Commit c4c41d3b authored by Robert Schmidt's avatar Robert Schmidt

Simplify nr_rlc: provide functions to add SRB/DRB

parent 0ed92011
...@@ -315,7 +315,7 @@ Still on DL (gNB side), PDCP push incoming data into RLC by calling: rlc_data_re ...@@ -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() 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()) 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() 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 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 ...@@ -99,14 +99,9 @@ void nr_rlc_bearer_init_ul_spec(struct NR_LogicalChannelConfig *mac_LogicalChann
abort(); abort();
} }
rlc_op_status_t nr_rrc_rlc_config_asn1_req(const protocol_ctxt_t *const ctxt_pP, void nr_rlc_add_drb(int rnti, int drb_id, const NR_RLC_BearerConfig_t *rlc_BearerConfig)
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)
{ {
abort(); 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) 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)
......
...@@ -113,12 +113,11 @@ int dl_rrc_message_rrcSetup(module_id_t module_id, const f1ap_dl_rrc_message_t * ...@@ -113,12 +113,11 @@ int dl_rrc_message_rrcSetup(module_id_t module_id, const f1ap_dl_rrc_message_t *
nr_rlc_srb_recv_sdu(dl_rrc->rnti, CCCH, dl_rrc->rrc_container, dl_rrc->rrc_container_length); 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}; /* the cellGroup sent to CU specifies there is SRB1, so create it */
nr_rrc_rlc_config_asn1_req(&ctxt, DevAssert(cellGroup->rlc_BearerToAddModList->list.count == 1);
ue_context_p->ue_context.SRB_configList, const NR_RLC_BearerConfig_t *bearer = cellGroup->rlc_BearerToAddModList->list.array[0];
NULL, DevAssert(bearer->servedRadioBearer->choice.srb_Identity == 1);
NULL, nr_rlc_add_srb(dl_rrc->rnti, DCCH, bearer);
cellGroup->rlc_BearerToAddModList);
return 0; return 0;
} }
...@@ -1121,7 +1121,7 @@ void nr_DRB_preconfiguration(ue_id_t crntiMaybeUEid) ...@@ -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_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); 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: ...@@ -683,14 +683,13 @@ rb_found:
#endif #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_entity_t *nr_rlc_am;
nr_rlc_ue_t *ue; nr_rlc_ue_t *ue;
struct NR_RLC_Config *r = rlc_BearerConfig->rlc_Config; struct NR_RLC_Config *r = rlc_BearerConfig->rlc_Config;
struct NR_LogicalChannelConfig *l = rlc_BearerConfig->mac_LogicalChannelConfig; struct NR_LogicalChannelConfig *l = rlc_BearerConfig->mac_LogicalChannelConfig;
int srb_id = s->srb_Identity;
int channel_id = rlc_BearerConfig->logicalChannelIdentity; int channel_id = rlc_BearerConfig->logicalChannelIdentity;
int logical_channel_group; int logical_channel_group;
...@@ -774,14 +773,13 @@ static void add_rlc_srb(int rnti, struct NR_SRB_ToAddMod *s, NR_RLC_BearerConfig ...@@ -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); 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_entity_t *nr_rlc_am;
nr_rlc_ue_t *ue; nr_rlc_ue_t *ue;
struct NR_RLC_Config *r = rlc_BearerConfig->rlc_Config; struct NR_RLC_Config *r = rlc_BearerConfig->rlc_Config;
struct NR_LogicalChannelConfig *l = rlc_BearerConfig->mac_LogicalChannelConfig; struct NR_LogicalChannelConfig *l = rlc_BearerConfig->mac_LogicalChannelConfig;
int drb_id = s->drb_Identity;
int channel_id = rlc_BearerConfig->logicalChannelIdentity; int channel_id = rlc_BearerConfig->logicalChannelIdentity;
int logical_channel_group; int logical_channel_group;
...@@ -856,14 +854,13 @@ static void add_drb_am(int rnti, struct NR_DRB_ToAddMod *s, NR_RLC_BearerConfig_ ...@@ -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); 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_entity_t *nr_rlc_um;
nr_rlc_ue_t *ue; nr_rlc_ue_t *ue;
struct NR_RLC_Config *r = rlc_BearerConfig->rlc_Config; struct NR_RLC_Config *r = rlc_BearerConfig->rlc_Config;
struct NR_LogicalChannelConfig *l = rlc_BearerConfig->mac_LogicalChannelConfig; struct NR_LogicalChannelConfig *l = rlc_BearerConfig->mac_LogicalChannelConfig;
int drb_id = s->drb_Identity;
int channel_id = rlc_BearerConfig->logicalChannelIdentity; int channel_id = rlc_BearerConfig->logicalChannelIdentity;
int logical_channel_group; int logical_channel_group;
...@@ -924,14 +921,14 @@ static void add_drb_um(int rnti, struct NR_DRB_ToAddMod *s, NR_RLC_BearerConfig_ ...@@ -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); 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) { switch (rlc_BearerConfig->rlc_Config->present) {
case NR_RLC_Config_PR_am: case NR_RLC_Config_PR_am:
add_drb_am(rnti, s, rlc_BearerConfig); add_drb_am(rnti, drb_id, rlc_BearerConfig);
break; break;
case NR_RLC_Config_PR_um_Bi_Directional: case NR_RLC_Config_PR_um_Bi_Directional:
add_drb_um(rnti, s, rlc_BearerConfig); add_drb_um(rnti, drb_id, rlc_BearerConfig);
break; break;
default: default:
LOG_E(RLC, "%s:%d:%s: fatal: unhandled DRB type\n", LOG_E(RLC, "%s:%d:%s: fatal: unhandled DRB type\n",
...@@ -953,67 +950,6 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP ...@@ -953,67 +950,6 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP
return 0; 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 { struct srb0_data {
int module_id; int module_id;
int CC_id; int CC_id;
......
...@@ -36,9 +36,6 @@ ...@@ -36,9 +36,6 @@
#include "NR_CellGroupConfig.h" #include "NR_CellGroupConfig.h"
#include "openair2/RRC/NR/nr_rrc_proto.h" #include "openair2/RRC/NR/nr_rrc_proto.h"
/* from OAI */
#include "pdcp.h"
struct NR_RLC_Config; struct NR_RLC_Config;
struct NR_LogicalChannelConfig; struct NR_LogicalChannelConfig;
...@@ -48,6 +45,9 @@ void nr_drb_config(struct NR_RLC_Config *rlc_Config, NR_RLC_Config_PR rlc_config ...@@ -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_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); void nr_rlc_remove_ue(int rnti);
int nr_rlc_get_available_tx_space( int nr_rlc_get_available_tx_space(
......
...@@ -177,12 +177,6 @@ rrc_gNB_generate_dedicatedRRCReconfiguration( ...@@ -177,12 +177,6 @@ rrc_gNB_generate_dedicatedRRCReconfiguration(
rrc_gNB_ue_context_t *ue_context_pP, rrc_gNB_ue_context_t *ue_context_pP,
NR_CellGroupConfig_t *cell_groupConfig_from_DU); 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, void bearer_context_setup_direct(e1ap_bearer_setup_req_t *req,
instance_t instance); instance_t instance);
......
...@@ -139,6 +139,47 @@ bool DURecvCb(protocol_ctxt_t *ctxt_pP, ...@@ -139,6 +139,47 @@ bool DURecvCb(protocol_ctxt_t *ctxt_pP,
return true; return true;
} }
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);
}
}
}
}
static void openair_nr_rrc_on(gNB_RRC_INST *rrc) static void openair_nr_rrc_on(gNB_RRC_INST *rrc)
{ {
NR_SRB_INFO *si = &rrc->carrier.SI; NR_SRB_INFO *si = &rrc->carrier.SI;
...@@ -301,22 +342,17 @@ static void apply_macrlc_config(gNB_RRC_INST *rrc, rrc_gNB_ue_context_t *const u ...@@ -301,22 +342,17 @@ static void apply_macrlc_config(gNB_RRC_INST *rrc, rrc_gNB_ue_context_t *const u
NR_CellGroupConfig_t *cgc = get_softmodem_params()->sa ? ue_context_pP->ue_context.masterCellGroup : NULL; NR_CellGroupConfig_t *cgc = get_softmodem_params()->sa ? ue_context_pP->ue_context.masterCellGroup : NULL;
nr_mac_update_cellgroup(RC.nrmac[rrc->module_id], ue_context_pP->ue_context.rnti, cgc); nr_mac_update_cellgroup(RC.nrmac[rrc->module_id], ue_context_pP->ue_context.rnti, cgc);
nr_rrc_rlc_config_asn1_req(ctxt_pP, nr_rrc_addmod_srbs(ctxt_pP->rntiMaybeUEid, ue_context_pP->ue_context.SRB_configList, cgc->rlc_BearerToAddModList);
ue_context_pP->ue_context.SRB_configList, nr_rrc_addmod_drbs(ctxt_pP->rntiMaybeUEid, ue_context_pP->ue_context.DRB_configList, cgc->rlc_BearerToAddModList);
ue_context_pP->ue_context.DRB_configList,
NULL,
get_softmodem_params()->sa ? cgc->rlc_BearerToAddModList : NULL);
} }
void apply_macrlc_config_reest(gNB_RRC_INST *rrc, rrc_gNB_ue_context_t *const ue_context_pP, const protocol_ctxt_t *const ctxt_pP, ue_id_t ue_id) void apply_macrlc_config_reest(gNB_RRC_INST *rrc, rrc_gNB_ue_context_t *const ue_context_pP, const protocol_ctxt_t *const ctxt_pP, ue_id_t ue_id)
{ {
nr_mac_update_cellgroup(RC.nrmac[rrc->module_id], ue_id, ue_context_pP->ue_context.masterCellGroup); nr_mac_update_cellgroup(RC.nrmac[rrc->module_id], ue_id, ue_context_pP->ue_context.masterCellGroup);
nr_rrc_rlc_config_asn1_req(ctxt_pP, nr_rrc_addmod_srbs(ctxt_pP->rntiMaybeUEid,
ue_context_pP->ue_context.SRB_configList, ue_context_pP->ue_context.SRB_configList,
NULL, ue_context_pP->ue_context.masterCellGroup->rlc_BearerToAddModList);
NULL,
get_softmodem_params()->sa ? ue_context_pP->ue_context.masterCellGroup->rlc_BearerToAddModList : NULL);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
...@@ -1089,12 +1125,11 @@ static void rrc_gNB_process_RRCReconfigurationComplete(const protocol_ctxt_t *co ...@@ -1089,12 +1125,11 @@ static void rrc_gNB_process_RRCReconfigurationComplete(const protocol_ctxt_t *co
/* Refresh SRBs/DRBs */ /* Refresh SRBs/DRBs */
if (!NODE_IS_CU(RC.nrrrc[ctxt_pP->module_id]->node_type)) { if (!NODE_IS_CU(RC.nrrrc[ctxt_pP->module_id]->node_type)) {
LOG_D(NR_RRC, "Configuring RLC DRBs/SRBs for UE %04x\n", ue_p->rnti); LOG_D(NR_RRC,"Configuring RLC DRBs/SRBs for UE %04x\n",ue_context_pP->ue_context.rnti);
nr_rrc_rlc_config_asn1_req(ctxt_pP, const struct NR_CellGroupConfig__rlc_BearerToAddModList *bearer_list =
SRB_configList, // NULL, ue_context_pP->ue_context.masterCellGroup->rlc_BearerToAddModList;
DRB_configList, nr_rrc_addmod_srbs(ctxt_pP->rntiMaybeUEid, SRB_configList, bearer_list);
DRB_Release_configList2, nr_rrc_addmod_drbs(ctxt_pP->rntiMaybeUEid, DRB_configList, bearer_list);
get_softmodem_params()->sa ? ue_p->masterCellGroup->rlc_BearerToAddModList : NULL);
} }
/* Set the SRB active in UE context */ /* Set the SRB active in UE context */
......
...@@ -33,9 +33,11 @@ ...@@ -33,9 +33,11 @@
#include "NR_UE-NR-Capability.h" #include "NR_UE-NR-Capability.h"
//#include "NR_UE-CapabilityRAT-ContainerList.h" //#include "NR_UE-CapabilityRAT-ContainerList.h"
#include "LTE_UE-CapabilityRAT-ContainerList.h" #include "LTE_UE-CapabilityRAT-ContainerList.h"
#include "NR_CellGroupConfig.h"
#include "NR_CG-Config.h" #include "NR_CG-Config.h"
//#include "NR_SRB-ToAddModList.h" //#include "NR_SRB-ToAddModList.h"
#include "openair2/LAYER2/NR_MAC_gNB/mac_proto.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 "openair2/RRC/LTE/rrc_eNB_GTPV1U.h"
#include "executables/softmodem-common.h" #include "executables/softmodem-common.h"
#include "executables/nr-softmodem.h" #include "executables/nr-softmodem.h"
...@@ -109,6 +111,7 @@ RB_PROTOTYPE(rrc_nr_ue_tree_s, rrc_gNB_ue_context_s, entries, ...@@ -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) 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) // 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; rrc_gNB_carrier_data_t *carrier=&rrc->carrier;
const gNB_RrcConfigurationReq *configuration = &rrc->configuration; 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 ...@@ -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.subframe,
ctxt.eNB_index); ctxt.eNB_index);
nr_pdcp_add_drbs( nr_pdcp_add_drbs(ctxt.enb_flag,
ctxt.enb_flag, ctxt.rntiMaybeUEid, 0, UE->rb_config->drb_ToAddModList, (UE->integrity_algorithm << 4) | UE->ciphering_algorithm, kUPenc, kUPint, UE->secondaryCellGroup->rlc_BearerToAddModList); ctxt.rntiMaybeUEid,
0,
nr_rrc_rlc_config_asn1_req( ue_context_p->ue_context.rb_config->drb_ToAddModList,
&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); (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); LOG_D(RRC, "%s:%d: done RRC PDCP/RLC ASN1 request for UE rnti %lx\n", __FUNCTION__, __LINE__, ctxt.rntiMaybeUEid);
} }
......
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
#include "intertask_interface.h" #include "intertask_interface.h"
#include "LAYER2/nr_rlc/nr_rlc_oai_api.h"
#include "nr-uesoftmodem.h" #include "nr-uesoftmodem.h"
#include "executables/softmodem-common.h" #include "executables/softmodem-common.h"
#include "plmn_data.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 ...@@ -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); 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) // 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, int8_t nr_rrc_ue_decode_secondary_cellgroup_config(const module_id_t module_id,
const uint8_t *buffer, const uint8_t *buffer,
...@@ -1947,35 +1988,31 @@ nr_rrc_ue_establish_srb2( ...@@ -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->srb_ToAddModList != NULL) {
if (radioBearerConfig->securityConfig != NULL) { if (radioBearerConfig->securityConfig != NULL) {
if (*radioBearerConfig->securityConfig->keyToUse == NR_SecurityConfig__keyToUse_master) { if (*radioBearerConfig->securityConfig->keyToUse == NR_SecurityConfig__keyToUse_master) {
NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm = radioBearerConfig->securityConfig->securityAlgorithmConfig->cipheringAlgorithm; ue_rrc->cipheringAlgorithm = radioBearerConfig->securityConfig->securityAlgorithmConfig->cipheringAlgorithm;
NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm = *radioBearerConfig->securityConfig->securityAlgorithmConfig->integrityProtAlgorithm; ue_rrc->integrityProtAlgorithm = *radioBearerConfig->securityConfig->securityAlgorithmConfig->integrityProtAlgorithm;
} }
} }
uint8_t *kRRCenc = NULL; uint8_t *kRRCenc = NULL;
uint8_t *kRRCint = NULL; uint8_t *kRRCint = NULL;
nr_derive_key_rrc_enc(NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm, nr_derive_key_rrc_enc(ue_rrc->cipheringAlgorithm, ue_rrc->kgnb, &kRRCenc);
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &kRRCenc); nr_derive_key_rrc_int(ue_rrc->integrityProtAlgorithm, ue_rrc->kgnb, &kRRCint);
nr_derive_key_rrc_int(NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm,
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &kRRCint);
// Refresh SRBs // Refresh SRBs
nr_pdcp_add_srbs(ctxt_pP->enb_flag, nr_pdcp_add_srbs(ctxt_pP->enb_flag,
ctxt_pP->rntiMaybeUEid, ctxt_pP->rntiMaybeUEid,
radioBearerConfig->srb_ToAddModList, 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, kRRCenc,
kRRCint); kRRCint);
// Refresh SRBs // Refresh SRBs
nr_rrc_rlc_config_asn1_req(ctxt_pP, nr_rrc_addmod_srbs(ctxt_pP->rntiMaybeUEid,
radioBearerConfig->srb_ToAddModList, radioBearerConfig->srb_ToAddModList,
NULL, ue_rrc->cell_group_config->rlc_BearerToAddModList);
NULL,
NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->rlc_BearerToAddModList
);
for (cnt = 0; cnt < radioBearerConfig->srb_ToAddModList->list.count; cnt++) { for (cnt = 0; cnt < radioBearerConfig->srb_ToAddModList->list.count; cnt++) {
SRB_id = radioBearerConfig->srb_ToAddModList->list.array[cnt]->srb_Identity; SRB_id = radioBearerConfig->srb_ToAddModList->list.array[cnt]->srb_Identity;
...@@ -2054,22 +2091,24 @@ nr_rrc_ue_establish_srb2( ...@@ -2054,22 +2091,24 @@ nr_rrc_ue_establish_srb2(
uint8_t *kUPenc = NULL; uint8_t *kUPenc = NULL;
uint8_t *kUPint = NULL; uint8_t *kUPint = NULL;
nr_derive_key_up_enc(NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm, NR_UE_RRC_INST_t *ue_rrc = &NR_UE_rrc_inst[ctxt_pP->module_id];
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &kUPenc); nr_derive_key_up_enc(ue_rrc->cipheringAlgorithm, ue_rrc->kgnb, &kUPenc);
nr_derive_key_up_int(NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm, nr_derive_key_up_int(ue_rrc->integrityProtAlgorithm, ue_rrc->kgnb, &kUPint);
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &kUPint);
// Refresh DRBs // Refresh DRBs
nr_pdcp_add_drbs(ctxt_pP->enb_flag, nr_pdcp_add_drbs(ctxt_pP->enb_flag,
ctxt_pP->rntiMaybeUEid, ctxt_pP->rntiMaybeUEid,
0, 0,
radioBearerConfig->drb_ToAddModList, 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, kUPenc,
kUPint, kUPint,
NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->rlc_BearerToAddModList); ue_rrc->cell_group_config->rlc_BearerToAddModList);
// Refresh DRBs // 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 // } // drb_ToAddModList //
if (radioBearerConfig->drb_ToReleaseList != NULL) { 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