Commit 7b163f16 authored by Robert Schmidt's avatar Robert Schmidt

Harmonize UE context setup resp bearer handling

This is preparatory work to handle the UE context setup response from
the target DU. There are two cases:

- "Initial" UE context setup response (during connection setup): we need
  to inform the CU-UP via an E1 message of the new bearers (GTP tunnel
  update)
- F1 handover:  we need to inform the CU-UP via an E1 message that there
  are DRBs to reestablish

There are two different functions, e1_send_bearer_updates() and
cuup_notify_reestablishment(), to do this. Harmonize the code, before
implementing the actual handover logic in the next commit.
parent 66b54806
...@@ -1851,11 +1851,17 @@ static void rrc_CU_process_ue_context_setup_response(MessageDef *msg_p, instance ...@@ -1851,11 +1851,17 @@ static void rrc_CU_process_ue_context_setup_response(MessageDef *msg_p, instance
xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, UE->masterCellGroup); xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, UE->masterCellGroup);
if (resp->drbs_to_be_setup_length > 0) { if (resp->drbs_to_be_setup_length > 0) {
int num_drb = get_number_active_drbs(UE);
DevAssert(num_drb == 0 || num_drb == resp->drbs_to_be_setup_length);
/* Note: we would ideally check that SRB2 is acked, but at least LiteOn DU /* Note: we would ideally check that SRB2 is acked, but at least LiteOn DU
* seems buggy and does not ack, so simply check that locally we activated */ * seems buggy and does not ack, so simply check that locally we activated */
AssertFatal(UE->Srb[1].Active && UE->Srb[2].Active, "SRBs 1 and 2 must be active during DRB Establishment"); AssertFatal(UE->Srb[1].Active && UE->Srb[2].Active, "SRBs 1 and 2 must be active during DRB Establishment");
store_du_f1u_tunnel(resp->drbs_to_be_setup, resp->drbs_to_be_setup_length, UE); store_du_f1u_tunnel(resp->drbs_to_be_setup, resp->drbs_to_be_setup_length, UE);
if (num_drb == 0)
e1_send_bearer_updates(rrc, UE, resp->drbs_to_be_setup_length, resp->drbs_to_be_setup); e1_send_bearer_updates(rrc, UE, resp->drbs_to_be_setup_length, resp->drbs_to_be_setup);
else
cuup_notify_reestablishment(rrc, UE);
} }
rrc_gNB_generate_dedicatedRRCReconfiguration(rrc, UE); rrc_gNB_generate_dedicatedRRCReconfiguration(rrc, UE);
......
...@@ -181,6 +181,15 @@ uint8_t get_next_available_drb_id(gNB_RRC_UE_t *ue) ...@@ -181,6 +181,15 @@ uint8_t get_next_available_drb_id(gNB_RRC_UE_t *ue)
return DRB_INACTIVE; return DRB_INACTIVE;
} }
int get_number_active_drbs(gNB_RRC_UE_t *ue)
{
int n = 0;
for (int i = 0; i < MAX_DRBS_PER_UE; ++i)
if (ue->established_drbs[i].status != DRB_INACTIVE)
n++;
return n;
}
bool drb_is_active(gNB_RRC_UE_t *ue, uint8_t drb_id) bool drb_is_active(gNB_RRC_UE_t *ue, uint8_t drb_id)
{ {
drb_t *drb = get_drb(ue, drb_id); drb_t *drb = get_drb(ue, drb_id);
......
...@@ -61,6 +61,9 @@ drb_t *generateDRB(gNB_RRC_UE_t *ue, ...@@ -61,6 +61,9 @@ drb_t *generateDRB(gNB_RRC_UE_t *ue,
/// @brief return the next available (inactive) DRB ID of UE ue /// @brief return the next available (inactive) DRB ID of UE ue
uint8_t get_next_available_drb_id(gNB_RRC_UE_t *ue); uint8_t get_next_available_drb_id(gNB_RRC_UE_t *ue);
/// @brief returns the number of active DRBs for this UE
int get_number_active_drbs(gNB_RRC_UE_t *ue);
/// @brief check if DRB with ID drb_id of UE ue is active /// @brief check if DRB with ID drb_id of UE ue is active
bool drb_is_active(gNB_RRC_UE_t *ue, uint8_t drb_id); bool drb_is_active(gNB_RRC_UE_t *ue, uint8_t drb_id);
......
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