Commit c40cceb4 authored by Maud Tribaudeau's avatar Maud Tribaudeau

reestablishment for LTE

parent 537605a6
......@@ -148,6 +148,7 @@ pthread_t pdcp_stats_thread_desc;
* \param[in] kRRCenc RRC encryption key
* \param[in] kRRCint RRC integrity key
* \param[in] kUPenc User-Plane encryption key
* \param[in] reestablisment_on_going status to know if reestablisment is on going
* \return A status about the processing, OK or error code.
*/
static bool pdcp_config_req_asn1(const protocol_ctxt_t *const ctxt_pP,
......@@ -164,7 +165,8 @@ static bool pdcp_config_req_asn1(const protocol_ctxt_t *const ctxt_pP,
const uint8_t security_modeP,
uint8_t *const kRRCenc_pP,
uint8_t *const kRRCint_pP,
uint8_t *const kUPenc_pP);
uint8_t *const kUPenc_pP,
bool reestablisment_on_going);
void *pdcp_stats_thread(void *param) {
......@@ -1523,8 +1525,7 @@ bool pdcp_remove_UE(const protocol_ctxt_t *const ctxt_pP)
//-----------------------------------------------------------------------------
bool
rrc_pdcp_config_asn1_req(const protocol_ctxt_t *const ctxt_pP,
bool rrc_pdcp_config_asn1_req(const protocol_ctxt_t *const ctxt_pP,
LTE_SRB_ToAddModList_t *const srb2add_list_pP,
LTE_DRB_ToAddModList_t *const drb2add_list_pP,
LTE_DRB_ToReleaseList_t *const drb2release_list_pP,
......@@ -1533,7 +1534,8 @@ rrc_pdcp_config_asn1_req(const protocol_ctxt_t *const ctxt_pP,
uint8_t *const kRRCint_pP,
uint8_t *const kUPenc_pP,
LTE_PMCH_InfoList_r9_t *const pmch_InfoList_r9_pP,
rb_id_t *const defaultDRB)
rb_id_t *const defaultDRB,
const rnti_t previous_rnti_for_reestab)
//-----------------------------------------------------------------------------
{
long int lc_id = 0;
......@@ -1551,13 +1553,17 @@ rrc_pdcp_config_asn1_req(const protocol_ctxt_t *const ctxt_pP,
LTE_SRB_ToAddMod_t *srb_toaddmod_p = NULL;
LTE_DRB_ToAddMod_t *drb_toaddmod_p = NULL;
pdcp_t *pdcp_p = NULL;
pdcp_t *pdcp_p_previous = NULL;
hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE;
hash_key_t key_previous = HASHTABLE_NOT_A_KEY_VALUE;
hashtable_rc_t h_rc;
hashtable_rc_t h_rc_previous;
hash_key_t key_defaultDRB = HASHTABLE_NOT_A_KEY_VALUE;
hashtable_rc_t h_defaultDRB_rc;
int i,j;
LTE_MBMS_SessionInfoList_r9_t *mbms_SessionInfoList_r9_p = NULL;
LTE_MBMS_SessionInfo_r9_t *MBMS_SessionInfo_p = NULL;
bool reestablishment_ongoing = previous_rnti_for_reestab == NOT_A_RNTI ? false : true;
LOG_T(PDCP, PROTOCOL_CTXT_FMT" %s() SRB2ADD %p DRB2ADD %p DRB2RELEASE %p\n",
PROTOCOL_CTXT_ARGS(ctxt_pP),
__FUNCTION__,
......@@ -1610,8 +1616,7 @@ rrc_pdcp_config_asn1_req(const protocol_ctxt_t *const ctxt_pP,
break;
default:
pdcp_config_req_asn1 (
ctxt_pP,
pdcp_config_req_asn1(ctxt_pP,
pdcp_p,
SRB_FLAG_YES,
rlc_type,
......@@ -1625,15 +1630,15 @@ rrc_pdcp_config_asn1_req(const protocol_ctxt_t *const ctxt_pP,
security_modeP,
kRRCenc_pP,
kRRCint_pP,
kUPenc_pP);
kUPenc_pP,
reestablishment_ongoing);
break;
}
break;
case LTE_SRB_ToAddMod__rlc_Config_PR_defaultValue:
pdcp_config_req_asn1 (
ctxt_pP,
pdcp_config_req_asn1(ctxt_pP,
pdcp_p,
SRB_FLAG_YES,
rlc_type,
......@@ -1647,7 +1652,8 @@ rrc_pdcp_config_asn1_req(const protocol_ctxt_t *const ctxt_pP,
security_modeP,
kRRCenc_pP,
kRRCint_pP,
kUPenc_pP);
kUPenc_pP,
reestablishment_ongoing);
// already the default values
break;
......@@ -1729,6 +1735,21 @@ rrc_pdcp_config_asn1_req(const protocol_ctxt_t *const ctxt_pP,
drb_report = drb_toaddmod_p->pdcp_Config->rlc_AM->statusReportRequired;
drb_sn = LTE_PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits; // default SN size
rlc_type = RLC_MODE_AM;
if (reestablishment_ongoing) { // we need to keep previous SN numbers for reestablishment in AM mode
key_previous =
PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, previous_rnti_for_reestab, ctxt_pP->enb_flag, drb_id, SRB_FLAG_NO);
h_rc_previous = hashtable_get(pdcp_coll_p, key_previous, (void **)&pdcp_p_previous);
LOG_I(PDCP,
"SEE DRB pdcp_previous->next_pdcp_tx_sn=%d pdcp_previous->next_pdcp_rx_sn=%d\n",
pdcp_p_previous->next_pdcp_tx_sn,
pdcp_p_previous->next_pdcp_rx_sn);
pdcp_p->next_pdcp_tx_sn = pdcp_p_previous->next_pdcp_tx_sn;
pdcp_p->next_pdcp_rx_sn = pdcp_p_previous->next_pdcp_rx_sn;
pdcp_p->tx_hfn = pdcp_p_previous->tx_hfn;
pdcp_p->rx_hfn = pdcp_p_previous->rx_hfn;
pdcp_p->last_submitted_pdcp_rx_sn = pdcp_p_previous->last_submitted_pdcp_rx_sn;
pdcp_p->first_missing_pdu = -1;
}
}
if (drb_toaddmod_p->pdcp_Config->rlc_UM) {
......@@ -1777,8 +1798,7 @@ rrc_pdcp_config_asn1_req(const protocol_ctxt_t *const ctxt_pP,
break;
}
pdcp_config_req_asn1 (
ctxt_pP,
pdcp_config_req_asn1(ctxt_pP,
pdcp_p,
SRB_FLAG_NO,
rlc_type,
......@@ -1792,7 +1812,8 @@ rrc_pdcp_config_asn1_req(const protocol_ctxt_t *const ctxt_pP,
security_modeP,
kRRCenc_pP,
kRRCint_pP,
kUPenc_pP);
kUPenc_pP,
reestablishment_ongoing);
}
}
}
......@@ -1813,8 +1834,7 @@ rrc_pdcp_config_asn1_req(const protocol_ctxt_t *const ctxt_pP,
lc_id = pdcp_p->lcid;
action = CONFIG_ACTION_REMOVE;
pdcp_config_req_asn1 (
ctxt_pP,
pdcp_config_req_asn1(ctxt_pP,
pdcp_p,
SRB_FLAG_NO,
rlc_type,
......@@ -1828,7 +1848,8 @@ rrc_pdcp_config_asn1_req(const protocol_ctxt_t *const ctxt_pP,
security_modeP,
kRRCenc_pP,
kRRCint_pP,
kUPenc_pP);
kUPenc_pP,
reestablishment_ongoing);
h_rc = hashtable_remove(pdcp_coll_p, key);
if ((defaultDRB != NULL) && (*defaultDRB == drb_id)) {
......@@ -1888,8 +1909,7 @@ rrc_pdcp_config_asn1_req(const protocol_ctxt_t *const ctxt_pP,
MBMS_SessionInfo_p->tmgi_r9.serviceId_r9.buf[2],
drb_id,
action);
pdcp_config_req_asn1 (
ctxt_pP,
pdcp_config_req_asn1(ctxt_pP,
NULL, // unused for MBMS
SRB_FLAG_NO,
RLC_MODE_NONE,
......@@ -1903,7 +1923,8 @@ rrc_pdcp_config_asn1_req(const protocol_ctxt_t *const ctxt_pP,
0, // unused for MBMS
NULL, // unused for MBMS
NULL, // unused for MBMS
NULL); // unused for MBMS
NULL,
reestablishment_ongoing); // unused for MBMS
}
}
}
......@@ -1924,7 +1945,8 @@ static bool pdcp_config_req_asn1(const protocol_ctxt_t *const ctxt_pP,
const uint8_t security_modeP,
uint8_t *const kRRCenc_pP,
uint8_t *const kRRCint_pP,
uint8_t *const kUPenc_pP)
uint8_t *const kUPenc_pP,
bool reestablisment_on_going)
//-----------------------------------------------------------------------------
{
......@@ -1975,12 +1997,14 @@ static bool pdcp_config_req_asn1(const protocol_ctxt_t *const ctxt_pP,
}
pdcp_pP->rlc_mode = rlc_modeP;
if (!reestablisment_on_going && rlc_modeP != RLC_MODE_AM) {
pdcp_pP->next_pdcp_tx_sn = 0;
pdcp_pP->next_pdcp_rx_sn = 0;
pdcp_pP->tx_hfn = 0;
pdcp_pP->rx_hfn = 0;
pdcp_pP->last_submitted_pdcp_rx_sn = 4095;
pdcp_pP->first_missing_pdu = -1;
}
LOG_I(PDCP, PROTOCOL_PDCP_CTXT_FMT" Action ADD LCID %d (%s id %ld) "
"configured with SN size %d bits and RLC %s\n",
PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP,pdcp_pP),
......
......@@ -297,20 +297,18 @@ void rrc_pdcp_config_req (
const rb_id_t rb_idP,
const uint8_t security_modeP);
/*! \fn bool rrc_pdcp_config_asn1_req (const protocol_ctxt_t* const , SRB_ToAddModList_t* srb2add_list, DRB_ToAddModList_t* drb2add_list, DRB_ToReleaseList_t* drb2release_list)
* \brief Function for RRC to configure a Radio Bearer.
* \param[in] ctxt_pP Running context.
* \param[in] index index of UE or eNB depending on the eNB_flag
* \param[in] srb2add_list SRB configuration list to be created.
* \param[in] drb2add_list DRB configuration list to be created.
* \param[in] drb2release_list DRB configuration list to be released.
* \param[in] security_mode Security algorithm to apply for integrity/ciphering
* \param[in] kRRCenc RRC encryption key
* \param[in] kRRCint RRC integrity key
* \param[in] kUPenc User-Plane encryption key
* \param[in] defaultDRB Default DRB ID
* \return A status about the processing, OK or error code.
*/
/*! \fn bool rrc_pdcp_config_asn1_req (const protocol_ctxt_t* const , SRB_ToAddModList_t* srb2add_list, DRB_ToAddModList_t*
* drb2add_list, DRB_ToReleaseList_t* drb2release_list) \brief Function for RRC to configure a Radio Bearer. \param[in] ctxt_pP
* Running context. \param[in] index index of UE or eNB depending on the eNB_flag \param[in] srb2add_list SRB
* configuration list to be created. \param[in] drb2add_list DRB configuration list to be created. \param[in] drb2release_list
* DRB configuration list to be released. \param[in] security_mode Security algorithm to apply for integrity/ciphering
* \param[in] kRRCenc RRC encryption key
* \param[in] kRRCint RRC integrity key
* \param[in] kUPenc User-Plane encryption key
* \param[in] defaultDRB Default DRB ID
* \param[in] previous_rnti_for_reestab rnti in case of reestablishment to get previous pdcp context
* \return A status about the processing, OK or error code.
*/
bool rrc_pdcp_config_asn1_req(const protocol_ctxt_t *const ctxt_pP,
LTE_SRB_ToAddModList_t *const srb2add_list,
LTE_DRB_ToAddModList_t *const drb2add_list,
......@@ -320,7 +318,8 @@ bool rrc_pdcp_config_asn1_req(const protocol_ctxt_t *const ctxt_pP,
uint8_t *const kRRCint,
uint8_t *const kUPenc,
LTE_PMCH_InfoList_r9_t *pmch_InfoList_r9,
rb_id_t *const defaultDRB);
rb_id_t *const defaultDRB,
const rnti_t previous_rnti_for_reestab);
/*! \fn void pdcp_add_UE(const protocol_ctxt_t* const ctxt_pP)
* \brief Function (for RRC) to add a new UE in PDCP module
......
......@@ -948,7 +948,8 @@ bool rrc_pdcp_config_asn1_req(const protocol_ctxt_t *const ctxt_pP,
uint8_t *const kRRCint,
uint8_t *const kUPenc,
LTE_PMCH_InfoList_r9_t *pmch_InfoList_r9,
rb_id_t *const defaultDRB)
rb_id_t *const defaultDRB,
const rnti_t previous_rnti_for_reestab)
{
return 0;
}
......
......@@ -1252,17 +1252,18 @@ rrc_ue_process_radioResourceConfigDedicated(
derive_key_nas(RRC_INT_ALG, UE_rrc_inst[ctxt_pP->module_id].integrity_algorithm, UE_rrc_inst[ctxt_pP->module_id].kenb, kRRCint);
// Refresh SRBs
rrc_pdcp_config_asn1_req(ctxt_pP,
rrc_pdcp_config_asn1_req(
ctxt_pP,
radioResourceConfigDedicated->srb_ToAddModList,
(LTE_DRB_ToAddModList_t *)NULL,
(LTE_DRB_ToReleaseList_t *)NULL,
UE_rrc_inst[ctxt_pP->module_id].ciphering_algorithm |
(UE_rrc_inst[ctxt_pP->module_id].integrity_algorithm << 4),
UE_rrc_inst[ctxt_pP->module_id].ciphering_algorithm | (UE_rrc_inst[ctxt_pP->module_id].integrity_algorithm << 4),
kRRCenc,
kRRCint,
NULL,
(LTE_PMCH_InfoList_r9_t *)NULL,
NULL);
NULL,
0);
// Refresh SRBs
rrc_rlc_config_asn1_req(ctxt_pP,
radioResourceConfigDedicated->srb_ToAddModList,
......@@ -1400,17 +1401,18 @@ rrc_ue_process_radioResourceConfigDedicated(
derive_key_nas(UP_ENC_ALG, UE_rrc_inst[ctxt_pP->module_id].integrity_algorithm, UE_rrc_inst[ctxt_pP->module_id].kenb, kUPenc);
// Refresh DRBs
rrc_pdcp_config_asn1_req(ctxt_pP,
rrc_pdcp_config_asn1_req(
ctxt_pP,
(LTE_SRB_ToAddModList_t *)NULL,
radioResourceConfigDedicated->drb_ToAddModList,
(LTE_DRB_ToReleaseList_t *)NULL,
UE_rrc_inst[ctxt_pP->module_id].ciphering_algorithm |
(UE_rrc_inst[ctxt_pP->module_id].integrity_algorithm << 4),
UE_rrc_inst[ctxt_pP->module_id].ciphering_algorithm | (UE_rrc_inst[ctxt_pP->module_id].integrity_algorithm << 4),
NULL,
NULL,
kUPenc,
(LTE_PMCH_InfoList_r9_t *)NULL,
UE_rrc_inst[ctxt_pP->module_id].defaultDRB);
UE_rrc_inst[ctxt_pP->module_id].defaultDRB,
0);
// Refresh DRBs
rrc_rlc_config_asn1_req(ctxt_pP,
(LTE_SRB_ToAddModList_t *)NULL,
......@@ -4832,8 +4834,8 @@ void decode_MBSFNAreaConfiguration( module_id_t ue_mod_idP, uint8_t eNB_index, f
NULL, // key rrc integrity
NULL, // key encryption
&(UE_rrc_inst[ue_mod_idP].mcch_message[eNB_index]->pmch_InfoList_r9),
NULL
);
NULL,
0);
rrc_rlc_config_asn1_req(&ctxt,
NULL,// SRB_ToAddModList
NULL,// DRB_ToAddModList
......@@ -5828,12 +5830,16 @@ void *rrc_control_socket_thread_fct(void *arg) {
UE->DRB_configList = CALLOC(1,sizeof(LTE_DRB_ToAddModList_t));
asn1cSeqAdd(&UE->DRB_configList->list,UE->DRB_config[0][0]);
rrc_pdcp_config_asn1_req(&ctxt,
(LTE_SRB_ToAddModList_t *) NULL,
(LTE_SRB_ToAddModList_t *)NULL,
UE->DRB_configList,
(LTE_DRB_ToReleaseList_t *) NULL,
0xff, NULL, NULL, NULL,
(LTE_PMCH_InfoList_r9_t *) NULL
,NULL);
(LTE_DRB_ToReleaseList_t *)NULL,
0xff,
NULL,
NULL,
NULL,
(LTE_PMCH_InfoList_r9_t *)NULL,
NULL,
0);
rrc_rlc_config_asn1_req(&ctxt,
(LTE_SRB_ToAddModList_t *)NULL,
UE->DRB_configList,
......@@ -6033,11 +6039,16 @@ void *rrc_control_socket_thread_fct(void *arg) {
UE->DRB_configList = CALLOC(1,sizeof(LTE_DRB_ToAddModList_t));
asn1cSeqAdd(&UE->DRB_configList->list,UE->DRB_config[0][0]);
rrc_pdcp_config_asn1_req(&ctxt,
(LTE_SRB_ToAddModList_t *) NULL,
(LTE_SRB_ToAddModList_t *)NULL,
UE->DRB_configList,
(LTE_DRB_ToReleaseList_t *) NULL,
0xff, NULL, NULL, NULL,
(LTE_PMCH_InfoList_r9_t *) NULL,NULL);
(LTE_DRB_ToReleaseList_t *)NULL,
0xff,
NULL,
NULL,
NULL,
(LTE_PMCH_InfoList_r9_t *)NULL,
NULL,
0);
rrc_rlc_config_asn1_req(&ctxt,
(LTE_SRB_ToAddModList_t *)NULL,
UE->DRB_configList,
......@@ -6187,11 +6198,16 @@ void *rrc_control_socket_thread_fct(void *arg) {
UE->DRB_configList = CALLOC(1,sizeof(LTE_DRB_ToAddModList_t));
asn1cSeqAdd(&UE->DRB_configList->list,UE->DRB_config[0][0]);
rrc_pdcp_config_asn1_req(&ctxt,
(LTE_SRB_ToAddModList_t *) NULL,
(LTE_SRB_ToAddModList_t *)NULL,
UE->DRB_configList,
(LTE_DRB_ToReleaseList_t *) NULL,
0xff, NULL, NULL, NULL,
(LTE_PMCH_InfoList_r9_t *) NULL,NULL);
(LTE_DRB_ToReleaseList_t *)NULL,
0xff,
NULL,
NULL,
NULL,
(LTE_PMCH_InfoList_r9_t *)NULL,
NULL,
0);
rrc_rlc_config_asn1_req(&ctxt,
(LTE_SRB_ToAddModList_t *)NULL,
UE->DRB_configList,
......
This diff is collapsed.
......@@ -275,8 +275,10 @@ static void rrc_M2AP_init_MBMS(
NULL, // key rrc encryption
NULL, // key rrc integrity
NULL // key encryption
, &(RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->pmch_InfoList_r9)
,NULL);
,
&(RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->pmch_InfoList_r9),
NULL,
0);
rrc_rlc_config_asn1_req(&ctxt,
NULL, // LTE_SRB_ToAddModList
......
......@@ -706,22 +706,46 @@ int gtpv1u_update_s1u_tunnel(
pthread_mutex_lock(&globGtp.gtp_lock);
getInstRetInt(compatInst(instance));
if ( inst->ue2te_mapping.find(create_tunnel_req->rnti) == inst->ue2te_mapping.end() ) {
LOG_E(GTPU,"[%ld] Update not already existing tunnel (new rnti %x, old rnti %x)\n",
instance, create_tunnel_req->rnti, prior_rnti);
// Check if tunnels already exist for new rnti
if (inst->ue2te_mapping.find(create_tunnel_req->rnti) != inst->ue2te_mapping.end()) {
LOG_E(GTPU, "[%ld] Update already existing tunnel for new rnti %x\n", instance, create_tunnel_req->rnti);
return -1;
}
// Check if tunnels exists for old rnti because we should take these tunnels.
// If we do not have tunnels, we create new one to not stop the software
auto it=inst->ue2te_mapping.find(prior_rnti);
if ( it != inst->ue2te_mapping.end() ) {
if (it == inst->ue2te_mapping.end()) {
LOG_W(GTPU,
"[%ld] Update a not existing tunnel, start create the new one (new rnti %x, old rnti %x)\n",
instance,
create_tunnel_req->rnti,
prior_rnti);
pthread_mutex_unlock(&globGtp.gtp_lock);
AssertFatal(false, "logic bug: update of non-existing tunnel (new ue id %u, old ue id %u)\n", create_tunnel_req->rnti, prior_rnti);
/* we don't know if we need 4G or 5G PDCP and can therefore not create a
* new tunnel */
gtpv1u_enb_create_tunnel_resp_t tmp;
(void)gtpv1u_create_s1u_tunnel(instance, create_tunnel_req, &tmp, pdcp_data_req);
return 0;
}
// If tunnels exist for old rnti, we use them for new rnti
inst->ue2te_mapping[create_tunnel_req->rnti]=it->second;
// Replace old RNTI by new one in te2ue_mapping
teid_t teid_incoming, teid_outcoming = 0;
for (int i = 0; i < create_tunnel_req->num_tunnels; i++) {
teid_incoming = it->second.bearers[create_tunnel_req->eps_bearer_id[i]].teid_incoming;
teid_outcoming = create_tunnel_req->sgw_S1u_teid[i];
globGtp.te2ue_mapping[teid_incoming].ue_id = create_tunnel_req->rnti;
LOG_I(GTPU,
"[%ld] Updated tunnel (new rnti %x, old rnti %x) DL teid =%x UL teid =%x\n",
instance,
create_tunnel_req->rnti,
prior_rnti,
teid_incoming,
teid_outcoming);
}
// Remove old rnti value from ue2te_mapping
inst->ue2te_mapping.erase(it);
pthread_mutex_unlock(&globGtp.gtp_lock);
return 0;
......
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