From 7e77fb674dd9e7c19c0cc4b307c82e256a8018ac Mon Sep 17 00:00:00 2001 From: Tien-Thinh Nguyen <tien-thinh.nguyen@eurecom.fr> Date: Fri, 3 Nov 2017 13:56:29 +0100 Subject: [PATCH] support SidelinkUEInformation (eNB) and RRCConnectionReconfiguration (SL) --- openair2/RRC/LITE/MESSAGES/asn1_msg.c | 24 ++++- openair2/RRC/LITE/MESSAGES/asn1_msg.h | 4 +- openair2/RRC/LITE/proto.h | 7 +- openair2/RRC/LITE/rrc_UE.c | 28 +++++- openair2/RRC/LITE/rrc_eNB.c | 137 ++++++++++++++++++++++++-- 5 files changed, 179 insertions(+), 21 deletions(-) diff --git a/openair2/RRC/LITE/MESSAGES/asn1_msg.c b/openair2/RRC/LITE/MESSAGES/asn1_msg.c index c3a41824c67..c0a99626123 100644 --- a/openair2/RRC/LITE/MESSAGES/asn1_msg.c +++ b/openair2/RRC/LITE/MESSAGES/asn1_msg.c @@ -1369,8 +1369,7 @@ uint8_t do_SidelinkUEInformation(uint8_t Mod_id, uint8_t *buffer, SL_Destinatio UL_DCCH_Message_t ul_dcch_msg; SidelinkUEInformation_r12_t *sidelinkUEInformation; - ARFCN_ValueEUTRA_r9_t commRxInterestedFreq[] = {2565000000.0}; //sidelink communication frequency - ARFCN_ValueEUTRA_r9_t carrierFreq[] = {2565000000.0}; + ARFCN_ValueEUTRA_r9_t carrierFreq[] = {2565000000.0};//sidelink communication frequency memset((void *)&ul_dcch_msg,0,sizeof(UL_DCCH_Message_t)); @@ -1383,7 +1382,8 @@ uint8_t do_SidelinkUEInformation(uint8_t Mod_id, uint8_t *buffer, SL_Destinatio switch(mode) { //if SIB18 is available case 1,2,3,4 case 1: // to receive sidelink communication - sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.commRxInterestedFreq_r12 = &commRxInterestedFreq[0]; + sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.commRxInterestedFreq_r12 = &carrierFreq[0]; + sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.commRxInterestedFreq_r12[0] = carrierFreq[0]; break; case 2: //to transmit non-relay related one-to-many sidelink communication //commTxResourceReq @@ -2186,11 +2186,13 @@ do_RRCConnectionReconfiguration( RSRP_Range_t *rsrp, C_RNTI_t *cba_rnti, struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList - *dedicatedInfoNASList - + *dedicatedInfoNASList, + SL_CommConfig_r12_t *sl_CommConfig, + SL_DiscConfig_r12_t *sl_DiscConfig #if defined(Rel10) || defined(Rel14) , SCellToAddMod_r10_t *SCell_config #endif + ) //------------------------------------------------------------------------------ { @@ -2282,6 +2284,18 @@ do_RRCConnectionReconfiguration( rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.dedicatedInfoNASList = dedicatedInfoNASList; rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.securityConfigHO = NULL; + //TTN for D2D + //allocate dedicated resource pools for SL communication (sl_CommConfig_r12) + if (sl_CommConfig) { + rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->sl_CommConfig_r12 = sl_CommConfig; + rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->sl_CommConfig_r12[0] = sl_CommConfig[0]; + } + //allocate dedicated resource pools for SL discovery (sl_DiscConfig) + if (sl_DiscConfig){ + rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->sl_DiscConfig_r12 = sl_DiscConfig; + rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->sl_DiscConfig_r12[0] = sl_DiscConfig[0]; + } + enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message, (void*)&dl_dcch_msg, buffer, diff --git a/openair2/RRC/LITE/MESSAGES/asn1_msg.h b/openair2/RRC/LITE/MESSAGES/asn1_msg.h index 5549b28576f..db59d468b71 100644 --- a/openair2/RRC/LITE/MESSAGES/asn1_msg.h +++ b/openair2/RRC/LITE/MESSAGES/asn1_msg.h @@ -199,7 +199,9 @@ do_RRCConnectionReconfiguration( struct MeasConfig__speedStatePars *speedStatePars, RSRP_Range_t *rsrp, C_RNTI_t *cba_rnti, - struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList* dedicatedInfoNASList + struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList* dedicatedInfoNASList, + SL_CommConfig_r12_t *sl_CommConfig, + SL_DiscConfig_r12_t *sl_DiscConfig #if defined(Rel10) || defined(Rel14) , SCellToAddMod_r10_t *SCell_config #endif diff --git a/openair2/RRC/LITE/proto.h b/openair2/RRC/LITE/proto.h index 7c361c51cc6..8824a090c7a 100644 --- a/openair2/RRC/LITE/proto.h +++ b/openair2/RRC/LITE/proto.h @@ -294,7 +294,10 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( int rrc_eNB_generate_RRCConnectionReconfiguration_Sidelink( const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP + rrc_eNB_ue_context_t* const ue_context_pP, + SL_DestinationIdentity_r12_t* SL_DestinationIdentity, + int n_destinations, + int n_discoveryMessages ); /** \brief process the received SidelinkUEInformation message at UE @@ -305,7 +308,7 @@ void rrc_eNB_process_SidelinkUEInformation( const protocol_ctxt_t* const ctxt_pP, rrc_eNB_ue_context_t* ue_context_pP, - SidelinkUEInformation_r12_t * sidelinkUEInformation + SidelinkUEInformation_r12_t* sidelinkUEInformation ); //L2_interface.c diff --git a/openair2/RRC/LITE/rrc_UE.c b/openair2/RRC/LITE/rrc_UE.c index 8bfe4b04a08..a0859bd7f5a 100644 --- a/openair2/RRC/LITE/rrc_UE.c +++ b/openair2/RRC/LITE/rrc_UE.c @@ -1898,6 +1898,19 @@ rrc_ue_process_rrcConnectionReconfiguration( rrc_ue_process_radioResourceConfigDedicated(ctxt_pP,eNB_index, rrcConnectionReconfiguration_r8->radioResourceConfigDedicated); } + //TTN for D2D + //if RRCConnectionReconfiguration message includes the sl-CommConfig + if (rrcConnectionReconfiguration_r8->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->sl_CommConfig_r12->commTxResources_r12->present != SL_CommConfig_r12__commTxResources_r12_PR_NOTHING){ + LOG_I(RRC,"sl-CommConfig is present\n"); + //rrc_ue_process_sidelink_commTxPool() + } + //if RRCConnectionReconfiguration message includes the sl-DiscConfig + if (rrcConnectionReconfiguration_r8->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->sl_DiscConfig_r12->discTxResources_r12->present != SL_DiscConfig_r12__discTxResources_r12_PR_NOTHING ){ + LOG_I(RRC,"sl-CommConfig is present\n"); + //rrc_ue_process_sidelink_discTxPool() + } + + #if defined(ENABLE_ITTI) /* Check if there is dedicated NAS information to forward to NAS */ @@ -4873,9 +4886,18 @@ void rrc_ue_generate_SidelinkUEInformation( const protocol_ctxt_t* const ctxt_pP uint8_t buffer[100]; //Generate SidelinkUEInformation - size = do_SidelinkUEInformation(ctxt_pP->module_id, buffer, destinationInfoList, discTxResourceReq, mode); - LOG_I(RRC,"[UE %d][RRC_UE] Frame %d : Logical Channel UL-DCCH, Generating SidelinkUEInformation (bytes%d, eNB %d)\n", - ctxt_pP->module_id,ctxt_pP->frame, size, eNB_index); + + if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&8192) != 0) {//if SIB18 is available + size = do_SidelinkUEInformation(ctxt_pP->module_id, buffer, destinationInfoList, NULL, mode); + LOG_I(RRC,"[UE %d][RRC_UE] Frame %d : Logical Channel UL-DCCH, Generating SidelinkUEInformation (bytes%d, eNB %d)\n", + ctxt_pP->module_id,ctxt_pP->frame, size, eNB_index); + } + if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&16384) != 0) {//if SIB19 is available + size = do_SidelinkUEInformation(ctxt_pP->module_id, buffer, NULL, discTxResourceReq, mode); + LOG_I(RRC,"[UE %d][RRC_UE] Frame %d : Logical Channel UL-DCCH, Generating SidelinkUEInformation (bytes%d, eNB %d)\n", + ctxt_pP->module_id,ctxt_pP->frame, size, eNB_index); + } + } diff --git a/openair2/RRC/LITE/rrc_eNB.c b/openair2/RRC/LITE/rrc_eNB.c index c0c3898dc78..c5189f2e224 100644 --- a/openair2/RRC/LITE/rrc_eNB.c +++ b/openair2/RRC/LITE/rrc_eNB.c @@ -56,6 +56,7 @@ #include "rrc_eNB_UE_context.h" #include "platform_types.h" #include "msc.h" +#include "SL-CommConfig-r12.h" #include "T.h" @@ -1414,7 +1415,9 @@ rrc_eNB_generate_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t* co (struct SPS_Config*)NULL, // *sps_Config, NULL, NULL, NULL, NULL,NULL, NULL, NULL, NULL, NULL, NULL, NULL, - (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)dedicatedInfoNASList + (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)dedicatedInfoNASList, + (SL_CommConfig_r12_t*)NULL, + (SL_DiscConfig_r12_t*)NULL #if defined(Rel10) || defined(Rel14) , (SCellToAddMod_r10_t*)NULL #endif @@ -2147,7 +2150,9 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons (struct MeasConfig__speedStatePars*)Sparams, (RSRP_Range_t*)rsrp, (C_RNTI_t*)cba_RNTI, - (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)dedicatedInfoNASList + (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)dedicatedInfoNASList, + (SL_CommConfig_r12_t*)NULL, + (SL_DiscConfig_r12_t*)NULL #if defined(Rel10) || defined(Rel14) , (SCellToAddMod_r10_t*)NULL #endif @@ -2251,7 +2256,9 @@ rrc_eNB_generate_RRCConnectionReconfiguration_SCell( (struct MeasConfig__speedStatePars*)NULL, (RSRP_Range_t*)NULL, (C_RNTI_t*)NULL, - (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)NULL + (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)NULL, + (SL_CommConfig_r12_t*)NULL, + (SL_DiscConfig_r12_t*)NULL #if defined(Rel10) || defined(Rel14) , ue_context_pP->ue_context.sCell_config @@ -3367,7 +3374,9 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( Sparams, NULL, NULL, - dedicatedInfoNASList + dedicatedInfoNASList, + (SL_CommConfig_r12_t*)NULL, + (SL_DiscConfig_r12_t*)NULL #if defined(Rel10) || defined(Rel14) , NULL // SCellToAddMod_r10_t #endif @@ -5248,11 +5257,66 @@ rrc_eNB_process_SidelinkUEInformation( ) //----------------------------------------------------------------------------- { + SL_DestinationIdentity_r12_t sl_DestinationIdentityList[16]; + int n_destinations = 0; + int ue_type = 0; + int n_discoveryMessages = 0; + LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel UL-DCCH, " "processing SidelinkUEInformation from UE (SRB1 Active)\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - //generate RRC Reconfiguration - rrc_eNB_generate_RRCConnectionReconfiguration_Sidelink(ctxt_pP, ue_context_pP); + + //For SL Commmunication + // express its interest to receive SL communication + if (sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.commRxInterestedFreq_r12){ + + } + // express its interest to transmit non-relay one-to-many SL communication + if (sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.commTxResourceReq_r12->carrierFreq_r12){ + n_destinations = sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.commTxResourceReq_r12->destinationInfoList_r12.list.count; + for (int i=0; i< n_destinations; i++ ){ + sl_DestinationIdentityList[i] = *(sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.commTxResourceReq_r12->destinationInfoList_r12.list.array[i]); + } + } + // express its interest to transmit non-relay one-to-one SL communication + if (sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceReqUC_r13->carrierFreq_r12){ + n_destinations = sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceReqUC_r13->destinationInfoList_r12.list.count; + for (int i=0; i< n_destinations; i++ ){ + sl_DestinationIdentityList[i] = *(sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceReqUC_r13->destinationInfoList_r12.list.array[i]); + } + } + + // express its interest to transmit relay related one-to-one SL communication + if (sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceInfoReqRelay_r13->commTxResourceReqRelayUC_r13->destinationInfoList_r12.list.count>0){ + n_destinations = sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceInfoReqRelay_r13->commTxResourceReqRelayUC_r13->destinationInfoList_r12.list.count; + ue_type = sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceInfoReqRelay_r13->ue_Type_r13; + for (int i=0; i< n_destinations; i++ ){ + sl_DestinationIdentityList[i] = *(sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceInfoReqRelay_r13->commTxResourceReqRelayUC_r13->destinationInfoList_r12.list.array[i]); + } + } + + //express its interest to transmit relay related one-to-many SL communication + if (sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceInfoReqRelay_r13->commTxResourceReqRelay_r13->destinationInfoList_r12.list.count>0){ + n_destinations = sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceInfoReqRelay_r13->commTxResourceReqRelay_r13->destinationInfoList_r12.list.count; + ue_type = sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceInfoReqRelay_r13->ue_Type_r13; + for (int i=0; i< n_destinations; i++ ){ + sl_DestinationIdentityList[i] = *(sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceInfoReqRelay_r13->commTxResourceReqRelay_r13->destinationInfoList_r12.list.array[i]); + } + } + //For SL Discovery + //express its interest to receive SL discovery announcements + + //express its interest to transmit non-PS related discovery announcements + if (sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.discTxResourceReq_r12 > 0){ + n_discoveryMessages = sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.discTxResourceReq_r12; + } + //express its interest to transmit PS related discovery announcements + if (sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->discTxResourceReqPS_r13->discTxResourceReq_r13 > 0){ + n_discoveryMessages = sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->discTxResourceReqPS_r13->discTxResourceReq_r13; + } + + //generate RRC Reconfiguration + rrc_eNB_generate_RRCConnectionReconfiguration_Sidelink(ctxt_pP, ue_context_pP, sl_DestinationIdentityList, n_destinations, n_discoveryMessages); } @@ -5260,18 +5324,71 @@ rrc_eNB_process_SidelinkUEInformation( int rrc_eNB_generate_RRCConnectionReconfiguration_Sidelink( const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP + rrc_eNB_ue_context_t* const ue_context_pP, + SL_DestinationIdentity_r12_t *SL_DestinationIdentity, + int n_destinations, + int n_discoveryMessages ) //----------------------------------------------------------------------------- { - uint8_t size; - uint8_t buffer[100]; + uint8_t buffer[RRC_BUF_SIZE]; + uint16_t size; + memset(buffer, 0, RRC_BUF_SIZE); + + // allocate dedicated pools for UE -sl-CommConfig/sl-DiscConfig (sl-V2X-ConfigDedicated) + //populate dedicated resources for SL communication (sl-CommConfig) + if (n_destinations > 0) { + //get dedicated resources from available pool and assign to the UE + SL_CommConfig_r12_t sl_CommConfig[n_destinations]; + //get a RP from the available RPs + //sl_CommConfig[0] = rrc_eNB_get_sidelink_commTXPool(ctxt_pP, ue_context_pP, SL_DestinationIdentity, n_destinations ); + + size = do_RRCConnectionReconfiguration(ctxt_pP, + buffer, + rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id), //Transaction_id + (SRB_ToAddModList_t*)NULL, + (DRB_ToAddModList_t*)NULL, + (DRB_ToReleaseList_t*)NULL, // DRB2_list, + (struct SPS_Config*)NULL, // *sps_Config, + NULL, NULL, NULL, NULL,NULL, + NULL, NULL, NULL, NULL, NULL, NULL, + (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)NULL, + (SL_CommConfig_r12_t*)sl_CommConfig, + (SL_DiscConfig_r12_t*)NULL + #if defined(Rel10) || defined(Rel14) + , (SCellToAddMod_r10_t*)NULL + #endif + ); + // + } + //populate dedicated resources for SL discovery (sl-DiscConfig) + if (n_discoveryMessages > 0){ + SL_DiscConfig_r12_t sl_DiscConfig[n_discoveryMessages]; + //get a RP from the available RPs + //SL_DiscConfig[0] = rrc_eNB_get_sidelink_discTXPool(ctxt_pP, ue_context_pP, n_discoveryMessages ); + size = do_RRCConnectionReconfiguration(ctxt_pP, + buffer, + rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id), //Transaction_id + (SRB_ToAddModList_t*)NULL, + (DRB_ToAddModList_t*)NULL, + (DRB_ToReleaseList_t*)NULL, // DRB2_list, + (struct SPS_Config*)NULL, // *sps_Config, + NULL, NULL, NULL, NULL,NULL, + NULL, NULL, NULL, NULL, NULL, NULL, + (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)NULL, + (SL_CommConfig_r12_t*)NULL, + (SL_DiscConfig_r12_t*)sl_DiscConfig + #if defined(Rel10) || defined(Rel14) + , (SCellToAddMod_r10_t*)NULL + #endif + ); + } - //size = do_RRCConnectionReconfiguration(ctxt_pP, buffer ); LOG_I(RRC,"[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration_Sidelink (bytes %d, UE id %x)\n", ctxt_pP->module_id,ctxt_pP->frame, size, ue_context_pP->ue_context.rnti); + // rrc_data_req(); return(0); -- GitLab