diff --git a/ci-scripts/conf_files/gnb-cu.sa.band78.106prb.conf b/ci-scripts/conf_files/gnb-cu.sa.band78.106prb.conf index f9040f2ce6..e7c5dd0514 100644 --- a/ci-scripts/conf_files/gnb-cu.sa.band78.106prb.conf +++ b/ci-scripts/conf_files/gnb-cu.sa.band78.106prb.conf @@ -19,7 +19,6 @@ gNBs = nr_cellid = 12345678L; - force_256qam_off = 1; tr_s_preference = "f1"; @@ -30,136 +29,7 @@ gNBs = local_s_portd = 2153; remote_s_portc = 500; remote_s_portd = 2153; - min_rxtxtime = 6; - - servingCellConfigCommon = ( - { - #spCellConfigCommon - - physCellId = 0; - -# downlinkConfigCommon - #frequencyInfoDL - # this is 3600 MHz + 43 PRBs@30kHz SCS (same as initial BWP) - absoluteFrequencySSB = 641280; - dl_frequencyBand = 78; - # this is 3600 MHz - dl_absoluteFrequencyPointA = 640008; - #scs-SpecificCarrierList - dl_offstToCarrier = 0; -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - dl_subcarrierSpacing = 1; - dl_carrierBandwidth = 106; - #initialDownlinkBWP - #genericParameters - # this is RBstart=27,L=48 (275*(L-1))+RBstart - initialDLBWPlocationAndBandwidth = 28875; # 6366 12925 12956 28875 12952 -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - initialDLBWPsubcarrierSpacing = 1; - #pdcch-ConfigCommon - initialDLBWPcontrolResourceSetZero = 11; - initialDLBWPsearchSpaceZero = 0; - - #uplinkConfigCommon - #frequencyInfoUL - ul_frequencyBand = 78; - #scs-SpecificCarrierList - ul_offstToCarrier = 0; -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - ul_subcarrierSpacing = 1; - ul_carrierBandwidth = 106; - pMax = 20; - #initialUplinkBWP - #genericParameters - initialULBWPlocationAndBandwidth = 28875; -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - initialULBWPsubcarrierSpacing = 1; - #rach-ConfigCommon - #rach-ConfigGeneric - prach_ConfigurationIndex = 98; -#prach_msg1_FDM -#0 = one, 1=two, 2=four, 3=eight - prach_msg1_FDM = 0; - prach_msg1_FrequencyStart = 0; - zeroCorrelationZoneConfig = 13; - preambleReceivedTargetPower = -96; -#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) - preambleTransMax = 6; -#powerRampingStep -# 0=dB0,1=dB2,2=dB4,3=dB6 - powerRampingStep = 1; -#ra_ReponseWindow -#1,2,4,8,10,20,40,80 - ra_ResponseWindow = 4; -#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR -#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen - ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4; -#oneHalf (0..15) 4,8,12,16,...60,64 - ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 14; -#ra_ContentionResolutionTimer -#(0..7) 8,16,24,32,40,48,56,64 - ra_ContentionResolutionTimer = 7; - rsrp_ThresholdSSB = 19; -#prach-RootSequenceIndex_PR -#1 = 839, 2 = 139 - prach_RootSequenceIndex_PR = 2; - prach_RootSequenceIndex = 1; - # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex - # - msg1_SubcarrierSpacing = 1, -# restrictedSetConfig -# 0=unrestricted, 1=restricted type A, 2=restricted type B - restrictedSetConfig = 0, - - msg3_DeltaPreamble = 1; - p0_NominalWithGrant =-90; - -# pucch-ConfigCommon setup : -# pucchGroupHopping -# 0 = neither, 1= group hopping, 2=sequence hopping - pucchGroupHopping = 0; - hoppingId = 40; - p0_nominal = -90; -# ssb_PositionsInBurs_BitmapPR -# 1=short, 2=medium, 3=long - ssb_PositionsInBurst_PR = 2; - ssb_PositionsInBurst_Bitmap = 1; - -# ssb_periodicityServingCell -# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 - ssb_periodicityServingCell = 2; - -# dmrs_TypeA_position -# 0 = pos2, 1 = pos3 - dmrs_TypeA_Position = 0; - -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - subcarrierSpacing = 1; - - - #tdd-UL-DL-ConfigurationCommon -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - referenceSubcarrierSpacing = 1; - # pattern1 - # dl_UL_TransmissionPeriodicity - # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10 - dl_UL_TransmissionPeriodicity = 6; - nrofDownlinkSlots = 7; - nrofDownlinkSymbols = 6; - nrofUplinkSlots = 2; - nrofUplinkSymbols = 4; - - ssPBCH_BlockPower = -25; - } - - ); # ------- SCTP definitions SCTP : { diff --git a/ci-scripts/conf_files/gnb-cu.sa.band78.106prb.usrpb200.conf b/ci-scripts/conf_files/gnb-cu.sa.band78.106prb.usrpb200.conf index 8e8eacb9e6..3d716c81ef 100644 --- a/ci-scripts/conf_files/gnb-cu.sa.band78.106prb.usrpb200.conf +++ b/ci-scripts/conf_files/gnb-cu.sa.band78.106prb.usrpb200.conf @@ -19,7 +19,6 @@ gNBs = nr_cellid = 12345678L; - force_256qam_off = 1; tr_s_preference = "f1"; @@ -30,135 +29,7 @@ gNBs = local_s_portd = 2153; remote_s_portc = 500; remote_s_portd = 2153; - min_rxtxtime = 6; - servingCellConfigCommon = ( - { - #spCellConfigCommon - - physCellId = 0; - -# downlinkConfigCommon - #frequencyInfoDL - # this is 3600 MHz + 43 PRBs@30kHz SCS (same as initial BWP) - absoluteFrequencySSB = 641280; - dl_frequencyBand = 78; - # this is 3600 MHz - dl_absoluteFrequencyPointA = 640008; - #scs-SpecificCarrierList - dl_offstToCarrier = 0; -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - dl_subcarrierSpacing = 1; - dl_carrierBandwidth = 106; - #initialDownlinkBWP - #genericParameters - # this is RBstart=27,L=48 (275*(L-1))+RBstart - initialDLBWPlocationAndBandwidth = 28875; # 6366 12925 12956 28875 12952 -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - initialDLBWPsubcarrierSpacing = 1; - #pdcch-ConfigCommon - initialDLBWPcontrolResourceSetZero = 11; - initialDLBWPsearchSpaceZero = 0; - - #uplinkConfigCommon - #frequencyInfoUL - ul_frequencyBand = 78; - #scs-SpecificCarrierList - ul_offstToCarrier = 0; -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - ul_subcarrierSpacing = 1; - ul_carrierBandwidth = 106; - pMax = 20; - #initialUplinkBWP - #genericParameters - initialULBWPlocationAndBandwidth = 28875; -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - initialULBWPsubcarrierSpacing = 1; - #rach-ConfigCommon - #rach-ConfigGeneric - prach_ConfigurationIndex = 98; -#prach_msg1_FDM -#0 = one, 1=two, 2=four, 3=eight - prach_msg1_FDM = 0; - prach_msg1_FrequencyStart = 0; - zeroCorrelationZoneConfig = 13; - preambleReceivedTargetPower = -96; -#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) - preambleTransMax = 6; -#powerRampingStep -# 0=dB0,1=dB2,2=dB4,3=dB6 - powerRampingStep = 1; -#ra_ReponseWindow -#1,2,4,8,10,20,40,80 - ra_ResponseWindow = 4; -#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR -#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen - ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4; -#oneHalf (0..15) 4,8,12,16,...60,64 - ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 14; -#ra_ContentionResolutionTimer -#(0..7) 8,16,24,32,40,48,56,64 - ra_ContentionResolutionTimer = 7; - rsrp_ThresholdSSB = 19; -#prach-RootSequenceIndex_PR -#1 = 839, 2 = 139 - prach_RootSequenceIndex_PR = 2; - prach_RootSequenceIndex = 1; - # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex - # - msg1_SubcarrierSpacing = 1, -# restrictedSetConfig -# 0=unrestricted, 1=restricted type A, 2=restricted type B - restrictedSetConfig = 0, - - msg3_DeltaPreamble = 1; - p0_NominalWithGrant =-90; - -# pucch-ConfigCommon setup : -# pucchGroupHopping -# 0 = neither, 1= group hopping, 2=sequence hopping - pucchGroupHopping = 0; - hoppingId = 40; - p0_nominal = -90; -# ssb_PositionsInBurs_BitmapPR -# 1=short, 2=medium, 3=long - ssb_PositionsInBurst_PR = 2; - ssb_PositionsInBurst_Bitmap = 1; - -# ssb_periodicityServingCell -# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 - ssb_periodicityServingCell = 2; - -# dmrs_TypeA_position -# 0 = pos2, 1 = pos3 - dmrs_TypeA_Position = 0; - -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - subcarrierSpacing = 1; - - - #tdd-UL-DL-ConfigurationCommon -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - referenceSubcarrierSpacing = 1; - # pattern1 - # dl_UL_TransmissionPeriodicity - # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10 - dl_UL_TransmissionPeriodicity = 6; - nrofDownlinkSlots = 7; - nrofDownlinkSymbols = 6; - nrofUplinkSlots = 2; - nrofUplinkSymbols = 4; - - ssPBCH_BlockPower = -25; - } - - ); # ------- SCTP definitions SCTP : { diff --git a/ci-scripts/conf_files/gnb-cucp.sa.f1.conf b/ci-scripts/conf_files/gnb-cucp.sa.f1.conf index f92ef6842c..5eb123dba1 100644 --- a/ci-scripts/conf_files/gnb-cucp.sa.f1.conf +++ b/ci-scripts/conf_files/gnb-cucp.sa.f1.conf @@ -20,7 +20,6 @@ gNBs = nr_cellid = 12345678L; - force_256qam_off = 1; tr_s_preference = "f1"; @@ -31,136 +30,7 @@ gNBs = local_s_portd = 2152; remote_s_portc = 500; remote_s_portd = 2152; - ssb_SubcarrierOffset = 0; - min_rxtxtime = 6; - servingCellConfigCommon = ( - { - #spCellConfigCommon - - physCellId = 0; - -# downlinkConfigCommon - #frequencyInfoDL - # this is 3600 MHz + 43 PRBs@30kHz SCS (same as initial BWP) - absoluteFrequencySSB = 641280; - dl_frequencyBand = 78; - # this is 3600 MHz - dl_absoluteFrequencyPointA = 640008; - #scs-SpecificCarrierList - dl_offstToCarrier = 0; -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - dl_subcarrierSpacing = 1; - dl_carrierBandwidth = 106; - #initialDownlinkBWP - #genericParameters - # this is RBstart=27,L=48 (275*(L-1))+RBstart - initialDLBWPlocationAndBandwidth = 28875; # 6366 12925 12956 28875 12952 -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - initialDLBWPsubcarrierSpacing = 1; - #pdcch-ConfigCommon - initialDLBWPcontrolResourceSetZero = 11; - initialDLBWPsearchSpaceZero = 0; - - #uplinkConfigCommon - #frequencyInfoUL - ul_frequencyBand = 78; - #scs-SpecificCarrierList - ul_offstToCarrier = 0; -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - ul_subcarrierSpacing = 1; - ul_carrierBandwidth = 106; - pMax = 20; - #initialUplinkBWP - #genericParameters - initialULBWPlocationAndBandwidth = 28875; -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - initialULBWPsubcarrierSpacing = 1; - #rach-ConfigCommon - #rach-ConfigGeneric - prach_ConfigurationIndex = 98; -#prach_msg1_FDM -#0 = one, 1=two, 2=four, 3=eight - prach_msg1_FDM = 0; - prach_msg1_FrequencyStart = 0; - zeroCorrelationZoneConfig = 13; - preambleReceivedTargetPower = -96; -#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) - preambleTransMax = 6; -#powerRampingStep -# 0=dB0,1=dB2,2=dB4,3=dB6 - powerRampingStep = 1; -#ra_ReponseWindow -#1,2,4,8,10,20,40,80 - ra_ResponseWindow = 4; -#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR -#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen - ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4; -#oneHalf (0..15) 4,8,12,16,...60,64 - ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 14; -#ra_ContentionResolutionTimer -#(0..7) 8,16,24,32,40,48,56,64 - ra_ContentionResolutionTimer = 7; - rsrp_ThresholdSSB = 19; -#prach-RootSequenceIndex_PR -#1 = 839, 2 = 139 - prach_RootSequenceIndex_PR = 2; - prach_RootSequenceIndex = 1; - # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex - # - msg1_SubcarrierSpacing = 1, -# restrictedSetConfig -# 0=unrestricted, 1=restricted type A, 2=restricted type B - restrictedSetConfig = 0, - - msg3_DeltaPreamble = 1; - p0_NominalWithGrant =-90; - -# pucch-ConfigCommon setup : -# pucchGroupHopping -# 0 = neither, 1= group hopping, 2=sequence hopping - pucchGroupHopping = 0; - hoppingId = 40; - p0_nominal = -90; -# ssb_PositionsInBurs_BitmapPR -# 1=short, 2=medium, 3=long - ssb_PositionsInBurst_PR = 2; - ssb_PositionsInBurst_Bitmap = 1; - -# ssb_periodicityServingCell -# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 - ssb_periodicityServingCell = 2; - -# dmrs_TypeA_position -# 0 = pos2, 1 = pos3 - dmrs_TypeA_Position = 0; - -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - subcarrierSpacing = 1; - - - #tdd-UL-DL-ConfigurationCommon -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - referenceSubcarrierSpacing = 1; - # pattern1 - # dl_UL_TransmissionPeriodicity - # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10 - dl_UL_TransmissionPeriodicity = 6; - nrofDownlinkSlots = 7; - nrofDownlinkSymbols = 6; - nrofUplinkSlots = 2; - nrofUplinkSymbols = 4; - - ssPBCH_BlockPower = -25; - } - - ); # ------- SCTP definitions SCTP : { diff --git a/ci-scripts/conf_files/gnb-cucp.sa.f1.quectel.conf b/ci-scripts/conf_files/gnb-cucp.sa.f1.quectel.conf index c403de1b64..9d0c13cd74 100644 --- a/ci-scripts/conf_files/gnb-cucp.sa.f1.quectel.conf +++ b/ci-scripts/conf_files/gnb-cucp.sa.f1.quectel.conf @@ -20,7 +20,6 @@ gNBs = nr_cellid = 12345678L; - force_256qam_off = 1; tr_s_preference = "f1"; @@ -31,136 +30,7 @@ gNBs = local_s_portd = 2153; remote_s_portc = 500; remote_s_portd = 2153; - ssb_SubcarrierOffset = 0; - min_rxtxtime = 6; - servingCellConfigCommon = ( - { - #spCellConfigCommon - - physCellId = 0; - -# downlinkConfigCommon - #frequencyInfoDL - # this is 3600 MHz + 43 PRBs@30kHz SCS (same as initial BWP) - absoluteFrequencySSB = 641280; - dl_frequencyBand = 78; - # this is 3600 MHz - dl_absoluteFrequencyPointA = 640008; - #scs-SpecificCarrierList - dl_offstToCarrier = 0; -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - dl_subcarrierSpacing = 1; - dl_carrierBandwidth = 106; - #initialDownlinkBWP - #genericParameters - # this is RBstart=27,L=48 (275*(L-1))+RBstart - initialDLBWPlocationAndBandwidth = 28875; # 6366 12925 12956 28875 12952 -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - initialDLBWPsubcarrierSpacing = 1; - #pdcch-ConfigCommon - initialDLBWPcontrolResourceSetZero = 11; - initialDLBWPsearchSpaceZero = 0; - - #uplinkConfigCommon - #frequencyInfoUL - ul_frequencyBand = 78; - #scs-SpecificCarrierList - ul_offstToCarrier = 0; -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - ul_subcarrierSpacing = 1; - ul_carrierBandwidth = 106; - pMax = 20; - #initialUplinkBWP - #genericParameters - initialULBWPlocationAndBandwidth = 28875; -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - initialULBWPsubcarrierSpacing = 1; - #rach-ConfigCommon - #rach-ConfigGeneric - prach_ConfigurationIndex = 98; -#prach_msg1_FDM -#0 = one, 1=two, 2=four, 3=eight - prach_msg1_FDM = 0; - prach_msg1_FrequencyStart = 0; - zeroCorrelationZoneConfig = 13; - preambleReceivedTargetPower = -96; -#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) - preambleTransMax = 6; -#powerRampingStep -# 0=dB0,1=dB2,2=dB4,3=dB6 - powerRampingStep = 1; -#ra_ReponseWindow -#1,2,4,8,10,20,40,80 - ra_ResponseWindow = 4; -#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR -#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen - ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4; -#oneHalf (0..15) 4,8,12,16,...60,64 - ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 14; -#ra_ContentionResolutionTimer -#(0..7) 8,16,24,32,40,48,56,64 - ra_ContentionResolutionTimer = 7; - rsrp_ThresholdSSB = 19; -#prach-RootSequenceIndex_PR -#1 = 839, 2 = 139 - prach_RootSequenceIndex_PR = 2; - prach_RootSequenceIndex = 1; - # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex - # - msg1_SubcarrierSpacing = 1, -# restrictedSetConfig -# 0=unrestricted, 1=restricted type A, 2=restricted type B - restrictedSetConfig = 0, - - msg3_DeltaPreamble = 1; - p0_NominalWithGrant =-90; - -# pucch-ConfigCommon setup : -# pucchGroupHopping -# 0 = neither, 1= group hopping, 2=sequence hopping - pucchGroupHopping = 0; - hoppingId = 40; - p0_nominal = -90; -# ssb_PositionsInBurs_BitmapPR -# 1=short, 2=medium, 3=long - ssb_PositionsInBurst_PR = 2; - ssb_PositionsInBurst_Bitmap = 1; - -# ssb_periodicityServingCell -# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 - ssb_periodicityServingCell = 2; - -# dmrs_TypeA_position -# 0 = pos2, 1 = pos3 - dmrs_TypeA_Position = 0; - -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - subcarrierSpacing = 1; - - - #tdd-UL-DL-ConfigurationCommon -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - referenceSubcarrierSpacing = 1; - # pattern1 - # dl_UL_TransmissionPeriodicity - # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10 - dl_UL_TransmissionPeriodicity = 6; - nrofDownlinkSlots = 7; - nrofDownlinkSymbols = 6; - nrofUplinkSlots = 2; - nrofUplinkSymbols = 4; - - ssPBCH_BlockPower = -25; - } - - ); # ------- SCTP definitions SCTP : { diff --git a/ci-scripts/conf_files/gnb-du.band78.106prb.rfsim.conf b/ci-scripts/conf_files/gnb-du.band78.106prb.rfsim.conf index 95b28a38ed..09f8d5007e 100644 --- a/ci-scripts/conf_files/gnb-du.band78.106prb.rfsim.conf +++ b/ci-scripts/conf_files/gnb-du.band78.106prb.rfsim.conf @@ -22,7 +22,6 @@ gNBs = ////////// Physical parameters: min_rxtxtime = 6; - force_256qam_off = 1; servingCellConfigCommon = ( { diff --git a/ci-scripts/conf_files/gnb-du.sa.band78.106prb.usrpb200.conf b/ci-scripts/conf_files/gnb-du.sa.band78.106prb.usrpb200.conf index b30bf92370..f7891902db 100644 --- a/ci-scripts/conf_files/gnb-du.sa.band78.106prb.usrpb200.conf +++ b/ci-scripts/conf_files/gnb-du.sa.band78.106prb.usrpb200.conf @@ -22,7 +22,6 @@ gNBs = ////////// Physical parameters: min_rxtxtime = 6; - force_256qam_off = 1; servingCellConfigCommon = ( diff --git a/ci-scripts/conf_files/gnb.sa.band78.51prb.usrpb200.conf b/ci-scripts/conf_files/gnb.sa.band78.51prb.usrpb200.conf index 405fb552c4..75dde393e9 100644 --- a/ci-scripts/conf_files/gnb.sa.band78.51prb.usrpb200.conf +++ b/ci-scripts/conf_files/gnb.sa.band78.51prb.usrpb200.conf @@ -30,7 +30,7 @@ gNBs = absoluteFrequencySSB = 620736; dl_frequencyBand = 78; # this is 3300.30 MHz - dl_absoluteFrequencyPointA = 620020; + dl_absoluteFrequencyPointA = 620052; #scs-SpecificCarrierList dl_offstToCarrier = 0; # subcarrierSpacing diff --git a/doc/SW_archi.md b/doc/SW_archi.md index 7facfcb595..4f80c98dcd 100644 --- a/doc/SW_archi.md +++ b/doc/SW_archi.md @@ -211,7 +211,7 @@ The scheduler also calls "run_pdcp()", as this is not a autonomous thread, it ne After calling run_pdcp, it updates "rlc" time data but it doesn't actually process rlc it sends a iiti message to activate the thread for RRC, the answer will be asynchronous in ???? -Calls schedule_nr_mib() that calls mac_rrc_nr_data_req() to fill MIB, +Calls schedule_nr_mib() that fills MIB, Calls schedule_nr_prach() which schedules the (fixed) PRACH region one frame in advance. diff --git a/executables/nr-cuup.c b/executables/nr-cuup.c index 81d255b87d..2992953ef0 100644 --- a/executables/nr-cuup.c +++ b/executables/nr-cuup.c @@ -106,7 +106,7 @@ void prepare_and_send_ue_context_modification_f1(rrc_gNB_ue_context_t *ue_contex abort(); } -f1ap_cudu_inst_t *getCxt(F1_t isCU, instance_t instanceP) +f1ap_cudu_inst_t *getCxt(instance_t instanceP) { abort(); return NULL; diff --git a/executables/nr-ru.c b/executables/nr-ru.c index 4a4fa8e7af..0f7c7e57fd 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -95,8 +95,8 @@ extern void nr_phy_config_request(NR_PHY_Config_t *gNB); //extern WORKER_CONF_t get_thread_worker_conf(void); void init_NR_RU(char *); +void start_NR_RU(); void stop_RU(int nb_ru); -void do_ru_sync(RU_t *ru); void configure_ru(int idx, void *arg); void configure_rru(int idx, void *arg); @@ -1398,7 +1398,6 @@ int start_write_thread(RU_t *ru) { void init_RU_proc(RU_t *ru) { int i=0; RU_proc_t *proc; - LOG_I(PHY,"Initializing RU proc %d (%s,%s),\n",ru->idx,NB_functions[ru->function],NB_timing[ru->if_timing]); proc = &ru->proc; memset((void *)proc,0,sizeof(RU_proc_t)); proc->ru = ru; @@ -1413,7 +1412,6 @@ void init_RU_proc(RU_t *ru) { pthread_mutex_init( &proc->mutex_emulateRF,NULL); pthread_cond_init( &proc->cond_emulateRF, NULL); - threadCreate( &proc->pthread_FH, ru_thread, (void *)ru, "ru_thread", ru->ru_thread_core, OAI_PRIORITY_RT_MAX ); if(emulate_rf) threadCreate( &proc->pthread_emulateRF, emulatedRF_thread, (void *)proc, "emulateRF", -1, OAI_PRIORITY_RT ); @@ -1421,7 +1419,12 @@ void init_RU_proc(RU_t *ru) { threadCreate( &ru->ru_stats_thread, ru_stats_thread, (void *)ru,"ru_stats", -1, OAI_PRIORITY_RT ); if (get_thread_worker_conf() == WORKER_ENABLE) { } + LOG_I(PHY, "Initialized RU proc %d (%s,%s),\n", ru->idx, NB_functions[ru->function], NB_timing[ru->if_timing]); +} +void start_RU_proc(RU_t *ru) +{ + threadCreate(&ru->proc.pthread_FH, ru_thread, (void *)ru, "ru_thread", ru->ru_thread_core, OAI_PRIORITY_RT_MAX); } @@ -1875,6 +1878,12 @@ void init_NR_RU(char *rf_config_file) { LOG_D(HW,"[nr-softmodem.c] RU threads created\n"); } +void start_NR_RU() +{ + RU_t *ru = RC.ru[0]; + start_RU_proc(ru); +} + void stop_RU(int nb_ru) { for (int inst = 0; inst < nb_ru; inst++) { diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index 5c419f1905..8bffda8f61 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -289,9 +289,8 @@ void exit_function(const char *file, const char *function, const int line, const } } - - -static int create_gNB_tasks(void) { +static int create_gNB_tasks(ngran_node_t node_type) +{ uint32_t gnb_nb = RC.nb_nr_inst; uint32_t gnb_id_start = 0; uint32_t gnb_id_end = gnb_id_start + gnb_nb; @@ -299,6 +298,8 @@ static int create_gNB_tasks(void) { itti_wait_ready(1); LOG_I(PHY, "%s() Task ready initialize structures\n", __FUNCTION__); + RCconfig_verify(node_type); + RCconfig_NR_L1(); RCconfig_nr_prs(); @@ -314,13 +315,11 @@ static int create_gNB_tasks(void) { LOG_I(GNB_APP,"Allocating gNB_RRC_INST for %d instances\n",RC.nb_nr_inst); - RC.nrrrc = (gNB_RRC_INST **)malloc(RC.nb_nr_inst*sizeof(gNB_RRC_INST *)); - LOG_I(PHY, "%s() RC.nb_nr_inst:%d RC.nrrrc:%p\n", __FUNCTION__, RC.nb_nr_inst, RC.nrrrc); - ngran_node_t node_type = get_node_type(); - for (int gnb_id = gnb_id_start; (gnb_id < gnb_id_end) ; gnb_id++) { - RC.nrrrc[gnb_id] = (gNB_RRC_INST*)calloc(1,sizeof(gNB_RRC_INST)); - LOG_I(PHY, "%s() Creating RRC instance RC.nrrrc[%d]:%p (%d of %d)\n", __FUNCTION__, gnb_id, RC.nrrrc[gnb_id], gnb_id+1, gnb_id_end); - configure_nr_rrc(gnb_id); + if (RC.nb_nr_inst > 0) { + AssertFatal(RC.nb_nr_inst == 1, "multiple RRC instances are not supported\n"); + RC.nrrrc = calloc(1, sizeof(*RC.nrrrc)); + RC.nrrrc[0] = calloc(1,sizeof(gNB_RRC_INST)); + RCconfig_NRRRC(RC.nrrrc[0]); } if (RC.nb_nr_inst > 0 && @@ -635,8 +634,9 @@ int main( int argc, char **argv ) { RCconfig_NR_L1(); // don't create if node doesn't connect to RRC/S1/GTP + const ngran_node_t node_type = get_node_type(); if (NFAPI_MODE != NFAPI_MODE_PNF) { - int ret = create_gNB_tasks(); + int ret = create_gNB_tasks(node_type); AssertFatal(ret == 0, "cannot create ITTI tasks\n"); } @@ -736,6 +736,13 @@ int main( int argc, char **argv ) { wait_nfapi_init("main?"); } + // wait for F1 Setup Response before starting L1 for real + if (NODE_IS_DU(node_type) || NODE_IS_MONOLITHIC(node_type)) + wait_f1_setup_response(); + + if (RC.nb_RU > 0) + start_NR_RU(); + if (RC.nb_nr_L1_inst > 0) { printf("wait RUs\n"); wait_RUs(); diff --git a/executables/nr-softmodem.h b/executables/nr-softmodem.h index 63a2391826..96b70d0f90 100644 --- a/executables/nr-softmodem.h +++ b/executables/nr-softmodem.h @@ -54,6 +54,7 @@ extern void kill_gNB_proc(int inst); // In nr-ru.c extern void init_NR_RU(char *); extern void init_RU_proc(RU_t *ru); +extern void start_NR_RU(void); extern void stop_RU(int nb_ru); extern void kill_NR_RU_proc(int inst); extern void set_function_spec_param(RU_t *ru); diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index b42edf31e0..15ef948c62 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -239,7 +239,7 @@ nrUE_params_t *get_nrUE_params(void) { } -void validate_input_pmi(rrc_pdsch_AntennaPorts_t pdsch_AntennaPorts, int nrOfLayers, int pmi) +void validate_input_pmi(nr_pdsch_AntennaPorts_t pdsch_AntennaPorts, int nrOfLayers, int pmi) { if (pmi == 0) return; @@ -622,11 +622,32 @@ int main(int argc, char **argv) frame_parms->N_RB_DL = N_RB_DL; frame_parms->N_RB_UL = N_RB_DL; + AssertFatal((gNB->if_inst = NR_IF_Module_init(0)) != NULL, "Cannot register interface"); + gNB->if_inst->NR_PHY_config_req = nr_phy_config_request; + + NR_ServingCellConfigCommon_t *scc = calloc(1,sizeof(*scc));; + prepare_scc(scc); + uint64_t ssb_bitmap = 1; // Enable only first SSB with index ssb_indx=0 + fill_scc_sim(scc, &ssb_bitmap, N_RB_DL, N_RB_DL, mu, mu); + fix_scc(scc, ssb_bitmap); + + // TODO do a UECAP for phy-sim + nr_pdsch_AntennaPorts_t pdsch_AntennaPorts = {0}; + pdsch_AntennaPorts.N1 = n_tx > 1 ? n_tx >> 1 : 1; + pdsch_AntennaPorts.N2 = 1; + pdsch_AntennaPorts.XP = n_tx > 1 ? 2 : 1; + const nr_mac_config_t conf = {.pdsch_AntennaPorts = pdsch_AntennaPorts, + .pusch_AntennaPorts = n_tx, + .minRXTXTIME = 6, + .do_CSIRS = 0, + .do_SRS = 0, + .force_256qam_off = false}; + RC.nb_nr_macrlc_inst = 1; RC.nb_nr_mac_CC = (int*)malloc(RC.nb_nr_macrlc_inst*sizeof(int)); for (i = 0; i < RC.nb_nr_macrlc_inst; i++) RC.nb_nr_mac_CC[i] = 1; - mac_top_init_gNB(ngran_gNB); + mac_top_init_gNB(ngran_gNB, scc, NULL, &conf); gNB_mac = RC.nrmac[0]; gNB_mac->dl_bler.harq_round_max = num_rounds; @@ -673,19 +694,9 @@ int main(int argc, char **argv) NR_ServingCellConfigCommon_t *scc = secondaryCellGroup->spCellConfig->reconfigurationWithSync->spCellConfigCommon; */ - NR_ServingCellConfigCommon_t *scc = calloc(1,sizeof(*scc));; - prepare_scc(scc); - uint64_t ssb_bitmap = 1; // Enable only first SSB with index ssb_indx=0 - fill_scc_sim(scc, &ssb_bitmap, N_RB_DL, N_RB_DL, mu, mu); - fix_scc(scc, ssb_bitmap); - NR_ServingCellConfig_t *scd = calloc(1,sizeof(*scd)); prepare_scd(scd); - rrc_pdsch_AntennaPorts_t pdsch_AntennaPorts = {0}; - pdsch_AntennaPorts.N1 = n_tx>1 ? n_tx>>1 : 1; - pdsch_AntennaPorts.N2 = 1; - pdsch_AntennaPorts.XP = n_tx>1 ? 2 : 1; gNB->ap_N1 = pdsch_AntennaPorts.N1; gNB->ap_N2 = pdsch_AntennaPorts.N2; gNB->ap_XP = pdsch_AntennaPorts.XP; @@ -696,12 +707,6 @@ int main(int argc, char **argv) prepare_sim_uecap(UE_Capability_nr,scc,mu, N_RB_DL,g_mcsTableIdx,0); - // TODO do a UECAP for phy-sim - const gNB_RrcConfigurationReq conf = {.pdsch_AntennaPorts = pdsch_AntennaPorts, - .minRXTXTIME = 6, - .do_CSIRS = 0, - .do_SRS = 0, - .force_256qam_off = false}; NR_CellGroupConfig_t *secondaryCellGroup = get_default_secondaryCellGroup(scc, scd, UE_Capability_nr, 0, 1, &conf, 0); /* RRC parameter validation for secondaryCellGroup */ @@ -719,11 +724,6 @@ int main(int argc, char **argv) //xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void*)secondaryCellGroup); - AssertFatal((gNB->if_inst = NR_IF_Module_init(0))!=NULL,"Cannot register interface"); - gNB->if_inst->NR_PHY_config_req = nr_phy_config_request; - - // common configuration - nr_mac_config_scc(RC.nrmac[0], pdsch_AntennaPorts, n_tx, 0, 6, scc); // UE dedicated configuration nr_mac_add_test_ue(RC.nrmac[0], secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity, secondaryCellGroup); // reset preprocessor to the one of DLSIM after it has been set during diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index f307884d45..a8c02998ee 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -608,23 +608,34 @@ int main(int argc, char *argv[]) frame_parms->N_RB_UL = N_RB_UL; frame_parms->Ncp = extended_prefix_flag ? EXTENDED : NORMAL; + AssertFatal((gNB->if_inst = NR_IF_Module_init(0)) != NULL, "Cannot register interface"); + gNB->if_inst->NR_PHY_config_req = nr_phy_config_request; + s_re = malloc(n_tx*sizeof(double*)); s_im = malloc(n_tx*sizeof(double*)); r_re = malloc(n_rx*sizeof(double*)); r_im = malloc(n_rx*sizeof(double*)); - RC.nb_nr_macrlc_inst = 1; - RC.nb_nr_mac_CC = (int*)malloc(RC.nb_nr_macrlc_inst*sizeof(int)); - for (i = 0; i < RC.nb_nr_macrlc_inst; i++) - RC.nb_nr_mac_CC[i] = 1; - mac_top_init_gNB(ngran_gNB); - NR_ServingCellConfigCommon_t *scc = calloc(1,sizeof(*scc));; prepare_scc(scc); uint64_t ssb_bitmap; fill_scc_sim(scc, &ssb_bitmap, N_RB_DL, N_RB_DL, mu, mu); fix_scc(scc,ssb_bitmap); + // TODO do a UECAP for phy-sim + const nr_mac_config_t conf = {.pdsch_AntennaPorts = {.N1 = 1, .N2 = 1, .XP = 1}, + .pusch_AntennaPorts = n_rx, + .minRXTXTIME = 0, + .do_CSIRS = 0, + .do_SRS = 0, + .force_256qam_off = false}; + + RC.nb_nr_macrlc_inst = 1; + RC.nb_nr_mac_CC = (int*)malloc(RC.nb_nr_macrlc_inst*sizeof(int)); + for (i = 0; i < RC.nb_nr_macrlc_inst; i++) + RC.nb_nr_mac_CC[i] = 1; + mac_top_init_gNB(ngran_gNB, scc, NULL /* scd will be updated further below */, &conf); + NR_ServingCellConfig_t *scd = calloc(1,sizeof(NR_ServingCellConfig_t)); prepare_scd(scd); @@ -632,14 +643,6 @@ int main(int argc, char *argv[]) prepare_sim_uecap(UE_Capability_nr,scc,mu, N_RB_UL,0,mcs_table); - // TODO do a UECAP for phy-sim - const gNB_RrcConfigurationReq conf = {.pdsch_AntennaPorts = {.N1 = 1, .N2 = 1, .XP = 1}, - .pusch_AntennaPorts = n_rx, - .minRXTXTIME = 0, - .do_CSIRS = 0, - .do_SRS = 0, - .force_256qam_off = false}; - NR_CellGroupConfig_t *secondaryCellGroup = get_default_secondaryCellGroup(scc, scd, UE_Capability_nr, 0, 1, &conf, 0); /* RRC parameter validation for secondaryCellGroup */ @@ -647,12 +650,6 @@ int main(int argc, char *argv[]) NR_BCCH_BCH_Message_t *mib = get_new_MIB_NR(scc); - AssertFatal((gNB->if_inst = NR_IF_Module_init(0))!=NULL,"Cannot register interface"); - - gNB->if_inst->NR_PHY_config_req = nr_phy_config_request; - // common configuration - nr_mac_config_scc(RC.nrmac[0], conf.pdsch_AntennaPorts, n_tx, 0, 6, scc); - nr_mac_config_mib(RC.nrmac[0], mib); // UE dedicated configuration nr_mac_add_test_ue(RC.nrmac[0], secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity, secondaryCellGroup); frame_parms->nb_antennas_tx = 1; diff --git a/openair2/COMMON/e1ap_messages_types.h b/openair2/COMMON/e1ap_messages_types.h index 7a1a8b2698..fba56ccb14 100644 --- a/openair2/COMMON/e1ap_messages_types.h +++ b/openair2/COMMON/e1ap_messages_types.h @@ -24,6 +24,8 @@ #ifndef E1AP_MESSAGES_TYPES_H #define E1AP_MESSAGES_TYPES_H +#include +#include #include "common/ngran_types.h" #include "f1ap_messages_types.h" #include "ngap_messages_types.h" @@ -55,7 +57,7 @@ typedef struct PLMN_ID_s { typedef struct e1ap_setup_req_s { uint64_t gNB_cu_up_id; char * gNB_cu_up_name; - int assoc_id; + sctp_assoc_t assoc_id; uint64_t transac_id; int supported_plmns; PLMN_ID_t plmns[E1AP_MAX_NUM_PLMNS]; diff --git a/openair2/COMMON/f1ap_messages_def.h b/openair2/COMMON/f1ap_messages_def.h index 08f552d9d3..0689dd52ac 100644 --- a/openair2/COMMON/f1ap_messages_def.h +++ b/openair2/COMMON/f1ap_messages_def.h @@ -19,8 +19,8 @@ * contact@openairinterface.org */ -/* F1AP -> SCTP */ -MESSAGE_DEF(F1AP_CU_SCTP_REQ , MESSAGE_PRIORITY_MED, f1ap_cu_setup_req_t , f1ap_cu_setup_req) +/* To setup F1 at DU */ +MESSAGE_DEF(F1AP_DU_REGISTER_REQ, MESSAGE_PRIORITY_MED, f1ap_du_register_req_t, f1ap_du_register_req) /* eNB_DU application layer -> F1AP messages or CU F1AP -> RRC*/ MESSAGE_DEF(F1AP_SETUP_REQ , MESSAGE_PRIORITY_MED, f1ap_setup_req_t , f1ap_setup_req) @@ -32,6 +32,9 @@ MESSAGE_DEF(F1AP_SETUP_RESP , MESSAGE_PRIORITY_MED, f1ap_setup_resp_t MESSAGE_DEF(F1AP_SETUP_FAILURE , MESSAGE_PRIORITY_MED, f1ap_setup_failure_t , f1ap_setup_failure) MESSAGE_DEF(F1AP_GNB_CU_CONFIGURATION_UPDATE , MESSAGE_PRIORITY_MED, f1ap_gnb_cu_configuration_update_t , f1ap_gnb_cu_configuration_update) +/* F1AP -> RRC to inform about lost connection */ +MESSAGE_DEF(F1AP_LOST_CONNECTION, MESSAGE_PRIORITY_MED, f1ap_lost_connection_t, f1ap_lost_connection) + /* MAC -> F1AP messages */ MESSAGE_DEF(F1AP_INITIAL_UL_RRC_MESSAGE , MESSAGE_PRIORITY_MED, f1ap_initial_ul_rrc_message_t , f1ap_initial_ul_rrc_message) MESSAGE_DEF(F1AP_UL_RRC_MESSAGE , MESSAGE_PRIORITY_MED, f1ap_ul_rrc_message_t , f1ap_ul_rrc_message) diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index 2f95ee8cdc..b47a763089 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -22,6 +22,8 @@ #ifndef F1AP_MESSAGES_TYPES_H_ #define F1AP_MESSAGES_TYPES_H_ +#include +#include #include "rlc.h" #include "s1ap_messages_types.h" @@ -30,6 +32,8 @@ #define F1AP_CU_SCTP_REQ(mSGpTR) (mSGpTR)->ittiMsg.f1ap_cu_sctp_req +#define F1AP_DU_REGISTER_REQ(mSGpTR) (mSGpTR)->ittiMsg.f1ap_du_register_req + #define F1AP_SETUP_REQ(mSGpTR) (mSGpTR)->ittiMsg.f1ap_setup_req #define F1AP_SETUP_RESP(mSGpTR) (mSGpTR)->ittiMsg.f1ap_setup_resp #define F1AP_GNB_CU_CONFIGURATION_UPDATE(mSGpTR) (mSGpTR)->ittiMsg.f1ap_gnb_cu_configuration_update @@ -37,6 +41,8 @@ #define F1AP_GNB_CU_CONFIGURATION_UPDATE_FAILURE(mSGpTR) (mSGpTR)->ittiMsg.f1ap_gnb_cu_configuration_update_failure #define F1AP_SETUP_FAILURE(mSGpTR) (mSGpTR)->ittiMsg.f1ap_setup_failure +#define F1AP_LOST_CONNECTION(mSGpTR) (mSGpTR)->ittiMsg.f1ap_lost_connection + #define F1AP_INITIAL_UL_RRC_MESSAGE(mSGpTR) (mSGpTR)->ittiMsg.f1ap_initial_ul_rrc_message #define F1AP_UL_RRC_MESSAGE(mSGpTR) (mSGpTR)->ittiMsg.f1ap_ul_rrc_message #define F1AP_UE_CONTEXT_SETUP_REQ(mSGpTR) (mSGpTR)->ittiMsg.f1ap_ue_context_setup_req @@ -75,133 +81,96 @@ typedef struct f1ap_net_ip_address_s { char ipv6_address[46]; } f1ap_net_ip_address_t; -typedef struct f1ap_cu_setup_req_s { - // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ - // To be removed if the structure is filled - uint32_t dummy; -} f1ap_cu_setup_req_t; - -typedef struct cellIDs_s { - - // Served Cell Information - /* Tracking area code */ - uint32_t tac; - - /* Mobile Country Codes - * Mobile Network Codes - */ - uint16_t mcc; - uint16_t mnc; - uint8_t mnc_digit_length; - - // NR Global Cell Id - uint64_t nr_cellid; - // NR Physical Cell Ids - uint16_t nr_pci; - // Number of slide support items (max 16, could be increased to as much as 1024) - uint16_t num_ssi; - uint8_t sst; - uint8_t sd; -} cellIDs_t; - -typedef struct f1ap_setup_req_s { - - // Midhaul networking parameters - - /* Connexion id used between SCTP/F1AP */ - uint16_t cnx_id; - - /* SCTP association id */ - int32_t assoc_id; - - /* The eNB IP address to bind */ +typedef struct f1ap_net_config_t { f1ap_net_ip_address_t CU_f1_ip_address; f1ap_net_ip_address_t DU_f1_ip_address; uint16_t CUport; uint16_t DUport; +} f1ap_net_config_t; - /* Number of SCTP streams used for a mme association */ - uint16_t sctp_in_streams; - uint16_t sctp_out_streams; +typedef struct f1ap_plmn_t { + uint16_t mcc; + uint16_t mnc; + uint8_t mnc_digit_length; +} f1ap_plmn_t; - uint16_t default_sctp_stream_id; +typedef enum f1ap_mode_t { F1AP_MODE_TDD = 0, F1AP_MODE_FDD = 1 } f1ap_mode_t; + +typedef struct f1ap_nr_frequency_info_t { + uint32_t arfcn; + int band; +} f1ap_nr_frequency_info_t; + +typedef struct f1ap_transmission_bandwidth_t { + uint8_t scs; + uint16_t nrb; +} f1ap_transmission_bandwidth_t; + +typedef struct f1ap_fdd_info_t { + f1ap_nr_frequency_info_t ul_freqinfo; + f1ap_nr_frequency_info_t dl_freqinfo; + f1ap_transmission_bandwidth_t ul_tbw; + f1ap_transmission_bandwidth_t dl_tbw; +} f1ap_fdd_info_t; + +typedef struct f1ap_tdd_info_t { + f1ap_nr_frequency_info_t freqinfo; + f1ap_transmission_bandwidth_t tbw; +} f1ap_tdd_info_t; + +typedef struct f1ap_served_cell_info_t { + // NR CGI + f1ap_plmn_t plmn; + uint64_t nr_cellid; // NR Global Cell Id + + // NR Physical Cell Ids + uint16_t nr_pci; + + /* Tracking area code */ + uint32_t *tac; + + // Number of slide support items (max 16, could be increased to as much as 1024) + uint16_t num_ssi; + uint8_t sst; + uint8_t sd; + + f1ap_mode_t mode; + union { + f1ap_fdd_info_t fdd; + f1ap_tdd_info_t tdd; + }; + + char *measurement_timing_information; +} f1ap_served_cell_info_t; + +typedef struct f1ap_gnb_du_system_info_t { + uint8_t *mib; + int mib_length; + uint8_t *sib1; + int sib1_length; +} f1ap_gnb_du_system_info_t; + +typedef struct f1ap_setup_req_s { // F1_Setup_Req payload uint64_t gNB_DU_id; char *gNB_DU_name; - - /* The type of the cell */ - enum cell_type_e cell_type; /// number of DU cells available uint16_t num_cells_available; //0< num_cells_available <= 512; - cellIDs_t cell[F1AP_MAX_NB_CELLS]; - // fdd_flag = 1 means FDD, 0 means TDD - int fdd_flag; - - union { - struct fdd_s { - uint32_t ul_nr_arfcn; - uint8_t ul_scs; - uint16_t ul_nrb; - - uint32_t dl_nr_arfcn; - uint8_t dl_scs; - uint16_t dl_nrb; - - uint32_t sul_active; - uint32_t sul_nr_arfcn; - uint8_t sul_scs; - uint16_t sul_nrb; - - uint8_t ul_num_frequency_bands; - uint16_t ul_nr_band[32]; - uint8_t ul_num_sul_frequency_bands; - uint16_t ul_nr_sul_band[32]; - - uint8_t dl_num_frequency_bands; - uint16_t dl_nr_band[32]; - uint8_t dl_num_sul_frequency_bands; - uint16_t dl_nr_sul_band[32]; - } fdd; - struct tdd_s { - - uint32_t nr_arfcn; - uint8_t scs; - uint16_t nrb; - - uint32_t sul_active; - uint32_t sul_nr_arfcn; - uint8_t sul_scs; - uint16_t sul_nrb; - - uint8_t num_frequency_bands; - uint16_t nr_band[32]; - uint8_t num_sul_frequency_bands; - uint16_t nr_sul_band[32]; - - } tdd; - } nr_mode_info[F1AP_MAX_NB_CELLS]; - - char *measurement_timing_information[F1AP_MAX_NB_CELLS]; - uint8_t ranac[F1AP_MAX_NB_CELLS]; - - // System Information - uint8_t *mib[F1AP_MAX_NB_CELLS]; - int mib_length[F1AP_MAX_NB_CELLS]; - uint8_t *sib1[F1AP_MAX_NB_CELLS]; - int sib1_length[F1AP_MAX_NB_CELLS]; - - + struct { + f1ap_served_cell_info_t info; + f1ap_gnb_du_system_info_t *sys_info; + } cell[F1AP_MAX_NB_CELLS]; } f1ap_setup_req_t; +typedef struct f1ap_du_register_req_t { + f1ap_setup_req_t setup_req; + f1ap_net_config_t net_config; +} f1ap_du_register_req_t; + typedef struct served_cells_to_activate_s { - /// mcc of DU cells - uint16_t mcc; - /// mnc of DU cells - uint16_t mnc; - /// mnc digit length of DU cells - uint8_t mnc_digit_length; + f1ap_plmn_t plmn; // NR Global Cell Id uint64_t nr_cellid; /// NRPCI @@ -215,16 +184,6 @@ typedef struct served_cells_to_activate_s { } served_cells_to_activate_t; typedef struct f1ap_setup_resp_s { - /* Connexion id used between SCTP/F1AP */ - uint16_t cnx_id; - - /* SCTP association id */ - int32_t assoc_id; - - /* Number of SCTP streams used for a mme association */ - uint16_t sctp_in_streams; - uint16_t sctp_out_streams; - /// string holding gNB_CU_name char *gNB_CU_name; /// number of DU cells to activate @@ -237,7 +196,7 @@ typedef struct f1ap_gnb_cu_configuration_update_s { uint16_t cnx_id; /* SCTP association id */ - int32_t assoc_id; + sctp_assoc_t assoc_id; /* Number of SCTP streams used for a mme association */ uint16_t sctp_in_streams; @@ -258,9 +217,7 @@ typedef struct f1ap_setup_failure_s { typedef struct f1ap_gnb_cu_configuration_update_acknowledge_s { uint16_t num_cells_failed_to_be_activated; - uint16_t mcc[F1AP_MAX_NB_CELLS]; - uint16_t mnc[F1AP_MAX_NB_CELLS]; - uint8_t mnc_digit_length[F1AP_MAX_NB_CELLS]; + f1ap_plmn_t plmn[F1AP_MAX_NB_CELLS]; uint64_t nr_cellid[F1AP_MAX_NB_CELLS]; uint16_t cause[F1AP_MAX_NB_CELLS]; int have_criticality; @@ -273,9 +230,7 @@ typedef struct f1ap_gnb_cu_configuration_update_acknowledge_s { uint16_t cause_failed[F1AP_MAX_NO_OF_TNL_ASSOCIATIONS]; uint16_t noofDedicatedSIDeliveryNeededUEs; uint32_t gNB_CU_ue_id[F1AP_MAX_NO_UE_ID]; - uint16_t ue_mcc[F1AP_MAX_NO_UE_ID]; - uint16_t ue_mnc[F1AP_MAX_NO_UE_ID]; - uint8_t ue_mnc_digit_length[F1AP_MAX_NO_UE_ID]; + f1ap_plmn_t ue_plmn[F1AP_MAX_NO_UE_ID]; uint64_t ue_nr_cellid[F1AP_MAX_NO_UE_ID]; } f1ap_gnb_cu_configuration_update_acknowledge_t; @@ -303,12 +258,7 @@ typedef struct f1ap_dl_rrc_message_s { typedef struct f1ap_initial_ul_rrc_message_s { uint32_t gNB_DU_ue_id; - /// mcc of DU cell - uint16_t mcc; - /// mnc of DU cell - uint16_t mnc; - /// mnc digit length of DU cells - uint8_t mnc_digit_length; + f1ap_plmn_t plmn; /// nr cell id uint64_t nr_cellid; /// crnti @@ -384,9 +334,7 @@ typedef struct f1ap_ue_context_setup_s { uint32_t gNB_CU_ue_id; uint32_t gNB_DU_ue_id; // SpCell Info - uint16_t mcc; - uint16_t mnc; - uint8_t mnc_digit_length; + f1ap_plmn_t plmn; uint64_t nr_cellid; uint8_t servCellIndex; uint8_t *cellULConfigured; @@ -456,11 +404,13 @@ typedef struct f1ap_paging_ind_s { uint16_t ueidentityindexvalue; uint64_t fiveg_s_tmsi; uint8_t fiveg_s_tmsi_length; - uint16_t mcc; - uint16_t mnc; - uint8_t mnc_digit_length; + f1ap_plmn_t plmn; uint64_t nr_cellid; uint8_t paging_drx; } f1ap_paging_ind_t; +typedef struct f1ap_lost_connection_t { + int dummy; +} f1ap_lost_connection_t; + #endif /* F1AP_MESSAGES_TYPES_H_ */ diff --git a/openair2/COMMON/m2ap_messages_types.h b/openair2/COMMON/m2ap_messages_types.h index 4187f1736c..d38c493bcb 100644 --- a/openair2/COMMON/m2ap_messages_types.h +++ b/openair2/COMMON/m2ap_messages_types.h @@ -23,6 +23,8 @@ #ifndef M2AP_MESSAGES_TYPES_H_ #define M2AP_MESSAGES_TYPES_H_ +#include +#include #include "s1ap_messages_types.h" #include "LTE_PhysCellId.h" @@ -104,7 +106,7 @@ typedef struct m2ap_setup_req_s { uint16_t cnx_id; /* SCTP association id */ - int32_t assoc_id; + sctp_assoc_t assoc_id; /* The eNB IP address to bind */ m2ap_net_ip_address_t MCE_M2_ip_address; @@ -258,7 +260,7 @@ typedef struct m2ap_setup_resp_s { uint16_t cnx_id; /* SCTP association id */ - int32_t assoc_id; + sctp_assoc_t assoc_id; /* Number of SCTP streams used for a mme association */ uint16_t sctp_in_streams; diff --git a/openair2/COMMON/m3ap_messages_types.h b/openair2/COMMON/m3ap_messages_types.h index 815f8b6df4..171631ddbd 100644 --- a/openair2/COMMON/m3ap_messages_types.h +++ b/openair2/COMMON/m3ap_messages_types.h @@ -22,6 +22,8 @@ #ifndef M3AP_MESSAGES_TYPES_H_ #define M3AP_MESSAGES_TYPES_H_ +#include +#include #include "s1ap_messages_types.h" #include "LTE_PhysCellId.h" @@ -336,7 +338,7 @@ typedef struct m3ap_setup_req_s{ /* Connexion id used between SCTP/M3AP */ uint16_t cnx_id; /* SCTP association id */ - int32_t assoc_id; + sctp_assoc_t assoc_id; /* Number of SCTP streams used for a mme association */ uint16_t sctp_in_streams; diff --git a/openair2/COMMON/rrc_messages_def.h b/openair2/COMMON/rrc_messages_def.h index 19a339db7c..8609aa45d2 100644 --- a/openair2/COMMON/rrc_messages_def.h +++ b/openair2/COMMON/rrc_messages_def.h @@ -55,7 +55,6 @@ MESSAGE_DEF(RRC_STATE_IND, MESSAGE_PRIORITY_MED, RrcStateInd, // eNB: ENB_APP -> RRC messages MESSAGE_DEF(RRC_CONFIGURATION_REQ, MESSAGE_PRIORITY_MED, RrcConfigurationReq, rrc_configuration_req) MESSAGE_DEF(NBIOTRRC_CONFIGURATION_REQ, MESSAGE_PRIORITY_MED, NbIoTRrcConfigurationReq, nbiotrrc_configuration_req) -MESSAGE_DEF(NRRRC_CONFIGURATION_REQ, MESSAGE_PRIORITY_MED, gNB_RrcConfigurationReq, nrrrc_configuration_req) // UE: NAS -> RRC messages MESSAGE_DEF(NAS_KENB_REFRESH_REQ, MESSAGE_PRIORITY_MED, NasKenbRefreshReq, nas_kenb_refresh_req) diff --git a/openair2/COMMON/rrc_messages_types.h b/openair2/COMMON/rrc_messages_types.h index 6a29ee1ae7..465c6c5342 100644 --- a/openair2/COMMON/rrc_messages_types.h +++ b/openair2/COMMON/rrc_messages_types.h @@ -69,8 +69,6 @@ #define NBIOTRRC_CONFIGURATION_REQ(mSGpTR) (mSGpTR)->ittiMsg.nbiotrrc_configuration_req -#define NRRRC_CONFIGURATION_REQ(mSGpTR) (mSGpTR)->ittiMsg.nrrrc_configuration_req - #define NAS_KENB_REFRESH_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_kenb_refresh_req #define NAS_CELL_SELECTION_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_cell_selection_req #define NAS_CONN_ESTABLI_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_conn_establi_req @@ -403,12 +401,6 @@ typedef struct NbIoTRrcConfigurationReq_s { long ue_TimersAndConstants_n311_NB; } NbIoTRrcConfigurationReq; -typedef struct { - int N1; - int N2; - int XP; -} rrc_pdsch_AntennaPorts_t; - // gNB: GNB_APP -> RRC messages typedef struct NRRrcConfigurationReq_s { uint64_t cell_identity; @@ -417,17 +409,7 @@ typedef struct NRRrcConfigurationReq_s { uint16_t mnc[PLMN_LIST_MAX_SIZE]; uint8_t mnc_digit_length[PLMN_LIST_MAX_SIZE]; uint8_t num_plmn; - NR_ServingCellConfigCommon_t *scc; - NR_ServingCellConfig_t *scd; - int sib1_tda; - rrc_pdsch_AntennaPorts_t pdsch_AntennaPorts; - int pusch_AntennaPorts; - int minRXTXTIME; - int do_CSIRS; - int do_SRS; - bool force_256qam_off; - int pusch_TargetSNRx10; - int pucch_TargetSNRx10; + bool enable_sdap; int drbs; } gNB_RrcConfigurationReq; diff --git a/openair2/COMMON/s1ap_messages_types.h b/openair2/COMMON/s1ap_messages_types.h index 2151375686..3dd8fc8213 100644 --- a/openair2/COMMON/s1ap_messages_types.h +++ b/openair2/COMMON/s1ap_messages_types.h @@ -22,6 +22,8 @@ #ifndef S1AP_MESSAGES_TYPES_H_ #define S1AP_MESSAGES_TYPES_H_ +#include +#include #include "LTE_asn_constant.h" //-------------------------------------------------------------------------------------------// // Defines to access message fields. diff --git a/openair2/COMMON/sctp_messages_types.h b/openair2/COMMON/sctp_messages_types.h index c2561c0424..88790bdc1f 100644 --- a/openair2/COMMON/sctp_messages_types.h +++ b/openair2/COMMON/sctp_messages_types.h @@ -22,6 +22,9 @@ #ifndef SCTP_MESSAGES_TYPES_H_ #define SCTP_MESSAGES_TYPES_H_ +#include +#include + #define SCTP_NEW_ASSOCIATION_REQ(mSGpTR) (mSGpTR)->ittiMsg.sctp_new_association_req #define SCTP_NEW_ASSOCIATION_REQ_MULTI(mSGpTR) (mSGpTR)->ittiMsg.sctp_new_association_req_multi #define SCTP_NEW_ASSOCIATION_RESP(mSGpTR) (mSGpTR)->ittiMsg.sctp_new_association_resp @@ -87,7 +90,7 @@ typedef struct sctp_init_msg_multi_cnf_s { typedef struct sctp_new_association_ind_s { /* Assoc id of the new association */ - int32_t assoc_id; + sctp_assoc_t assoc_id; /* The port used by remote host */ uint16_t port; @@ -102,7 +105,7 @@ typedef struct sctp_new_association_resp_s { uint16_t ulp_cnx_id; /* SCTP Association ID */ - int32_t assoc_id; + sctp_assoc_t assoc_id; /* Input/output streams */ uint16_t out_streams; @@ -114,7 +117,7 @@ typedef struct sctp_new_association_resp_s { typedef struct sctp_data_ind_s { /* SCTP Association ID */ - int32_t assoc_id; + sctp_assoc_t assoc_id; /* Buffer to send over SCTP */ uint32_t buffer_length; @@ -139,7 +142,7 @@ typedef struct sctp_init_s { typedef struct sctp_close_association_s { - uint32_t assoc_id; + sctp_assoc_t assoc_id; } sctp_close_association_t; diff --git a/openair2/COMMON/x2ap_messages_types.h b/openair2/COMMON/x2ap_messages_types.h index ca01be5035..8ce43cc96c 100644 --- a/openair2/COMMON/x2ap_messages_types.h +++ b/openair2/COMMON/x2ap_messages_types.h @@ -22,6 +22,8 @@ #ifndef X2AP_MESSAGES_TYPES_H_ #define X2AP_MESSAGES_TYPES_H_ +#include +#include #include "s1ap_messages_types.h" #include "LTE_PhysCellId.h" @@ -425,7 +427,7 @@ typedef struct x2ap_ENDC_reconf_complete_s { typedef struct x2ap_ENDC_sgnb_release_request_s { int rnti; x2ap_cause_t cause; - int assoc_id; + sctp_assoc_t assoc_id; } x2ap_ENDC_sgnb_release_request_t; typedef struct x2ap_ENDC_sgnb_release_required_s { diff --git a/openair2/E1AP/e1ap.c b/openair2/E1AP/e1ap.c index 4ad4ea8415..2390b23d2e 100644 --- a/openair2/E1AP/e1ap.c +++ b/openair2/E1AP/e1ap.c @@ -67,8 +67,8 @@ const char *const e1ap_direction2String(int e1ap_dir) return(e1ap_direction_String[e1ap_dir]); } -int e1ap_handle_message(instance_t instance, uint32_t assoc_id, - const uint8_t *const data, const uint32_t data_length) { +int e1ap_handle_message(instance_t instance, sctp_assoc_t assoc_id, const uint8_t *const data, const uint32_t data_length) +{ E1AP_E1AP_PDU_t pdu= {0}; int ret; DevAssert(data != NULL); @@ -128,18 +128,14 @@ int e1ap_send_RESET_ACKNOWLEDGE(instance_t instance, E1AP_Reset_t *Reset) { return -1; } -int e1ap_handle_RESET(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - E1AP_E1AP_PDU_t *pdu) { +int e1ap_handle_RESET(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, E1AP_E1AP_PDU_t *pdu) +{ AssertFatal(false,"Not implemented yet\n"); return -1; } -int e1ap_handle_RESET_ACKNOWLEDGE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - E1AP_E1AP_PDU_t *pdu) { +int e1ap_handle_RESET_ACKNOWLEDGE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, E1AP_E1AP_PDU_t *pdu) +{ AssertFatal(false,"Not implemented yet\n"); return -1; } @@ -147,10 +143,8 @@ int e1ap_handle_RESET_ACKNOWLEDGE(instance_t instance, /* Error Indication */ -int e1ap_handle_ERROR_INDICATION(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - E1AP_E1AP_PDU_t *pdu) { +int e1ap_handle_ERROR_INDICATION(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, E1AP_E1AP_PDU_t *pdu) +{ AssertFatal(false,"Not implemented yet\n"); return -1; } @@ -465,13 +459,19 @@ int e1apCUCP_handle_CONFIGURATION_UPDATE(e1ap_setup_req_t *setupReq, E1AP_E1AP_P return -1; } -int e1apCUUP_handle_gNB_DU_CONFIGURATION_UPDATE_ACKNOWLEDGE(e1ap_setup_req_t *setupReq, uint32_t assoc_id, uint32_t stream, E1AP_E1AP_PDU_t *pdu) +int e1apCUUP_handle_gNB_DU_CONFIGURATION_UPDATE_ACKNOWLEDGE(e1ap_setup_req_t *setupReq, + sctp_assoc_t assoc_id, + uint32_t stream, + E1AP_E1AP_PDU_t *pdu) { AssertFatal(false,"Not implemented yet\n"); return -1; } -int e1apCUUP_handle_gNB_DU_CONFIGURATION_FAILURE(e1ap_setup_req_t *setupReq, uint32_t assoc_id, uint32_t stream, E1AP_E1AP_PDU_t *pdu) +int e1apCUUP_handle_gNB_DU_CONFIGURATION_FAILURE(e1ap_setup_req_t *setupReq, + sctp_assoc_t assoc_id, + uint32_t stream, + E1AP_E1AP_PDU_t *pdu) { AssertFatal(false,"Not implemented yet\n"); return -1; @@ -491,18 +491,14 @@ int e1ap_send_RELEASE_ACKNOWLEDGE(instance_t instance) { return -1; } -int e1ap_handle_RELEASE_REQUEST(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - E1AP_E1AP_PDU_t *pdu) { +int e1ap_handle_RELEASE_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, E1AP_E1AP_PDU_t *pdu) +{ AssertFatal(false,"Not implemented yet\n"); return -1; } -int e1ap_handle_RELEASE_ACKNOWLEDGE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - E1AP_E1AP_PDU_t *pdu) { +int e1ap_handle_RELEASE_ACKNOWLEDGE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, E1AP_E1AP_PDU_t *pdu) +{ AssertFatal(false,"Not implemented yet\n"); return -1; } @@ -1251,17 +1247,19 @@ int e1apCUUP_handle_BEARER_CONTEXT_MODIFICATION_REQUEST(e1ap_upcp_inst_t *e1_ins } int e1apCUCP_handle_BEARER_CONTEXT_MODIFICATION_RESPONSE(instance_t instance, - uint32_t assoc_id, + sctp_assoc_t assoc_id, uint32_t stream, - E1AP_E1AP_PDU_t *pdu) { + E1AP_E1AP_PDU_t *pdu) +{ AssertFatal(false,"Not implemented yet\n"); return -1; } int e1apCUCP_handle_BEARER_CONTEXT_MODIFICATION_FAILURE(instance_t instance, - uint32_t assoc_id, + sctp_assoc_t assoc_id, uint32_t stream, - E1AP_E1AP_PDU_t *pdu) { + E1AP_E1AP_PDU_t *pdu) +{ AssertFatal(false,"Not implemented yet\n"); return -1; } @@ -1277,17 +1275,19 @@ int e1apCUCP_send_BEARER_CONTEXT_MODIFICATION_CONFIRM(instance_t instance) { } int e1apCUCP_handle_BEARER_CONTEXT_MODIFICATION_REQUIRED(instance_t instance, - uint32_t assoc_id, + sctp_assoc_t assoc_id, uint32_t stream, - E1AP_E1AP_PDU_t *pdu) { + E1AP_E1AP_PDU_t *pdu) +{ AssertFatal(false,"Not implemented yet\n"); return -1; } int e1apCUUP_handle_BEARER_CONTEXT_MODIFICATION_CONFIRM(instance_t instance, - uint32_t assoc_id, + sctp_assoc_t assoc_id, uint32_t stream, - E1AP_E1AP_PDU_t *pdu) { + E1AP_E1AP_PDU_t *pdu) +{ AssertFatal(false,"Not implemented yet\n"); return -1; } @@ -1464,9 +1464,10 @@ int e1apCUCP_handle_BEARER_CONTEXT_RELEASE_COMPLETE(e1ap_upcp_inst_t *e1_inst, c } int e1apCUCP_handle_BEARER_CONTEXT_RELEASE_REQUEST(instance_t instance, - uint32_t assoc_id, + sctp_assoc_t assoc_id, uint32_t stream, - E1AP_E1AP_PDU_t *pdu) { + E1AP_E1AP_PDU_t *pdu) +{ AssertFatal(false,"Not implemented yet\n"); return -1; } @@ -1481,9 +1482,10 @@ int e1apCUUP_send_BEARER_CONTEXT_INACTIVITY_NOTIFICATION(instance_t instance) { } int e1apCUCP_handle_BEARER_CONTEXT_INACTIVITY_NOTIFICATION(instance_t instance, - uint32_t assoc_id, + sctp_assoc_t assoc_id, uint32_t stream, - E1AP_E1AP_PDU_t *pdu) { + E1AP_E1AP_PDU_t *pdu) +{ AssertFatal(false,"Not implemented yet\n"); return -1; } @@ -1501,18 +1503,14 @@ int e1apCUUP_send_DATA_USAGE_REPORT(instance_t instance) { return -1; } -int e1apCUCP_handle_DL_DATA_NOTIFICATION(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - E1AP_E1AP_PDU_t *pdu) { +int e1apCUCP_handle_DL_DATA_NOTIFICATION(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, E1AP_E1AP_PDU_t *pdu) +{ AssertFatal(false,"Not implemented yet\n"); return -1; } -int e1apCUCP_handle_send_DATA_USAGE_REPORT(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - E1AP_E1AP_PDU_t *pdu) { +int e1apCUCP_handle_send_DATA_USAGE_REPORT(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, E1AP_E1AP_PDU_t *pdu) +{ AssertFatal(false,"Not implemented yet\n"); return -1; } diff --git a/openair2/E1AP/e1ap_common.h b/openair2/E1AP/e1ap_common.h index 80a2b925e1..cddf5b9ea6 100644 --- a/openair2/E1AP/e1ap_common.h +++ b/openair2/E1AP/e1ap_common.h @@ -34,7 +34,7 @@ typedef struct e1ap_upcp_inst_s { bool same_process; E1_t type; enum sctp_state_e sockState; - uint32_t assoc_id; + sctp_assoc_t assoc_id; instance_t gtpInstN3; instance_t gtpInstF1U; e1ap_setup_req_t setupReq; diff --git a/openair2/F1AP/f1ap_common.c b/openair2/F1AP/f1ap_common.c index f396d570df..3491adc48a 100644 --- a/openair2/F1AP/f1ap_common.c +++ b/openair2/F1AP/f1ap_common.c @@ -32,42 +32,44 @@ #include "f1ap_common.h" -static f1ap_cudu_inst_t *f1_du_inst[NUMBER_OF_gNB_MAX]= {0}; -static f1ap_cudu_inst_t *f1_cu_inst[NUMBER_OF_gNB_MAX]= {0}; +static f1ap_cudu_inst_t *f1_inst[NUMBER_OF_gNB_MAX]= {0}; -uint8_t F1AP_get_next_transaction_identifier(instance_t mod_idP, instance_t cu_mod_idP) { +uint8_t F1AP_get_next_transaction_identifier(instance_t mod_idP, instance_t cu_mod_idP) +{ + DevAssert(mod_idP == 0 && cu_mod_idP == 0); static uint8_t transaction_identifier[NUMBER_OF_gNB_MAX] = {0}; transaction_identifier[mod_idP+cu_mod_idP] = (transaction_identifier[mod_idP+cu_mod_idP] + 1) % F1AP_TRANSACTION_IDENTIFIER_NUMBER; return transaction_identifier[mod_idP+cu_mod_idP]; } -f1ap_cudu_inst_t *getCxt(F1_t isCU, instance_t instanceP) { - //Fixme: 4G F1 has race condtions, someone may debug it, using this test - /* - static pid_t t=-1; - pid_t tNew=gettid(); - AssertFatal ( t==-1 || t==tNew, "This is not thread safe\n"); - t=tNew; - */ - AssertFatal( instanceP < sizeofArray(f1_cu_inst), ""); - return isCU == CUtype ? f1_cu_inst[ instanceP]: f1_du_inst[ instanceP]; +f1ap_cudu_inst_t *getCxt(instance_t instanceP) +{ + DevAssert(instanceP == 0); + return f1_inst[instanceP]; } -void createF1inst(F1_t isCU, instance_t instanceP, f1ap_setup_req_t *req) { - if (isCU == CUtype) { - AssertFatal(f1_cu_inst[instanceP] == NULL, "Double call to F1 CU init\n"); - f1_cu_inst[instanceP]=( f1ap_cudu_inst_t *) calloc(1, sizeof( f1ap_cudu_inst_t)); - //memcpy(f1_cu_inst[instanceP]->setupReq, req, sizeof(f1ap_setup_req_t) ); - } else { - AssertFatal(f1_du_inst[instanceP] == NULL, "Double call to F1 DU init\n"); - f1_du_inst[instanceP]=( f1ap_cudu_inst_t *) calloc(1, sizeof(f1ap_cudu_inst_t)); - memcpy(&f1_du_inst[instanceP]->setupReq, req, sizeof(f1ap_setup_req_t) ); - } +static pthread_mutex_t f1_inst_mtx = PTHREAD_MUTEX_INITIALIZER; +void createF1inst(instance_t instanceP, f1ap_setup_req_t *req, f1ap_net_config_t *nc) +{ + DevAssert(instanceP == 0); + pthread_mutex_lock(&f1_inst_mtx); + AssertFatal(f1_inst[0] == NULL, "Attempted to initialize multiple F1 instances\n"); + f1_inst[0] = calloc(1, sizeof(f1ap_cudu_inst_t)); + AssertFatal(f1_inst[0] != NULL, "out of memory\n"); + if (req) + f1_inst[0]->setupReq = *req; + if (nc) + f1_inst[0]->net_config = *nc; + pthread_mutex_unlock(&f1_inst_mtx); } - -int f1ap_assoc_id(F1_t isCu, instance_t instanceP) { - f1ap_setup_req_t *f1_inst=f1ap_req(isCu, instanceP); - return f1_inst->assoc_id; +void destroyF1inst(instance_t instance) +{ + DevAssert(instance == 0); + pthread_mutex_lock(&f1_inst_mtx); + AssertFatal(f1_inst[0] != NULL, "Attempted to free uninitialized F1 instances\n"); + free(f1_inst[instance]); + f1_inst[instance] = NULL; + pthread_mutex_unlock(&f1_inst_mtx); } diff --git a/openair2/F1AP/f1ap_common.h b/openair2/F1AP/f1ap_common.h index a346d9682a..5dcd661b3b 100644 --- a/openair2/F1AP/f1ap_common.h +++ b/openair2/F1AP/f1ap_common.h @@ -387,56 +387,40 @@ /** \brief Function array prototype. **/ -typedef int (*f1ap_message_processing_t)( - instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *message_p -); -int f1ap_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, - const uint8_t *const data, const uint32_t data_length); - -typedef struct f1ap_cudu_ue_inst_s { - // used for NB stats generation - rnti_t rnti; - instance_t f1ap_uid; - instance_t du_ue_f1ap_id; - instance_t cu_ue_f1ap_id; -} f1ap_cudu_ue_t; +typedef int (*f1ap_message_processing_t)(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *message_p); +int f1ap_handle_message(instance_t instance, + sctp_assoc_t assoc_id, + int32_t stream, + const uint8_t *const data, + const uint32_t data_length); typedef struct f1ap_cudu_inst_s { f1ap_setup_req_t setupReq; + + /* The eNB IP address to bind */ + f1ap_net_config_t net_config; + + /* SCTP information */ + sctp_assoc_t assoc_id; uint16_t sctp_in_streams; uint16_t sctp_out_streams; - uint16_t default_sctp_stream_id; - instance_t gtpInst; - uint64_t gNB_DU_id; - uint16_t num_ues; - f1ap_cudu_ue_t f1ap_ue[MAX_MOBILES_PER_GNB]; -} f1ap_cudu_inst_t; -typedef enum { - DUtype=0, - CUtype -} F1_t; + /* GTP instance used by F1 */ + instance_t gtpInst; +} f1ap_cudu_inst_t; static const int nrb_lut[29] = {11, 18, 24, 25, 31, 32, 38, 51, 52, 65, 66, 78, 79, 93, 106, 107, 121, 132, 133, 135, 160, 162, 189, 216, 217, 245, 264, 270, 273}; uint8_t F1AP_get_next_transaction_identifier(instance_t mod_idP, instance_t cu_mod_idP); -f1ap_cudu_inst_t *getCxt(F1_t isCU, instance_t instanceP); +f1ap_cudu_inst_t *getCxt(instance_t instanceP); -void createF1inst(F1_t isCU, instance_t instanceP, f1ap_setup_req_t *req); - -int f1ap_assoc_id(F1_t isCu, instance_t instanceP); - -static inline f1ap_setup_req_t *f1ap_req(F1_t isCu, instance_t instanceP) { - return &getCxt(isCu, instanceP)->setupReq; -} +void createF1inst(instance_t instanceP, f1ap_setup_req_t *req, f1ap_net_config_t *nc); +void destroyF1inst(instance_t instance); //lts: C struct type is not homogeneous, so we need macros instead of functions #define addnRCGI(nRCGi, servedCelL) \ - MCC_MNC_TO_PLMNID((servedCelL)->mcc,(servedCelL)-> mnc,(servedCelL)->mnc_digit_length, \ + MCC_MNC_TO_PLMNID((servedCelL)->plmn.mcc,(servedCelL)->plmn.mnc,(servedCelL)->plmn.mnc_digit_length, \ &((nRCGi).pLMN_Identity)); \ NR_CELL_ID_TO_BIT_STRING((servedCelL)->nr_cellid, &((nRCGi).nRCellIdentity)); extern RAN_CONTEXT_t RC; diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index 6b2384b7c8..03b281ea39 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -39,17 +39,13 @@ int CU_send_RESET(instance_t instance, F1AP_Reset_t *Reset) { AssertFatal(1==0,"Not implemented yet\n"); } -int CU_handle_RESET_ACKKNOWLEDGE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { +int CU_handle_RESET_ACKKNOWLEDGE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); } -int CU_handle_RESET(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { +int CU_handle_RESET(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); } @@ -61,10 +57,8 @@ int CU_send_RESET_ACKNOWLEDGE(instance_t instance, F1AP_ResetAcknowledge_t *Rese /* Error Indication */ -int CU_handle_ERROR_INDICATION(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { +int CU_handle_ERROR_INDICATION(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); } @@ -76,12 +70,9 @@ int CU_send_ERROR_INDICATION(instance_t instance, F1AP_ErrorIndication_t *ErrorI /* F1 Setup */ -int CU_handle_F1_SETUP_REQUEST(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { +int CU_handle_F1_SETUP_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) +{ LOG_D(F1AP, "CU_handle_F1_SETUP_REQUEST\n"); - MessageDef *message_p; F1AP_F1SetupRequest_t *container; F1AP_F1SetupRequestIEs_t *ie; int i = 0; @@ -94,9 +85,9 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, assoc_id, stream); } - /* assoc_id */ - f1ap_setup_req_t *req=&getCxt(true, instance)->setupReq; - req->assoc_id = assoc_id; + MessageDef *message_p = itti_alloc_new_message(TASK_CU_F1, 0, F1AP_SETUP_REQ); + message_p->ittiMsgHeader.originInstance = assoc_id; + f1ap_setup_req_t *req = &F1AP_SETUP_REQ(message_p); /* gNB_DU_id */ // this function exits if the ie is mandatory F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_F1SetupRequestIEs_t, ie, container, @@ -124,95 +115,84 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, F1AP_Served_Cell_Information_t *servedCellInformation= &served_cells_item->served_Cell_Information; /* tac */ if (servedCellInformation->fiveGS_TAC) { - OCTET_STRING_TO_INT16(servedCellInformation->fiveGS_TAC, req->cell[i].tac); - LOG_D(F1AP, "req->tac[%d] %d \n", i, req->cell[i].tac); + req->cell[i].info.tac = malloc(sizeof(*req->cell[i].info.tac)); + AssertFatal(req->cell[i].info.tac != NULL, "out of memory\n"); + OCTET_STRING_TO_INT16(servedCellInformation->fiveGS_TAC, *req->cell[i].info.tac); + LOG_D(F1AP, "req->tac[%d] %d \n", i, *req->cell[i].info.tac); } /* - nRCGI */ - TBCD_TO_MCC_MNC(&(servedCellInformation->nRCGI.pLMN_Identity), req->cell[i].mcc, - req->cell[i].mnc,req->cell[i].mnc_digit_length); + TBCD_TO_MCC_MNC(&(servedCellInformation->nRCGI.pLMN_Identity), + req->cell[i].info.plmn.mcc, + req->cell[i].info.plmn.mnc, + req->cell[i].info.plmn.mnc_digit_length); // NR cellID BIT_STRING_TO_NR_CELL_IDENTITY(&servedCellInformation->nRCGI.nRCellIdentity, - req->cell[i].nr_cellid); + req->cell[i].info.nr_cellid); LOG_D(F1AP, "[SCTP %d] Received nRCGI: MCC %d, MNC %d, CELL_ID %llu\n", assoc_id, - req->cell[i].mcc, - req->cell[i].mnc, - (long long unsigned int)req->cell[i].nr_cellid); + req->cell[i].info.plmn.mcc, + req->cell[i].info.plmn.mnc, + (long long unsigned int)req->cell[i].info.nr_cellid); /* - nRPCI */ - req->cell[i].nr_pci = servedCellInformation->nRPCI; - LOG_D(F1AP, "req->nr_pci[%d] %d \n", i, req->cell[i].nr_pci); - - // LTS: FIXME cell_type is not a attribute of a cell in the data structure !!!!!!!!!! - f1ap_req(true, instance)->cell_type = CELL_MACRO_GNB; + req->cell[i].info.nr_pci = servedCellInformation->nRPCI; + LOG_D(F1AP, "req->nr_pci[%d] %d \n", i, req->cell[i].info.nr_pci); // FDD Cells if (servedCellInformation->nR_Mode_Info.present==F1AP_NR_Mode_Info_PR_fDD) { - struct fdd_s *FDDs=&req->nr_mode_info[i].fdd; + req->cell[i].info.mode = F1AP_MODE_FDD; + f1ap_fdd_info_t *FDDs = &req->cell[i].info.fdd; F1AP_FDD_Info_t * fDD_Info=servedCellInformation->nR_Mode_Info.choice.fDD; - FDDs->ul_nr_arfcn=fDD_Info->uL_NRFreqInfo.nRARFCN; - FDDs->ul_num_frequency_bands=fDD_Info->uL_NRFreqInfo.freqBandListNr.list.count; + FDDs->ul_freqinfo.arfcn = fDD_Info->uL_NRFreqInfo.nRARFCN; + AssertFatal(fDD_Info->uL_NRFreqInfo.freqBandListNr.list.count == 1, "cannot handle more than one frequency band\n"); for (int f=0; f < fDD_Info->uL_NRFreqInfo.freqBandListNr.list.count; f++) { - F1AP_FreqBandNrItem_t * FreqItem=fDD_Info->uL_NRFreqInfo.freqBandListNr.list.array[f]; - FDDs->ul_nr_band[f]=FreqItem->freqBandIndicatorNr; - int num_available_supported_SULBands=FreqItem->supportedSULBandList.list.count; - for (int sul=0; sul < num_available_supported_SULBands; sul ++ ) { - F1AP_SupportedSULFreqBandItem_t * SulItem= FreqItem->supportedSULBandList.list.array[sul]; - FDDs->ul_nr_sul_band[sul]=SulItem->freqBandIndicatorNr; - } + F1AP_FreqBandNrItem_t * FreqItem=fDD_Info->uL_NRFreqInfo.freqBandListNr.list.array[f]; + FDDs->ul_freqinfo.band = FreqItem->freqBandIndicatorNr; + AssertFatal(FreqItem->supportedSULBandList.list.count == 0, "cannot handle SUL bands!\n"); } - FDDs->dl_nr_arfcn=fDD_Info->dL_NRFreqInfo.nRARFCN; + FDDs->dl_freqinfo.arfcn = fDD_Info->dL_NRFreqInfo.nRARFCN; int dlBands=fDD_Info->dL_NRFreqInfo.freqBandListNr.list.count; + AssertFatal(dlBands == 0, "cannot handled more than one frequency band\n"); for (int dlB=0; dlB < dlBands; dlB++) { F1AP_FreqBandNrItem_t * FreqItem=fDD_Info->dL_NRFreqInfo.freqBandListNr.list.array[dlB]; - FDDs->dl_nr_band[dlB]=FreqItem->freqBandIndicatorNr; - int num_available_supported_SULBands = FreqItem->supportedSULBandList.list.count; - for (int sul=0; sul < num_available_supported_SULBands; sul ++ ) { - F1AP_SupportedSULFreqBandItem_t * SulItem= FreqItem->supportedSULBandList.list.array[sul]; - FDDs->ul_nr_sul_band[sul]=SulItem->freqBandIndicatorNr; - } + FDDs->dl_freqinfo.band = FreqItem->freqBandIndicatorNr; + int num_available_supported_SULBands = FreqItem->supportedSULBandList.list.count; + AssertFatal(num_available_supported_SULBands == 0, "cannot handle SUL bands!\n"); } - FDDs->ul_scs=fDD_Info->uL_Transmission_Bandwidth.nRSCS; - FDDs->ul_nrb=nrb_lut[fDD_Info->uL_Transmission_Bandwidth.nRNRB]; - FDDs->dl_scs=fDD_Info->dL_Transmission_Bandwidth.nRSCS; - FDDs->dl_nrb=nrb_lut[fDD_Info->dL_Transmission_Bandwidth.nRNRB]; - } - - // TDD - if (servedCellInformation->nR_Mode_Info.present==F1AP_NR_Mode_Info_PR_tDD) { - struct tdd_s *TDDs=&req->nr_mode_info[i].tdd; - F1AP_TDD_Info_t * tDD_Info=servedCellInformation->nR_Mode_Info.choice.tDD; - TDDs->nr_arfcn=tDD_Info->nRFreqInfo.nRARFCN; - TDDs->num_frequency_bands=tDD_Info->nRFreqInfo.freqBandListNr.list.count; + FDDs->ul_tbw.scs = fDD_Info->uL_Transmission_Bandwidth.nRSCS; + FDDs->ul_tbw.nrb = nrb_lut[fDD_Info->uL_Transmission_Bandwidth.nRNRB]; + FDDs->dl_tbw.scs = fDD_Info->dL_Transmission_Bandwidth.nRSCS; + FDDs->dl_tbw.nrb = nrb_lut[fDD_Info->dL_Transmission_Bandwidth.nRNRB]; + } else if (servedCellInformation->nR_Mode_Info.present==F1AP_NR_Mode_Info_PR_tDD) { + req->cell[i].info.mode = F1AP_MODE_TDD; + f1ap_tdd_info_t *TDDs = &req->cell[i].info.tdd; + F1AP_TDD_Info_t *tDD_Info = servedCellInformation->nR_Mode_Info.choice.tDD; + TDDs->freqinfo.arfcn = tDD_Info->nRFreqInfo.nRARFCN; + AssertFatal(tDD_Info->nRFreqInfo.freqBandListNr.list.count == 1, "cannot handle more than one frequency band\n"); for (int f=0; f < tDD_Info->nRFreqInfo.freqBandListNr.list.count; f++) { - struct F1AP_FreqBandNrItem * FreqItem=tDD_Info->nRFreqInfo.freqBandListNr.list.array[f]; - TDDs->nr_band[f]=FreqItem->freqBandIndicatorNr; - int num_available_supported_SULBands=FreqItem->supportedSULBandList.list.count; - for (int sul=0; sul < num_available_supported_SULBands; sul ++ ) { - struct F1AP_SupportedSULFreqBandItem * SulItem= FreqItem->supportedSULBandList.list.array[sul]; - TDDs->nr_sul_band[sul]=SulItem->freqBandIndicatorNr; - } + struct F1AP_FreqBandNrItem * FreqItem=tDD_Info->nRFreqInfo.freqBandListNr.list.array[f]; + TDDs->freqinfo.band = FreqItem->freqBandIndicatorNr; + int num_available_supported_SULBands = FreqItem->supportedSULBandList.list.count; + AssertFatal(num_available_supported_SULBands == 0, "cannot hanlde SUL bands!\n"); } - TDDs->scs=tDD_Info->transmission_Bandwidth.nRSCS; - TDDs->nrb=nrb_lut[tDD_Info->transmission_Bandwidth.nRNRB]; + TDDs->tbw.scs = tDD_Info->transmission_Bandwidth.nRSCS; + TDDs->tbw.nrb = nrb_lut[tDD_Info->transmission_Bandwidth.nRNRB]; + } else { + AssertFatal(false, "unknown NR Mode info %d\n", servedCellInformation->nR_Mode_Info.present); } struct F1AP_GNB_DU_System_Information * DUsi=served_cells_item->gNB_DU_System_Information; - LOG_I(F1AP, "Received Cell in %d context\n", f1ap_req(true, instance)->cell_type==CELL_MACRO_GNB); // System Information + req->cell[i].sys_info = calloc(1, sizeof(*req->cell[i].sys_info)); + AssertFatal(req->cell[i].sys_info != NULL, "out of memory\n"); + f1ap_gnb_du_system_info_t *sys_info = req->cell[i].sys_info; /* mib */ - req->mib[i] = calloc(DUsi->mIB_message.size + 1, sizeof(char)); - memcpy(req->mib[i], DUsi->mIB_message.buf, DUsi->mIB_message.size); - /* Convert the mme name to a printable string */ - req->mib[i][DUsi->mIB_message.size] = '\0'; - req->mib_length[i] = DUsi->mIB_message.size; - LOG_D(F1AP, "req->mib[%d] len = %d \n", i, req->mib_length[i]); + sys_info->mib = calloc(DUsi->mIB_message.size, sizeof(char)); + memcpy(sys_info->mib, DUsi->mIB_message.buf, DUsi->mIB_message.size); + sys_info->mib_length = DUsi->mIB_message.size; /* sib1 */ - req->sib1[i] = calloc(DUsi->sIB1_message.size + 1, sizeof(char)); - memcpy(req->sib1[i], DUsi->sIB1_message.buf, DUsi->sIB1_message.size); - /* Convert the mme name to a printable string */ - req->sib1[i][DUsi->sIB1_message.size] = '\0'; - req->sib1_length[i] = DUsi->sIB1_message.size; - LOG_D(F1AP, "req->sib1[%d] len = %d \n", i, req->sib1_length[i]); + sys_info->sib1 = calloc(DUsi->sIB1_message.size, sizeof(char)); + memcpy(sys_info->sib1, DUsi->sIB1_message.buf, DUsi->sIB1_message.size); + sys_info->sib1_length = DUsi->sIB1_message.size; } // char *measurement_timing_information[F1AP_MAX_NB_CELLS]; @@ -249,12 +229,6 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, // uint16_t nr_sul_band[32]; // } tdd; // } nr_mode_info[F1AP_MAX_NB_CELLS]; - - - - // We copy and store in F1 task data, RRC will free "req" as it frees all itti received messages - message_p = itti_alloc_new_message(TASK_CU_F1, 0, F1AP_SETUP_REQ); - memcpy(&F1AP_SETUP_REQ(message_p), req, sizeof(f1ap_setup_req_t) ); if (req->num_cells_available > 0) { itti_send_msg_to_task(TASK_RRC_GNB, GNB_MODULE_ID_TO_INSTANCE(instance), message_p); @@ -267,13 +241,8 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, return 0; } -int CU_send_F1_SETUP_RESPONSE(instance_t instance, - f1ap_setup_resp_t *f1ap_setup_resp) { - instance_t enb_mod_idP; - instance_t cu_mod_idP; - // This should be fixed - enb_mod_idP = (instance_t)0; - cu_mod_idP = (instance_t)0; +int CU_send_F1_SETUP_RESPONSE(instance_t instance, f1ap_setup_resp_t *f1ap_setup_resp) +{ F1AP_F1AP_PDU_t pdu= {0}; uint8_t *buffer=NULL; uint32_t len=0; @@ -291,7 +260,7 @@ int CU_send_F1_SETUP_RESPONSE(instance_t instance, ie1->id = F1AP_ProtocolIE_ID_id_TransactionID; ie1->criticality = F1AP_Criticality_reject; ie1->value.present = F1AP_F1SetupResponseIEs__value_PR_TransactionID; - ie1->value.choice.TransactionID = F1AP_get_next_transaction_identifier(enb_mod_idP, cu_mod_idP); + ie1->value.choice.TransactionID = F1AP_get_next_transaction_identifier(0, 0); /* optional */ /* c2. GNB_CU_Name */ @@ -336,7 +305,7 @@ int CU_send_F1_SETUP_RESPONSE(instance_t instance, /* optional */ /* - gNB-CU System Information */ - if (1) { + if (f1ap_setup_resp->cells_to_activate[i].num_SI > 0) { /* 3.1.2 gNB-CUSystem Information */ F1AP_ProtocolExtensionContainer_10696P112_t *p = calloc(1, sizeof(* p)); cells_to_be_activated_item->iE_Extensions = (struct F1AP_ProtocolExtensionContainer *) p; @@ -370,15 +339,12 @@ int CU_send_F1_SETUP_RESPONSE(instance_t instance, } ASN_STRUCT_RESET(asn_DEF_F1AP_F1AP_PDU, &pdu); - f1ap_itti_send_sctp_data_req(true, instance, buffer, len, 0); + f1ap_itti_send_sctp_data_req(instance, buffer, len); return 0; } int CU_send_F1_SETUP_FAILURE(instance_t instance) { LOG_D(F1AP, "CU_send_F1_SETUP_FAILURE\n"); - instance_t enb_mod_idP=0; - instance_t cu_mod_idP=0; - // This should be fixed F1AP_F1AP_PDU_t pdu= {0}; uint8_t *buffer=NULL; uint32_t len=0; @@ -396,7 +362,7 @@ int CU_send_F1_SETUP_FAILURE(instance_t instance) { ie1->id = F1AP_ProtocolIE_ID_id_TransactionID; ie1->criticality = F1AP_Criticality_reject; ie1->value.present = F1AP_F1SetupFailureIEs__value_PR_TransactionID; - ie1->value.choice.TransactionID = F1AP_get_next_transaction_identifier(enb_mod_idP, cu_mod_idP); + ie1->value.choice.TransactionID = F1AP_get_next_transaction_identifier(0, 0); /* mandatory */ /* c2. Cause */ asn1cSequenceAdd(out->protocolIEs.list, F1AP_F1SetupFailureIEs_t, ie2); @@ -440,7 +406,7 @@ int CU_send_F1_SETUP_FAILURE(instance_t instance) { } ASN_STRUCT_RESET(asn_DEF_F1AP_F1AP_PDU, &pdu); - f1ap_itti_send_sctp_data_req(true,instance, buffer, len, 0); + f1ap_itti_send_sctp_data_req(instance, buffer, len); return 0; } @@ -448,10 +414,8 @@ int CU_send_F1_SETUP_FAILURE(instance_t instance) { gNB-DU Configuration Update */ -int CU_handle_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { +int CU_handle_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); } @@ -488,7 +452,7 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu ieC1->id = F1AP_ProtocolIE_ID_id_TransactionID; ieC1->criticality = F1AP_Criticality_reject; ieC1->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_TransactionID; - ieC1->value.choice.TransactionID = F1AP_get_next_transaction_identifier(instance, 0); + ieC1->value.choice.TransactionID = F1AP_get_next_transaction_identifier(0, 0); // mandatory // c2. Cells_to_be_Activated_List @@ -556,30 +520,29 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu LOG_DUMPMSG(F1AP, LOG_DUMP_CHAR, buffer, len, "F1AP gNB-CU CONFIGURATION UPDATE : "); ASN_STRUCT_RESET(asn_DEF_F1AP_F1AP_PDU, &pdu); - f1ap_itti_send_sctp_data_req(true,instance, buffer, len, 0); + f1ap_itti_send_sctp_data_req(instance, buffer, len); return 0; } -int CU_handle_gNB_CU_CONFIGURATION_UPDATE_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { +int CU_handle_gNB_CU_CONFIGURATION_UPDATE_FAILURE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); } int CU_handle_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { + sctp_assoc_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) +{ LOG_I(F1AP,"Cell Configuration ok (assoc_id %d)\n",assoc_id); return(0); } - int CU_handle_gNB_DU_RESOURCE_COORDINATION_REQUEST(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { + sctp_assoc_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) +{ AssertFatal(0, "Not implemented yet\n"); } diff --git a/openair2/F1AP/f1ap_cu_interface_management.h b/openair2/F1AP/f1ap_cu_interface_management.h index 83da037925..abdb60bf88 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.h +++ b/openair2/F1AP/f1ap_cu_interface_management.h @@ -37,32 +37,20 @@ * Reset */ int CU_send_RESET(instance_t instance, F1AP_Reset_t *Reset); -int CU_handle_RESET_ACKKNOWLEDGE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); -int CU_handle_RESET(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); +int CU_handle_RESET_ACKKNOWLEDGE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); +int CU_handle_RESET(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); int CU_send_RESET_ACKNOWLEDGE(instance_t instance, F1AP_ResetAcknowledge_t *ResetAcknowledge); /* * Error Indication */ -int CU_handle_ERROR_INDICATION(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); +int CU_handle_ERROR_INDICATION(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); int CU_send_ERROR_INDICATION(instance_t instance, F1AP_ErrorIndication_t *ErrorIndication); /* * F1 Setup */ -int CU_handle_F1_SETUP_REQUEST(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); +int CU_handle_F1_SETUP_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); int CU_send_F1_SETUP_RESPONSE(instance_t instance, f1ap_setup_resp_t *f1ap_setup_resp); @@ -71,10 +59,7 @@ int CU_send_F1_SETUP_FAILURE(instance_t instance); /* * gNB-DU Configuration Update */ -int CU_handle_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); +int CU_handle_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); int CU_send_gNB_DU_CONFIGURATION_FAILURE(instance_t instance, F1AP_GNBDUConfigurationUpdateFailure_t *GNBDUConfigurationUpdateFailure); @@ -87,22 +72,22 @@ int CU_send_gNB_DU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, */ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configuration_update_t *f1ap_gnb_cu_configuration_update); int CU_handle_gNB_CU_CONFIGURATION_UPDATE_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); + sctp_assoc_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); int CU_handle_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); + sctp_assoc_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); /* * gNB-DU Resource Coordination */ int CU_handle_gNB_DU_RESOURCE_COORDINATION_REQUEST(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); + sctp_assoc_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); int CU_send_gNB_DU_RESOURCE_COORDINATION_RESPONSE(instance_t instance, F1AP_GNBDUResourceCoordinationResponse_t *GNBDUResourceCoordinationResponse); diff --git a/openair2/F1AP/f1ap_cu_paging.c b/openair2/F1AP/f1ap_cu_paging.c index f0e68bf1fc..5175456c4e 100644 --- a/openair2/F1AP/f1ap_cu_paging.c +++ b/openair2/F1AP/f1ap_cu_paging.c @@ -101,8 +101,7 @@ int CU_send_Paging(instance_t instance, f1ap_paging_ind_t *paging) { itemies->criticality = F1AP_Criticality_reject; itemies->value.present = F1AP_PagingCell_ItemIEs__value_PR_PagingCell_Item; F1AP_NRCGI_t *nRCGI = &itemies->value.choice.PagingCell_Item.nRCGI; - MCC_MNC_TO_PLMNID(paging->mcc, paging->mnc, paging->mnc_digit_length, - &nRCGI->pLMN_Identity); + MCC_MNC_TO_PLMNID(paging->plmn.mcc, paging->plmn.mnc, paging->plmn.mnc_digit_length, &nRCGI->pLMN_Identity); NR_CELL_ID_TO_BIT_STRING(paging->nr_cellid, &nRCGI->nRCellIdentity); } @@ -115,6 +114,6 @@ int CU_send_Paging(instance_t instance, f1ap_paging_ind_t *paging) { return -1; } ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_F1AP_F1AP_PDU, &pdu); - f1ap_itti_send_sctp_data_req(true, instance, buffer, len, 0); + f1ap_itti_send_sctp_data_req(instance, buffer, len); return 0; } diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index 13bc9954a3..391841cfa0 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -43,10 +43,8 @@ Initial UL RRC Message Transfer */ -int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { +int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) +{ LOG_D(F1AP, "CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER\n"); // decode the F1 message // get the rrc message from the contauiner @@ -89,7 +87,6 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, F1AP_ProtocolIE_ID_id_DUtoCURRCContainer, false); // create an ITTI message and copy SDU - AssertFatal(f1ap_req(true, instance)->cell_type == CELL_MACRO_GNB, "illegal cell type %d\n", f1ap_req(true, instance)->cell_type); message_p = itti_alloc_new_message(TASK_CU_F1, 0, F1AP_INITIAL_UL_RRC_MESSAGE); f1ap_initial_ul_rrc_message_t *ul_rrc = &F1AP_INITIAL_UL_RRC_MESSAGE(message_p); ul_rrc->gNB_DU_ue_id = du_ue_id; @@ -210,17 +207,15 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance, return -1; } - f1ap_itti_send_sctp_data_req(true, instance, buffer, len, 0 /* BK: fix me*/); + f1ap_itti_send_sctp_data_req(instance, buffer, len); return 0; } /* UL RRC Message Transfer */ -int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { +int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) +{ LOG_D(F1AP, "CU_handle_UL_RRC_MESSAGE_TRANSFER \n"); F1AP_ULRRCMessageTransfer_t *container; F1AP_ULRRCMessageTransferIEs_t *ie; diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.h b/openair2/F1AP/f1ap_cu_rrc_message_transfer.h index c8c9d3a6f9..6b7023a84d 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.h +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.h @@ -33,18 +33,10 @@ #ifndef F1AP_CU_RRC_MESSAGE_TRANSFER_H_ #define F1AP_CU_RRC_MESSAGE_TRANSFER_H_ -int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); +int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); -int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance, - f1ap_dl_rrc_message_t *f1ap_dl_rrc); - -int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); +int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance, f1ap_dl_rrc_message_t *f1ap_dl_rrc); +int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); #endif /* F1AP_CU_RRC_MESSAGE_TRANSFER_H_ */ diff --git a/openair2/F1AP/f1ap_cu_task.c b/openair2/F1AP/f1ap_cu_task.c index 617366563c..2d47398d51 100644 --- a/openair2/F1AP/f1ap_cu_task.c +++ b/openair2/F1AP/f1ap_cu_task.c @@ -48,28 +48,41 @@ static instance_t cu_task_create_gtpu_instance(eth_params_t *IPaddrs) { return gtpv1Init(tmp); } -static void cu_task_handle_sctp_association_ind(instance_t instance, sctp_new_association_ind_t *sctp_new_association_ind, - eth_params_t *IPaddrs) { - createF1inst(true, instance, NULL); +static void cu_task_handle_sctp_association_ind(instance_t instance, + sctp_new_association_ind_t *sctp_new_association_ind, + eth_params_t *IPaddrs) +{ + createF1inst(instance, NULL, NULL); // save the assoc id - f1ap_setup_req_t *f1ap_cu_data=f1ap_req(true, instance); + f1ap_cudu_inst_t *f1ap_cu_data = getCxt(instance); f1ap_cu_data->assoc_id = sctp_new_association_ind->assoc_id; f1ap_cu_data->sctp_in_streams = sctp_new_association_ind->in_streams; f1ap_cu_data->sctp_out_streams = sctp_new_association_ind->out_streams; - f1ap_cu_data->default_sctp_stream_id = 0; if (RC.nrrrc[instance]->node_type != ngran_gNB_CUCP) { - getCxt(CUtype, instance)->gtpInst = cu_task_create_gtpu_instance(IPaddrs); - AssertFatal(getCxt(CUtype, instance)->gtpInst > 0, "Failed to create CU F1-U UDP listener"); + getCxt(instance)->gtpInst = cu_task_create_gtpu_instance(IPaddrs); + AssertFatal(getCxt(instance)->gtpInst > 0, "Failed to create CU F1-U UDP listener"); } else LOG_I(F1AP, "In F1AP connection, don't start GTP-U, as we have also E1AP\n"); // Fixme: fully inconsistent instances management // dirty global var is a bad fix - CUuniqInstance=getCxt(CUtype, instance)->gtpInst; + CUuniqInstance=getCxt(instance)->gtpInst; } static void cu_task_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp) { DevAssert(sctp_new_association_resp != NULL); + if (sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN) { + f1ap_cudu_inst_t *f1ap_cu_data = getCxt(instance); + AssertFatal(f1ap_cu_data != NULL, "illegal state: SCTP shutdown for non-existing F1AP endpoint\n"); + LOG_I(F1AP, "Received SCTP shutdown for assoc_id %d, removing endpoint\n", sctp_new_association_resp->assoc_id); + destroyF1inst(instance); + /* inform RRC that the DU is gone */ + MessageDef *message_p = itti_alloc_new_message(TASK_CU_F1, 0, F1AP_LOST_CONNECTION); + message_p->ittiMsgHeader.originInstance = sctp_new_association_resp->assoc_id; + itti_send_msg_to_task(TASK_RRC_GNB, instance, message_p); + return; + } + if (sctp_new_association_resp->sctp_state != SCTP_STATE_ESTABLISHED) { LOG_W(F1AP, "Received unsuccessful result for SCTP association (%u), instance %ld, cnx_id %u\n", sctp_new_association_resp->sctp_state, diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index 4b91903d5f..9e9a85d9e5 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -509,7 +509,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /*Use a dummy teid for the outgoing GTP-U tunnel (DU) which will be updated once we get the UE context setup response from the DU*/ /* Use a dummy address and teid for the outgoing GTP-U tunnel (DU) which will be updated once we get the UE context setup response from the DU */ transport_layer_addr_t addr = { .length= 32, .buffer= { 0 } }; - f1ap_ue_context_setup_req->drbs_to_be_setup[i].up_ul_tnl[j].teid = newGtpuCreateTunnel(getCxt(CUtype, instance)->gtpInst, + f1ap_ue_context_setup_req->drbs_to_be_setup[i].up_ul_tnl[j].teid = newGtpuCreateTunnel(getCxt(instance)->gtpInst, f1ap_ue_context_setup_req->gNB_CU_ue_id, f1ap_ue_context_setup_req->drbs_to_be_setup[i].drb_id, f1ap_ue_context_setup_req->drbs_to_be_setup[i].drb_id, @@ -628,14 +628,12 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, // return -1; // } LOG_D(F1AP,"F1AP UEContextSetupRequest Encoded %u bits\n", len); - f1ap_itti_send_sctp_data_req(true, instance, buffer, len, 0 /* BK: fix me*/); + f1ap_itti_send_sctp_data_req(instance, buffer, len); return 0; } -int CU_handle_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { +int CU_handle_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) +{ MessageDef *msg_p; F1AP_UEContextSetupResponse_t *container; F1AP_UEContextSetupResponseIEs_t *ie; @@ -692,7 +690,7 @@ int CU_handle_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, F1AP_GTPTunnel_t *dl_up_tnl0 = dl_up_tnl_info_p->dLUPTNLInformation.choice.gTPTunnel; BIT_STRING_TO_TRANSPORT_LAYER_ADDRESS_IPv4(&dl_up_tnl0->transportLayerAddress, drb_p->up_dl_tnl[0].tl_address); OCTET_STRING_TO_UINT32(&dl_up_tnl0->gTP_TEID, drb_p->up_dl_tnl[0].teid); - GtpuUpdateTunnelOutgoingAddressAndTeid(getCxt(CUtype, instance)->gtpInst, + GtpuUpdateTunnelOutgoingAddressAndTeid(getCxt(instance)->gtpInst, f1ap_ue_context_setup_resp->gNB_DU_ue_id, (ebi_t)drbs_setup_item_p->dRBID, drb_p->up_dl_tnl[0].tl_address, @@ -766,14 +764,12 @@ int CU_handle_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, return 0; } -int CU_handle_UE_CONTEXT_SETUP_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { +int CU_handle_UE_CONTEXT_SETUP_FAILURE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); } -int CU_handle_UE_CONTEXT_RELEASE_REQUEST(instance_t instance, uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) +int CU_handle_UE_CONTEXT_RELEASE_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { MessageDef *msg = itti_alloc_new_message(TASK_CU_F1, 0, F1AP_UE_CONTEXT_RELEASE_REQ); f1ap_ue_context_release_req_t *req = &F1AP_UE_CONTEXT_RELEASE_REQ(msg); @@ -916,13 +912,12 @@ int CU_send_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, return -1; } - f1ap_itti_send_sctp_data_req(true, instance, buffer, len, 0); + f1ap_itti_send_sctp_data_req(instance, buffer, len); return 0; } -int CU_handle_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { + +int CU_handle_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) +{ F1AP_UEContextReleaseComplete_t *container; F1AP_UEContextReleaseCompleteIEs_t *ie; DevAssert(pdu); @@ -963,7 +958,8 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance, f1ap_ue_context uint8_t *buffer=NULL; uint32_t len=0; // for test - cellIDs_t hardCoded= { .mcc=208, .mnc=93, .mnc_digit_length=2}; + LOG_W(F1AP, "UE Context Modification Request PLMN is hardcoded!\n"); + f1ap_served_cell_info_t hardCoded= { .plmn.mcc=208, .plmn.mnc=93, .plmn.mnc_digit_length=2}; /* Create */ /* 0. Message Type */ pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; @@ -1562,15 +1558,12 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance, f1ap_ue_context LOG_E(F1AP, "Failed to encode F1 UE CONTEXT_MODIFICATION REQUEST\n"); return -1; } - f1ap_itti_send_sctp_data_req(true, instance, buffer, len, 0 /* BK: fix me*/); + f1ap_itti_send_sctp_data_req(instance, buffer, len); return 0; } -int CU_handle_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { - +int CU_handle_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) +{ MessageDef *msg_p; F1AP_UEContextModificationResponse_t *container; F1AP_UEContextModificationResponseIEs_t *ie; @@ -1628,7 +1621,7 @@ int CU_handle_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance, F1AP_GTPTunnel_t *dl_up_tnl0 = dl_up_tnl_info_p->dLUPTNLInformation.choice.gTPTunnel; BIT_STRING_TO_TRANSPORT_LAYER_ADDRESS_IPv4(&dl_up_tnl0->transportLayerAddress, drb_p->up_dl_tnl[0].tl_address); OCTET_STRING_TO_UINT32(&dl_up_tnl0->gTP_TEID, drb_p->up_dl_tnl[0].teid); - GtpuUpdateTunnelOutgoingAddressAndTeid(getCxt(CUtype, instance)->gtpInst, + GtpuUpdateTunnelOutgoingAddressAndTeid(getCxt(instance)->gtpInst, f1ap_ue_context_modification_resp->gNB_CU_ue_id, (ebi_t)drbs_setupmod_item_p->dRBID, drb_p->up_dl_tnl[0].tl_address, @@ -1694,14 +1687,12 @@ int CU_handle_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance, return 0; } -int CU_handle_UE_CONTEXT_MODIFICATION_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { - AssertFatal(1==0,"Not implemented yet\n"); +int CU_handle_UE_CONTEXT_MODIFICATION_FAILURE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) +{ + AssertFatal(1 == 0, "Not implemented yet\n"); } -int CU_handle_UE_CONTEXT_MODIFICATION_REQUIRED(instance_t instance, uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) +int CU_handle_UE_CONTEXT_MODIFICATION_REQUIRED(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { DevAssert(pdu != NULL); @@ -1892,7 +1883,7 @@ int CU_send_UE_CONTEXT_MODIFICATION_CONFIRM(instance_t instance, f1ap_ue_context LOG_E(F1AP, "Failed to encode F1 UE Context Modification Confirm\n"); return -1; } - f1ap_itti_send_sctp_data_req(true, instance, buffer, len, 0); + f1ap_itti_send_sctp_data_req(instance, buffer, len); return 0; } @@ -1959,6 +1950,6 @@ int CU_send_UE_CONTEXT_MODIFICATION_REFUSE(instance_t instance, f1ap_ue_context_ LOG_E(F1AP, "Failed to encode F1 UE Context Modification Refuse\n"); return -1; } - f1ap_itti_send_sctp_data_req(true, instance, buffer, len, 0); + f1ap_itti_send_sctp_data_req(instance, buffer, len); return 0; } diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.h b/openair2/F1AP/f1ap_cu_ue_context_management.h index 76bbecb2b8..5409c6e53e 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.h +++ b/openair2/F1AP/f1ap_cu_ue_context_management.h @@ -39,24 +39,14 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, f1ap_ue_context_setup_t *f1ap_ue_context_setup_req); -int CU_handle_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); - -int CU_handle_UE_CONTEXT_SETUP_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); +int CU_handle_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); +int CU_handle_UE_CONTEXT_SETUP_FAILURE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); /* * UE Context Release Request (gNB-DU initiated) */ -int CU_handle_UE_CONTEXT_RELEASE_REQUEST(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); +int CU_handle_UE_CONTEXT_RELEASE_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); /* * UE Context Release (gNB-CU initiated) @@ -64,28 +54,19 @@ int CU_handle_UE_CONTEXT_RELEASE_REQUEST(instance_t instance, int CU_send_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, f1ap_ue_context_release_cmd_t *cmd); -int CU_handle_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); +int CU_handle_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); /* * UE Context Modification (gNB-CU initiated) */ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance, f1ap_ue_context_modif_req_t *f1ap_ue_context_modification_req); -int CU_handle_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); -int CU_handle_UE_CONTEXT_MODIFICATION_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); +int CU_handle_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); +int CU_handle_UE_CONTEXT_MODIFICATION_FAILURE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); /* * UE Context Modification Required (gNB-DU initiated) */ -int CU_handle_UE_CONTEXT_MODIFICATION_REQUIRED(instance_t instance, uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); +int CU_handle_UE_CONTEXT_MODIFICATION_REQUIRED(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); int CU_send_UE_CONTEXT_MODIFICATION_CONFIRM(instance_t instance, f1ap_ue_context_modif_confirm_t *confirm); diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c index 053e302f13..d271cccde8 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -34,6 +34,7 @@ #include "f1ap_encoder.h" #include "f1ap_itti_messaging.h" #include "f1ap_du_interface_management.h" +#include "openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.h" #include "assertions.h" #include "GNB_APP/gnb_paramdef.h" @@ -49,10 +50,8 @@ int to_NRNRB(int nrb) { AssertFatal(1==0,"nrb %d is not in the list of possible NRNRB\n",nrb); } -int DU_handle_RESET(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { +int DU_handle_RESET(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); } @@ -64,14 +63,11 @@ int DU_send_RESET(instance_t instance, F1AP_Reset_t *Reset) { AssertFatal(1==0,"Not implemented yet\n"); } -int DU_handle_RESET_ACKNOWLEDGE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { +int DU_handle_RESET_ACKNOWLEDGE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); } - /* Error Indication */ @@ -80,22 +76,18 @@ int DU_send_ERROR_INDICATION(instance_t instance, F1AP_F1AP_PDU_t *pdu_p) { AssertFatal(1==0,"Not implemented yet\n"); } -int DU_handle_ERROR_INDICATION(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { +int DU_handle_ERROR_INDICATION(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); } - /* F1 Setup */ // SETUP REQUEST -int DU_send_F1_SETUP_REQUEST(instance_t instance) { - instance_t nb_mod_idP=0; - instance_t du_mod_idP=0; +int DU_send_F1_SETUP_REQUEST(instance_t instance, f1ap_setup_req_t *setup_req) +{ F1AP_F1AP_PDU_t pdu= {0}; uint8_t *buffer; uint32_t len; @@ -113,23 +105,23 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { ieC1->id = F1AP_ProtocolIE_ID_id_TransactionID; ieC1->criticality = F1AP_Criticality_reject; ieC1->value.present = F1AP_F1SetupRequestIEs__value_PR_TransactionID; - ieC1->value.choice.TransactionID = F1AP_get_next_transaction_identifier(nb_mod_idP, du_mod_idP); + ieC1->value.choice.TransactionID = F1AP_get_next_transaction_identifier(0, 0); /* mandatory */ /* c2. GNB_DU_ID (integer value) */ asn1cSequenceAdd(f1Setup->protocolIEs.list, F1AP_F1SetupRequestIEs_t, ieC2); ieC2->id = F1AP_ProtocolIE_ID_id_gNB_DU_ID; ieC2->criticality = F1AP_Criticality_reject; ieC2->value.present = F1AP_F1SetupRequestIEs__value_PR_GNB_DU_ID; - asn_int642INTEGER(&ieC2->value.choice.GNB_DU_ID, f1ap_req(false, instance)->gNB_DU_id); + asn_int642INTEGER(&ieC2->value.choice.GNB_DU_ID, setup_req->gNB_DU_id); /* optional */ /* c3. GNB_DU_Name */ - if (f1ap_req(false,instance)->gNB_DU_name != NULL) { + if (setup_req->gNB_DU_name != NULL) { asn1cSequenceAdd(f1Setup->protocolIEs.list, F1AP_F1SetupRequestIEs_t, ieC3); ieC3->id = F1AP_ProtocolIE_ID_id_gNB_DU_Name; ieC3->criticality = F1AP_Criticality_ignore; ieC3->value.present = F1AP_F1SetupRequestIEs__value_PR_GNB_DU_Name; - char *gNB_DU_name=f1ap_req(false, instance)->gNB_DU_name; + char *gNB_DU_name=setup_req->gNB_DU_name; OCTET_STRING_fromBuf(&ieC3->value.choice.GNB_DU_Name, gNB_DU_name, strlen(gNB_DU_name)); } @@ -139,13 +131,13 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { ieCells->id = F1AP_ProtocolIE_ID_id_gNB_DU_Served_Cells_List; ieCells->criticality = F1AP_Criticality_reject; ieCells->value.present = F1AP_F1SetupRequestIEs__value_PR_GNB_DU_Served_Cells_List; - int num_cells_available = f1ap_req(false, instance)->num_cells_available; + int num_cells_available = setup_req->num_cells_available; LOG_D(F1AP, "num_cells_available = %d \n", num_cells_available); for (int i=0; icell[i]; + f1ap_served_cell_info_t *cell = &setup_req->cell[i].info; asn1cSequenceAdd(ieCells->value.choice.GNB_DU_Served_Cells_List.list, F1AP_GNB_DU_Served_Cells_ItemIEs_t, duServedCell); duServedCell->id = F1AP_ProtocolIE_ID_id_GNB_DU_Served_Cells_Item; @@ -154,13 +146,15 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { F1AP_GNB_DU_Served_Cells_Item_t *gnb_du_served_cells_item=&duServedCell->value.choice.GNB_DU_Served_Cells_Item; /* 4.1.1 served cell Information */ F1AP_Served_Cell_Information_t *served_cell_information= &gnb_du_served_cells_item->served_Cell_Information; - addnRCGI(served_cell_information->nRCGI,cell); + addnRCGI(served_cell_information->nRCGI, cell); /* - nRPCI */ served_cell_information->nRPCI = cell->nr_pci; // int 0..1007 /* - fiveGS_TAC */ - uint32_t tac=htonl(cell->tac); - asn1cCalloc(served_cell_information->fiveGS_TAC, netOrder); - OCTET_STRING_fromBuf(netOrder, ((char *)&tac)+1, 3); + if (cell->tac != NULL) { + uint32_t tac=htonl(*cell->tac); + asn1cCalloc(served_cell_information->fiveGS_TAC, netOrder); + OCTET_STRING_fromBuf(netOrder, ((char *)&tac)+1, 3); + } /* - Configured_EPS_TAC */ if(0) { @@ -170,7 +164,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { /* servedPLMN information */ asn1cSequenceAdd(served_cell_information->servedPLMNs.list, F1AP_ServedPLMNs_Item_t,servedPLMN_item); - MCC_MNC_TO_PLMNID(cell->mcc, cell->mnc, cell->mnc_digit_length, &servedPLMN_item->pLMN_Identity); + MCC_MNC_TO_PLMNID(cell->plmn.mcc, cell->plmn.mnc, cell->plmn.mnc_digit_length, &servedPLMN_item->pLMN_Identity); // // /* - CHOICE NR-MODE-Info */ F1AP_NR_Mode_Info_t *nR_Mode_Info= &served_cell_information->nR_Mode_Info; F1AP_ProtocolExtensionContainer_10696P34_t *p = calloc(1, sizeof(*p)); @@ -205,129 +199,85 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { } } - if (f1ap_req(false, instance)->fdd_flag) { // FDD + if (setup_req->cell[i].info.mode == F1AP_MODE_FDD) { // FDD + const f1ap_fdd_info_t *fdd = &setup_req->cell[i].info.fdd; nR_Mode_Info->present = F1AP_NR_Mode_Info_PR_fDD; asn1cCalloc(nR_Mode_Info->choice.fDD, fDD_Info); /* FDD.1 UL NRFreqInfo */ /* FDD.1.1 UL NRFreqInfo ARFCN */ - fDD_Info->uL_NRFreqInfo.nRARFCN = f1ap_req(false,instance)->nr_mode_info[i].fdd.ul_nr_arfcn; // Integer + fDD_Info->uL_NRFreqInfo.nRARFCN = fdd->ul_freqinfo.arfcn; // Integer /* FDD.1.2 F1AP_SUL_Information */ - if(0) { // Optional - asn1cCalloc(fDD_Info->uL_NRFreqInfo.sul_Information, fdd_sul_info); - fdd_sul_info->sUL_NRARFCN = 0; - fdd_sul_info->sUL_transmission_Bandwidth.nRSCS = 0; - fdd_sul_info->sUL_transmission_Bandwidth.nRNRB = 0; - } /* FDD.1.3 freqBandListNr */ - int fdd_ul_num_available_freq_Bands = f1ap_req(false,instance)->nr_mode_info[i].fdd.ul_num_frequency_bands; - LOG_D(F1AP, "fdd_ul_num_available_freq_Bands = %d \n", fdd_ul_num_available_freq_Bands); - + int fdd_ul_num_available_freq_Bands = 1; for (int fdd_ul_j=0; fdd_ul_juL_NRFreqInfo.freqBandListNr.list, F1AP_FreqBandNrItem_t, nr_freqBandNrItem); /* FDD.1.3.1 freqBandIndicatorNr*/ - nr_freqBandNrItem->freqBandIndicatorNr = f1ap_req(false,instance)->nr_mode_info[i].fdd.ul_nr_band[fdd_ul_j]; // - /* FDD.1.3.2 supportedSULBandList*/ - int num_available_supported_SULBands = f1ap_req(false,instance)->nr_mode_info[i].fdd.ul_num_sul_frequency_bands; - LOG_D(F1AP, "num_available_supported_SULBands = %d \n", num_available_supported_SULBands); + nr_freqBandNrItem->freqBandIndicatorNr = fdd->ul_freqinfo.band; - for (int fdd_ul_k=0; fdd_ul_ksupportedSULBandList.list, F1AP_SupportedSULFreqBandItem_t, nr_supportedSULFreqBandItem); - /* FDD.1.3.2.1 freqBandIndicatorNr */ - nr_supportedSULFreqBandItem->freqBandIndicatorNr = f1ap_req(false,instance)->nr_mode_info[i].fdd.ul_nr_sul_band[fdd_ul_k]; // - } // for FDD : UL supported_SULBands + /* FDD.1.3.2 supportedSULBandList*/ } // for FDD : UL freq_Bands /* FDD.2 DL NRFreqInfo */ /* FDD.2.1 DL NRFreqInfo ARFCN */ - fDD_Info->dL_NRFreqInfo.nRARFCN = f1ap_req(false,instance)->nr_mode_info[i].fdd.dl_nr_arfcn; // Integer + fDD_Info->dL_NRFreqInfo.nRARFCN = fdd->dl_freqinfo.arfcn; // Integer /* FDD.2.2 F1AP_SUL_Information */ - if(0) { // Optional - F1AP_SUL_Information_t *fdd_sul_info=fDD_Info->dL_NRFreqInfo.sul_Information; - fdd_sul_info->sUL_NRARFCN = 0; - fdd_sul_info->sUL_transmission_Bandwidth.nRSCS = 0; - fdd_sul_info->sUL_transmission_Bandwidth.nRNRB = 0; - } /* FDD.2.3 freqBandListNr */ - int fdd_dl_num_available_freq_Bands = f1ap_req(false,instance)->nr_mode_info[i].fdd.dl_num_frequency_bands; - LOG_D(F1AP, "fdd_dl_num_available_freq_Bands = %d \n", fdd_dl_num_available_freq_Bands); - + int fdd_dl_num_available_freq_Bands = 1; for (int fdd_dl_j=0; fdd_dl_jdL_NRFreqInfo.freqBandListNr.list, F1AP_FreqBandNrItem_t, nr_freqBandNrItem); /* FDD.2.3.1 freqBandIndicatorNr*/ - nr_freqBandNrItem->freqBandIndicatorNr = f1ap_req(false,instance)->nr_mode_info[i].fdd.dl_nr_band[fdd_dl_j]; // - /* FDD.2.3.2 supportedSULBandList*/ - int num_available_supported_SULBands = f1ap_req(false,instance)->nr_mode_info[i].fdd.dl_num_sul_frequency_bands; - LOG_D(F1AP, "num_available_supported_SULBands = %d \n", num_available_supported_SULBands); + nr_freqBandNrItem->freqBandIndicatorNr = fdd->dl_freqinfo.band; - for (int fdd_dl_k=0; fdd_dl_ksupportedSULBandList.list, F1AP_SupportedSULFreqBandItem_t, nr_supportedSULFreqBandItem); - /* FDD.2.3.2.1 freqBandIndicatorNr */ - nr_supportedSULFreqBandItem->freqBandIndicatorNr = f1ap_req(false,instance)->nr_mode_info[i].fdd.dl_nr_sul_band[fdd_dl_k]; // - } // for FDD : DL supported_SULBands + /* FDD.2.3.2 supportedSULBandList*/ } // for FDD : DL freq_Bands /* FDD.3 UL Transmission Bandwidth */ - fDD_Info->uL_Transmission_Bandwidth.nRSCS = f1ap_req(false,instance)->nr_mode_info[i].fdd.ul_scs; - fDD_Info->uL_Transmission_Bandwidth.nRNRB = to_NRNRB(f1ap_req(false,instance)->nr_mode_info[i].fdd.ul_nrb); + fDD_Info->uL_Transmission_Bandwidth.nRSCS = fdd->ul_tbw.scs; + fDD_Info->uL_Transmission_Bandwidth.nRNRB = to_NRNRB(fdd->ul_tbw.nrb); /* FDD.4 DL Transmission Bandwidth */ - fDD_Info->dL_Transmission_Bandwidth.nRSCS = f1ap_req(false,instance)->nr_mode_info[i].fdd.dl_scs; - fDD_Info->dL_Transmission_Bandwidth.nRNRB = to_NRNRB(f1ap_req(false,instance)->nr_mode_info[i].fdd.dl_nrb); - } else { // TDD + fDD_Info->dL_Transmission_Bandwidth.nRSCS = fdd->dl_tbw.scs; + fDD_Info->dL_Transmission_Bandwidth.nRNRB = to_NRNRB(fdd->dl_tbw.nrb); + } else if (setup_req->cell[i].info.mode == F1AP_MODE_TDD) { // TDD + const f1ap_tdd_info_t *tdd = &setup_req->cell[i].info.tdd; nR_Mode_Info->present = F1AP_NR_Mode_Info_PR_tDD; asn1cCalloc(nR_Mode_Info->choice.tDD, tDD_Info); /* TDD.1 nRFreqInfo */ /* TDD.1.1 nRFreqInfo ARFCN */ - tDD_Info->nRFreqInfo.nRARFCN = f1ap_req(false,instance)->nr_mode_info[i].tdd.nr_arfcn; // Integer + tDD_Info->nRFreqInfo.nRARFCN = tdd->freqinfo.arfcn; // Integer /* TDD.1.2 F1AP_SUL_Information */ - if(0) { // Optional - F1AP_SUL_Information_t *tdd_sul_info= tDD_Info->nRFreqInfo.sul_Information; - tdd_sul_info->sUL_NRARFCN = 0; - tdd_sul_info->sUL_transmission_Bandwidth.nRSCS = 0; - tdd_sul_info->sUL_transmission_Bandwidth.nRNRB = 0; - } /* TDD.1.3 freqBandListNr */ - int tdd_num_available_freq_Bands = f1ap_req(false,instance)->nr_mode_info[i].tdd.num_frequency_bands; - LOG_D(F1AP, "tdd_num_available_freq_Bands = %d \n", tdd_num_available_freq_Bands); - + int tdd_num_available_freq_Bands = 1; for (int j=0; jnRFreqInfo.freqBandListNr.list, F1AP_FreqBandNrItem_t, nr_freqBandNrItem); /* TDD.1.3.1 freqBandIndicatorNr*/ - nr_freqBandNrItem->freqBandIndicatorNr = *f1ap_req(false,instance)->nr_mode_info[i].tdd.nr_band; // + nr_freqBandNrItem->freqBandIndicatorNr = tdd->freqinfo.band; /* TDD.1.3.2 supportedSULBandList*/ - int num_available_supported_SULBands = f1ap_req(false,instance)->nr_mode_info[i].tdd.num_sul_frequency_bands; - LOG_D(F1AP, "num_available_supported_SULBands = %d \n", num_available_supported_SULBands); - - for (int k=0; ksupportedSULBandList.list,F1AP_SupportedSULFreqBandItem_t, nr_supportedSULFreqBandItem); - /* TDD.1.3.2.1 freqBandIndicatorNr */ - nr_supportedSULFreqBandItem->freqBandIndicatorNr = *f1ap_req(false,instance)->nr_mode_info[i].tdd.nr_sul_band; // - } // for TDD : supported_SULBands } // for TDD : freq_Bands /* TDD.2 transmission_Bandwidth */ - tDD_Info->transmission_Bandwidth.nRSCS = f1ap_req(false,instance)->nr_mode_info[i].tdd.scs; - tDD_Info->transmission_Bandwidth.nRNRB = to_NRNRB(f1ap_req(false,instance)->nr_mode_info[i].tdd.nrb); - } // if nR_Mode_Info + tDD_Info->transmission_Bandwidth.nRSCS = tdd->tbw.scs; + tDD_Info->transmission_Bandwidth.nRNRB = to_NRNRB(tdd->tbw.nrb); + } else { + AssertFatal(false, "unknown mode %d\n", setup_req->cell[i].info.mode); + } /* - measurementTimingConfiguration */ - char *measurementTimingConfiguration = f1ap_req(false,instance)->measurement_timing_information[i]; // sept. 2018 + char *measurementTimingConfiguration = cell->measurement_timing_information; // sept. 2018 OCTET_STRING_fromBuf(&served_cell_information->measurementTimingConfiguration, measurementTimingConfiguration, strlen(measurementTimingConfiguration)); asn1cCalloc(gnb_du_served_cells_item->gNB_DU_System_Information, gNB_DU_System_Information); /* 4.1.2 gNB-DU System Information */ - OCTET_STRING_fromBuf(&gNB_DU_System_Information->mIB_message, // sept. 2018 - (const char *)f1ap_req(false,instance)->mib[i], //f1ap_du_data->mib, - f1ap_req(false,instance)->mib_length[i]); - OCTET_STRING_fromBuf(&gNB_DU_System_Information->sIB1_message, // sept. 2018 - (const char *)f1ap_req(false,instance)->sib1[i], - f1ap_req(false,instance)->sib1_length[i]); + AssertFatal(setup_req->cell[i].sys_info != NULL, "assume that sys_info is present, which is not the case\n"); + const f1ap_gnb_du_system_info_t *sys_info = setup_req->cell[i].sys_info; + OCTET_STRING_fromBuf(&gNB_DU_System_Information->mIB_message, (const char *)sys_info->mib, sys_info->mib_length); + OCTET_STRING_fromBuf(&gNB_DU_System_Information->sIB1_message, (const char *)sys_info->sib1, sys_info->sib1_length); } /* mandatory */ @@ -348,14 +298,12 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { } ASN_STRUCT_RESET(asn_DEF_F1AP_F1AP_PDU, &pdu); - f1ap_itti_send_sctp_data_req(false, instance, buffer, len, 0); + f1ap_itti_send_sctp_data_req(instance, buffer, len); return 0; } -int DU_handle_F1_SETUP_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { +int DU_handle_F1_SETUP_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) +{ LOG_D(F1AP, "DU_handle_F1_SETUP_RESPONSE\n"); AssertFatal(pdu->present == F1AP_F1AP_PDU_PR_successfulOutcome, "pdu->present != F1AP_F1AP_PDU_PR_successfulOutcome\n"); @@ -370,9 +318,7 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, int TransactionId = -1; int num_cells_to_activate = 0; F1AP_Cells_to_be_Activated_List_Item_t *cell; - MessageDef *msg_p = itti_alloc_new_message (TASK_DU_F1, 0, F1AP_SETUP_RESP); - LOG_D(F1AP, "F1AP: F1Setup-Resp: protocolIEs.list.count %d\n", - in->protocolIEs.list.count); + f1ap_setup_resp_t resp = {0}; for (int i=0; i < in->protocolIEs.list.count; i++) { ie = in->protocolIEs.list.array[i]; @@ -393,11 +339,10 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, "ie->criticality != F1AP_Criticality_ignore\n"); AssertFatal(ie->value.present == F1AP_F1SetupResponseIEs__value_PR_GNB_CU_Name, "ie->value.present != F1AP_F1SetupResponseIEs__value_PR_TransactionID\n"); - F1AP_SETUP_RESP (msg_p).gNB_CU_name = malloc(ie->value.choice.GNB_CU_Name.size+1); - memcpy(F1AP_SETUP_RESP (msg_p).gNB_CU_name,ie->value.choice.GNB_CU_Name.buf,ie->value.choice.GNB_CU_Name.size); - F1AP_SETUP_RESP (msg_p).gNB_CU_name[ie->value.choice.GNB_CU_Name.size]='\0'; - LOG_D(F1AP, "F1AP: F1Setup-Resp: gNB_CU_name %s\n", - F1AP_SETUP_RESP (msg_p).gNB_CU_name); + resp.gNB_CU_name = malloc(ie->value.choice.GNB_CU_Name.size+1); + memcpy(resp.gNB_CU_name, ie->value.choice.GNB_CU_Name.buf, ie->value.choice.GNB_CU_Name.size); + resp.gNB_CU_name[ie->value.choice.GNB_CU_Name.size] = '\0'; + LOG_D(F1AP, "F1AP: F1Setup-Resp: gNB_CU_name %s\n", resp.gNB_CU_name); break; case F1AP_ProtocolIE_ID_id_GNB_CU_RRC_Version: @@ -421,16 +366,17 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, AssertFatal(cells_to_be_activated_list_item_ies->value.present == F1AP_Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item, "cells_to_be_activated_list_item_ies->value.present == F1AP_Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item"); cell = &cells_to_be_activated_list_item_ies->value.choice.Cells_to_be_Activated_List_Item; - TBCD_TO_MCC_MNC(&cell->nRCGI.pLMN_Identity, F1AP_SETUP_RESP (msg_p).cells_to_activate[i].mcc, F1AP_SETUP_RESP (msg_p).cells_to_activate[i].mnc, - F1AP_SETUP_RESP (msg_p).cells_to_activate[i].mnc_digit_length); + TBCD_TO_MCC_MNC(&cell->nRCGI.pLMN_Identity, + resp.cells_to_activate[i].plmn.mcc, + resp.cells_to_activate[i].plmn.mnc, + resp.cells_to_activate[i].plmn.mnc_digit_length); LOG_D(F1AP, "nr_cellId : %x %x %x %x %x\n", cell->nRCGI.nRCellIdentity.buf[0], cell->nRCGI.nRCellIdentity.buf[1], cell->nRCGI.nRCellIdentity.buf[2], cell->nRCGI.nRCellIdentity.buf[3], cell->nRCGI.nRCellIdentity.buf[4]); - BIT_STRING_TO_NR_CELL_IDENTITY(&cell->nRCGI.nRCellIdentity, - F1AP_SETUP_RESP (msg_p).cells_to_activate[i].nr_cellid); + BIT_STRING_TO_NR_CELL_IDENTITY(&cell->nRCGI.nRCellIdentity, resp.cells_to_activate[i].nr_cellid); F1AP_ProtocolExtensionContainer_10696P112_t *ext = (F1AP_ProtocolExtensionContainer_10696P112_t *)cell->iE_Extensions; if (ext==NULL) @@ -449,24 +395,26 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_AvailableSNPN_ID_List */ case F1AP_ProtocolIE_ID_id_gNB_CUSystemInformation: { - F1AP_SETUP_RESP (msg_p).cells_to_activate[i].nrpci = (cell->nRPCI != NULL) ? *cell->nRPCI : 0; + resp.cells_to_activate[i].nrpci = (cell->nRPCI != NULL) ? *cell->nRPCI : 0; F1AP_GNB_CUSystemInformation_t *gNB_CUSystemInformation = (F1AP_GNB_CUSystemInformation_t *)&cells_to_be_activated_list_itemExtIEs->extensionValue.choice.GNB_CUSystemInformation; - F1AP_SETUP_RESP (msg_p).cells_to_activate[i].num_SI = gNB_CUSystemInformation->sibtypetobeupdatedlist.list.count; + resp.cells_to_activate[i].num_SI = gNB_CUSystemInformation->sibtypetobeupdatedlist.list.count; AssertFatal(ext->list.count==1,"At least one SI message should be there, and only 1 for now!\n"); - LOG_D(F1AP, "F1AP: Cell %d MCC %d MNC %d NRCellid %lx num_si %d\n", - i, F1AP_SETUP_RESP (msg_p).cells_to_activate[i].mcc, F1AP_SETUP_RESP (msg_p).cells_to_activate[i].mnc, - F1AP_SETUP_RESP (msg_p).cells_to_activate[i].nr_cellid, F1AP_SETUP_RESP (msg_p).cells_to_activate[i].num_SI); + LOG_D(F1AP, + "F1AP: Cell %d MCC %d MNC %d NRCellid %lx num_si %d\n", + i, + resp.cells_to_activate[i].plmn.mcc, + resp.cells_to_activate[i].plmn.mnc, + resp.cells_to_activate[i].nr_cellid, + resp.cells_to_activate[i].num_SI); for (int si = 0; si < gNB_CUSystemInformation->sibtypetobeupdatedlist.list.count; si++) { F1AP_SibtypetobeupdatedListItem_t *sib_item = gNB_CUSystemInformation->sibtypetobeupdatedlist.list.array[si]; size_t size = sib_item->sIBmessage.size; - F1AP_SETUP_RESP (msg_p).cells_to_activate[i].SI_container_length[si] = size; + resp.cells_to_activate[i].SI_container_length[si] = size; LOG_D(F1AP, "F1AP: SI_container_length[%d][%ld] %ld bytes\n", i, sib_item->sIBtype, size); - F1AP_SETUP_RESP (msg_p).cells_to_activate[i].SI_container[si] = malloc(F1AP_SETUP_RESP (msg_p).cells_to_activate[i].SI_container_length[si]); - memcpy((void *)F1AP_SETUP_RESP (msg_p).cells_to_activate[i].SI_container[si], - (void *)sib_item->sIBmessage.buf, - size); - F1AP_SETUP_RESP (msg_p).cells_to_activate[i].SI_type[si]=sib_item->sIBtype; + resp.cells_to_activate[i].SI_container[si] = malloc(resp.cells_to_activate[i].SI_container_length[si]); + memcpy(resp.cells_to_activate[i].SI_container[si], sib_item->sIBmessage.buf, size); + resp.cells_to_activate[i].SI_type[si]=sib_item->sIBtype; } break; @@ -506,30 +454,26 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, AssertFatal(TransactionId!=-1,"TransactionId was not sent\n"); LOG_D(F1AP,"F1AP: num_cells_to_activate %d\n",num_cells_to_activate); - F1AP_SETUP_RESP (msg_p).num_cells_to_activate = num_cells_to_activate; + resp.num_cells_to_activate = num_cells_to_activate; // tmp - // F1AP_SETUP_RESP (msg_p).num_SI[0] = 1; for (int i=0; i 0, "System Information %d is missing",i); + AssertFatal(resp.cells_to_activate[i].num_SI == 0, "System Information handling not implemented"); LOG_D(F1AP, "Sending F1AP_SETUP_RESP ITTI message\n"); - itti_send_msg_to_task(TASK_GNB_APP, GNB_MODULE_ID_TO_INSTANCE(assoc_id), msg_p); + f1_setup_response(&resp); return 0; } // SETUP FAILURE -int DU_handle_F1_SETUP_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { - LOG_E(F1AP, "DU_handle_F1_SETUP_FAILURE\n"); +int DU_handle_F1_SETUP_FAILURE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) +{ F1AP_F1SetupFailure_t *out; F1AP_F1SetupFailureIEs_t *ie; + f1ap_setup_failure_t fail = {0}; out = &pdu->choice.unsuccessfulOutcome->value.choice.F1SetupFailure; /* Transaction ID */ - F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_F1SetupFailureIEs_t, ie, out, - F1AP_ProtocolIE_ID_id_TransactionID, true); + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_F1SetupFailureIEs_t, ie, out, F1AP_ProtocolIE_ID_id_TransactionID, true); /* Cause */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_F1SetupFailureIEs_t, ie, out, F1AP_ProtocolIE_ID_id_Cause, true); @@ -540,10 +484,10 @@ int DU_handle_F1_SETUP_FAILURE(instance_t instance, F1AP_ProtocolIE_ID_id_TimeToWait, true); } + f1_setup_failure(&fail); return 0; } - /* gNB-DU Configuration Update */ @@ -569,7 +513,7 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, ie1->id = F1AP_ProtocolIE_ID_id_TransactionID; ie1->criticality = F1AP_Criticality_reject; ie1->value.present = F1AP_GNBDUConfigurationUpdateIEs__value_PR_TransactionID; - ie1->value.choice.TransactionID = F1AP_get_next_transaction_identifier(instance, du_mod_idP); + ie1->value.choice.TransactionID = F1AP_get_next_transaction_identifier(0, 0); /* mandatory */ /* c2. Served_Cells_To_Add */ asn1cSequenceAdd(out, F1AP_GNBDUConfigurationUpdateIEs_t, ie2); @@ -586,15 +530,17 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, F1AP_Served_Cells_To_Add_Item_t *served_cells_to_add_item= &served_cells_to_add_item_ies->value.choice.Served_Cells_To_Add_Item; F1AP_Served_Cell_Information_t *served_cell_information=&served_cells_to_add_item->served_Cell_Information; /* - nRCGI */ - addnRCGI(served_cell_information->nRCGI, &f1ap_setup_req->cell[j]); + addnRCGI(served_cell_information->nRCGI, &f1ap_setup_req->cell[j].info); /* - nRPCI */ /* 2.1.1 serverd cell Information */ - cellIDs_t *cell=&f1ap_req(false, instance)->cell[j]; + f1ap_served_cell_info_t *cell = &f1ap_setup_req->cell[j].info; served_cell_information->nRPCI = cell->nr_pci; // int 0..1007 /* - fiveGS_TAC */ - uint32_t tac=htonl(cell->tac); - served_cell_information->fiveGS_TAC=(F1AP_FiveGS_TAC_t *) calloc(1,sizeof(F1AP_FiveGS_TAC_t *)); - OCTET_STRING_fromBuf(served_cell_information->fiveGS_TAC, ((char *)&tac)+1, 3); + if (cell->tac != NULL) { + uint32_t tac = htonl(*cell->tac); + served_cell_information->fiveGS_TAC = calloc(1, sizeof(*served_cell_information->fiveGS_TAC)); + OCTET_STRING_fromBuf(served_cell_information->fiveGS_TAC, ((char *)&tac)+1, 3); + } /* - Configured_EPS_TAC */ if(1) { @@ -603,12 +549,12 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, } asn1cSequenceAdd(served_cell_information->servedPLMNs.list, F1AP_ServedPLMNs_Item_t, servedPLMN_item); - MCC_MNC_TO_PLMNID(cell->mcc, cell->mnc, cell->mnc_digit_length, &servedPLMN_item->pLMN_Identity); + MCC_MNC_TO_PLMNID(cell->plmn.mcc, cell->plmn.mnc, cell->plmn.mnc_digit_length, &servedPLMN_item->pLMN_Identity); // // /* - CHOICE NR-MODE-Info */ F1AP_NR_Mode_Info_t *nR_Mode_Info=&served_cell_information->nR_Mode_Info; LOG_E(F1AP,"Here hardcoded values instead of values from configuration file\n"); - if (f1ap_setup_req->fdd_flag) { + if (cell->mode == F1AP_MODE_FDD) { nR_Mode_Info->present = F1AP_NR_Mode_Info_PR_fDD; /* > FDD >> FDD Info */ asn1cCalloc(nR_Mode_Info->choice.fDD, fDD_Info); @@ -630,7 +576,7 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, /* >>> DL Transmission Bandwidth */ fDD_Info->dL_Transmission_Bandwidth.nRSCS = F1AP_NRSCS_scs15; fDD_Info->dL_Transmission_Bandwidth.nRNRB = F1AP_NRNRB_nrb11; - } else { // TDD + } else if (cell->mode == F1AP_MODE_TDD) { // TDD nR_Mode_Info->present = F1AP_NR_Mode_Info_PR_tDD; /* > TDD >> TDD Info */ asn1cCalloc(nR_Mode_Info->choice.tDD, tDD_Info); @@ -642,6 +588,8 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, nr_supportedSULFreqBandItem->freqBandIndicatorNr = 444L; tDD_Info->transmission_Bandwidth.nRSCS= F1AP_NRSCS_scs15; tDD_Info->transmission_Bandwidth.nRNRB= F1AP_NRNRB_nrb11; + } else { + AssertFatal(false, "illegal mode %d\n", cell->mode); } /* - measurementTimingConfiguration */ @@ -668,7 +616,7 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, for (int i=0; i<1; i++) { // - cellIDs_t *cell=&f1ap_req(false, instance)->cell[i]; + f1ap_served_cell_info_t *cell = &f1ap_setup_req->cell[i].info; asn1cSequenceAdd(ie3->value.choice.Served_Cells_To_Modify_List.list, F1AP_Served_Cells_To_Modify_ItemIEs_t, served_cells_to_modify_item_ies); served_cells_to_modify_item_ies->id = F1AP_ProtocolIE_ID_id_Served_Cells_To_Modify_Item; served_cells_to_modify_item_ies->criticality = F1AP_Criticality_reject; @@ -681,11 +629,11 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, /* - nRCGI */ //addnRGCI(served_cell_information->nRCGI,f1ap_setup_req->cell[i]); /* - nRPCI */ - served_cell_information->nRPCI = f1ap_setup_req->cell[i].nr_pci; // int 0..1007 + served_cell_information->nRPCI = cell->nr_pci; // int 0..1007 /* - fiveGS_TAC */ asn1cCalloc(served_cell_information->fiveGS_TAC, tac ); OCTET_STRING_fromBuf(tac, - (const char *) &f1ap_setup_req->cell[i].tac, + (const char *) &cell->tac, 3); /* - Configured_EPS_TAC */ @@ -697,11 +645,11 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, } asn1cSequenceAdd(served_cell_information->servedPLMNs.list, F1AP_ServedPLMNs_Item_t, servedPLMN_item); - MCC_MNC_TO_PLMNID(cell->mcc, cell->mnc, cell->mnc_digit_length, &servedPLMN_item->pLMN_Identity); + MCC_MNC_TO_PLMNID(cell->plmn.mcc, cell->plmn.mnc, cell->plmn.mnc_digit_length, &servedPLMN_item->pLMN_Identity); // // /* - CHOICE NR-MODE-Info */ F1AP_NR_Mode_Info_t *nR_Mode_Info= &served_cell_information->nR_Mode_Info; - if (f1ap_setup_req->fdd_flag) { + if (cell->mode == F1AP_MODE_FDD) { nR_Mode_Info->present = F1AP_NR_Mode_Info_PR_fDD; /* > FDD >> FDD Info */ asn1cCalloc(nR_Mode_Info->choice.fDD, fDD_Info); @@ -724,7 +672,7 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, /* >>> DL Transmission Bandwidth */ fDD_Info->dL_Transmission_Bandwidth.nRSCS = F1AP_NRSCS_scs15; fDD_Info->dL_Transmission_Bandwidth.nRNRB = F1AP_NRNRB_nrb11; - } else { // TDD + } else if (cell->mode == F1AP_MODE_TDD) { // TDD nR_Mode_Info->present = F1AP_NR_Mode_Info_PR_tDD; /* > TDD >> TDD Info */ asn1cCalloc(nR_Mode_Info->choice.tDD, tDD_Info); @@ -736,6 +684,8 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, nr_supportedSULFreqBandItem->freqBandIndicatorNr = 444L; tDD_Info->transmission_Bandwidth.nRSCS= F1AP_NRSCS_scs15; tDD_Info->transmission_Bandwidth.nRNRB= F1AP_NRNRB_nrb11; + } else { + AssertFatal(false, "unknown mode %d\n", cell->mode); } /* - measurementTimingConfiguration */ @@ -768,7 +718,7 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, served_cells_to_delete_item_ies->value.present = F1AP_Served_Cells_To_Delete_ItemIEs__value_PR_Served_Cells_To_Delete_Item; F1AP_Served_Cells_To_Delete_Item_t *served_cells_to_delete_item=&served_cells_to_delete_item_ies->value.choice.Served_Cells_To_Delete_Item; /* 3.1 oldNRCGI */ - addnRCGI(served_cells_to_delete_item->oldNRCGI, &f1ap_setup_req->cell[i]); + addnRCGI(served_cells_to_delete_item->oldNRCGI, &f1ap_setup_req->cell[i].info); } if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { @@ -780,25 +730,21 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, return 0; } -int DU_handle_gNB_DU_CONFIGURATION_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { +int DU_handle_gNB_DU_CONFIGURATION_FAILURE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); } int DU_handle_gNB_DU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { + sctp_assoc_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); } - -int DU_handle_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { +int DU_handle_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) +{ LOG_D(F1AP, "DU_handle_gNB_CU_CONFIGURATION_UPDATE\n"); AssertFatal(pdu->present == F1AP_F1AP_PDU_PR_initiatingMessage, "pdu->present != F1AP_F1AP_PDU_PR_initiatingMessage\n"); @@ -848,8 +794,10 @@ int DU_handle_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, AssertFatal(cells_to_be_activated_list_item_ies->value.present == F1AP_Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item, "cells_to_be_activated_list_item_ies->value.present == F1AP_Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item"); cell = &cells_to_be_activated_list_item_ies->value.choice.Cells_to_be_Activated_List_Item; - TBCD_TO_MCC_MNC(&cell->nRCGI.pLMN_Identity, F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].mcc, F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].mnc, - F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].mnc_digit_length); + TBCD_TO_MCC_MNC(&cell->nRCGI.pLMN_Identity, + F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p).cells_to_activate[i].plmn.mcc, + F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p).cells_to_activate[i].plmn.mnc, + F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p).cells_to_activate[i].plmn.mnc_digit_length); LOG_D(F1AP, "nr_cellId : %x %x %x %x %x\n", cell->nRCGI.nRCellIdentity.buf[0], cell->nRCGI.nRCellIdentity.buf[1], @@ -880,9 +828,13 @@ int DU_handle_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, F1AP_GNB_CUSystemInformation_t *gNB_CUSystemInformation = (F1AP_GNB_CUSystemInformation_t *)&cells_to_be_activated_list_itemExtIEs->extensionValue.choice.GNB_CUSystemInformation; F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].num_SI = gNB_CUSystemInformation->sibtypetobeupdatedlist.list.count; AssertFatal(ext->list.count==1,"At least one SI message should be there, and only 1 for now!\n"); - LOG_D(F1AP, "F1AP: Cell %d MCC %d MNC %d NRCellid %lx num_si %d\n", - i, F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].mcc, F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].mnc, - F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].nr_cellid, F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].num_SI); + LOG_D(F1AP, + "F1AP: Cell %d MCC %d MNC %d NRCellid %lx num_si %d\n", + i, + F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p).cells_to_activate[i].plmn.mcc, + F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p).cells_to_activate[i].plmn.mnc, + F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p).cells_to_activate[i].nr_cellid, + F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p).cells_to_activate[i].num_SI); for (int si = 0; si < gNB_CUSystemInformation->sibtypetobeupdatedlist.list.count; si++) { F1AP_SibtypetobeupdatedListItem_t *sib_item = gNB_CUSystemInformation->sibtypetobeupdatedlist.list.array[si]; @@ -985,7 +937,7 @@ int DU_send_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, } ASN_STRUCT_RESET(asn_DEF_F1AP_F1AP_PDU, &pdu); - f1ap_itti_send_sctp_data_req(false, instance, buffer, len, 0); + f1ap_itti_send_sctp_data_req(instance, buffer, len); return 0; } @@ -996,8 +948,9 @@ int DU_send_gNB_DU_RESOURCE_COORDINATION_REQUEST(instance_t instance, } int DU_handle_gNB_DU_RESOURCE_COORDINATION_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { + sctp_assoc_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) +{ AssertFatal(0, "Not implemented yet\n"); } diff --git a/openair2/F1AP/f1ap_du_interface_management.h b/openair2/F1AP/f1ap_du_interface_management.h index 83cd69cf6c..f077dc547a 100644 --- a/openair2/F1AP/f1ap_du_interface_management.h +++ b/openair2/F1AP/f1ap_du_interface_management.h @@ -36,41 +36,25 @@ /* * Reset */ -int DU_handle_RESET(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); +int DU_handle_RESET(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); int DU_send_RESET_ACKKNOWLEDGE(instance_t instance, F1AP_ResetAcknowledge_t *ResetAcknowledge); int DU_send_RESET(instance_t instance, F1AP_Reset_t *Reset); -int DU_handle_RESET_ACKNOWLEDGE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); +int DU_handle_RESET_ACKNOWLEDGE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); /* * Error Indication */ int DU_send_ERROR_INDICATION(instance_t instance, F1AP_F1AP_PDU_t *pdu_p); -int DU_handle_ERROR_INDICATION(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); - +int DU_handle_ERROR_INDICATION(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); /* * F1 Setup */ -int DU_send_F1_SETUP_REQUEST(instance_t instance); +int DU_send_F1_SETUP_REQUEST(instance_t instance, f1ap_setup_req_t *setup_req); -int DU_handle_F1_SETUP_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); +int DU_handle_F1_SETUP_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); -int DU_handle_F1_SETUP_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); +int DU_handle_F1_SETUP_FAILURE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); /* * gNB-DU Configuration Update @@ -79,23 +63,17 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, instance_t du_mod_idP, f1ap_setup_req_t *f1ap_du_data); -int DU_handle_gNB_DU_CONFIGURATION_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); +int DU_handle_gNB_DU_CONFIGURATION_FAILURE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); int DU_handle_gNB_DU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); + sctp_assoc_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); /* * gNB-CU Configuration Update */ -int DU_handle_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); +int DU_handle_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); int DU_send_gNB_CU_CONFIGURATION_UPDATE_FAILURE(instance_t instance, f1ap_gnb_cu_configuration_update_failure_t *GNBCUConfigurationUpdateFailure); @@ -112,8 +90,8 @@ int DU_send_gNB_DU_RESOURCE_COORDINATION_REQUEST(instance_t instance, F1AP_GNBDUResourceCoordinationRequest_t *GNBDUResourceCoordinationRequest); int DU_handle_gNB_DU_RESOURCE_COORDINATION_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); + sctp_assoc_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); #endif /* F1AP_DU_INTERFACE_MANAGEMENT_H_ */ diff --git a/openair2/F1AP/f1ap_du_paging.c b/openair2/F1AP/f1ap_du_paging.c index 92601b357d..08a2b319e7 100644 --- a/openair2/F1AP/f1ap_du_paging.c +++ b/openair2/F1AP/f1ap_du_paging.c @@ -35,10 +35,8 @@ #include "oai_asn1.h" #include "openair2/RRC/LTE/rrc_proto.h" -int DU_handle_Paging(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { +int DU_handle_Paging(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) +{ F1AP_Paging_t *paging; F1AP_PagingIEs_t *ie; long tmsi; diff --git a/openair2/F1AP/f1ap_du_paging.h b/openair2/F1AP/f1ap_du_paging.h index 3e1806ae02..5ec21bcbae 100644 --- a/openair2/F1AP/f1ap_du_paging.h +++ b/openair2/F1AP/f1ap_du_paging.h @@ -33,9 +33,6 @@ #ifndef F1AP_DU_PAGING_H_ #define F1AP_DU_PAGING_H_ -int DU_handle_Paging(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); +int DU_handle_Paging(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); #endif /* F1AP_DU_PAGING_H_ */ diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index bcb38029cd..5a61879059 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -55,10 +55,8 @@ #include "openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.h" /* DL RRC Message Transfer */ -int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { +int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) +{ F1AP_DLRRCMessageTransfer_t *container; F1AP_DLRRCMessageTransferIEs_t *ie; int executeDuplication; @@ -85,7 +83,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, /* strange: it is not named OLD_GNB_DU_UE... */ old_gNB_DU_ue_id_stack = ie->value.choice.GNB_DU_UE_F1AP_ID_1; old_gNB_DU_ue_id = &old_gNB_DU_ue_id_stack; - gtpv1u_update_ue_id(getCxt(false, instance)->gtpInst, old_gNB_DU_ue_id_stack, du_ue_f1ap_id); + gtpv1u_update_ue_id(getCxt(instance)->gtpInst, old_gNB_DU_ue_id_stack, du_ue_f1ap_id); } /* mandatory */ @@ -172,7 +170,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instanceP, const f1ap_ini ie2->criticality = F1AP_Criticality_reject; ie2->value.present = F1AP_InitialULRRCMessageTransferIEs__value_PR_NRCGI; //Fixme: takes always the first cell - addnRCGI(ie2->value.choice.NRCGI, getCxt(DUtype, instanceP)->setupReq.cell); + addnRCGI(ie2->value.choice.NRCGI, &getCxt(instanceP)->setupReq.cell[0].info); /* mandatory */ /* c3. C_RNTI */ // 16 asn1cSequenceAdd(out->protocolIEs.list, F1AP_InitialULRRCMessageTransferIEs_t, ie3); @@ -213,7 +211,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instanceP, const f1ap_ini return -1; } - f1ap_itti_send_sctp_data_req(false, instanceP, buffer, len, getCxt(DUtype, instanceP)->default_sctp_stream_id); + f1ap_itti_send_sctp_data_req(instanceP, buffer, len); return 0; } @@ -279,6 +277,6 @@ int DU_send_UL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, const f1ap_ul_rrc_me return -1; } - f1ap_itti_send_sctp_data_req(false, instance, buffer, len, getCxt(DUtype, instance)->default_sctp_stream_id); + f1ap_itti_send_sctp_data_req(instance, buffer, len); return 0; } diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.h b/openair2/F1AP/f1ap_du_rrc_message_transfer.h index f784b7a0cf..e959d8b9e1 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.h +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.h @@ -36,10 +36,7 @@ #include "f1ap_common.h" -int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); +int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); int DU_send_UL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, const f1ap_ul_rrc_message_t *msg); diff --git a/openair2/F1AP/f1ap_du_task.c b/openair2/F1AP/f1ap_du_task.c index 8f8258a1f8..797099a480 100644 --- a/openair2/F1AP/f1ap_du_task.c +++ b/openair2/F1AP/f1ap_du_task.c @@ -40,8 +40,9 @@ //Fixme: Uniq dirty DU instance, by global var, datamodel need better management instance_t DUuniqInstance=0; -void du_task_send_sctp_association_req(instance_t instance, f1ap_setup_req_t *f1ap_setup_req) { - DevAssert(f1ap_setup_req != NULL); +void du_task_send_sctp_association_req(instance_t instance, f1ap_net_config_t *nc) +{ + DevAssert(nc != NULL); MessageDef *message_p = NULL; sctp_new_association_req_t *sctp_new_association_req_p = NULL; message_p = itti_alloc_new_message(TASK_DU_F1, 0, SCTP_NEW_ASSOCIATION_REQ); @@ -49,42 +50,37 @@ void du_task_send_sctp_association_req(instance_t instance, f1ap_setup_req_t *f1 sctp_new_association_req_p->ulp_cnx_id = instance; sctp_new_association_req_p->port = F1AP_PORT_NUMBER; sctp_new_association_req_p->ppid = F1AP_SCTP_PPID; - sctp_new_association_req_p->in_streams = f1ap_setup_req->sctp_in_streams; - sctp_new_association_req_p->out_streams = f1ap_setup_req->sctp_out_streams; + sctp_new_association_req_p->in_streams = 2; //du_inst->sctp_in_streams; + sctp_new_association_req_p->out_streams = 2; //du_inst->sctp_out_streams; // remote - memcpy(&sctp_new_association_req_p->remote_address, - &f1ap_setup_req->CU_f1_ip_address, - sizeof(f1ap_setup_req->CU_f1_ip_address)); + memcpy(&sctp_new_association_req_p->remote_address, &nc->CU_f1_ip_address, sizeof(nc->CU_f1_ip_address)); // local - memcpy(&sctp_new_association_req_p->local_address, - &f1ap_setup_req->DU_f1_ip_address, - sizeof(f1ap_setup_req->DU_f1_ip_address)); - //printf("sib itti message %s\n", f1ap_setup_req_t->sib1[0]); - //printf("nr_cellid : %llx (%lld)",f1ap_setup_req->nr_cellid[0],f1ap_setup_req->nr_cellid[0]); - //du_f1ap_register_to_sctp + memcpy(&sctp_new_association_req_p->local_address, &nc->DU_f1_ip_address, sizeof(nc->DU_f1_ip_address)); + // du_f1ap_register_to_sctp itti_send_msg_to_task(TASK_SCTP, instance, message_p); } void du_task_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp) { DevAssert(sctp_new_association_resp != NULL); + f1ap_cudu_inst_t *f1ap_du_data = getCxt(instance); + DevAssert(f1ap_du_data != NULL); if (sctp_new_association_resp->sctp_state != SCTP_STATE_ESTABLISHED) { - LOG_W(F1AP, "Received unsuccessful result for SCTP association (%u), instance %ld, cnx_id %u\n", + LOG_W(F1AP, "Received unsuccessful result for SCTP association (%u), instance %ld, cnx_id %u, retrying...\n", sctp_new_association_resp->sctp_state, instance, sctp_new_association_resp->ulp_cnx_id); - //f1ap_handle_setup_message(instance, sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN); + sleep(3); + du_task_send_sctp_association_req(instance, &f1ap_du_data->net_config); return; // exit -1 for debugging } // save the assoc id - f1ap_setup_req_t *f1ap_du_data=f1ap_req(false, instance); f1ap_du_data->assoc_id = sctp_new_association_resp->assoc_id; f1ap_du_data->sctp_in_streams = sctp_new_association_resp->in_streams; f1ap_du_data->sctp_out_streams = sctp_new_association_resp->out_streams; - f1ap_du_data->default_sctp_stream_id = 0; /* setup parameters for F1U and start the server */ - DU_send_F1_SETUP_REQUEST(instance); + DU_send_F1_SETUP_REQUEST(instance, &f1ap_du_data->setupReq); } void du_task_handle_sctp_data_ind(instance_t instance, sctp_data_ind_t *sctp_data_ind) { @@ -109,14 +105,19 @@ void *F1AP_DU_task(void *arg) { LOG_D(F1AP, "DU Task Received %s for instance %ld\n", ITTI_MSG_NAME(msg),myInstance); switch (ITTI_MSG_ID(msg)) { - case F1AP_SETUP_REQ: { + case F1AP_SETUP_REQ: + AssertFatal(false, "the F1AP_SETUP_REQ should not be received; use the F1AP_DU_REGISTER_REQ instead\n"); + break; + + case F1AP_DU_REGISTER_REQ: { // this is not a true F1 message, but rather an ITTI message sent by gnb_app // 1. save the itti msg so that you can use it to sen f1ap_setup_req, fill the f1ap_setup_req message, // 2. store the message in f1ap context, that is also stored in RC // 2. send a sctp_association req - f1ap_setup_req_t *msgSetup = &F1AP_SETUP_REQ(msg); - createF1inst(false, myInstance, msgSetup); - du_task_send_sctp_association_req(myInstance, msgSetup); + f1ap_setup_req_t *msgSetup = &F1AP_DU_REGISTER_REQ(msg).setup_req; + f1ap_net_config_t *nc = &F1AP_DU_REGISTER_REQ(msg).net_config; + createF1inst(myInstance, msgSetup, nc); + du_task_send_sctp_association_req(myInstance, nc); } break; case F1AP_GNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE: diff --git a/openair2/F1AP/f1ap_du_task.h b/openair2/F1AP/f1ap_du_task.h index 2d5195baed..8ce8aacab6 100644 --- a/openair2/F1AP/f1ap_du_task.h +++ b/openair2/F1AP/f1ap_du_task.h @@ -22,7 +22,8 @@ #ifndef F1AP_DU_TASK_H_ #define F1AP_DU_TASK_H_ -void du_task_send_sctp_association_req(instance_t instance, f1ap_setup_req_t *f1ap_setup_req); +struct f1ap_net_config_t; +void du_task_send_sctp_association_req(instance_t instance, struct f1ap_net_config_t *du_inst); void du_task_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp); void du_task_handle_sctp_data_ind(instance_t instance, sctp_data_ind_t *sctp_data_ind); void *F1AP_DU_task(void *arg); diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index 352a29bd06..f3ee222bea 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -57,10 +57,7 @@ bool DURecvCb(protocol_ctxt_t *ctxt_pP, return true; } -int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) +int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { F1AP_UEContextSetupRequest_t *container; int i; @@ -85,9 +82,9 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ieNet, container, F1AP_ProtocolIE_ID_id_SpCell_ID, true); PLMNID_TO_MCC_MNC(&ieNet->value.choice.NRCGI.pLMN_Identity, - f1ap_ue_context_setup_req->mcc, - f1ap_ue_context_setup_req->mnc, - f1ap_ue_context_setup_req->mnc_digit_length); + f1ap_ue_context_setup_req->plmn.mcc, + f1ap_ue_context_setup_req->plmn.mnc, + f1ap_ue_context_setup_req->plmn.mnc_digit_length); BIT_STRING_TO_NR_CELL_IDENTITY(&ieNet->value.choice.NRCGI.nRCellIdentity, f1ap_ue_context_setup_req->nr_cellid); /* ServCellIndex */ F1AP_UEContextSetupRequestIEs_t *ieCell; @@ -150,7 +147,7 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, BIT_STRING_TO_TRANSPORT_LAYER_ADDRESS_IPv4(&ul_up_tnl0->transportLayerAddress, drb_p->up_ul_tnl[0].tl_address); OCTET_STRING_TO_UINT32(&ul_up_tnl0->gTP_TEID, drb_p->up_ul_tnl[0].teid); // 3GPP assumes GTP-U is on port 2152, but OAI is configurable - drb_p->up_ul_tnl[0].port=getCxt(false,instance)->setupReq.CUport; + drb_p->up_ul_tnl[0].port = getCxt(instance)->net_config.CUport; switch (drbs_tobesetup_item_p->rLCMode) { case F1AP_RLCMode_rlc_am: @@ -332,8 +329,7 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup asn1cCalloc(dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.choice.gTPTunnel,gTPTunnel); /* transportLayerAddress */ struct sockaddr_in addr= {0}; - inet_pton(AF_INET, getCxt(false,instance)->setupReq.DU_f1_ip_address.ipv4_address, - &addr.sin_addr.s_addr); + inet_pton(AF_INET, getCxt(instance)->net_config.DU_f1_ip_address.ipv4_address, &addr.sin_addr.s_addr); TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(addr.sin_addr.s_addr, &gTPTunnel->transportLayerAddress); /* gTP_TEID */ @@ -459,7 +455,9 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup F1AP_SCell_FailedtoSetup_Item_t *sCell_FailedtoSetup_item= &sCell_FailedtoSetup_item_ies->value.choice.SCell_FailedtoSetup_Item; /* sCell_ID */ - addnRCGI(sCell_FailedtoSetup_item->sCell_ID,f1ap_req(false, instance)->cell+i); + AssertFatal(false, "handle correct CellID\n"); + f1ap_served_cell_info_t cellID = {0}; + addnRCGI(sCell_FailedtoSetup_item->sCell_ID, &cellID); /* cause */ asn1cCalloc(sCell_FailedtoSetup_item->cause, tmp); // dummy value @@ -544,10 +542,7 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup return -1; } - f1ap_itti_send_sctp_data_req(false, instance, - buffer, - len, - getCxt(false, instance)->default_sctp_stream_id); + f1ap_itti_send_sctp_data_req(instance, buffer, len); return 0; } @@ -622,14 +617,11 @@ int DU_send_UE_CONTEXT_RELEASE_REQUEST(instance_t instance, return -1; } - f1ap_itti_send_sctp_data_req(false, instance, - buffer, - len, - getCxt(false, instance)->default_sctp_stream_id); + f1ap_itti_send_sctp_data_req(instance, buffer, len); return 0; } -int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) +int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { F1AP_UEContextReleaseCommand_t *container; F1AP_UEContextReleaseCommandIEs_t *ie; @@ -772,10 +764,7 @@ int DU_send_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, f1ap_ue_context_rel return -1; } - f1ap_itti_send_sctp_data_req(false, instance, - buffer, - len, - getCxt(false, instance)->default_sctp_stream_id); + f1ap_itti_send_sctp_data_req(instance, buffer, len); return 0; } @@ -789,7 +778,7 @@ static instance_t du_create_gtpu_instance_to_cu(char *CUaddr, uint16_t CUport, c return gtpv1Init(tmp); } -int DU_handle_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance, uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) +int DU_handle_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { F1AP_UEContextModificationRequest_t *container; int i; @@ -858,7 +847,7 @@ int DU_handle_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance, uint32_t asso BIT_STRING_TO_TRANSPORT_LAYER_ADDRESS_IPv4(&ul_up_tnl0->transportLayerAddress, drb_p->up_ul_tnl[0].tl_address); OCTET_STRING_TO_UINT32(&ul_up_tnl0->gTP_TEID, drb_p->up_ul_tnl[0].teid); // 3GPP assumes GTP-U is on port 2152, but OAI is configurable - drb_p->up_ul_tnl[0].port=getCxt(false,instance)->setupReq.CUport; + drb_p->up_ul_tnl[0].port = getCxt(instance)->net_config.CUport; extern instance_t DUuniqInstance; if (DUuniqInstance == 0) { @@ -870,16 +859,15 @@ int DU_handle_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance, uint32_t asso (drb_p->up_ul_tnl[0].tl_address >> 8) & 0xff, (drb_p->up_ul_tnl[0].tl_address >> 16) & 0xff, (drb_p->up_ul_tnl[0].tl_address >> 24) & 0xff); - getCxt(DUtype, instance)->gtpInst=du_create_gtpu_instance_to_cu( - gtp_tunnel_ip_address, - getCxt(false,instance)->setupReq.CUport, - getCxt(false,instance)->setupReq.DU_f1_ip_address.ipv4_address, - getCxt(false,instance)->setupReq.DUport); - AssertFatal(getCxt(DUtype, instance)->gtpInst>0,"Failed to create CU F1-U UDP listener"); + getCxt(instance)->gtpInst = du_create_gtpu_instance_to_cu(gtp_tunnel_ip_address, + getCxt(instance)->net_config.CUport, + getCxt(instance)->net_config.DU_f1_ip_address.ipv4_address, + getCxt(instance)->net_config.DUport); + AssertFatal(getCxt(instance)->gtpInst > 0, "Failed to create CU F1-U UDP listener"); // Fixme: fully inconsistent instances management // dirty global var is a bad fix extern instance_t legacyInstanceMapping; - legacyInstanceMapping = DUuniqInstance = getCxt(DUtype, instance)->gtpInst; + legacyInstanceMapping = DUuniqInstance = getCxt(instance)->gtpInst; } switch (drbs_tobesetupmod_item_p->rLCMode) { @@ -1035,7 +1023,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance, f1ap_ue_contex transport_layer_addr_t tl_addr = {0}; memcpy(tl_addr.buffer, &drb->up_ul_tnl[0].tl_address, sizeof(drb->up_ul_tnl[0].tl_address)); tl_addr.length = sizeof(drb->up_ul_tnl[0].tl_address) * 8; - drb->up_dl_tnl[j].teid = newGtpuCreateTunnel(getCxt(false, instance)->gtpInst, + drb->up_dl_tnl[j].teid = newGtpuCreateTunnel(getCxt(instance)->gtpInst, resp->gNB_DU_ue_id, drb->drb_id, drb->drb_id, @@ -1054,8 +1042,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance, f1ap_ue_contex asn1cCalloc(dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.choice.gTPTunnel,gTPTunnel); /* transportLayerAddress */ struct sockaddr_in addr= {0}; - inet_pton(AF_INET, getCxt(false,instance)->setupReq.DU_f1_ip_address.ipv4_address, - &addr.sin_addr.s_addr); + inet_pton(AF_INET, getCxt(instance)->net_config.DU_f1_ip_address.ipv4_address, &addr.sin_addr.s_addr); TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(addr.sin_addr.s_addr, &gTPTunnel->transportLayerAddress); /* gTP_TEID */ @@ -1093,8 +1080,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance, f1ap_ue_contex asn1cCalloc(dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.choice.gTPTunnel, gTPTunnel); /* transportLayerAddress */ struct sockaddr_in addr= {0}; - inet_pton(AF_INET, getCxt(false,instance)->setupReq.DU_f1_ip_address.ipv4_address, - &addr.sin_addr.s_addr); + inet_pton(AF_INET, getCxt(instance)->net_config.DU_f1_ip_address.ipv4_address, &addr.sin_addr.s_addr); TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(addr.sin_addr.s_addr, &gTPTunnel->transportLayerAddress); /* gTP_TEID */ INT32_TO_OCTET_STRING(resp->drbs_to_be_modified[i].up_dl_tnl[j].teid, &gTPTunnel->gTP_TEID); @@ -1169,7 +1155,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance, f1ap_ue_contex /* 8.1 SCell_ToBeSetup_Item */ F1AP_SCell_FailedtoSetupMod_Item_t *scell_failedtoSetupMod_item=&scell_failedtoSetupMod_item_ies->value.choice.SCell_FailedtoSetupMod_Item; /* - sCell_ID */ - addnRCGI(scell_failedtoSetupMod_item->sCell_ID, &f1ap_req(false, instance)->cell[i]); + addnRCGI(scell_failedtoSetupMod_item->sCell_ID, &getCxt(instance)->setupReq.cell[i].info); asn1cCalloc(scell_failedtoSetupMod_item->cause, tmp); tmp->present = F1AP_Cause_PR_radioNetwork; tmp->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnb_du_ue_f1ap_id; @@ -1278,7 +1264,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance, f1ap_ue_contex return -1; } - f1ap_itti_send_sctp_data_req(false, instance, buffer, len, getCxt(false, instance)->default_sctp_stream_id); + f1ap_itti_send_sctp_data_req(instance, buffer, len); return 0; } @@ -1402,11 +1388,11 @@ int DU_send_UE_CONTEXT_MODIFICATION_REQUIRED(instance_t instance, f1ap_ue_contex return -1; } - f1ap_itti_send_sctp_data_req(false, instance, buffer, len, getCxt(false, instance)->default_sctp_stream_id); + f1ap_itti_send_sctp_data_req(instance, buffer, len); return 0; } -int DU_handle_UE_CONTEXT_MODIFICATION_CONFIRM(instance_t instance, uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) +int DU_handle_UE_CONTEXT_MODIFICATION_CONFIRM(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { F1AP_UEContextModificationConfirm_t *container = &pdu->choice.successfulOutcome->value.choice.UEContextModificationConfirm; f1ap_ue_context_modif_confirm_t confirm = {0}; @@ -1482,7 +1468,7 @@ int DU_handle_UE_CONTEXT_MODIFICATION_CONFIRM(instance_t instance, uint32_t asso return 0; } -int DU_handle_UE_CONTEXT_MODIFICATION_REFUSE(instance_t instance, uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) +int DU_handle_UE_CONTEXT_MODIFICATION_REFUSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { F1AP_UEContextModificationRefuse_t *container = &pdu->choice.unsuccessfulOutcome->value.choice.UEContextModificationRefuse; f1ap_ue_context_modif_refuse_t refuse = {0}; diff --git a/openair2/F1AP/f1ap_du_ue_context_management.h b/openair2/F1AP/f1ap_du_ue_context_management.h index cd8565f328..536007da42 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.h +++ b/openair2/F1AP/f1ap_du_ue_context_management.h @@ -38,10 +38,7 @@ */ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup_t *req); -int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); +int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); int DU_send_UE_CONTEXT_SETUP_FAILURE(instance_t instance); @@ -55,10 +52,7 @@ int DU_send_UE_CONTEXT_RELEASE_REQUEST(instance_t instance, /* * UE Context Release Command (gNB-CU initiated) */ -int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); +int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); /* * UE Context Release Complete (gNB-DU initiated) @@ -68,10 +62,7 @@ int DU_send_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, f1ap_ue_context_rel /* * UE Context Modification (gNB-CU initiated) */ -int DU_handle_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); +int DU_handle_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance, f1ap_ue_context_modif_resp_t *resp); int DU_send_UE_CONTEXT_MODIFICATION_FAILURE(instance_t instance); @@ -80,10 +71,8 @@ int DU_send_UE_CONTEXT_MODIFICATION_FAILURE(instance_t instance); * UE Context Modification Required (gNB-DU initiated) */ int DU_send_UE_CONTEXT_MODIFICATION_REQUIRED(instance_t instance, f1ap_ue_context_modif_required_t *required); - -int DU_handle_UE_CONTEXT_MODIFICATION_CONFIRM(instance_t instance, uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); - -int DU_handle_UE_CONTEXT_MODIFICATION_REFUSE(instance_t instance, uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); +int DU_handle_UE_CONTEXT_MODIFICATION_CONFIRM(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); +int DU_handle_UE_CONTEXT_MODIFICATION_REFUSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); /* * UE Inactivity Notification diff --git a/openair2/F1AP/f1ap_handlers.c b/openair2/F1AP/f1ap_handlers.c index cf2530c850..458299e626 100644 --- a/openair2/F1AP/f1ap_handlers.c +++ b/openair2/F1AP/f1ap_handlers.c @@ -97,7 +97,7 @@ static F1AP_F1AP_PDU_t *f1ap_decode_pdu(const uint8_t *const buffer, uint32_t le } int f1ap_handle_message(instance_t instance, - uint32_t assoc_id, + sctp_assoc_t assoc_id, int32_t stream, const uint8_t *const data, const uint32_t data_length) diff --git a/openair2/F1AP/f1ap_itti_messaging.c b/openair2/F1AP/f1ap_itti_messaging.c index 12386b69d6..d4e112d1d5 100644 --- a/openair2/F1AP/f1ap_itti_messaging.c +++ b/openair2/F1AP/f1ap_itti_messaging.c @@ -22,26 +22,27 @@ #include "f1ap_common.h" #include "f1ap_itti_messaging.h" -void f1ap_itti_send_sctp_data_req(bool isCu, instance_t instance, uint8_t *buffer, - uint32_t buffer_length, uint16_t stream) { +void f1ap_itti_send_sctp_data_req(instance_t instance, uint8_t *buffer, uint32_t buffer_length) +{ MessageDef *message_p; sctp_data_req_t *sctp_data_req; - message_p = itti_alloc_new_message(isCu?TASK_CU_F1:TASK_DU_F1, 0, SCTP_DATA_REQ); + message_p = itti_alloc_new_message(TASK_CU_F1, 0, SCTP_DATA_REQ); sctp_data_req = &message_p->ittiMsg.sctp_data_req; - sctp_data_req->assoc_id = f1ap_assoc_id(isCu,instance); + sctp_data_req->assoc_id = getCxt(instance)->assoc_id; sctp_data_req->buffer = buffer; sctp_data_req->buffer_length = buffer_length; - sctp_data_req->stream = stream; + sctp_data_req->stream = 0; LOG_D(F1AP, "Sending ITTI message to SCTP Task\n"); itti_send_msg_to_task(TASK_SCTP, instance, message_p); } -void f1ap_itti_send_sctp_close_association(bool isCu, instance_t instance) { +void f1ap_itti_send_sctp_close_association(instance_t instance) +{ MessageDef *message_p = NULL; sctp_close_association_t *sctp_close_association_p = NULL; message_p = itti_alloc_new_message(TASK_S1AP, 0, SCTP_CLOSE_ASSOCIATION); sctp_close_association_p = &message_p->ittiMsg.sctp_close_association; - sctp_close_association_p->assoc_id = f1ap_assoc_id(isCu,instance); + sctp_close_association_p->assoc_id = getCxt(instance)->assoc_id; itti_send_msg_to_task(TASK_SCTP, instance, message_p); } diff --git a/openair2/F1AP/f1ap_itti_messaging.h b/openair2/F1AP/f1ap_itti_messaging.h index a6499849a9..b132b3d826 100644 --- a/openair2/F1AP/f1ap_itti_messaging.h +++ b/openair2/F1AP/f1ap_itti_messaging.h @@ -22,7 +22,6 @@ #ifndef F1AP_ITTI_MESSAGING_H_ #define F1AP_ITTI_MESSAGING_H_ -void f1ap_itti_send_sctp_data_req(bool isCu,instance_t instance, uint8_t *buffer, - uint32_t buffer_length, uint16_t stream); +void f1ap_itti_send_sctp_data_req(instance_t instance, uint8_t *buffer, uint32_t buffer_length); #endif /* F1AP_ITTI_MESSAGING_H_ */ diff --git a/openair2/GNB_APP/gnb_app.c b/openair2/GNB_APP/gnb_app.c index 337f907a20..cd701f01f5 100644 --- a/openair2/GNB_APP/gnb_app.c +++ b/openair2/GNB_APP/gnb_app.c @@ -52,31 +52,14 @@ #include "openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h" #include "openair2/E1AP/e1ap.h" #include "gnb_config.h" +#include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h" + extern unsigned char NB_gNB_INST; extern RAN_CONTEXT_t RC; #define GNB_REGISTER_RETRY_DELAY 10 -/*------------------------------------------------------------------------------*/ -void configure_nr_rrc(uint32_t gnb_id) -{ - MessageDef *msg_p = NULL; - // int CC_id; - - msg_p = itti_alloc_new_message (TASK_GNB_APP, 0, NRRRC_CONFIGURATION_REQ); - - if (RC.nrrrc[gnb_id]) { - RCconfig_NRRRC(msg_p,gnb_id, RC.nrrrc[gnb_id]); - - LOG_I(GNB_APP, "RRC starting with node type %d\n", RC.nrrrc[gnb_id]->node_type); - LOG_I(GNB_APP,"Sending configuration message to NR_RRC task\n"); - itti_send_msg_to_task (TASK_RRC_GNB, GNB_MODULE_ID_TO_INSTANCE(gnb_id), msg_p); - - } - else AssertFatal(0,"NRRRC context for gNB %u not allocated\n",gnb_id); -} - /*------------------------------------------------------------------------------*/ @@ -179,12 +162,10 @@ void *gNB_app_task(void *args_p) LOG_E(F1AP, "Create task for F1AP DU failed\n"); AssertFatal(1==0,"exiting"); } - // configure F1AP here for F1C - LOG_I(GNB_APP,"ngran_gNB_DU: Allocating ITTI message for F1AP_SETUP_REQ\n"); - msg_p = itti_alloc_new_message (TASK_GNB_APP, 0, F1AP_SETUP_REQ); - RCconfig_NR_DU_F1(msg_p, 0); - - itti_send_msg_to_task (TASK_DU_F1, GNB_MODULE_ID_TO_INSTANCE(0), msg_p); + } + if (NODE_IS_DU(node_type) || NODE_IS_MONOLITHIC(node_type)) { + // need to check SA? + nr_mac_send_f1_setup_req(); } } do { @@ -249,15 +230,9 @@ void *gNB_app_task(void *args_p) break; case F1AP_SETUP_RESP: - AssertFatal(NODE_IS_DU(node_type), "Should not have received F1AP_SETUP_RESP in CU/gNB\n"); - - LOG_I(GNB_APP, "Received %s: associated ngran_gNB_CU %s with %d cells to activate\n", ITTI_MSG_NAME (msg_p), - F1AP_SETUP_RESP(msg_p).gNB_CU_name,F1AP_SETUP_RESP(msg_p).num_cells_to_activate); - cell_to_activate = F1AP_SETUP_RESP(msg_p).num_cells_to_activate; - - gNB_app_handle_f1ap_setup_resp(&F1AP_SETUP_RESP(msg_p)); - + AssertFatal(false, "Should not received this, logic bug\n"); break; + case F1AP_GNB_CU_CONFIGURATION_UPDATE: AssertFatal(NODE_IS_DU(node_type), "Should not have received F1AP_GNB_CU_CONFIGURATION_UPDATE in CU/gNB\n"); diff --git a/openair2/GNB_APP/gnb_app.h b/openair2/GNB_APP/gnb_app.h index 44c4374fc3..0b70ca0bdb 100644 --- a/openair2/GNB_APP/gnb_app.h +++ b/openair2/GNB_APP/gnb_app.h @@ -33,7 +33,6 @@ #include void *gNB_app_task(void *args_p); -void configure_nr_rrc(uint32_t gnb_id); uint32_t gNB_app_register(uint32_t gnb_id_start, uint32_t gnb_id_end); uint32_t gNB_app_register_x2(uint32_t gnb_id_start, uint32_t gnb_id_end); #endif /* GNB_APP_H_ */ diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index d724785399..e190b21748 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -47,6 +47,7 @@ #include "sctp_eNB_task.h" #include "sctp_default_values.h" #include "F1AP_CauseRadioNetwork.h" +#include "f1ap_common.h" // #include "SystemInformationBlockType2.h" // #include "LAYER2/MAC/extern.h" // #include "LAYER2/MAC/proto.h" @@ -647,6 +648,64 @@ void fix_scd(NR_ServingCellConfig_t *scd) { } } +static void verify_gnb_param_notset(paramdef_t *params, int paramidx, const char *paramname) +{ + char aprefix[MAX_OPTNAME_SIZE * 2 + 8]; + sprintf(aprefix, "%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, 0); + AssertFatal(!config_isparamset(params, paramidx), + "Option \"%s." GNB_CONFIG_STRING_SERVINGCELLCONFIGCOMMON + ".%s\" is not allowed in this config, please remove it\n", + aprefix, + paramname); +} +static void verify_section_notset(char *aprefix, const char *secname) +{ + paramlist_def_t pl = {0}; + strncpy(pl.listname, secname, sizeof(pl.listname) - 1); + config_getlist(&pl, NULL, 0, aprefix); + AssertFatal(pl.numelt == 0, "Section \"%s.%s\" not allowed in this config, please remove it\n", aprefix ? aprefix : "", secname); +} +void RCconfig_verify(ngran_node_t node_type) +{ + paramdef_t GNBSParams[] = GNBSPARAMS_DESC; + config_get(GNBSParams, sizeof(GNBSParams) / sizeof(paramdef_t), NULL); + int num_gnbs = GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt; + AssertFatal(num_gnbs == 1, "need to have a " GNB_CONFIG_STRING_GNB_LIST " section, but %d found\n", num_gnbs); + paramlist_def_t GNBParamList = {GNB_CONFIG_STRING_GNB_LIST, NULL, 0}; + paramdef_t GNBParams[] = GNBPARAMS_DESC; + config_getlist(&GNBParamList, GNBParams, sizeof(GNBParams) / sizeof(paramdef_t), NULL); + paramdef_t *gnbp = GNBParamList.paramarray[0]; + + if (NODE_IS_CU(node_type)) { + // verify that there is no SCC and radio config in the case of CU + verify_section_notset(GNB_CONFIG_STRING_GNB_LIST ".[0]", GNB_CONFIG_STRING_SERVINGCELLCONFIGCOMMON); + + verify_gnb_param_notset(gnbp, GNB_PDSCH_ANTENNAPORTS_N1_IDX, GNB_CONFIG_STRING_PDSCHANTENNAPORTS_N1); + verify_gnb_param_notset(gnbp, GNB_PDSCH_ANTENNAPORTS_N2_IDX, GNB_CONFIG_STRING_PDSCHANTENNAPORTS_N2); + verify_gnb_param_notset(gnbp, GNB_PDSCH_ANTENNAPORTS_XP_IDX, GNB_CONFIG_STRING_PDSCHANTENNAPORTS_XP); + verify_gnb_param_notset(gnbp, GNB_PUSCH_ANTENNAPORTS_IDX, GNB_CONFIG_STRING_PUSCHANTENNAPORTS); + verify_gnb_param_notset(gnbp, GNB_MINRXTXTIME_IDX, GNB_CONFIG_STRING_MINRXTXTIME); + verify_gnb_param_notset(gnbp, GNB_SIB1_TDA_IDX, GNB_CONFIG_STRING_SIB1TDA); + verify_gnb_param_notset(gnbp, GNB_DO_CSIRS_IDX, GNB_CONFIG_STRING_DOCSIRS); + verify_gnb_param_notset(gnbp, GNB_DO_SRS_IDX, GNB_CONFIG_STRING_DOSRS); + verify_gnb_param_notset(gnbp, GNB_FORCE256QAMOFF_IDX, GNB_CONFIG_STRING_FORCE256QAMOFF); + + // check for some general sections + verify_section_notset(NULL, CONFIG_STRING_L1_LIST); + verify_section_notset(NULL, CONFIG_STRING_RU_LIST); + verify_section_notset(NULL, CONFIG_STRING_MACRLC_LIST); + } else if (NODE_IS_DU(node_type)) { + // verify that there is no bearer config + verify_gnb_param_notset(gnbp, GNB_ENABLE_SDAP_IDX, GNB_CONFIG_STRING_ENABLE_SDAP); + verify_gnb_param_notset(gnbp, GNB_DRBS, GNB_CONFIG_STRING_DRBS); + + verify_section_notset(GNB_CONFIG_STRING_GNB_LIST ".", GNB_CONFIG_STRING_AMF_IP_ADDRESS); + verify_section_notset(NULL, CONFIG_STRING_SECURITY); + } // else nothing to be checked + + /* other possible verifications: PNF, VNF, CU-CP, CU-UP, ...? */ +} + void RCconfig_nr_prs(void) { uint16_t j = 0, k = 0; @@ -872,22 +931,221 @@ void RCconfig_NR_L1(void) } } +static void check_ssb_raster(uint64_t freq, int band, int scs); + +static NR_ServingCellConfigCommon_t *get_scc_config(int minRXTXTIME) +{ + NR_ServingCellConfigCommon_t *scc = calloc(1,sizeof(*scc)); + uint64_t ssb_bitmap=0xff; + prepare_scc(scc); + paramdef_t SCCsParams[] = SCCPARAMS_DESC(scc); + paramlist_def_t SCCsParamList = {GNB_CONFIG_STRING_SERVINGCELLCONFIGCOMMON, NULL, 0}; + + char aprefix[MAX_OPTNAME_SIZE*2 + 8]; + sprintf(aprefix, "%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, 0); + config_getlist(&SCCsParamList, NULL, 0, aprefix); + if (SCCsParamList.numelt > 0) { + sprintf(aprefix, "%s.[%i].%s.[%i]", GNB_CONFIG_STRING_GNB_LIST,0,GNB_CONFIG_STRING_SERVINGCELLCONFIGCOMMON, 0); + config_get(SCCsParams,sizeof(SCCsParams) / sizeof(paramdef_t), aprefix); + LOG_I(RRC, + "Read in ServingCellConfigCommon (PhysCellId %d, ABSFREQSSB %d, DLBand %d, ABSFREQPOINTA %d, DLBW " + "%d,RACH_TargetReceivedPower %d\n", + (int)*scc->physCellId, + (int)*scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB, + (int)*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], + (int)scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA, + (int)scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth, + (int)scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric + .preambleReceivedTargetPower); + // SSB of the PCell is always on the sync raster + uint64_t ssb_freq = from_nrarfcn(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], + *scc->ssbSubcarrierSpacing, + *scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB); + LOG_I(RRC, "absoluteFrequencySSB %ld corresponds to %lu Hz\n", + *scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB, ssb_freq); + if (get_softmodem_params()->sa) + check_ssb_raster(ssb_freq, + *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], + *scc->ssbSubcarrierSpacing); + fix_scc(scc, ssb_bitmap); + } + nr_rrc_config_ul_tda(scc, minRXTXTIME); + return scc; +} + +static NR_ServingCellConfig_t *get_scd_config(void) +{ + char aprefix[MAX_OPTNAME_SIZE*2 + 8]; + NR_ServingCellConfig_t *scd = calloc(1, sizeof(*scd)); + prepare_scd(scd); + paramdef_t SCDsParams[] = SCDPARAMS_DESC(scd); + paramlist_def_t SCDsParamList = {GNB_CONFIG_STRING_SERVINGCELLCONFIGDEDICATED, NULL, 0}; + config_getlist(&SCDsParamList, NULL, 0, aprefix); + if (SCDsParamList.numelt > 0) { + sprintf(aprefix, "%s.[%i].%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, 0, GNB_CONFIG_STRING_SERVINGCELLCONFIGDEDICATED, 0); + config_get(SCDsParams, sizeof(SCDsParams) / sizeof(paramdef_t), aprefix); + const NR_BWP_UplinkDedicated_t *bwp_Dedicated = scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated; + const NR_PTRS_UplinkConfig_t *setup = + bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup; + LOG_I(RRC, + "Read in ServingCellConfigDedicated UL (FreqDensity_0 %ld, FreqDensity_1 %ld, TimeDensity_0 %ld, TimeDensity_1 %ld, " + "TimeDensity_2 %ld, RE offset %ld, First_active_BWP_ID %ld SCS %ld, LocationandBW %ld\n", + *setup->transformPrecoderDisabled->frequencyDensity->list.array[0], + *setup->transformPrecoderDisabled->frequencyDensity->list.array[1], + *setup->transformPrecoderDisabled->timeDensity->list.array[0], + *setup->transformPrecoderDisabled->timeDensity->list.array[1], + *setup->transformPrecoderDisabled->timeDensity->list.array[2], + *setup->transformPrecoderDisabled->resourceElementOffset, + *scd->firstActiveDownlinkBWP_Id, + scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Common->genericParameters.subcarrierSpacing, + scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Common->genericParameters.locationAndBandwidth); + } + fix_scd(scd); + + return scd; +} + +static int read_du_cell_info(uint64_t *id, char **name, f1ap_served_cell_info_t *info, int max_cell_info) +{ + AssertFatal(max_cell_info == 1, "only one cell supported\n"); + memset(info, 0, sizeof(*info)); + + paramdef_t GNBSParams[] = GNBSPARAMS_DESC; + paramdef_t GNBParams[] = GNBPARAMS_DESC; + paramlist_def_t GNBParamList = {GNB_CONFIG_STRING_GNB_LIST,NULL,0}; + config_get( GNBSParams,sizeof(GNBSParams)/sizeof(paramdef_t),NULL); + int num_gnbs = GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt; + AssertFatal(num_gnbs == 1, "cannot configure DU: required config section \"gNBs\" missing\n"); + + // Output a list of all eNBs. + config_getlist(&GNBParamList, GNBParams, sizeof(GNBParams) / sizeof(paramdef_t), NULL); + AssertFatal(GNBParamList.paramarray[0][GNB_GNB_ID_IDX].uptr != NULL, "gNB id %u is not defined in configuration file\n", 0); + + AssertFatal(strcmp(GNBSParams[GNB_ACTIVE_GNBS_IDX].strlistptr[0], *GNBParamList.paramarray[0][GNB_GNB_NAME_IDX].strptr) == 0, + "no active gNB found/mismatch of gNBs: %s vs %s\n", + GNBSParams[GNB_ACTIVE_GNBS_IDX].strlistptr[0], + *GNBParamList.paramarray[0][GNB_GNB_NAME_IDX].strptr); + + char aprefix[MAX_OPTNAME_SIZE * 2 + 8]; + sprintf(aprefix, "%s.[0]", GNB_CONFIG_STRING_GNB_LIST); + paramdef_t PLMNParams[] = GNBPLMNPARAMS_DESC; + /* map parameter checking array instances to parameter definition array instances */ + checkedparam_t config_check_PLMNParams[] = PLMNPARAMS_CHECK; + for (int I = 0; I < sizeof(PLMNParams) / sizeof(paramdef_t); ++I) + PLMNParams[I].chkPptr = &(config_check_PLMNParams[I]); + paramlist_def_t PLMNParamList = {GNB_CONFIG_STRING_PLMN_LIST, NULL, 0}; + config_getlist(&PLMNParamList, PLMNParams, sizeof(PLMNParams) / sizeof(paramdef_t), aprefix); + + *id = *(GNBParamList.paramarray[0][GNB_GNB_ID_IDX].uptr); + *name = strdup(*(GNBParamList.paramarray[0][GNB_GNB_NAME_IDX].strptr)); + info->tac = malloc(sizeof(*info->tac)); + AssertFatal(info->tac != NULL, "out of memory\n"); + *info->tac = *GNBParamList.paramarray[0][GNB_TRACKING_AREA_CODE_IDX].uptr; + info->plmn.mcc = *PLMNParamList.paramarray[0][GNB_MOBILE_COUNTRY_CODE_IDX].uptr; + info->plmn.mnc = *PLMNParamList.paramarray[0][GNB_MOBILE_NETWORK_CODE_IDX].uptr; + info->plmn.mnc_digit_length = *PLMNParamList.paramarray[0][GNB_MNC_DIGIT_LENGTH].u8ptr; + AssertFatal((info->plmn.mnc_digit_length == 2) || (info->plmn.mnc_digit_length == 3), + "BAD MNC DIGIT LENGTH %d", + info->plmn.mnc_digit_length); + info->nr_cellid = (uint64_t) * (GNBParamList.paramarray[0][GNB_NRCELLID_IDX].u64ptr); + + LOG_W(GNB_APP, "no slices transported via F1 Setup Request!\n"); + info->num_ssi = 0; + + return 1; +} + +static f1ap_setup_req_t *RC_read_F1Setup(uint64_t id, + const char *name, + const f1ap_served_cell_info_t *info, + const NR_ServingCellConfigCommon_t *scc, + NR_BCCH_BCH_Message_t *mib, + const NR_BCCH_DL_SCH_Message_t *sib1) +{ + f1ap_setup_req_t *req = calloc(1, sizeof(*req)); + AssertFatal(req != NULL, "out of memory\n"); + req->gNB_DU_id = id; + req->gNB_DU_name = strdup(name); + req->num_cells_available = 1; + req->cell[0].info = *info; + LOG_I(GNB_APP, + "F1AP: gNB idx %d gNB_DU_id %ld, gNB_DU_name %s, TAC %d MCC/MNC/length %d/%d/%d cellID %ld\n", + 0, + req->gNB_DU_id, + req->gNB_DU_name, + *req->cell[0].info.tac, + req->cell[0].info.plmn.mcc, + req->cell[0].info.plmn.mnc, + req->cell[0].info.plmn.mnc_digit_length, + req->cell[0].info.nr_cellid); + + req->cell[0].info.nr_pci = *scc->physCellId; + if (scc->tdd_UL_DL_ConfigurationCommon) { + LOG_I(GNB_APP, "ngran_DU: Configuring Cell %d for TDD\n", 0); + req->cell[0].info.mode = F1AP_MODE_TDD; + f1ap_tdd_info_t *tdd = &req->cell[0].info.tdd; + tdd->freqinfo.arfcn = scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA; + tdd->tbw.scs = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; + tdd->tbw.nrb = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; + tdd->freqinfo.band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; + } else { + LOG_I(GNB_APP, "ngran_DU: Configuring Cell %d for FDD\n", 0); + req->cell[0].info.mode = F1AP_MODE_FDD; + f1ap_fdd_info_t *fdd = &req->cell[0].info.fdd; + fdd->dl_freqinfo.arfcn = scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA; + fdd->ul_freqinfo.arfcn = *scc->uplinkConfigCommon->frequencyInfoUL->absoluteFrequencyPointA; + fdd->dl_tbw.scs = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; + fdd->ul_tbw.scs = scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; + fdd->dl_tbw.nrb = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; + fdd->ul_tbw.nrb = scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; + fdd->dl_freqinfo.band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; + fdd->ul_freqinfo.band = *scc->uplinkConfigCommon->frequencyInfoUL->frequencyBandList->list.array[0]; + } + + req->cell[0].info.measurement_timing_information = "0"; + + int buf_len = 3; // this is what we assume in monolithic + req->cell[0].sys_info = calloc(1, sizeof(*req->cell[0].sys_info)); + AssertFatal(req->cell[0].sys_info != NULL, "out of memory\n"); + f1ap_gnb_du_system_info_t *sys_info = req->cell[0].sys_info; + sys_info->mib = calloc(buf_len, sizeof(*sys_info->mib)); + DevAssert(sys_info->mib != NULL); + DevAssert(mib != NULL); + sys_info->mib_length = encode_MIB_NR(mib, 0, sys_info->mib, buf_len); + DevAssert(sys_info->mib_length == buf_len); + + if (get_softmodem_params()->sa) { + // in NSA we don't transmit SIB1 + DevAssert(sib1 != NULL); + NR_SIB1_t *bcch_SIB1 = sib1->message.choice.c1->choice.systemInformationBlockType1; + sys_info->sib1 = calloc(NR_MAX_SIB_LENGTH / 8, sizeof(*sys_info->sib1)); + asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_SIB1, NULL, (void *)bcch_SIB1, sys_info->sib1, NR_MAX_SIB_LENGTH / 8); + AssertFatal(enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); + sys_info->sib1_length = (enc_rval.encoded + 7) / 8; + } + + return req; +} + void RCconfig_nr_macrlc() { int j = 0; uint16_t prbbl[275] = {0}; int num_prbbl = 0; + + paramlist_def_t GNBParamList = {GNB_CONFIG_STRING_GNB_LIST, NULL, 0}; + paramdef_t GNBSParams[] = GNBSPARAMS_DESC; + config_get(GNBSParams, sizeof(GNBSParams) / sizeof(paramdef_t), NULL); + int num_gnbs = GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt; + AssertFatal(num_gnbs == 1, + "Failed to parse config file: number of gnbs for gNB %s is %d != 1\n", + GNB_CONFIG_STRING_ACTIVE_GNBS, + num_gnbs); + paramdef_t GNBParams[] = GNBPARAMS_DESC; + config_getlist(&GNBParamList, GNBParams, sizeof(GNBParams) / sizeof(paramdef_t), NULL); + if (NFAPI_MODE != NFAPI_MODE_PNF) { - paramdef_t GNBSParams[] = GNBSPARAMS_DESC; ////////// Identification parameters - paramdef_t GNBParams[] = GNBPARAMS_DESC; - paramlist_def_t GNBParamList = {GNB_CONFIG_STRING_GNB_LIST, NULL, 0}; - - config_get(GNBSParams, sizeof(GNBSParams) / sizeof(paramdef_t), NULL); - int num_gnbs = GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt; - AssertFatal(num_gnbs > 0, "Failed to parse config file no gnbs %s \n", GNB_CONFIG_STRING_ACTIVE_GNBS); - - config_getlist(&GNBParamList, GNBParams, sizeof(GNBParams) / sizeof(paramdef_t), NULL); char *ulprbbl = *GNBParamList.paramarray[0][GNB_ULPRBBLACKLIST_IDX].strptr; char *save = NULL; char *pt = strtok_r(ulprbbl, ",", &save); @@ -908,10 +1166,39 @@ void RCconfig_nr_macrlc() { MacRLC_Params[i].chkPptr = &(config_check_MacRLCParams[i]); config_getlist(&MacRLC_ParamList, MacRLC_Params, sizeof(MacRLC_Params) / sizeof(paramdef_t), NULL); + nr_mac_config_t config = {0}; + config.pdsch_AntennaPorts.N1 = *GNBParamList.paramarray[0][GNB_PDSCH_ANTENNAPORTS_N1_IDX].iptr; + config.pdsch_AntennaPorts.N2 = *GNBParamList.paramarray[0][GNB_PDSCH_ANTENNAPORTS_N2_IDX].iptr; + config.pdsch_AntennaPorts.XP = *GNBParamList.paramarray[0][GNB_PDSCH_ANTENNAPORTS_XP_IDX].iptr; + config.pusch_AntennaPorts = *GNBParamList.paramarray[0][GNB_PUSCH_ANTENNAPORTS_IDX].iptr; + LOG_I(GNB_APP, + "pdsch_AntennaPorts N1 %d N2 %d XP %d pusch_AntennaPorts %d\n", + config.pdsch_AntennaPorts.N1, + config.pdsch_AntennaPorts.N2, + config.pdsch_AntennaPorts.XP, + config.pusch_AntennaPorts); + + config.minRXTXTIME = *GNBParamList.paramarray[0][GNB_MINRXTXTIME_IDX].iptr; + LOG_I(GNB_APP, "minTXRXTIME %d\n", config.minRXTXTIME); + config.sib1_tda = *GNBParamList.paramarray[0][GNB_SIB1_TDA_IDX].iptr; + LOG_I(GNB_APP, "SIB1 TDA %d\n", config.sib1_tda); + config.do_CSIRS = *GNBParamList.paramarray[0][GNB_DO_CSIRS_IDX].iptr; + config.do_SRS = *GNBParamList.paramarray[0][GNB_DO_SRS_IDX].iptr; + config.force_256qam_off = *GNBParamList.paramarray[0][GNB_FORCE256QAMOFF_IDX].iptr; + LOG_I(GNB_APP, + "CSI-RS %d, SRS %d, 256 QAM %s\n", + config.do_CSIRS, + config.do_SRS, + config.force_256qam_off ? "force off" : "may be on"); + + NR_ServingCellConfigCommon_t *scc = get_scc_config(config.minRXTXTIME); + //xer_fprint(stdout, &asn_DEF_NR_ServingCellConfigCommon, scc); + NR_ServingCellConfig_t *scd = get_scd_config(); + if (MacRLC_ParamList.numelt > 0) { RC.nb_nr_macrlc_inst = MacRLC_ParamList.numelt; ngran_node_t node_type = get_node_type(); - mac_top_init_gNB(node_type); + mac_top_init_gNB(node_type, scc, scd, &config); RC.nb_nr_mac_CC = (int *)malloc(RC.nb_nr_macrlc_inst * sizeof(int)); for (j = 0; j < RC.nb_nr_macrlc_inst; j++) { @@ -992,6 +1279,25 @@ void RCconfig_nr_macrlc() { RC.nrmac[j]->num_ulprbbl = num_prbbl; memcpy(RC.nrmac[j]->ulprbbl, prbbl, 275 * sizeof(prbbl[0])); } // for (j=0;jsa) + nr_mac_configure_sib1(RC.nrmac[0], &info.plmn, info.nr_cellid, *info.tac); + + // read F1 Setup information from config and generated MIB/SIB1 + // and store it at MAC for sending later + NR_BCCH_BCH_Message_t *mib = RC.nrmac[0]->common_channels[0].mib; + const NR_BCCH_DL_SCH_Message_t *sib1 = RC.nrmac[0]->common_channels[0].sib1; + f1ap_setup_req_t *req = RC_read_F1Setup(id, name, &info, scc, mib, sib1); + AssertFatal(req != NULL, "could not read F1 Setup information\n"); + RC.nrmac[0]->f1_config.setup_req = req; + + free(name); /* read_du_cell_info() allocated memory */ + } else { // MacRLC_ParamList.numelt > 0 LOG_E(PHY, "No %s configuration found\n", CONFIG_STRING_MACRLC_LIST); // AssertFatal (0,"No " CONFIG_STRING_MACRLC_LIST " configuration found"); @@ -1118,7 +1424,7 @@ void config_security(gNB_RRC_INST *rrc) } // Section 5.4.3 of 38.101-1 and -2 -void check_ssb_raster(uint64_t freq, int band, int scs) +static void check_ssb_raster(uint64_t freq, int band, int scs) { int start_gscn = 0, step_gscn = 0, end_gscn = 0; for (int i = 0; i < sizeof(sync_raster) / sizeof(sync_raster_t); i++) { @@ -1167,32 +1473,20 @@ void check_ssb_raster(uint64_t freq, int band, int scs) gscn, freq, band); } -void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) +void RCconfig_NRRRC(gNB_RRC_INST *rrc) { int num_gnbs = 0; char aprefix[MAX_OPTNAME_SIZE*2 + 8]; int32_t gnb_id = 0; int k = 0; + int i = 0; paramdef_t GNBSParams[] = GNBSPARAMS_DESC; ////////// Identification parameters paramdef_t GNBParams[] = GNBPARAMS_DESC; paramlist_def_t GNBParamList = {GNB_CONFIG_STRING_GNB_LIST,NULL,0}; - NR_ServingCellConfigCommon_t *scc = calloc(1,sizeof(*scc)); - uint64_t ssb_bitmap=0xff; - prepare_scc(scc); - paramdef_t SCCsParams[] = SCCPARAMS_DESC(scc); - paramlist_def_t SCCsParamList = {GNB_CONFIG_STRING_SERVINGCELLCONFIGCOMMON, NULL, 0}; - - // Serving Cell Config Dedicated - NR_ServingCellConfig_t *scd = calloc(1,sizeof(NR_ServingCellConfig_t)); - memset((void*)scd,0,sizeof(NR_ServingCellConfig_t)); - prepare_scd(scd); - paramdef_t SCDsParams[] = SCDPARAMS_DESC(scd); - paramlist_def_t SCDsParamList = {GNB_CONFIG_STRING_SERVINGCELLCONFIGDEDICATED, NULL, 0}; - ////////// Physical parameters /* get global parameters, defined outside any section in the config file */ @@ -1200,6 +1494,7 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) config_get( GNBSParams,sizeof(GNBSParams)/sizeof(paramdef_t),NULL); num_gnbs = GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt; AssertFatal (i 0) { @@ -1220,50 +1515,6 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) sprintf(aprefix, "%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, 0); - config_getlist(&SCCsParamList, NULL, 0, aprefix); - if (SCCsParamList.numelt > 0) { - sprintf(aprefix, "%s.[%i].%s.[%i]", GNB_CONFIG_STRING_GNB_LIST,0,GNB_CONFIG_STRING_SERVINGCELLCONFIGCOMMON, 0); - config_get(SCCsParams,sizeof(SCCsParams) / sizeof(paramdef_t), aprefix); - LOG_I(RRC,"Read in ServingCellConfigCommon (PhysCellId %d, ABSFREQSSB %d, DLBand %d, ABSFREQPOINTA %d, DLBW %d,RACH_TargetReceivedPower %d\n", - (int)*scc->physCellId, - (int)*scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB, - (int)*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], - (int)scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA, - (int)scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth, - (int)scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.preambleReceivedTargetPower); - // SSB of the PCell is always on the sync raster - uint64_t ssb_freq = from_nrarfcn(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], - *scc->ssbSubcarrierSpacing, - *scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB); - LOG_I(RRC, "absoluteFrequencySSB %ld corresponds to %lu Hz\n", - *scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB, ssb_freq); - if (get_softmodem_params()->sa) - check_ssb_raster(ssb_freq, - *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], - *scc->ssbSubcarrierSpacing); - fix_scc(scc, ssb_bitmap); - } - - sprintf(aprefix, "%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, 0); - - config_getlist(&SCDsParamList, NULL, 0, aprefix); - if (SCDsParamList.numelt > 0) { - sprintf(aprefix, "%s.[%i].%s.[%i]", GNB_CONFIG_STRING_GNB_LIST,0,GNB_CONFIG_STRING_SERVINGCELLCONFIGDEDICATED, 0); - config_get( SCDsParams,sizeof(SCDsParams)/sizeof(paramdef_t),aprefix); - LOG_I(RRC,"Read in ServingCellConfigDedicated UL (FreqDensity_0 %d, FreqDensity_1 %d, TimeDensity_0 %d, TimeDensity_1 %d, TimeDensity_2 %d, RE offset %d, First_active_BWP_ID %d SCS %d, LocationandBW %d \n", - (int)*scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->frequencyDensity->list.array[0], - (int)*scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->frequencyDensity->list.array[1], - (int)*scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->timeDensity->list.array[0], - (int)*scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->timeDensity->list.array[1], - (int)*scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->timeDensity->list.array[2], - (int)*scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->resourceElementOffset, - (int)*scd->firstActiveDownlinkBWP_Id, - (int)scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Common->genericParameters.subcarrierSpacing, - (int)scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Common->genericParameters.locationAndBandwidth - ); - } - fix_scd(scd); - printf("NRRRC %u: Southbound Transport %s\n",i,*(GNBParamList.paramarray[i][GNB_TRANSPORT_S_PREFERENCE_IDX].strptr)); rrc->node_type = get_node_type(); @@ -1284,14 +1535,11 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) rrc->eth_params_s.my_portd = *(GNBParamList.paramarray[i][GNB_LOCAL_S_PORTD_IDX].uptr); rrc->eth_params_s.remote_portd = *(GNBParamList.paramarray[i][GNB_REMOTE_S_PORTD_IDX].uptr); rrc->eth_params_s.transp_preference = ETH_UDP_MODE; - rrc->sctp_in_streams = (uint16_t)*(SCTPParams[GNB_SCTP_INSTREAMS_IDX].uptr); - rrc->sctp_out_streams = (uint16_t)*(SCTPParams[GNB_SCTP_OUTSTREAMS_IDX].uptr); } rrc->nr_cellid = (uint64_t)*(GNBParamList.paramarray[i][GNB_NRCELLID_IDX].u64ptr); - rrc->carrier.physCellId = *scc->physCellId; rrc->um_on_default_drb = *(GNBParamList.paramarray[i][GNB_UMONDEFAULTDRB_IDX].uptr); if (strcmp(*(GNBParamList.paramarray[i][GNB_TRANSPORT_S_PREFERENCE_IDX].strptr), "local_mac") == 0) { @@ -1310,6 +1558,7 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) // search if in active list + gNB_RrcConfigurationReq nrrrc_config = {0}; for (k=0; k configuration, &NRRRC_CONFIGURATION_REQ(msg_p), sizeof(NRRRC_CONFIGURATION_REQ(msg_p))); + openair_rrc_gNB_configuration(rrc, &nrrrc_config); }//End if (num_gnbs>0) config_security(rrc); @@ -1881,389 +2110,63 @@ int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i) { return 0; } -int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i) { - int k; - paramdef_t GNBSParams[] = GNBSPARAMS_DESC; - paramdef_t GNBParams[] = GNBPARAMS_DESC; - paramlist_def_t GNBParamList = {GNB_CONFIG_STRING_GNB_LIST,NULL,0}; - config_get( GNBSParams,sizeof(GNBSParams)/sizeof(paramdef_t),NULL); - int num_gnbs = GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt; - AssertFatal (i < num_gnbs, - "Failed to parse config file no %uth element in %s \n",i, GNB_CONFIG_STRING_ACTIVE_GNBS); - - if (num_gnbs > 0) { - // Output a list of all eNBs. - config_getlist( &GNBParamList,GNBParams,sizeof(GNBParams)/sizeof(paramdef_t),NULL); - AssertFatal(GNBParamList.paramarray[i][GNB_GNB_ID_IDX].uptr != NULL, - "gNB id %u is not defined in configuration file\n",i); - f1ap_setup_req_t * f1Setup=&F1AP_SETUP_REQ(msg_p); - f1Setup->num_cells_available = 0; - f1Setup->cell_type=CELL_MACRO_GNB; - - for (k=0; k num_cells_available++; - f1Setup->gNB_DU_id = *(GNBParamList.paramarray[0][GNB_GNB_ID_IDX].uptr); - LOG_I(GNB_APP,"F1AP: gNB_DU_id[%d] %ld\n",k,f1Setup->gNB_DU_id); - f1Setup->gNB_DU_name = strdup(*(GNBParamList.paramarray[0][GNB_GNB_NAME_IDX].strptr)); - LOG_I(GNB_APP,"F1AP: gNB_DU_name[%d] %s\n",k,f1Setup->gNB_DU_name); - f1Setup->cell[k].tac = *GNBParamList.paramarray[i][GNB_TRACKING_AREA_CODE_IDX].uptr; - LOG_I(GNB_APP,"F1AP: tac[%d] %d\n",k,f1Setup->cell[k].tac); - f1Setup->cell[k].mcc = *PLMNParamList.paramarray[0][GNB_MOBILE_COUNTRY_CODE_IDX].uptr; - LOG_I(GNB_APP,"F1AP: mcc[%d] %d\n",k,f1Setup->cell[k].mcc); - f1Setup->cell[k].mnc = *PLMNParamList.paramarray[0][GNB_MOBILE_NETWORK_CODE_IDX].uptr; - LOG_I(GNB_APP,"F1AP: mnc[%d] %d\n",k,f1Setup->cell[k].mnc); - f1Setup->cell[k].mnc_digit_length = *PLMNParamList.paramarray[0][GNB_MNC_DIGIT_LENGTH].u8ptr; - LOG_I(GNB_APP,"F1AP: mnc_digit_length[%d] %d\n",k,f1Setup->cell[k].mnc_digit_length); - AssertFatal((f1Setup->cell[k].mnc_digit_length == 2) || - (f1Setup->cell[k].mnc_digit_length == 3), - "BAD MNC DIGIT LENGTH %d", - f1Setup->cell[k].mnc_digit_length); - f1Setup->cell[k].nr_cellid = (uint64_t)*(GNBParamList.paramarray[i][GNB_NRCELLID_IDX].u64ptr); - LOG_I(GNB_APP,"F1AP: nr_cellid[%d] %ld\n",k,f1Setup->cell[k].nr_cellid); - LOG_I(GNB_APP,"F1AP: CU_ip4_address in DU %s\n",RC.nrmac[k]->eth_params_n.remote_addr); - LOG_I(GNB_APP,"FIAP: CU_ip4_address in DU %p, strlen %d\n",f1Setup->CU_f1_ip_address.ipv4_address,(int)strlen(RC.nrmac[k]->eth_params_n.remote_addr)); - f1Setup->CU_f1_ip_address.ipv6 = 0; - f1Setup->CU_f1_ip_address.ipv4 = 1; - //strcpy(f1Setup->CU_f1_ip_address.ipv6_address, ""); - strcpy(f1Setup->CU_f1_ip_address.ipv4_address, RC.nrmac[k]->eth_params_n.remote_addr); - LOG_I(GNB_APP,"F1AP: DU_ip4_address in DU %s\n",RC.nrmac[k]->eth_params_n.my_addr); - LOG_I(GNB_APP,"FIAP: DU_ip4_address in DU %p, strlen %ld\n", - f1Setup->DU_f1_ip_address.ipv4_address, - strlen(RC.nrmac[k]->eth_params_n.my_addr)); - f1Setup->DU_f1_ip_address.ipv6 = 0; - f1Setup->DU_f1_ip_address.ipv4 = 1; - //strcpy(f1Setup->DU_f1_ip_address.ipv6_address, ""); - strcpy(f1Setup->DU_f1_ip_address.ipv4_address, RC.nrmac[k]->eth_params_n.my_addr); - f1Setup->DUport= RC.nrmac[k]->eth_params_n.my_portd; - f1Setup->CUport= RC.nrmac[k]->eth_params_n.remote_portd; - //strcpy(f1Setup->CU_ip_address[l].ipv6_address,*(F1ParamList.paramarray[l][ENB_CU_IPV6_ADDRESS_IDX].strptr)); - sprintf(aprefix,"%s.[%i].%s",GNB_CONFIG_STRING_GNB_LIST,k,GNB_CONFIG_STRING_SCTP_CONFIG); - config_get(SCTPParams,sizeof(SCTPParams)/sizeof(paramdef_t),aprefix); - f1Setup->sctp_in_streams = (uint16_t)*(SCTPParams[GNB_SCTP_INSTREAMS_IDX].uptr); - f1Setup->sctp_out_streams = (uint16_t)*(SCTPParams[GNB_SCTP_OUTSTREAMS_IDX].uptr); - gNB_RRC_INST *rrc = RC.nrrrc[k]; - // wait until RRC cell information is configured - int cell_info_configured = 0; - - do { - LOG_I(GNB_APP,"ngran_gNB_DU: Waiting for basic cell configuration\n"); - usleep(100000); - pthread_mutex_lock(&rrc->cell_info_mutex); - cell_info_configured = rrc->cell_info_configured; - pthread_mutex_unlock(&rrc->cell_info_mutex); - } while (cell_info_configured == 0); - - rrc->configuration.mcc[0] = f1Setup->cell[k].mcc; - rrc->configuration.mnc[0] = f1Setup->cell[k].mnc; - rrc->configuration.tac = f1Setup->cell[k].tac; - rrc->nr_cellid = f1Setup->cell[k].nr_cellid; - f1Setup->cell[k].nr_pci = *rrc->configuration.scc->physCellId; - f1Setup->cell[k].num_ssi = 0; - - if (rrc->configuration.scc->tdd_UL_DL_ConfigurationCommon) { - LOG_I(GNB_APP,"ngran_DU: Configuring Cell %d for TDD\n",k); - f1Setup->fdd_flag = 0; - f1Setup->nr_mode_info[k].tdd.nr_arfcn = rrc->configuration.scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA; - f1Setup->nr_mode_info[k].tdd.scs = rrc->configuration.scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; - f1Setup->nr_mode_info[k].tdd.nrb = rrc->configuration.scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; - f1Setup->nr_mode_info[k].tdd.num_frequency_bands = 1; - f1Setup->nr_mode_info[k].tdd.nr_band[0] = *rrc->configuration.scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; - f1Setup->nr_mode_info[k].tdd.sul_active = 0; - } else { - /***************** for test *****************/ - LOG_I(GNB_APP,"ngran_DU: Configuring Cell %d for FDD\n",k); - f1Setup->fdd_flag = 1; - f1Setup->nr_mode_info[k].fdd.dl_nr_arfcn = 26200UL; - f1Setup->nr_mode_info[k].fdd.ul_nr_arfcn = 26200UL; - // For LTE use scs field to carry prefix type and number of antennas - f1Setup->nr_mode_info[k].fdd.dl_scs = 0; - f1Setup->nr_mode_info[k].fdd.ul_scs = 0; - // use nrb field to hold LTE N_RB_DL (0...5) - f1Setup->nr_mode_info[k].fdd.ul_nrb = 3; - f1Setup->nr_mode_info[k].fdd.ul_nrb = 3; - // RK: we need to check there value for FDD's frequency_bands DL/UL - f1Setup->nr_mode_info[k].fdd.ul_num_frequency_bands = 1; - f1Setup->nr_mode_info[k].fdd.ul_nr_band[0] = 7; - f1Setup->nr_mode_info[k].fdd.dl_num_frequency_bands = 1; - f1Setup->nr_mode_info[k].fdd.dl_nr_band[0] = 7; - f1Setup->nr_mode_info[k].fdd.ul_num_sul_frequency_bands = 0; - f1Setup->nr_mode_info[k].fdd.ul_nr_sul_band[0] = 7; - f1Setup->nr_mode_info[k].fdd.dl_num_sul_frequency_bands = 0; - f1Setup->nr_mode_info[k].fdd.dl_nr_sul_band[0] = 7; - f1Setup->nr_mode_info[k].fdd.sul_active = 0; - /***************** for test *****************/ - } - - f1Setup->measurement_timing_information[k] = "0"; - f1Setup->ranac[k] = 0; - DevAssert(rrc->carrier.mib != NULL); - int buf_len = 3; // this is what we assume in monolithic - f1Setup->mib[k] = calloc(buf_len, sizeof(*f1Setup->mib[k])); - DevAssert(f1Setup->mib[k] != NULL); - f1Setup->mib_length[k] = encode_MIB_NR(rrc->carrier.mib, 0, f1Setup->mib[k], buf_len); - DevAssert(f1Setup->mib_length[k] == buf_len); - - NR_BCCH_DL_SCH_Message_t *bcch_message = NULL; - asn_codec_ctx_t st={100*1000}; - asn_dec_rval_t dec_rval = uper_decode_complete( &st, - &asn_DEF_NR_BCCH_DL_SCH_Message, - (void **)&bcch_message, - (const void *)rrc->carrier.SIB1, - rrc->carrier.sizeof_SIB1); - - if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { - LOG_E(RRC,"SIB1 decode error\n"); - // free the memory - SEQUENCE_free( &asn_DEF_NR_BCCH_DL_SCH_Message, bcch_message, 1 ); - exit(1); - } - - NR_SIB1_t *bcch_SIB1 = bcch_message->message.choice.c1->choice.systemInformationBlockType1; - f1Setup->sib1[k] = calloc(1,rrc->carrier.sizeof_SIB1); - asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_SIB1, - NULL, - (void *)bcch_SIB1, - f1Setup->sib1[k], - NR_MAX_SIB_LENGTH/8); - AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", - enc_rval.failed_type->name, enc_rval.encoded); - - //if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { - LOG_I(NR_RRC, "SIB1 container to be integrated in F1 Setup request:\n"); - xer_fprint(stdout, &asn_DEF_NR_SIB1,(void *)bcch_message->message.choice.c1->choice.systemInformationBlockType1 ); - //} - f1Setup->sib1_length[k] = (enc_rval.encoded+7)/8; - break; - } - } +void wait_f1_setup_response(void) +{ + gNB_MAC_INST *mac = RC.nrmac[0]; + NR_SCHED_LOCK(&mac->sched_lock); + if (mac->f1_config.setup_resp != NULL) { + NR_SCHED_UNLOCK(&mac->sched_lock); + return; } - return 0; + + LOG_W(GNB_APP, "waiting for F1 Setup Response before activating radio\n"); + + /* for the moment, we keep it simple and just sleep to periodically check. + * The actual check is protected by a mutex */ + while (mac->f1_config.setup_resp == NULL) { + NR_SCHED_UNLOCK(&mac->sched_lock); + sleep(1); + NR_SCHED_LOCK(&mac->sched_lock); + } + NR_SCHED_UNLOCK(&mac->sched_lock); } - -int du_check_plmn_identity(rrc_gNB_carrier_data_t *carrier,uint16_t mcc,uint16_t mnc,uint8_t mnc_digit_length) { - NR_SIB1_t *sib1 = carrier->siblock1->message.choice.c1->choice.systemInformationBlockType1; - AssertFatal(sib1->cellAccessRelatedInfo.plmn_IdentityInfoList.list.array[0]->plmn_IdentityList.list.count > 0, - "plmn info isn't there\n"); - AssertFatal(mnc_digit_length == 2 || mnc_digit_length == 3, - "impossible mnc_digit_length %d\n", mnc_digit_length); - NR_PLMN_Identity_t *plmn_Identity = sib1->cellAccessRelatedInfo.plmn_IdentityInfoList.list.array[0] - ->plmn_IdentityList.list.array[0]; - - // check if mcc is different and return failure if so - if (mcc != - ((*plmn_Identity->mcc->list.array[0])*100)+ - ((*plmn_Identity->mcc->list.array[1])*10) + - (*plmn_Identity->mcc->list.array[2])) { - LOG_E(GNB_APP, "mcc in F1AP_SETUP_RESP message is different from mcc in DU \n"); - return(0); - } - - // check that mnc digit length is different and return failure if so - if (mnc_digit_length != plmn_Identity->mnc.list.count) { - LOG_E(GNB_APP, "mnc(length: %d) in F1AP_SETUP_RESP message is different from mnc(length: %d) in DU \n", - mnc_digit_length, plmn_Identity->mnc.list.count); - return 0; - } - - // check that 2 digit mnc is different and return failure if so - if (mnc_digit_length == 2 && - (mnc != - (*plmn_Identity->mnc.list.array[0]*10) + - (*plmn_Identity->mnc.list.array[1]))) { - LOG_E(GNB_APP, "mnc(%d) in F1AP_SETUP_RESP message is different from mnc(%ld%ld) in DU \n", - mnc, *plmn_Identity->mnc.list.array[0], *plmn_Identity->mnc.list.array[1]); - return(0); - } - else if (mnc_digit_length == 3 && - (mnc != - (*plmn_Identity->mnc.list.array[0]*100) + - (*plmn_Identity->mnc.list.array[1]*10) + - (*plmn_Identity->mnc.list.array[2]))) { - LOG_E(GNB_APP, "mnc(%d) in F1AP_SETUP_RESP message is different from mnc(%ld%ld%ld) in DU \n", - mnc, *plmn_Identity->mnc.list.array[0], *plmn_Identity->mnc.list.array[1], *plmn_Identity->mnc.list.array[2]); - return(0); - } - - // if we're here, the mcc/mnc match so return success - return(1); -} - -void du_extract_and_decode_SI(int inst, int si_ind, uint8_t *si_container, int si_container_length) { - gNB_RRC_INST *rrc = RC.nrrrc[inst]; - rrc_gNB_carrier_data_t *carrier = &rrc->carrier; - NR_BCCH_DL_SCH_Message_t *bcch_message ; - AssertFatal(si_ind == 0, "Can only handle a single SI block for now\n"); - LOG_I(GNB_APP, "rrc inst %d: Trying to decode SI block %d @ %p, length %d\n", inst, si_ind, si_container, si_container_length); - // point to first SI block - bcch_message = &carrier->systemInformation; - asn_dec_rval_t dec_rval = uper_decode_complete( NULL, - &asn_DEF_NR_BCCH_DL_SCH_Message, - (void **)&bcch_message, - (const void *)si_container, - si_container_length); - - if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { - AssertFatal(1==0, "[GNB_APP][NR_RRC inst %"PRIu8"] Failed to decode BCCH_DLSCH_MESSAGE (%zu bits)\n", - inst, - dec_rval.consumed ); - } - - if (bcch_message->message.present == NR_BCCH_DL_SCH_MessageType_PR_c1) { - switch (bcch_message->message.choice.c1->present) { - case NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1: - AssertFatal(1 == 0, "Should have received SIB1 from CU\n"); - break; - - case NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformation: - { - NR_SystemInformation_t *si = bcch_message->message.choice.c1->choice.systemInformation; - - if (si->criticalExtensions.present == NR_SystemInformation__criticalExtensions_PR_systemInformation) { - for (int i = 0; i < si->criticalExtensions.choice.systemInformation->sib_TypeAndInfo.list.count; i++) { - LOG_I(GNB_APP, "Extracting SI %d/%d\n", i, si->criticalExtensions.choice.systemInformation->sib_TypeAndInfo.list.count); - SystemInformation_IEs__sib_TypeAndInfo__Member *typeAndInfo; - typeAndInfo = si->criticalExtensions.choice.systemInformation->sib_TypeAndInfo.list.array[i]; - - switch(typeAndInfo->present) { - case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_NOTHING: - AssertFatal(0, "Should have received SIB2 SIB3 from CU\n"); - break; - case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib2: - LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB2 in CU F1AP_SETUP_RESP message\n", inst); - carrier->sib2 = typeAndInfo->choice.sib2; - carrier->SIB23 = (uint8_t *)malloc(64); - memcpy((void *)carrier->SIB23, (void *)si_container, si_container_length); - carrier->sizeof_SIB23 = si_container_length; - break; - case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib3: - carrier->sib3 = typeAndInfo->choice.sib3; - LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB3 in CU F1AP_SETUP_RESP message\n", inst); - break; - case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib4: - LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB4 in CU F1AP_SETUP_RESP message\n", inst); - break; - case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib5: - LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB5 in CU F1AP_SETUP_RESP message\n", inst); - break; - case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib6: - LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB6 in CU F1AP_SETUP_RESP message\n", inst); - break; - case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib7: - LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB7 in CU F1AP_SETUP_RESP message\n", inst); - break; - case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib8: - LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB8 in CU F1AP_SETUP_RESP message\n", inst); - break; - case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib9: - LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB9 in CU F1AP_SETUP_RESP message\n", inst); - break; - case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib10_v1610: - LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB10 in CU F1AP_SETUP_RESP message\n", inst); - break; - case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib11_v1610: - LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB11 in CU F1AP_SETUP_RESP message\n", inst); - break; - case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib12_v1610: - LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB12 in CU F1AP_SETUP_RESP message\n", inst); - break; - case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib13_v1610: - LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB13 in CU F1AP_SETUP_RESP message\n", inst); - break; - case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib14_v1610: - LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB14 in CU F1AP_SETUP_RESP message\n", inst); - break; - default: - AssertFatal(1 == 0,"Shouldn't have received this SI %d\n", typeAndInfo->present); - break; - } - } - } - - break; - } - - case NR_BCCH_DL_SCH_MessageType__c1_PR_NOTHING: - AssertFatal(0, "Should have received SIB1 from CU\n"); - break; - } - } else AssertFatal(1 == 0, "No SI messages\n"); -} - -int gNB_app_handle_f1ap_setup_resp(f1ap_setup_resp_t *resp) { - int i, j, si_ind; - int ret=0; - LOG_I(GNB_APP, "cells_to_activate %d, RRC instances %d\n", - resp->num_cells_to_activate, RC.nb_nr_inst); - - for (j = 0; j < resp->num_cells_to_activate; j++) { - for (i = 0; i < RC.nb_nr_inst; i++) { - rrc_gNB_carrier_data_t *carrier = &RC.nrrrc[i]->carrier; - // identify local index of cell j by nr_cellid, plmn identity and physical cell ID - LOG_I(GNB_APP, "Checking cell %d, rrc inst %d : rrc->nr_cellid %lx, resp->nr_cellid %lx\n", - j, i, RC.nrrrc[i]->nr_cellid, resp->cells_to_activate[j].nr_cellid); - - if (RC.nrrrc[i]->nr_cellid == resp->cells_to_activate[j].nr_cellid && - (du_check_plmn_identity(carrier, resp->cells_to_activate[j].mcc, resp->cells_to_activate[j].mnc, resp->cells_to_activate[j].mnc_digit_length)>0 && - resp->cells_to_activate[j].nrpci == carrier->physCellId)) { - // copy system information and decode it - for (si_ind=0; si_indcells_to_activate[j].num_SI; si_ind++) { - - du_extract_and_decode_SI(i, - si_ind, - resp->cells_to_activate[j].SI_container[si_ind], - resp->cells_to_activate[j].SI_container_length[si_ind]); - } - ret++; - } else { - LOG_E(GNB_APP, "F1 Setup Response not matching\n"); - } - } - } - return(ret); +static bool check_plmn_identity(const f1ap_plmn_t *check_plmn, const f1ap_plmn_t *plmn) +{ + return plmn->mcc == check_plmn->mcc && plmn->mnc_digit_length == check_plmn->mnc_digit_length && plmn->mnc == check_plmn->mnc; } int gNB_app_handle_f1ap_gnb_cu_configuration_update(f1ap_gnb_cu_configuration_update_t *gnb_cu_cfg_update) { - int i, j, si_ind, ret=0; + int i, j, ret=0; LOG_I(GNB_APP, "cells_to_activate %d, RRC instances %d\n", gnb_cu_cfg_update->num_cells_to_activate, RC.nb_nr_inst); + AssertFatal(gnb_cu_cfg_update->num_cells_to_activate == 1, "only one cell supported at the moment\n"); + AssertFatal(RC.nb_nr_inst == 1, "expected one instance\n"); + gNB_MAC_INST *mac = RC.nrmac[0]; + NR_SCHED_LOCK(&mac->sched_lock); for (j = 0; j < gnb_cu_cfg_update->num_cells_to_activate; j++) { for (i = 0; i < RC.nb_nr_inst; i++) { - rrc_gNB_carrier_data_t *carrier = &RC.nrrrc[i]->carrier; + f1ap_setup_req_t *setup_req = RC.nrmac[i]->f1_config.setup_req; // identify local index of cell j by nr_cellid, plmn identity and physical cell ID - LOG_I(GNB_APP, "Checking cell %d, rrc inst %d : rrc->nr_cellid %lx, gnb_cu_cfg_updatenr_cellid %lx\n", - j, i, RC.nrrrc[i]->nr_cellid, gnb_cu_cfg_update->cells_to_activate[j].nr_cellid); - if (RC.nrrrc[i]->nr_cellid == gnb_cu_cfg_update->cells_to_activate[j].nr_cellid && - (du_check_plmn_identity(carrier, gnb_cu_cfg_update->cells_to_activate[j].mcc, gnb_cu_cfg_update->cells_to_activate[j].mnc, gnb_cu_cfg_update->cells_to_activate[j].mnc_digit_length)>0 && - gnb_cu_cfg_update->cells_to_activate[j].nrpci == carrier->physCellId)) { + if (setup_req->cell[0].info.nr_cellid == gnb_cu_cfg_update->cells_to_activate[j].nr_cellid + && check_plmn_identity(&setup_req->cell[0].info.plmn, &gnb_cu_cfg_update->cells_to_activate[j].plmn) > 0 + && setup_req->cell[0].info.nr_pci == gnb_cu_cfg_update->cells_to_activate[j].nrpci) { // copy system information and decode it - for (si_ind=0; si_indcells_to_activate[j].num_SI; si_ind++) { - - du_extract_and_decode_SI(i, - si_ind, - gnb_cu_cfg_update->cells_to_activate[j].SI_container[si_ind], - gnb_cu_cfg_update->cells_to_activate[j].SI_container_length[si_ind]); - } - ret++; + AssertFatal(gnb_cu_cfg_update->cells_to_activate[j].num_SI == 0, + "gNB-CU Configuration Update: handling of additional SIs not implemend\n"); + ret++; + mac->f1_config.setup_resp = malloc(sizeof(*mac->f1_config.setup_resp)); + AssertFatal(mac->f1_config.setup_resp != NULL, "out of memory\n"); + mac->f1_config.setup_resp->gNB_CU_name = gnb_cu_cfg_update->gNB_CU_name; + mac->f1_config.setup_resp->num_cells_to_activate = gnb_cu_cfg_update->num_cells_to_activate; + mac->f1_config.setup_resp->cells_to_activate[0] = gnb_cu_cfg_update->cells_to_activate[0]; } else { LOG_E(GNB_APP, "GNB_CU_CONFIGURATION_UPDATE not matching\n"); } } } + NR_SCHED_UNLOCK(&mac->sched_lock); MessageDef *msg_ack_p = NULL; if (ret > 0) { // generate gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE @@ -2330,41 +2233,6 @@ ngran_node_t get_node_type(void) return ngran_gNB_DU; } -void nr_read_config_and_init(void) { - MessageDef *msg_p = NULL; - uint32_t gnb_id; - uint32_t gnb_nb = RC.nb_nr_inst; - - RCconfig_NR_L1(); - RCconfig_nr_prs(); - RCconfig_nr_macrlc(); - - LOG_I(PHY, "%s() RC.nb_nr_L1_inst:%d\n", __FUNCTION__, RC.nb_nr_L1_inst); - - if (RC.nb_nr_L1_inst>0) AssertFatal(l1_north_init_gNB()==0,"could not initialize L1 north interface\n"); - - AssertFatal (gnb_nb <= RC.nb_nr_inst, - "Number of gNB is greater than gNB defined in configuration file (%u/%u)!", - gnb_nb, RC.nb_nr_inst); - - LOG_I(GNB_APP,"Allocating gNB_RRC_INST for %d instances\n",RC.nb_nr_inst); - - RC.nrrrc = (gNB_RRC_INST **)malloc(RC.nb_nr_inst*sizeof(gNB_RRC_INST *)); - LOG_I(PHY, "%s() RC.nb_nr_inst:%d RC.nrrrc:%p\n", __FUNCTION__, RC.nb_nr_inst, RC.nrrrc); - - for (gnb_id = 0; gnb_id < RC.nb_nr_inst ; gnb_id++) { - RC.nrrrc[gnb_id] = (gNB_RRC_INST*)malloc(sizeof(gNB_RRC_INST)); - LOG_I(PHY, "%s() Creating RRC instance RC.nrrrc[%d]:%p (%d of %d)\n", __FUNCTION__, gnb_id, RC.nrrrc[gnb_id], gnb_id+1, RC.nb_nr_inst); - memset((void *)RC.nrrrc[gnb_id],0,sizeof(gNB_RRC_INST)); - msg_p = itti_alloc_new_message (TASK_GNB_APP, 0, NRRRC_CONFIGURATION_REQ); - RCconfig_NRRRC(msg_p,gnb_id, RC.nrrrc[gnb_id]); - } - - if (NODE_IS_CU(RC.nrrrc[0]->node_type) && RC.nrrrc[0]->node_type != ngran_gNB_CUCP) { - nr_pdcp_layer_init(); - } -} - #ifdef E2_AGENT e2_agent_args_t RCconfig_NR_E2agent(void) diff --git a/openair2/GNB_APP/gnb_config.h b/openair2/GNB_APP/gnb_config.h index 0a23ebea74..6cd7d53c92 100644 --- a/openair2/GNB_APP/gnb_config.h +++ b/openair2/GNB_APP/gnb_config.h @@ -91,6 +91,8 @@ typedef struct ru_config_s { uint8_t if_compress; } ru_config_t; */ + +void RCconfig_verify(ngran_node_t node_type); extern void NRRCconfig_RU(void); extern void RCconfig_nr_prs(void); extern void RCconfig_NR_L1(void); @@ -100,13 +102,11 @@ extern void NRRCConfig(void); //void enb_config_display(void); //void ru_config_display(void); -void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc); +void RCconfig_NRRRC(gNB_RRC_INST *rrc); int RCconfig_NR_NG(MessageDef *msg_p, uint32_t i); int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i); -int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i); -int gNB_app_handle_f1ap_setup_resp(f1ap_setup_resp_t *resp); +void wait_f1_setup_response(void); int gNB_app_handle_f1ap_gnb_cu_configuration_update(f1ap_gnb_cu_configuration_update_t *gnb_cu_cfg_update); -void nr_read_config_and_init(void); MessageDef *RCconfig_NR_CU_E1(bool separate_CUUP_process); ngran_node_t get_node_type(void); diff --git a/openair2/LAYER2/MAC/mac.h b/openair2/LAYER2/MAC/mac.h index c1f9a51335..702d0d6f56 100644 --- a/openair2/LAYER2/MAC/mac.h +++ b/openair2/LAYER2/MAC/mac.h @@ -1298,8 +1298,6 @@ typedef struct { /*! \brief top level eNB MAC structure */ typedef struct eNB_MAC_INST_s { - /// Ethernet parameters for northbound midhaul interface - eth_params_t eth_params_n; /// Ethernet parameters for fronthaul interface eth_params_t eth_params_s; /// @@ -1662,8 +1660,6 @@ typedef struct { int ra_frame; // This variable keeps the frame in which the RA started for the specific UE. It is used in order // to make sure that different UEs RA starts within a number of frames difference. - eth_params_t eth_params_n; - } UE_MAC_INST; typedef struct { diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index 656195815a..a0f3fae413 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -4105,7 +4105,7 @@ uint32_t get_Y(const NR_SearchSpace_t *ss, int slot, rnti_t rnti) { void get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config, frame_t frameP, - NR_MIB_t *mib, + const NR_MIB_t *mib, uint8_t num_slot_per_frame, uint8_t ssb_subcarrier_offset, uint16_t ssb_start_symbol, diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h index ab7a820612..3689e4a5a2 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h @@ -207,7 +207,7 @@ uint32_t nr_compute_tbslbrm(uint16_t table, void get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config, frame_t frameP, - NR_MIB_t *mib, + const NR_MIB_t *mib, uint8_t num_slot_per_frame, uint8_t ssb_subcarrier_offset, uint16_t ssb_start_symbol, diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 853770887e..9710a90518 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -332,6 +332,12 @@ static void config_common(gNB_MAC_INST *nrmac, int pdsch_AntennaPorts, int pusch cfg->ssb_table.ssb_subcarrier_offset.value = get_ssb_subcarrier_offset(*scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB, scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA); + AssertFatal(cfg->ssb_table.ssb_subcarrier_offset.value < 16, + "cannot handle ssb_subcarrier_offset %d resulting from Point A %ld SSB %ld: please increase dl_absoluteFrequencyPointA " + "in the config by 16\n", + cfg->ssb_table.ssb_subcarrier_offset.value, + scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA, + *scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB); cfg->ssb_table.ssb_subcarrier_offset.tl.tag = NFAPI_NR_CONFIG_SSB_SUBCARRIER_OFFSET_TAG; cfg->num_tlv++; @@ -437,48 +443,13 @@ static void config_common(gNB_MAC_INST *nrmac, int pdsch_AntennaPorts, int pusch } } -int nr_mac_enable_ue_rrc_processing_timer(module_id_t Mod_idP, rnti_t rnti, NR_SubcarrierSpacing_t subcarrierSpacing, uint32_t rrc_reconfiguration_delay) -{ - if (rrc_reconfiguration_delay == 0) { - return -1; - } - - gNB_MAC_INST *nrmac = RC.nrmac[Mod_idP]; - NR_SCHED_LOCK(&nrmac->sched_lock); - - NR_UE_info_t *UE_info = find_nr_UE(&nrmac->UE_info,rnti); - if (!UE_info) { - LOG_W(NR_MAC, "Could not find UE for RNTI 0x%04x\n", rnti); - NR_SCHED_UNLOCK(&nrmac->sched_lock); - return -1; - } - NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl; - const uint16_t sl_ahead = nrmac->if_inst->sl_ahead; - sched_ctrl->rrc_processing_timer = (rrc_reconfiguration_delay<rnti, rrc_reconfiguration_delay); - - // it might happen that timing advance command should be sent during the RRC - // processing timer. To prevent this, set a variable as if we would have just - // sent it. This way, another TA command will for sure be sent in some - // frames, after RRC processing timer. - sched_ctrl->ta_frame = (nrmac->frame - 1 + 1024) % 1024; - - NR_SCHED_UNLOCK(&nrmac->sched_lock); - return 0; -} - -void nr_mac_config_scc(gNB_MAC_INST *nrmac, - rrc_pdsch_AntennaPorts_t pdsch_AntennaPorts, - int pusch_AntennaPorts, - int sib1_tda, - int minRXTXTIMEpdsch, - NR_ServingCellConfigCommon_t *scc) +void nr_mac_config_scc(gNB_MAC_INST *nrmac, NR_ServingCellConfigCommon_t *scc, const nr_mac_config_t *config) { DevAssert(nrmac != NULL); - AssertFatal(nrmac->common_channels[0].ServingCellConfigCommon == NULL, "logic error: multiple configurations of SCC\n"); - NR_SCHED_LOCK(&nrmac->sched_lock); - DevAssert(scc != NULL); + DevAssert(config != NULL); + //NR_SCHED_LOCK(&nrmac->sched_lock); + AssertFatal(scc->ssb_PositionsInBurst->present > 0 && scc->ssb_PositionsInBurst->present < 4, "SSB Bitmap type %d is not valid\n", scc->ssb_PositionsInBurst->present); @@ -493,9 +464,8 @@ void nr_mac_config_scc(gNB_MAC_INST *nrmac, LOG_I(NR_MAC, "Configuring common parameters from NR ServingCellConfig\n"); - int num_pdsch_antenna_ports = pdsch_AntennaPorts.N1 * pdsch_AntennaPorts.N2 * pdsch_AntennaPorts.XP; - nrmac->xp_pdsch_antenna_ports = pdsch_AntennaPorts.XP; - config_common(nrmac, num_pdsch_antenna_ports, pusch_AntennaPorts, scc); + int num_pdsch_antenna_ports = config->pdsch_AntennaPorts.N1 * config->pdsch_AntennaPorts.N2 * config->pdsch_AntennaPorts.XP; + config_common(nrmac, num_pdsch_antenna_ports, config->pusch_AntennaPorts, scc); if (NFAPI_MODE == NFAPI_MODE_PNF || NFAPI_MODE == NFAPI_MODE_VNF) { // fake that the gNB is configured in nFAPI mode, which would normally be @@ -507,7 +477,6 @@ void nr_mac_config_scc(gNB_MAC_INST *nrmac, nrmac->if_inst->NR_PHY_config_req(&phycfg); } - nrmac->minRXTXTIMEpdsch = minRXTXTIMEpdsch; find_SSB_and_RO_available(nrmac); const NR_TDD_UL_DL_Pattern_t *tdd = scc->tdd_UL_DL_ConfigurationCommon ? &scc->tdd_UL_DL_ConfigurationCommon->pattern1 : NULL; @@ -528,7 +497,7 @@ void nr_mac_config_scc(gNB_MAC_INST *nrmac, nrmac->dlsch_slot_bitmap[slot / 64] |= (uint64_t)((slot % nr_slots_period) < nr_dl_slots) << (slot % 64); nrmac->ulsch_slot_bitmap[slot / 64] |= (uint64_t)((slot % nr_slots_period) >= nr_ulstart_slot) << (slot % 64); - LOG_I(NR_MAC, + LOG_D(NR_MAC, "slot %d DL %d UL %d\n", slot, (nrmac->dlsch_slot_bitmap[slot / 64] & ((uint64_t)1 << (slot % 64))) != 0, @@ -545,7 +514,6 @@ void nr_mac_config_scc(gNB_MAC_INST *nrmac, if (get_softmodem_params()->sa > 0) { NR_COMMON_channels_t *cc = &nrmac->common_channels[0]; - nrmac->sib1_tda = sib1_tda; for (int n = 0; n < NR_NB_RA_PROC_MAX; n++) { NR_RA_t *ra = &cc->ra[n]; ra->cfra = false; @@ -556,31 +524,19 @@ void nr_mac_config_scc(gNB_MAC_INST *nrmac, ra->preambles.preamble_list[i] = i; } } - NR_SCHED_UNLOCK(&nrmac->sched_lock); + //NR_SCHED_UNLOCK(&nrmac->sched_lock); } -void nr_mac_config_mib(gNB_MAC_INST *nrmac, NR_BCCH_BCH_Message_t *mib) +void nr_mac_configure_sib1(gNB_MAC_INST *nrmac, const f1ap_plmn_t *plmn, uint64_t cellID, int tac) { - DevAssert(nrmac != NULL); - DevAssert(mib != NULL); - NR_SCHED_LOCK(&nrmac->sched_lock); + AssertFatal(get_softmodem_params()->sa > 0, "error: SIB1 only applicable for SA\n"); + NR_COMMON_channels_t *cc = &nrmac->common_channels[0]; - - AssertFatal(cc->mib == NULL, "logic bug: updated MIB multiple times\n"); - cc->mib = mib; - NR_SCHED_UNLOCK(&nrmac->sched_lock); -} - -void nr_mac_config_sib1(gNB_MAC_INST *nrmac, NR_BCCH_DL_SCH_Message_t *sib1) -{ - DevAssert(nrmac != NULL); - DevAssert(sib1 != NULL); - NR_SCHED_LOCK(&nrmac->sched_lock); - NR_COMMON_channels_t *cc = &nrmac->common_channels[0]; - - AssertFatal(cc->sib1 == NULL, "logic bug: updated SIB1 multiple times\n"); + NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; + NR_BCCH_DL_SCH_Message_t *sib1 = get_SIB1_NR(scc, plmn, cellID, tac); cc->sib1 = sib1; - NR_SCHED_UNLOCK(&nrmac->sched_lock); + cc->sib1_bcch_length = encode_SIB1_NR(sib1, cc->sib1_bcch_pdu, sizeof(cc->sib1_bcch_pdu)); + AssertFatal(cc->sib1_bcch_length > 0, "could not encode SIB1\n"); } bool nr_mac_add_test_ue(gNB_MAC_INST *nrmac, uint32_t rnti, NR_CellGroupConfig_t *CellGroup) @@ -640,28 +596,24 @@ bool nr_mac_prepare_ra_ue(gNB_MAC_INST *nrmac, uint32_t rnti, NR_CellGroupConfig return true; } -bool nr_mac_update_cellgroup(gNB_MAC_INST *nrmac, uint32_t rnti, NR_CellGroupConfig_t *CellGroup) +/* Prepare a new CellGroupConfig to be applied for this UE. We cannot + * immediatly apply it, as we have to wait for the reconfiguration through RRC. + * This function sets up everything to apply the reconfiguration. Later, we + * will trigger the timer with nr_mac_enable_ue_rrc_processing_timer(); upon + * expiry nr_mac_apply_cellgroup() will apply the CellGroupConfig (radio config + * etc). */ +bool nr_mac_prepare_cellgroup_update(gNB_MAC_INST *nrmac, NR_UE_info_t *UE, NR_CellGroupConfig_t *CellGroup) { DevAssert(nrmac != NULL); + DevAssert(UE != NULL); + DevAssert(CellGroup != NULL); + /* we assume that this function is mutex-protected from outside */ NR_SCHED_ENSURE_LOCKED(&nrmac->sched_lock); - DevAssert(CellGroup != NULL); - - NR_UE_info_t *UE = find_nr_UE(&nrmac->UE_info, rnti); - AssertFatal(UE != NULL, "Can't find UE %04x for CellGroup update\n", rnti); - - /* copy CellGroup by calling asn1c encode this is a temporary hack to avoid the gNB having a pointer to RRC CellGroup structure - * (otherwise it would be applied to early) - * TODO remove once we have a proper implementation */ - UE->enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig, NULL, (void *)CellGroup, UE->cg_buf, 32768); - - if (UE->enc_rval.encoded == -1) { - LOG_E(NR_MAC, "ASN1 message CellGroupConfig encoding failed (%s, %lu)!\n", UE->enc_rval.failed_type->name, UE->enc_rval.encoded); - exit(1); - } - process_CellGroup(CellGroup, UE); + UE->reconfigCellGroup = CellGroup; + UE->expect_reconfiguration = true; return true; } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index bdf84ddc8e..71dd7731e5 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -159,7 +159,7 @@ static int16_t ssb_index_from_prach(module_id_t module_idP, void find_SSB_and_RO_available(gNB_MAC_INST *nrmac) { /* already mutex protected through nr_mac_config_scc() */ - NR_SCHED_ENSURE_LOCKED(&nrmac->sched_lock); + //NR_SCHED_ENSURE_LOCKED(&nrmac->sched_lock); NR_COMMON_channels_t *cc = &nrmac->common_channels[0]; NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; @@ -1893,14 +1893,9 @@ static void nr_check_Msg4_Ack(module_id_t module_id, int CC_id, frame_t frame, s // Pause scheduling according to: // 3GPP TS 38.331 Section 12 Table 12.1-1: UE performance requirements for RRC procedures for UEs - const NR_ServingCellConfig_t *servingCellConfig = UE->CellGroup && UE->CellGroup->spCellConfig ? UE->CellGroup->spCellConfig->spCellConfigDedicated : NULL; - uint32_t delay_ms = servingCellConfig && servingCellConfig->downlinkBWP_ToAddModList ? - NR_RRC_SETUP_DELAY_MS + NR_RRC_BWP_SWITCHING_DELAY_MS : NR_RRC_SETUP_DELAY_MS; - - sched_ctrl->rrc_processing_timer = (delay_ms << ra->DL_BWP.scs); - LOG_I(NR_MAC, "(%d.%d) Activating RRC processing timer for UE %04x with %d ms\n", frame, slot, UE->rnti, delay_ms); + nr_mac_enable_ue_rrc_processing_timer(RC.nrmac[module_id], UE, false); } else { - LOG_I(NR_MAC, "(ue rnti 0x%04x) RA Procedure failed at Msg4!\n", ra->rnti); + LOG_I(NR_MAC, "%4d.%2d UE %04x: RA Procedure failed at Msg4!\n", frame, slot, ra->rnti); } nr_clear_ra_proc(module_id, CC_id, frame, ra); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index 3c5d56893d..52d6825079 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -105,19 +105,26 @@ static void fill_ssb_vrb_map(NR_COMMON_channels_t *cc, int rbStart, int ssb_subc vrb_map[rbStart + rb] = SL_to_bitmap(symStart % NR_SYMBOLS_PER_SLOT, 4); } +static int encode_mib(NR_BCCH_BCH_Message_t *mib, frame_t frame, uint8_t *buffer, int buf_size) +{ + int encode_size = 3; + AssertFatal(buf_size >= encode_size, "buffer of size %d too small, need 3 bytes\n", buf_size); + int encoded = encode_MIB_NR(mib, frame, buffer, encode_size); + DevAssert(encoded == encode_size); + return encode_size; +} + void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP, nfapi_nr_dl_tti_request_t *DL_req) { gNB_MAC_INST *gNB = RC.nrmac[module_idP]; /* already mutex protected: held in gNB_dlsch_ulsch_scheduler() */ - NR_COMMON_channels_t *cc; nfapi_nr_dl_tti_request_body_t *dl_req; - NR_MIB_t *mib = RC.nrrrc[module_idP]->carrier.mib->message.choice.mib; uint8_t num_tdd_period,num_ssb; - int mib_sdu_length; int CC_id; for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { - cc = &gNB->common_channels[CC_id]; + NR_COMMON_channels_t *cc= &gNB->common_channels[CC_id]; + const NR_MIB_t *mib = cc->mib->message.choice.mib; NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; const int slots_per_frame = nr_slots_per_frame[*scc->ssbSubcarrierSpacing]; dl_req = &DL_req->dl_tti_request_body; @@ -125,8 +132,7 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP, // get MIB every 8 frames if(((slotP == 0) && (frameP & 7) == 0) || gNB->first_MIB) { - - mib_sdu_length = mac_rrc_nr_data_req(module_idP, CC_id, frameP, MIBCH, 0, 1, &cc->MIB_pdu.payload[0]); + int mib_sdu_length = encode_mib(cc->mib, frameP, cc->MIB_pdu, sizeof(cc->MIB_pdu)); // flag to avoid sending an empty MIB in the first frames of execution since gNB doesn't get at the beginning in frame 0 slot 0 gNB->first_MIB = false; @@ -139,6 +145,8 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP, mib_sdu_length); } + uint32_t mib_pdu = (*(uint32_t *)cc->MIB_pdu) & ((1 << 24) - 1); + int8_t ssb_period = *scc->ssb_periodicityServingCell; uint8_t ssb_frame_periodicity = 1; // every how many frames SSB are generated @@ -175,7 +183,7 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP, // if start symbol is in current slot, schedule current SSB, fill VRB map and call get_type0_PDCCH_CSS_config_parameters if ((ssb_start_symbol/14) == rel_slot){ const int prb_offset = offset_pointa >> scs; - schedule_ssb(frameP, slotP, scc, dl_req, i_ssb, ssbSubcarrierOffset, offset_pointa, (*(uint32_t*)cc->MIB_pdu.payload) & ((1<<24)-1)); + schedule_ssb(frameP, slotP, scc, dl_req, i_ssb, ssbSubcarrierOffset, offset_pointa, mib_pdu); fill_ssb_vrb_map(cc, prb_offset, ssbSubcarrierOffset, ssb_start_symbol, CC_id); if (get_softmodem_params()->sa == 1) { get_type0_PDCCH_CSS_config_parameters(&gNB->type0_PDCCH_CSS_config[i_ssb], @@ -204,7 +212,7 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP, // if start symbol is in current slot, schedule current SSB, fill VRB map and call get_type0_PDCCH_CSS_config_parameters if ((ssb_start_symbol/14) == rel_slot){ const int prb_offset = offset_pointa >> scs; - schedule_ssb(frameP, slotP, scc, dl_req, i_ssb, ssbSubcarrierOffset, offset_pointa, (*(uint32_t*)cc->MIB_pdu.payload) & ((1<<24)-1)); + schedule_ssb(frameP, slotP, scc, dl_req, i_ssb, ssbSubcarrierOffset, offset_pointa, mib_pdu); fill_ssb_vrb_map(cc, prb_offset, ssbSubcarrierOffset, ssb_start_symbol, CC_id); if (get_softmodem_params()->sa == 1) { get_type0_PDCCH_CSS_config_parameters(&gNB->type0_PDCCH_CSS_config[i_ssb], @@ -234,7 +242,7 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP, // if start symbol is in current slot, schedule current SSB, fill VRB map and call get_type0_PDCCH_CSS_config_parameters if ((ssb_start_symbol/14) == rel_slot){ const int prb_offset = offset_pointa >> (scs-2); // reference 60kHz - schedule_ssb(frameP, slotP, scc, dl_req, i_ssb, ssbSubcarrierOffset, offset_pointa, (*(uint32_t*)cc->MIB_pdu.payload) & ((1<<24)-1)); + schedule_ssb(frameP, slotP, scc, dl_req, i_ssb, ssbSubcarrierOffset, offset_pointa, mib_pdu); fill_ssb_vrb_map(cc, prb_offset, ssbSubcarrierOffset >> (scs - 2), ssb_start_symbol, CC_id); const NR_TDD_UL_DL_Pattern_t *tdd = &scc->tdd_UL_DL_ConfigurationCommon->pattern1; const int n_slots_frame = nr_slots_per_frame[*scc->ssbSubcarrierSpacing]; @@ -532,7 +540,7 @@ void schedule_nr_sib1(module_id_t module_idP, gNB_MAC_INST *gNB_mac = RC.nrmac[module_idP]; NR_ServingCellConfigCommon_t *scc = gNB_mac->common_channels[CC_id].ServingCellConfigCommon; - int time_domain_allocation = gNB_mac->sib1_tda; + int time_domain_allocation = gNB_mac->radio_config.sib1_tda; int L_max; switch (scc->ssb_PositionsInBurst->present) { @@ -561,14 +569,6 @@ void schedule_nr_sib1(module_id_t module_idP, LOG_D(NR_MAC,"(%d.%d) SIB1 transmission: ssb_index %d\n", frameP, slotP, type0_PDCCH_CSS_config->ssb_index); - // Get SIB1 - uint8_t sib1_payload[NR_MAX_SIB_LENGTH/8]; - uint16_t sib1_sdu_length = mac_rrc_nr_data_req(module_idP, CC_id, frameP, BCCH, SI_RNTI, 1, sib1_payload); - LOG_D(NR_MAC,"sib1_sdu_length = %i\n", sib1_sdu_length); - LOG_D(NR_MAC,"SIB1: \n"); - for (int k=0;ktype0_pdcch_ss_mux_pattern); // assuming normal CP NR_tda_info_t tda_info = get_info_from_tda_tables(table_type, time_domain_allocation, gNB_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position, true); @@ -580,6 +580,8 @@ void schedule_nr_sib1(module_id_t module_idP, &tda_info, 1); + + NR_COMMON_channels_t *cc = &gNB_mac->common_channels[0]; // Configure sched_ctrlCommon for SIB1 uint32_t TBS = schedule_control_sib1(module_idP, CC_id, type0_PDCCH_CSS_config, @@ -587,7 +589,7 @@ void schedule_nr_sib1(module_id_t module_idP, &dmrs_parms, &tda_info, candidate_idx, - sib1_sdu_length); + cc->sib1_bcch_length); nfapi_nr_dl_tti_request_body_t *dl_req = &DL_req->dl_tti_request_body; int pdu_index = gNB_mac->pdu_index[0]++; @@ -597,7 +599,7 @@ void schedule_nr_sib1(module_id_t module_idP, nfapi_nr_pdu_t *tx_req = &TX_req->pdu_list[ntx_req]; // Data to be transmitted - memcpy(tx_req->TLVs[0].value.direct, sib1_payload, TBS); + memcpy(tx_req->TLVs[0].value.direct, cc->sib1_bcch_pdu, TBS); tx_req->PDU_length = TBS; tx_req->PDU_index = pdu_index; @@ -609,9 +611,14 @@ void schedule_nr_sib1(module_id_t module_idP, type0_PDCCH_CSS_config->active = false; - T(T_GNB_MAC_DL_PDU_WITH_DATA, T_INT(module_idP), T_INT(CC_id), - T_INT(0xffff), T_INT(frameP), T_INT(slotP), T_INT(0 /* harq_pid */), - T_BUFFER(sib1_payload, TBS)); + T(T_GNB_MAC_DL_PDU_WITH_DATA, + T_INT(module_idP), + T_INT(CC_id), + T_INT(0xffff), + T_INT(frameP), + T_INT(slotP), + T_INT(0 /* harq_pid */), + T_BUFFER(cc->sib1_bcch_pdu, cc->sib1_bcch_length)); } } } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 00fefe3b31..a3ab4eb74c 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -661,7 +661,8 @@ static void pf_dl(module_id_t module_id, else sched_pdsch->mcs = get_mcs_from_bler(bo, stats, &sched_ctrl->dl_bler_stats, max_mcs, frame); sched_pdsch->nrOfLayers = get_dl_nrOfLayers(sched_ctrl, current_BWP->dci_format); - sched_pdsch->pm_index = mac->identity_pm ? 0 : get_pm_index(UE, sched_pdsch->nrOfLayers, mac->xp_pdsch_antenna_ports); + sched_pdsch->pm_index = + mac->identity_pm ? 0 : get_pm_index(UE, sched_pdsch->nrOfLayers, mac->radio_config.pdsch_AntennaPorts.XP); const uint8_t Qm = nr_get_Qm_dl(sched_pdsch->mcs, current_BWP->mcsTableIdx); const uint16_t R = nr_get_code_rate_dl(sched_pdsch->mcs, current_BWP->mcsTableIdx); uint32_t tbs = nr_compute_tbs(Qm, diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index f475ed385a..b1b60a9816 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -1946,6 +1946,9 @@ int get_nrofHARQ_ProcessesForPDSCH(e_NR_PDSCH_ServingCellConfig__nrofHARQ_Proces void delete_nr_ue_data(NR_UE_info_t *UE, NR_COMMON_channels_t *ccPtr, uid_allocator_t *uia) { + ASN_STRUCT_FREE(asn_DEF_NR_CellGroupConfig, UE->CellGroup); + ASN_STRUCT_FREE(asn_DEF_NR_CellGroupConfig, UE->reconfigCellGroup); + ASN_STRUCT_FREE(asn_DEF_NR_UE_NR_Capability, UE->capability); NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl; destroy_nr_list(&sched_ctrl->available_dl_harq); destroy_nr_list(&sched_ctrl->feedback_dl_harq); @@ -1953,6 +1956,7 @@ void delete_nr_ue_data(NR_UE_info_t *UE, NR_COMMON_channels_t *ccPtr, uid_alloca destroy_nr_list(&sched_ctrl->available_ul_harq); destroy_nr_list(&sched_ctrl->feedback_ul_harq); destroy_nr_list(&sched_ctrl->retrans_ul_harq); + free_sched_pucch_list(sched_ctrl); uid_linear_allocator_free(uia, UE->uid); LOG_I(NR_MAC, "Remove NR rnti 0x%04x\n", UE->rnti); free(UE); @@ -2361,6 +2365,11 @@ void set_sched_pucch_list(NR_UE_sched_ctrl_t *sched_ctrl, } } +void free_sched_pucch_list(NR_UE_sched_ctrl_t *sched_ctrl) +{ + free(sched_ctrl->sched_pucch); +} + void create_dl_harq_list(NR_UE_sched_ctrl_t *sched_ctrl, const NR_PDSCH_ServingCellConfig_t *pdsch) { const int nrofHARQ = pdsch && pdsch->nrofHARQ_ProcessesForPDSCH ? @@ -2727,20 +2736,80 @@ void nr_csirs_scheduling(int Mod_idP, frame_t frame, sub_frame_t slot, int n_slo } } +static void nr_mac_apply_cellgroup(gNB_MAC_INST *mac, NR_UE_info_t *UE, frame_t frame, sub_frame_t slot) +{ + LOG_I(NR_MAC, "%4d.%2d RNTI %04x: RRC processing timer expired\n", frame, slot, UE->rnti); + + /* check if there is a new CellGroupConfig to be applied */ + if (UE->apply_cellgroup && UE->reconfigCellGroup != NULL) { + LOG_I(NR_MAC, "%4d.%2d RNTI %04x: Apply CellGroupConfig after RRC processing timer expiry\n", frame, slot, UE->rnti); + ASN_STRUCT_FREE(asn_DEF_NR_CellGroupConfig, UE->CellGroup); + UE->CellGroup = UE->reconfigCellGroup; + UE->reconfigCellGroup = NULL; + UE->apply_cellgroup = false; + + if (LOG_DEBUGFLAG(DEBUG_ASN1)) + xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void *)UE->CellGroup); + } + + NR_ServingCellConfigCommon_t *scc = mac->common_channels[0].ServingCellConfigCommon; + + /* Note! we already did process_CellGroup(), so no need to do this again */ + NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl; + configure_UE_BWP(mac, scc, sched_ctrl, NULL, UE, -1, -1); + + reset_srs_stats(UE); + + if (get_softmodem_params()->sa) { + // add all available DL HARQ processes for this UE in SA + create_dl_harq_list(sched_ctrl, UE->current_DL_BWP.pdsch_servingcellconfig); + } +} + +int nr_mac_enable_ue_rrc_processing_timer(gNB_MAC_INST *mac, NR_UE_info_t *UE, bool apply_cellgroup) +{ + DevAssert(mac != NULL); + DevAssert(UE != NULL); + NR_SCHED_ENSURE_LOCKED(&mac->sched_lock); + + const uint16_t sl_ahead = mac->if_inst->sl_ahead; + // TODO: account for BWP switch with NR_RRC_BWP_SWITCHING_DELAY_MS + int delay = NR_RRC_RECONFIGURATION_DELAY_MS; + NR_SubcarrierSpacing_t scs = UE->current_UL_BWP.scs; + + UE->UE_sched_ctrl.rrc_processing_timer = (delay << scs) + sl_ahead; + UE->apply_cellgroup = apply_cellgroup; + AssertFatal(!UE->apply_cellgroup || (UE->apply_cellgroup && UE->reconfigCellGroup), + "logic bug: apply_cellgroup %d and UE->reconfigCellGroup %p: did you try to apply a cellGroup, while none is deposited?\n", + UE->apply_cellgroup, + UE->reconfigCellGroup); + + // it might happen that timing advance command should be sent during the RRC + // processing timer. To prevent this, set a variable as if we would have just + // sent it. This way, another TA command will for sure be sent in some + // frames, after RRC processing timer. + UE->UE_sched_ctrl.ta_frame = (mac->frame - 1 + 1024) % 1024; + + LOG_I(NR_MAC, "%4d.%2d UE %04x: Activate RRC processing timer (%d ms)\n", mac->frame, mac->slot, UE->rnti, delay); + return 0; +} + void nr_mac_update_timers(module_id_t module_id, frame_t frame, sub_frame_t slot) { - /* already mutex protected: held in gNB_dlsch_ulsch_scheduler() */ - NR_SCHED_ENSURE_LOCKED(&RC.nrmac[module_id]->sched_lock); + gNB_MAC_INST *mac = RC.nrmac[module_id]; - NR_UEs_t *UE_info = &RC.nrmac[module_id]->UE_info; + /* already mutex protected: held in gNB_dlsch_ulsch_scheduler() */ + NR_SCHED_ENSURE_LOCKED(&mac->sched_lock); + + NR_UEs_t *UE_info = &mac->UE_info; UE_iterator(UE_info->list, UE) { NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl; if (nr_mac_check_release(sched_ctrl, UE->rnti)) { nr_rlc_remove_ue(UE->rnti); - mac_remove_nr_ue(RC.nrmac[module_id], UE->rnti); + mac_remove_nr_ue(mac, UE->rnti); // go back to examine the next UE, which is at the position the // current UE was UE--; @@ -2748,41 +2817,12 @@ void nr_mac_update_timers(module_id_t module_id, } /* check if UL failure and trigger release request if necessary */ - nr_mac_check_ul_failure(RC.nrmac[module_id], UE->rnti, sched_ctrl); + nr_mac_check_ul_failure(mac, UE->rnti, sched_ctrl); if (sched_ctrl->rrc_processing_timer > 0) { sched_ctrl->rrc_processing_timer--; - if (sched_ctrl->rrc_processing_timer == 0) { - LOG_I(NR_MAC, "(%d.%d) De-activating RRC processing timer for UE %04x\n", frame, slot, UE->rnti); - - reset_srs_stats(UE); - - NR_CellGroupConfig_t *cg = NULL; - uper_decode(NULL, - &asn_DEF_NR_CellGroupConfig, // might be added prefix later - (void **)&cg, - (uint8_t *)UE->cg_buf, - (UE->enc_rval.encoded + 7) / 8, - 0, - 0); - UE->CellGroup = cg; - - if (LOG_DEBUGFLAG(DEBUG_ASN1)) { - xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void *) UE->CellGroup); - } - - NR_ServingCellConfigCommon_t *scc = RC.nrmac[module_id]->common_channels[0].ServingCellConfigCommon; - - LOG_I(NR_MAC,"Modified rnti %04x with CellGroup\n", UE->rnti); - process_CellGroup(cg, UE); - NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl; - configure_UE_BWP(RC.nrmac[module_id], scc, sched_ctrl, NULL, UE, -1, -1); - - if (get_softmodem_params()->sa) { - // add all available DL HARQ processes for this UE in SA - create_dl_harq_list(sched_ctrl, UE->current_DL_BWP.pdsch_servingcellconfig); - } - } + if (sched_ctrl->rrc_processing_timer == 0) + nr_mac_apply_cellgroup(mac, UE, frame, slot); } // RA timer @@ -2790,7 +2830,7 @@ void nr_mac_update_timers(module_id_t module_id, UE->ra_timer--; if (UE->ra_timer == 0) { LOG_W(NR_MAC, "Removing UE %04x because RA timer expired\n", UE->rnti); - mac_remove_nr_ue(RC.nrmac[module_id], UE->rnti); + mac_remove_nr_ue(mac, UE->rnti); } } } @@ -2884,16 +2924,13 @@ void prepare_initial_ul_rrc_message(gNB_MAC_INST *mac, NR_UE_info_t *UE) { NR_SCHED_ENSURE_LOCKED(&mac->sched_lock); /* 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 = get_initial_cellGroupConfig(UE->uid, scc, sccd, &rrc->configuration); + int CC_id = 0; + const NR_ServingCellConfigCommon_t *scc = mac->common_channels[CC_id].ServingCellConfigCommon; + const NR_ServingCellConfig_t *sccd = mac->common_channels[CC_id].pre_ServingCellConfig; + NR_CellGroupConfig_t *cellGroupConfig = get_initial_cellGroupConfig(UE->uid, scc, sccd, &mac->radio_config); UE->CellGroup = cellGroupConfig; - nr_mac_update_cellgroup(mac, UE->rnti, cellGroupConfig); + process_CellGroup(cellGroupConfig, UE); /* activate SRB0 */ nr_rlc_activate_srb0(UE->rnti, mac, UE, send_initial_ul_rrc_message); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index 7b130b6adb..77b0eeba9e 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -1209,7 +1209,7 @@ int nr_acknack_scheduling(gNB_MAC_INST *mac, * called often, don't try to lock every time */ const int CC_id = 0; - const int minfbtime = mac->minRXTXTIMEpdsch; + const int minfbtime = mac->radio_config.minRXTXTIME; const NR_ServingCellConfigCommon_t *scc = mac->common_channels[CC_id].ServingCellConfigCommon; const NR_UE_UL_BWP_t *ul_bwp = &UE->current_UL_BWP; const int n_slots_frame = nr_slots_per_frame[ul_bwp->scs]; diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index 15d823aaf2..a39945d8fb 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -38,24 +38,20 @@ void set_cset_offset(uint16_t); -void mac_top_init_gNB(ngran_node_t node_type); +void mac_top_init_gNB(ngran_node_t node_type, + NR_ServingCellConfigCommon_t *scc, + NR_ServingCellConfig_t *scd, + const nr_mac_config_t *conf); +void nr_mac_send_f1_setup_req(void); -int nr_mac_enable_ue_rrc_processing_timer(module_id_t Mod_idP, - rnti_t rnti, - NR_SubcarrierSpacing_t subcarrierSpacing, - uint32_t rrc_reconfiguration_delay); +void nr_mac_config_scc(gNB_MAC_INST *nrmac, NR_ServingCellConfigCommon_t *scc, const nr_mac_config_t *mac_config); +void nr_mac_configure_sib1(gNB_MAC_INST *nrmac, const f1ap_plmn_t *plmn, uint64_t cellID, int tac); -void nr_mac_config_scc(gNB_MAC_INST *nrmac, - rrc_pdsch_AntennaPorts_t pdsch_AntennaPorts, - int pusch_AntennaPorts, - int sib1_tda, - int minRXTXTIMEpdsch, - NR_ServingCellConfigCommon_t *scc); -void nr_mac_config_mib(gNB_MAC_INST *nrmac, NR_BCCH_BCH_Message_t *mib); -void nr_mac_config_sib1(gNB_MAC_INST *nrmac, NR_BCCH_DL_SCH_Message_t *sib1); bool nr_mac_add_test_ue(gNB_MAC_INST *nrmac, uint32_t rnti, NR_CellGroupConfig_t *CellGroup); bool nr_mac_prepare_ra_ue(gNB_MAC_INST *nrmac, uint32_t rnti, NR_CellGroupConfig_t *CellGroup); -bool nr_mac_update_cellgroup(gNB_MAC_INST *nrmac, uint32_t rnti, NR_CellGroupConfig_t *CellGroup); + +bool nr_mac_prepare_cellgroup_update(gNB_MAC_INST *nrmac, NR_UE_info_t *UE, NR_CellGroupConfig_t *CellGroup); +int nr_mac_enable_ue_rrc_processing_timer(gNB_MAC_INST *mac, NR_UE_info_t *UE, bool apply_cellGroup); void clear_nr_nfapi_information(gNB_MAC_INST *gNB, int CC_idP, @@ -395,6 +391,7 @@ uint8_t get_dl_nrOfLayers(const NR_UE_sched_ctrl_t *sched_ctrl, const nr_dci_for void set_sched_pucch_list(NR_UE_sched_ctrl_t *sched_ctrl, const NR_UE_UL_BWP_t *ul_bwp, const NR_ServingCellConfigCommon_t *scc); +void free_sched_pucch_list(NR_UE_sched_ctrl_t *sched_ctrl); const int get_dl_tda(const gNB_MAC_INST *nrmac, const NR_ServingCellConfigCommon_t *scc, int slot); const int get_ul_tda(gNB_MAC_INST *nrmac, const NR_ServingCellConfigCommon_t *scc, int frame, int slot); diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c index e78b66fded..0e383e4eaf 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c +++ b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c @@ -30,6 +30,49 @@ #include "uper_decoder.h" #include "uper_encoder.h" +static bool check_plmn_identity(const f1ap_plmn_t *check_plmn, const f1ap_plmn_t *plmn) +{ + return plmn->mcc == check_plmn->mcc && plmn->mnc_digit_length == check_plmn->mnc_digit_length && plmn->mnc == check_plmn->mnc; +} + +void f1_setup_response(const f1ap_setup_resp_t *resp) +{ + LOG_I(MAC, "received F1 Setup Response from CU %s\n", resp->gNB_CU_name); + + if (resp->num_cells_to_activate == 0) { + LOG_W(NR_MAC, "no cell to activate: cell remains blocked\n"); + return; + } + + gNB_MAC_INST *mac = RC.nrmac[0]; + NR_SCHED_LOCK(&mac->sched_lock); + const f1ap_setup_req_t *setup_req = mac->f1_config.setup_req; + const f1ap_served_cell_info_t *du_cell = &setup_req->cell[0].info; + + AssertFatal(resp->num_cells_to_activate == 1, "can only handle one cell, but %d activated\n", resp->num_cells_to_activate); + const served_cells_to_activate_t *cu_cell = &resp->cells_to_activate[0]; + + AssertFatal(du_cell->nr_cellid == cu_cell->nr_cellid, "CellID mismatch: DU %ld vs CU %ld\n", du_cell->nr_cellid, cu_cell->nr_cellid); + AssertFatal(check_plmn_identity(&du_cell->plmn, &cu_cell->plmn), "PLMN mismatch\n"); + AssertFatal(du_cell->nr_pci == cu_cell->nrpci, "PCI mismatch: DU %d vs CU %d\n", du_cell->nr_pci, cu_cell->nrpci); + + AssertFatal(cu_cell->num_SI == 0, "handling of CU-provided SIBs: not implemented\n"); + + mac->f1_config.setup_resp = malloc(sizeof(*mac->f1_config.setup_resp)); + AssertFatal(mac->f1_config.setup_resp != NULL, "out of memory\n"); + *mac->f1_config.setup_resp = *resp; + if (resp->gNB_CU_name) + mac->f1_config.setup_resp->gNB_CU_name = strdup(resp->gNB_CU_name); + + NR_SCHED_UNLOCK(&mac->sched_lock); +} + +void f1_setup_failure(const f1ap_setup_failure_t *failure) +{ + LOG_E(MAC, "the CU reported F1AP Setup Failure, is there a configuration mismatch?\n"); + exit(1); +} + static NR_RLC_BearerConfig_t *get_bearerconfig_from_srb(const f1ap_srb_to_be_setup_t *srb) { long priority = srb->srb_id; // high priority for SRB @@ -95,6 +138,54 @@ static int handle_ue_context_drbs_setup(int rnti, return drbs_len; } +static NR_UE_NR_Capability_t *get_ue_nr_cap(int rnti, uint8_t *buf, uint32_t len) +{ + if (buf == NULL || len == 0) + return NULL; + + NR_UE_CapabilityRAT_ContainerList_t *clist = NULL; + asn_dec_rval_t dec_rval = uper_decode(NULL, &asn_DEF_NR_UE_CapabilityRAT_ContainerList, (void **)&clist, buf, len, 0, 0); + if (dec_rval.code != RC_OK) { + LOG_W(NR_MAC, "cannot decode UE capability container list of UE RNTI %04x, ignoring capabilities\n", rnti); + return NULL; + } + + NR_UE_NR_Capability_t *cap = NULL; + for (int i = 0; i < clist->list.count; i++) { + const NR_UE_CapabilityRAT_Container_t *c = clist->list.array[i]; + if (cap != NULL || c->rat_Type != NR_RAT_Type_nr) { + LOG_W(NR_MAC, "UE RNTI %04x: ignoring capability of type %ld\n", rnti, c->rat_Type); + continue; + } + + asn_dec_rval_t dec_rval = uper_decode(NULL, + &asn_DEF_NR_UE_NR_Capability, + (void **)&cap, + c->ue_CapabilityRAT_Container.buf, + c->ue_CapabilityRAT_Container.size, + 0, + 0); + if (dec_rval.code != RC_OK) { + LOG_W(NR_MAC, "cannot decode NR UE capabilities of UE RNTI %04x, ignoring NR capability\n", rnti); + cap = NULL; + continue; + } + } + return cap; +} + +static NR_CellGroupConfig_t *clone_CellGroupConfig(const NR_CellGroupConfig_t *orig) +{ + uint8_t buf[16636]; + asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig, NULL, orig, buf, sizeof(buf)); + AssertFatal(enc_rval.encoded > 0, "could not clone CellGroupConfig: problem while encoding\n"); + NR_CellGroupConfig_t *cloned = NULL; + asn_dec_rval_t dec_rval = uper_decode(NULL, &asn_DEF_NR_CellGroupConfig, (void **)&cloned, buf, enc_rval.encoded, 0, 0); + AssertFatal(dec_rval.code == RC_OK && dec_rval.consumed == enc_rval.encoded, + "could not clone CellGroupConfig: problem while decodung\n"); + return cloned; +} + void ue_context_setup_request(const f1ap_ue_context_setup_t *req) { gNB_MAC_INST *mac = RC.nrmac[0]; @@ -104,9 +195,12 @@ void ue_context_setup_request(const f1ap_ue_context_setup_t *req) .gNB_DU_ue_id = req->gNB_DU_ue_id, }; + NR_UE_NR_Capability_t *ue_cap = NULL; if (req->cu_to_du_rrc_information != NULL) { AssertFatal(req->cu_to_du_rrc_information->cG_ConfigInfo == NULL, "CG-ConfigInfo not handled\n"); - AssertFatal(req->cu_to_du_rrc_information->uE_CapabilityRAT_ContainerList == NULL, "UE capabilities not handled yet\n"); + ue_cap = get_ue_nr_cap(req->gNB_DU_ue_id, + req->cu_to_du_rrc_information->uE_CapabilityRAT_ContainerList, + req->cu_to_du_rrc_information->uE_CapabilityRAT_ContainerList_length); AssertFatal(req->cu_to_du_rrc_information->measConfig == NULL, "MeasConfig not handled\n"); } @@ -115,12 +209,14 @@ void ue_context_setup_request(const f1ap_ue_context_setup_t *req) NR_UE_info_t *UE = find_nr_UE(&RC.nrmac[0]->UE_info, req->gNB_DU_ue_id); AssertFatal(UE != NULL, "did not find UE with RNTI %04x, but UE Context Setup Failed not implemented\n", req->gNB_DU_ue_id); + NR_CellGroupConfig_t *new_CellGroup = clone_CellGroupConfig(UE->CellGroup); + if (req->srbs_to_be_setup_length > 0) { resp.srbs_to_be_setup_length = handle_ue_context_srbs_setup(req->gNB_DU_ue_id, req->srbs_to_be_setup_length, req->srbs_to_be_setup, &resp.srbs_to_be_setup, - UE->CellGroup); + new_CellGroup); } if (req->drbs_to_be_setup_length > 0) { @@ -128,27 +224,33 @@ void ue_context_setup_request(const f1ap_ue_context_setup_t *req) req->drbs_to_be_setup_length, req->drbs_to_be_setup, &resp.drbs_to_be_setup, - UE->CellGroup); + new_CellGroup); } if (req->rrc_container != NULL) nr_rlc_srb_recv_sdu(req->gNB_DU_ue_id, DCCH, req->rrc_container, req->rrc_container_length); - //nr_mac_update_cellgroup() + UE->capability = ue_cap; + if (ue_cap != NULL) { + // store the new UE capabilities, and update the cellGroupConfig + ASN_STRUCT_FREE(asn_DEF_NR_UE_NR_Capability, UE->capability); + UE->capability = ue_cap; + LOG_I(NR_MAC, "UE %04x: received capabilities, updating CellGroupConfig\n", UE->rnti); + NR_ServingCellConfigCommon_t *scc = mac->common_channels[0].ServingCellConfigCommon; + update_cellGroupConfig(new_CellGroup, UE->uid, UE->capability, &mac->radio_config, scc); + } + resp.du_to_cu_rrc_information = calloc(1, sizeof(du_to_cu_rrc_information_t)); AssertFatal(resp.du_to_cu_rrc_information != NULL, "out of memory\n"); resp.du_to_cu_rrc_information->cellGroupConfig = calloc(1,1024); AssertFatal(resp.du_to_cu_rrc_information->cellGroupConfig != NULL, "out of memory\n"); - asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig, - NULL, - UE->CellGroup, - resp.du_to_cu_rrc_information->cellGroupConfig, - 1024); + asn_enc_rval_t enc_rval = + uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig, NULL, new_CellGroup, resp.du_to_cu_rrc_information->cellGroupConfig, 1024); AssertFatal(enc_rval.encoded > 0, "Could not encode CellGroup, failed element %s\n", enc_rval.failed_type->name); resp.du_to_cu_rrc_information->cellGroupConfig_length = (enc_rval.encoded + 7) >> 3; /* TODO: need to apply after UE context reconfiguration confirmed? */ - process_CellGroup(UE->CellGroup, UE); + nr_mac_prepare_cellgroup_update(mac, UE, new_CellGroup); NR_SCHED_UNLOCK(&mac->sched_lock); @@ -174,21 +276,26 @@ void ue_context_modification_request(const f1ap_ue_context_modif_req_t *req) .gNB_DU_ue_id = req->gNB_DU_ue_id, }; + NR_UE_NR_Capability_t *ue_cap = NULL; if (req->cu_to_du_rrc_information != NULL) { AssertFatal(req->cu_to_du_rrc_information->cG_ConfigInfo == NULL, "CG-ConfigInfo not handled\n"); - AssertFatal(req->cu_to_du_rrc_information->uE_CapabilityRAT_ContainerList == NULL, "UE capabilities not handled yet\n"); + ue_cap = get_ue_nr_cap(req->gNB_DU_ue_id, + req->cu_to_du_rrc_information->uE_CapabilityRAT_ContainerList, + req->cu_to_du_rrc_information->uE_CapabilityRAT_ContainerList_length); AssertFatal(req->cu_to_du_rrc_information->measConfig == NULL, "MeasConfig not handled\n"); } NR_SCHED_LOCK(&mac->sched_lock); NR_UE_info_t *UE = find_nr_UE(&RC.nrmac[0]->UE_info, req->gNB_DU_ue_id); + NR_CellGroupConfig_t *new_CellGroup = clone_CellGroupConfig(UE->CellGroup); + if (req->srbs_to_be_setup_length > 0) { resp.srbs_to_be_setup_length = handle_ue_context_srbs_setup(req->gNB_DU_ue_id, req->srbs_to_be_setup_length, req->srbs_to_be_setup, &resp.srbs_to_be_setup, - UE->CellGroup); + new_CellGroup); } if (req->drbs_to_be_setup_length > 0) { @@ -196,7 +303,7 @@ void ue_context_modification_request(const f1ap_ue_context_modif_req_t *req) req->drbs_to_be_setup_length, req->drbs_to_be_setup, &resp.drbs_to_be_setup, - UE->CellGroup); + new_CellGroup); } if (req->rrc_container != NULL) @@ -207,24 +314,31 @@ void ue_context_modification_request(const f1ap_ue_context_modif_req_t *req) "RRC reconfiguration outcome unsuccessful, but no rollback mechanism implemented to come back to old configuration\n"); } - if (req->srbs_to_be_setup_length > 0 || req->drbs_to_be_setup_length > 0) { - /* TODO: if we change e.g. BWP or MCS table, need to automatically call - * configure_UE_BWP() (form nr_mac_update_timers()) after some time? */ + if (ue_cap != NULL) { + // store the new UE capabilities, and update the cellGroupConfig + ASN_STRUCT_FREE(asn_DEF_NR_UE_NR_Capability, UE->capability); + UE->capability = ue_cap; + LOG_I(NR_MAC, "UE %04x: received capabilities, updating CellGroupConfig\n", UE->rnti); + NR_ServingCellConfigCommon_t *scc = mac->common_channels[0].ServingCellConfigCommon; + update_cellGroupConfig(new_CellGroup, UE->uid, UE->capability, &mac->radio_config, scc); + } + if (req->srbs_to_be_setup_length > 0 || req->drbs_to_be_setup_length > 0 || ue_cap != NULL) { resp.du_to_cu_rrc_information = calloc(1, sizeof(du_to_cu_rrc_information_t)); AssertFatal(resp.du_to_cu_rrc_information != NULL, "out of memory\n"); resp.du_to_cu_rrc_information->cellGroupConfig = calloc(1, 1024); AssertFatal(resp.du_to_cu_rrc_information->cellGroupConfig != NULL, "out of memory\n"); asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig, NULL, - UE->CellGroup, + new_CellGroup, resp.du_to_cu_rrc_information->cellGroupConfig, 1024); AssertFatal(enc_rval.encoded > 0, "Could not encode CellGroup, failed element %s\n", enc_rval.failed_type->name); resp.du_to_cu_rrc_information->cellGroupConfig_length = (enc_rval.encoded + 7) >> 3; - /* works? */ - nr_mac_update_cellgroup(RC.nrmac[0], req->gNB_DU_ue_id, UE->CellGroup); + nr_mac_prepare_cellgroup_update(mac, UE, new_CellGroup); + } else { + ASN_STRUCT_FREE(asn_DEF_NR_CellGroupConfig, new_CellGroup); // we actually don't need it } NR_SCHED_UNLOCK(&mac->sched_lock); @@ -355,26 +469,13 @@ void dl_rrc_message_transfer(const f1ap_dl_rrc_message_t *dl_rrc) if (UE->expect_reconfiguration && dl_rrc->srb_id == DCCH) { /* we expected a reconfiguration, and this is on DCCH. We assume this is - * the reconfiguration; nr_mac_update_cellgroup() brings the config into - * the form expected by nr_mac_update_timers(), and we set the timer to - * apply the real configuration at expiration. - * Calling it nr_mac_update_cellgroup() is misleading, and using an - * intermediate buffer seems not necessary. This is for historical reasons, - * when we only had pointer to an RRC structure, and wanted to duplicate - * the contents to be applied later. The actually interesting function here - * is also configure_UE_BWP(), only called in nr_mac_update_timers(). - * TODO: This should be cleaned up when the whole CellGroupConfig is - * handled entirely at the DU: no intermediate buffer, trigger the timer - * from a function (there is nr_mac_enable_ue_rrc_processing_timer(), which - * is called from the RRC, hence locks the scheduler, which we cannot use). */ - LOG_I(NR_MAC, "triggering rrc_processing_timer time UE %04x\n", UE->rnti); - pthread_mutex_lock(&mac->sched_lock); - nr_mac_update_cellgroup(mac, dl_rrc->gNB_DU_ue_id, UE->reconfigCellGroup); - pthread_mutex_unlock(&mac->sched_lock); - const uint16_t sl_ahead = mac->if_inst->sl_ahead; - NR_SubcarrierSpacing_t scs = 1; - int delay = 10; - UE->UE_sched_ctrl.rrc_processing_timer = (delay << scs) + sl_ahead; + * the reconfiguration: nr_mac_prepare_cellgroup_update() already stored + * the CellGroupConfig. Below, we trigger a timer, and the CellGroupConfig + * will be applied after its expiry in nr_mac_apply_cellgroup().*/ + NR_SCHED_LOCK(&mac->sched_lock); + nr_mac_enable_ue_rrc_processing_timer(mac, UE, /* apply_cellGroup = */ true); + NR_SCHED_UNLOCK(&mac->sched_lock); + UE->expect_reconfiguration = false; } if (dl_rrc->old_gNB_DU_ue_id != NULL) { @@ -390,9 +491,11 @@ void dl_rrc_message_transfer(const f1ap_dl_rrc_message_t *dl_rrc) * from the current configuration. Also, expect the reconfiguration from * the CU, so save the old UE's CellGroup for the new UE */ UE->CellGroup->spCellConfig = NULL; - nr_mac_update_cellgroup(mac, dl_rrc->gNB_DU_ue_id, UE->CellGroup); - UE->reconfigCellGroup = oldUE->CellGroup; - UE->expect_reconfiguration = true; + NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl; + NR_ServingCellConfigCommon_t *scc = mac->common_channels[0].ServingCellConfigCommon; + configure_UE_BWP(mac, scc, sched_ctrl, NULL, UE, -1, -1); + + nr_mac_prepare_cellgroup_update(mac, UE, oldUE->CellGroup); oldUE->CellGroup = NULL; mac_remove_nr_ue(mac, *dl_rrc->old_gNB_DU_ue_id); pthread_mutex_unlock(&mac->sched_lock); diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.h b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.h index ebe6ba5adc..32759b304f 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.h @@ -25,6 +25,9 @@ #include "platform_types.h" #include "f1ap_messages_types.h" +void f1_setup_response(const f1ap_setup_resp_t *resp); +void f1_setup_failure(const f1ap_setup_failure_t *failure); + void ue_context_setup_request(const f1ap_ue_context_setup_t *req); void ue_context_modification_request(const f1ap_ue_context_modif_req_t *req); void ue_context_modification_confirm(const f1ap_ue_context_modif_confirm_t *confirm); diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul.h b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul.h index 43a4818e93..b90e490302 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul.h @@ -25,6 +25,8 @@ #include "platform_types.h" #include "f1ap_messages_types.h" +typedef void (*f1_setup_request_func_t)(const f1ap_setup_req_t* req); + typedef void (*ue_context_setup_response_func_t)(const f1ap_ue_context_setup_t* req, const f1ap_ue_context_setup_t *resp); typedef void (*ue_context_modification_response_func_t)(const f1ap_ue_context_modif_req_t *req, const f1ap_ue_context_modif_resp_t *resp); diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_direct.c b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_direct.c index dab70b5e82..905b9255e4 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_direct.c +++ b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_direct.c @@ -24,6 +24,46 @@ #include "mac_rrc_ul.h" +static void f1_setup_request_direct(const f1ap_setup_req_t *req) +{ + MessageDef *msg = itti_alloc_new_message(TASK_MAC_GNB, 0, F1AP_SETUP_REQ); + f1ap_setup_req_t *f1ap_msg = &F1AP_SETUP_REQ(msg); + f1ap_msg->gNB_DU_id = req->gNB_DU_id; + f1ap_msg->gNB_DU_name = strdup(req->gNB_DU_name); + f1ap_msg->num_cells_available = req->num_cells_available; + for (int n = 0; n < req->num_cells_available; ++n) { + f1ap_msg->cell[n].info = req->cell[n].info; // copy most fields + if (req->cell[n].info.tac) { + f1ap_msg->cell[n].info.tac = malloc(sizeof(*f1ap_msg->cell[n].info.tac)); + AssertFatal(f1ap_msg->cell[n].info.tac != NULL, "out of memory\n"); + *f1ap_msg->cell[n].info.tac = *req->cell[n].info.tac; + } + if (req->cell[n].info.measurement_timing_information) + f1ap_msg->cell[n].info.measurement_timing_information = strdup(req->cell[n].info.measurement_timing_information); + + if (req->cell[n].sys_info) { + f1ap_gnb_du_system_info_t *orig_sys_info = req->cell[n].sys_info; + f1ap_gnb_du_system_info_t *copy_sys_info = calloc(1, sizeof(*copy_sys_info)); + AssertFatal(copy_sys_info != NULL, "out of memory\n"); + f1ap_msg->cell[n].sys_info = copy_sys_info; + + copy_sys_info->mib = calloc(orig_sys_info->mib_length, sizeof(uint8_t)); + AssertFatal(copy_sys_info->mib != NULL, "out of memory\n"); + memcpy(copy_sys_info->mib, orig_sys_info->mib, orig_sys_info->mib_length); + copy_sys_info->mib_length = orig_sys_info->mib_length; + + if (orig_sys_info->sib1_length > 0) { + copy_sys_info->sib1 = calloc(orig_sys_info->sib1_length, sizeof(uint8_t)); + AssertFatal(copy_sys_info->sib1 != NULL, "out of memory\n"); + memcpy(copy_sys_info->sib1, orig_sys_info->sib1, orig_sys_info->sib1_length); + copy_sys_info->sib1_length = orig_sys_info->sib1_length; + } + } + } + + itti_send_msg_to_task(TASK_RRC_GNB, 0, msg); +} + static void ue_context_setup_response_direct(const f1ap_ue_context_setup_t *req, const f1ap_ue_context_setup_t *resp) { DevAssert(req->drbs_to_be_setup_length == resp->drbs_to_be_setup_length); @@ -64,9 +104,7 @@ static void ue_context_modification_response_direct(const f1ap_ue_context_modif_ f1ap_msg->gNB_CU_ue_id = resp->gNB_CU_ue_id; f1ap_msg->gNB_DU_ue_id = resp->gNB_DU_ue_id; - f1ap_msg->mcc = resp->mcc; - f1ap_msg->mnc = resp->mnc; - f1ap_msg->mnc_digit_length = resp->mnc_digit_length; + f1ap_msg->plmn = resp->plmn; f1ap_msg->nr_cellid = resp->nr_cellid; f1ap_msg->servCellIndex = resp->servCellIndex; AssertFatal(resp->cellULConfigured == NULL, "not handled\n"); @@ -174,6 +212,7 @@ static void initial_ul_rrc_message_transfer_direct(module_id_t module_id, const void mac_rrc_ul_direct_init(struct nr_mac_rrc_ul_if_s *mac_rrc) { + mac_rrc->f1_setup_request = f1_setup_request_direct; mac_rrc->ue_context_setup_response = ue_context_setup_response_direct; mac_rrc->ue_context_modification_response = ue_context_modification_response_direct; mac_rrc->ue_context_modification_required = ue_context_modification_required_direct; diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_f1ap.c b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_f1ap.c index c873c569e5..b98de08a0d 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_f1ap.c +++ b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_f1ap.c @@ -29,6 +29,76 @@ #include "mac_rrc_ul.h" +static f1ap_net_config_t read_DU_IP_config(const eth_params_t* f1_params) +{ + f1ap_net_config_t nc = {0}; + + nc.CU_f1_ip_address.ipv6 = 0; + nc.CU_f1_ip_address.ipv4 = 1; + strcpy(nc.CU_f1_ip_address.ipv4_address, f1_params->remote_addr); + nc.CUport = f1_params->remote_portd; + LOG_I(GNB_APP, + "FIAP: CU_ip4_address in DU %p, strlen %d\n", + nc.CU_f1_ip_address.ipv4_address, + (int)strlen(f1_params->remote_addr)); + + nc.DU_f1_ip_address.ipv6 = 0; + nc.DU_f1_ip_address.ipv4 = 1; + strcpy(nc.DU_f1_ip_address.ipv4_address, f1_params->my_addr); + nc.DUport = f1_params->my_portd; + LOG_I(GNB_APP, + "FIAP: DU_ip4_address in DU %p, strlen %ld\n", + nc.DU_f1_ip_address.ipv4_address, + strlen(f1_params->my_addr)); + + // sctp_in_streams/sctp_out_streams are given by SCTP layer + return nc; +} + + +static void f1_setup_request_f1ap(const f1ap_setup_req_t *req) +{ + MessageDef *msg = itti_alloc_new_message(TASK_MAC_GNB, 0, F1AP_DU_REGISTER_REQ); + + f1ap_setup_req_t *f1ap_setup = &F1AP_DU_REGISTER_REQ(msg).setup_req; + f1ap_setup->gNB_DU_id = req->gNB_DU_id; + f1ap_setup->gNB_DU_name = strdup(req->gNB_DU_name); + f1ap_setup->num_cells_available = req->num_cells_available; + for (int n = 0; n < req->num_cells_available; ++n) { + f1ap_setup->cell[n].info = req->cell[n].info; // copy most fields + if (req->cell[n].info.tac) { + f1ap_setup->cell[n].info.tac = malloc(sizeof(*f1ap_setup->cell[n].info.tac)); + AssertFatal(f1ap_setup->cell[n].info.tac != NULL, "out of memory\n"); + *f1ap_setup->cell[n].info.tac = *req->cell[n].info.tac; + } + if (req->cell[n].info.measurement_timing_information) + f1ap_setup->cell[n].info.measurement_timing_information = strdup(req->cell[n].info.measurement_timing_information); + + if (req->cell[n].sys_info) { + f1ap_gnb_du_system_info_t *orig_sys_info = req->cell[n].sys_info; + f1ap_gnb_du_system_info_t *copy_sys_info = calloc(1, sizeof(*copy_sys_info)); + AssertFatal(copy_sys_info != NULL, "out of memory\n"); + f1ap_setup->cell[n].sys_info = copy_sys_info; + + copy_sys_info->mib = calloc(orig_sys_info->mib_length, sizeof(uint8_t)); + AssertFatal(copy_sys_info->mib != NULL, "out of memory\n"); + memcpy(copy_sys_info->mib, orig_sys_info->mib, orig_sys_info->mib_length); + copy_sys_info->mib_length = orig_sys_info->mib_length; + + if (orig_sys_info->sib1_length > 0) { + copy_sys_info->sib1 = calloc(orig_sys_info->sib1_length, sizeof(uint8_t)); + AssertFatal(copy_sys_info->sib1 != NULL, "out of memory\n"); + memcpy(copy_sys_info->sib1, orig_sys_info->sib1, orig_sys_info->sib1_length); + copy_sys_info->sib1_length = orig_sys_info->sib1_length; + } + } + } + + F1AP_DU_REGISTER_REQ(msg).net_config = read_DU_IP_config(&RC.nrmac[0]->eth_params_n); + + itti_send_msg_to_task(TASK_DU_F1, 0, msg); +} + static void ue_context_setup_response_f1ap(const f1ap_ue_context_setup_t *req, const f1ap_ue_context_setup_t *resp) { DevAssert(req->drbs_to_be_setup_length == resp->drbs_to_be_setup_length); @@ -161,6 +231,7 @@ static void initial_ul_rrc_message_transfer_f1ap(module_id_t module_id, const f1 void mac_rrc_ul_f1ap_init(struct nr_mac_rrc_ul_if_s *mac_rrc) { + mac_rrc->f1_setup_request = f1_setup_request_f1ap; mac_rrc->ue_context_setup_response = ue_context_setup_response_f1ap; mac_rrc->ue_context_modification_response = ue_context_modification_response_f1ap; mac_rrc->ue_context_modification_required = ue_context_modification_required_f1ap; diff --git a/openair2/LAYER2/NR_MAC_gNB/main.c b/openair2/LAYER2/NR_MAC_gNB/main.c index 7fd559fdcd..f38e70d66e 100644 --- a/openair2/LAYER2/NR_MAC_gNB/main.c +++ b/openair2/LAYER2/NR_MAC_gNB/main.c @@ -205,11 +205,16 @@ static void mac_rrc_init(gNB_MAC_INST *mac, ngran_node_t node_type) } } -void mac_top_init_gNB(ngran_node_t node_type) +void mac_top_init_gNB(ngran_node_t node_type, + NR_ServingCellConfigCommon_t *scc, + NR_ServingCellConfig_t *scd, + const nr_mac_config_t *config) { module_id_t i; gNB_MAC_INST *nrmac; + AssertFatal(RC.nb_nr_macrlc_inst == 1, "what is the point of calling %s() if you don't need exactly one MAC?\n", __func__); + LOG_I(MAC, "[MAIN] Init function start:nb_nr_macrlc_inst=%d\n",RC.nb_nr_macrlc_inst); if (RC.nb_nr_macrlc_inst > 0) { @@ -239,7 +244,13 @@ void mac_top_init_gNB(ngran_node_t node_type) RC.nrmac[i]->ul_handle = 0; + RC.nrmac[i]->common_channels[0].ServingCellConfigCommon = scc; + RC.nrmac[i]->radio_config = *config; + + RC.nrmac[i]->common_channels[0].pre_ServingCellConfig = scd; + RC.nrmac[i]->first_MIB = true; + RC.nrmac[i]->common_channels[0].mib = get_new_MIB_NR(scc); RC.nrmac[i]->cset0_bwp_start = 0; RC.nrmac[i]->cset0_bwp_size = 0; @@ -305,4 +316,14 @@ void mac_top_init_gNB(ngran_node_t node_type) du_init_f1_ue_data(); srand48(0); + + // triggers also PYH initialization in case we have L1 via FAPI + nr_mac_config_scc(RC.nrmac[0], scc, config); +} + +void nr_mac_send_f1_setup_req(void) +{ + gNB_MAC_INST *mac = RC.nrmac[0]; + DevAssert(mac); + mac->mac_rrc.f1_setup_request(mac->f1_config.setup_req); } diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 4bec3664c8..eacb8c84dd 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -71,6 +71,7 @@ #include "NR_BCCH-BCH-Message.h" #include "NR_CellGroupConfig.h" #include "NR_BCCH-DL-SCH-Message.h" +#include "openair2/RRC/NR/nr_rrc_config.h" /* PHY */ #include "time_meas.h" @@ -120,6 +121,24 @@ typedef enum { WAIT_Msg4_ACK = 6 } RA_gNB_state_t; +typedef struct nr_pdsch_AntennaPorts_t { + int N1; + int N2; + int XP; +} nr_pdsch_AntennaPorts_t; + +typedef struct nr_mac_config_t { + int sib1_tda; + nr_pdsch_AntennaPorts_t pdsch_AntennaPorts; + int pusch_AntennaPorts; + int minRXTXTIME; + int do_CSIRS; + int do_SRS; + bool force_256qam_off; + //int pusch_TargetSNRx10; + //int pucch_TargetSNRx10; +} nr_mac_config_t; + typedef struct NR_preamble_ue { uint8_t num_preambles; uint8_t *preamble_list; @@ -220,12 +239,15 @@ typedef struct { NR_BCCH_BCH_Message_t *mib; NR_BCCH_DL_SCH_Message_t *sib1; NR_ServingCellConfigCommon_t *ServingCellConfigCommon; + /// pre-configured ServingCellConfig that is default for every UE + NR_ServingCellConfig_t *pre_ServingCellConfig; NR_ARFCN_ValueEUTRA_t ul_CarrierFreq; long ul_Bandwidth; /// Outgoing MIB PDU for PHY - MIB_PDU MIB_pdu; + uint8_t MIB_pdu[3]; /// Outgoing BCCH pdu for PHY - BCCH_PDU BCCH_pdu; + uint8_t sib1_bcch_pdu[NR_MAX_SIB_LENGTH / 8]; + int sib1_bcch_length; /// Outgoing BCCH DCI allocation uint32_t BCCH_alloc_pdu; /// Outgoing CCCH pdu for PHY @@ -656,6 +678,7 @@ typedef struct NR_bler_options { } NR_bler_options_t; typedef struct nr_mac_rrc_ul_if_s { + f1_setup_request_func_t f1_setup_request; ue_context_setup_response_func_t ue_context_setup_response; ue_context_modification_response_func_t ue_context_modification_response; ue_context_modification_required_func_t ue_context_modification_required; @@ -677,10 +700,10 @@ typedef struct { /// currently active CellGroupConfig NR_CellGroupConfig_t *CellGroup; /// CellGroupConfig that is to be activated after the next reconfiguration - NR_CellGroupConfig_t *reconfigCellGroup; bool expect_reconfiguration; - char cg_buf[32768]; /* arbitrary size */ - asn_enc_rval_t enc_rval; + NR_CellGroupConfig_t *reconfigCellGroup; + bool apply_cellgroup; + NR_UE_NR_Capability_t *capability; // UE selected beam index uint8_t UE_beam_index; bool Msg4_ACKed; @@ -708,6 +731,11 @@ typedef bool (*nr_pp_impl_ul)(module_id_t mod_id, frame_t frame, sub_frame_t slot); +typedef struct f1_config_t { + f1ap_setup_req_t *setup_req; + f1ap_setup_resp_t *setup_resp; +} f1_config_t; + /*! \brief top level eNB MAC structure */ typedef struct gNB_MAC_INST_s { /// Ethernet parameters for northbound midhaul interface @@ -734,9 +762,7 @@ typedef struct gNB_MAC_INST_s { /// Subcarrier Offset int ssb_SubcarrierOffset; int ssb_OffsetPointA; - /// SIB1 Time domain allocation - int sib1_tda; - int minRXTXTIMEpdsch; + /// Common cell resources NR_COMMON_channels_t common_channels[NFAPI_CC_MAX]; /// current PDU index (BCH,DLSCH) @@ -802,20 +828,22 @@ typedef struct gNB_MAC_INST_s { /// UL preprocessor for differentiated scheduling nr_pp_impl_ul pre_processor_ul; + nr_mac_config_t radio_config; + NR_UE_sched_ctrl_t *sched_ctrlCommon; uint16_t cset0_bwp_start; uint16_t cset0_bwp_size; NR_Type0_PDCCH_CSS_config_t type0_PDCCH_CSS_config[64]; - int xp_pdsch_antenna_ports; - bool first_MIB; NR_bler_options_t dl_bler; NR_bler_options_t ul_bler; uint8_t min_grant_prb; uint8_t min_grant_mcs; bool identity_pm; + nr_mac_rrc_ul_if_t mac_rrc; + f1_config_t f1_config; int16_t frame; int16_t slot; diff --git a/openair2/M2AP/m2ap_MCE_defs.h b/openair2/M2AP/m2ap_MCE_defs.h index dc8f9ff5ee..4f6e295d01 100644 --- a/openair2/M2AP/m2ap_MCE_defs.h +++ b/openair2/M2AP/m2ap_MCE_defs.h @@ -115,7 +115,7 @@ typedef struct m2ap_MCE_data_s { uint16_t cnx_id; /* SCTP association id */ - int32_t assoc_id; + sctp_assoc_t assoc_id; /* Nid cells */ uint32_t Nid_cell[MAX_NUM_CCs]; diff --git a/openair2/M2AP/m2ap_MCE_generate_messages.c b/openair2/M2AP/m2ap_MCE_generate_messages.c index 3a4c1bb473..d513fcd3db 100644 --- a/openair2/M2AP/m2ap_MCE_generate_messages.c +++ b/openair2/M2AP/m2ap_MCE_generate_messages.c @@ -314,7 +314,7 @@ int m2ap_MCE_generate_m2_setup_response(m2ap_MCE_instance_t *instance_p, m2ap_MC } int m2ap_MCE_generate_m2_setup_failure(instance_t instance, - uint32_t assoc_id, + sctp_assoc_t assoc_id, M2AP_Cause_PR cause_type, long cause_value, long time_to_wait) diff --git a/openair2/M2AP/m2ap_MCE_generate_messages.h b/openair2/M2AP/m2ap_MCE_generate_messages.h index 1632dc807a..17c8243a38 100644 --- a/openair2/M2AP/m2ap_MCE_generate_messages.h +++ b/openair2/M2AP/m2ap_MCE_generate_messages.h @@ -38,7 +38,7 @@ int m2ap_MCE_generate_m2_setup_request(m2ap_MCE_instance_t *instance_p, int m2ap_MCE_generate_m2_setup_response(m2ap_MCE_instance_t *instance_p, m2ap_MCE_data_t *m2ap_MCE_data_p); int m2ap_MCE_generate_m2_setup_failure(instance_t instance, - uint32_t assoc_id, + sctp_assoc_t assoc_id, M2AP_Cause_PR cause_type, long cause_value, long time_to_wait); diff --git a/openair2/M2AP/m2ap_MCE_handler.c b/openair2/M2AP/m2ap_MCE_handler.c index aacb178444..586b89750f 100644 --- a/openair2/M2AP/m2ap_MCE_handler.c +++ b/openair2/M2AP/m2ap_MCE_handler.c @@ -74,9 +74,11 @@ static char *m2ap_direction_String[] = { return(m2ap_direction_String[m2ap_dir]); } - -int m2ap_MCE_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, - const uint8_t * const data, const uint32_t data_length) +int m2ap_MCE_handle_message(instance_t instance, + sctp_assoc_t assoc_id, + int32_t stream, + const uint8_t *const data, + const uint32_t data_length) { M2AP_M2AP_PDU_t pdu; int ret; diff --git a/openair2/M2AP/m2ap_MCE_handler.h b/openair2/M2AP/m2ap_MCE_handler.h index 68cab5c8ac..164efe171e 100644 --- a/openair2/M2AP/m2ap_MCE_handler.h +++ b/openair2/M2AP/m2ap_MCE_handler.h @@ -33,11 +33,13 @@ //void m2ap_handle_m2_setup_message(m2ap_eNB_instance_t *instance_p, m2ap_eNB_data_t *eNB_desc_p, int sctp_shutdown); -int m2ap_MCE_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, - const uint8_t * const data, const uint32_t data_length); - -//int m2ap_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, - //const uint8_t * const data, const uint32_t data_length); +int m2ap_MCE_handle_message(instance_t instance, + sctp_assoc_t assoc_id, + int32_t stream, + const uint8_t *const data, + const uint32_t data_length); +// int m2ap_handle_message(instance_t instance, sctp_assoc_t assoc_id, int32_t stream, +// const uint8_t * const data, const uint32_t data_length); #endif /* __M2AP_MCE_HANDLERS__H__ */ diff --git a/openair2/M2AP/m2ap_MCE_interface_management.c b/openair2/M2AP/m2ap_MCE_interface_management.c index 58a4c7b967..9d45eac4a3 100644 --- a/openair2/M2AP/m2ap_MCE_interface_management.c +++ b/openair2/M2AP/m2ap_MCE_interface_management.c @@ -43,8 +43,9 @@ extern m2ap_setup_req_t *m2ap_mce_data_from_enb; /* * MBMS Session start */ -int MCE_send_MBMS_SESSION_START_REQUEST(instance_t instance/*, uint32_t assoc_id*/,m2ap_session_start_req_t* m2ap_session_start_req){ - +int MCE_send_MBMS_SESSION_START_REQUEST(instance_t instance /*, sctp_assoc_t assoc_id*/, + m2ap_session_start_req_t *m2ap_session_start_req) +{ //AssertFatal(1==0,"Not implemented yet\n"); //module_id_t enb_mod_idP=0; @@ -153,13 +154,10 @@ int MCE_send_MBMS_SESSION_START_REQUEST(instance_t instance/*, uint32_t assoc_id //MCE_m2ap_itti_send_sctp_data_req(instance, m2ap_mce_data_from_mce->assoid,buffer,len,0); m2ap_MCE_itti_send_sctp_data_req(instance,m2ap_mce_data_from_enb->assoc_id,buffer,len,0); return 0; - } -int MCE_handle_MBMS_SESSION_START_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu){ +int MCE_handle_MBMS_SESSION_START_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu) +{ //AssertFatal(1==0,"Not implemented yet\n"); LOG_D(M2AP, "MCE_handle_MBMS_SESSION_START_RESPONSE\n"); @@ -215,13 +213,10 @@ int MCE_handle_MBMS_SESSION_START_RESPONSE(instance_t instance, assoc_id,ENB_MODULE_ID_TO_INSTANCE(assoc_id)); itti_send_msg_to_task(TASK_MCE_APP, ENB_MODULE_ID_TO_INSTANCE(assoc_id), msg_g); return 0; - } -int MCE_handle_MBMS_SESSION_START_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu){ - AssertFatal(1==0,"Not implemented yet\n"); +int MCE_handle_MBMS_SESSION_START_FAILURE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu) +{ + AssertFatal(1 == 0, "Not implemented yet\n"); } /* @@ -285,10 +280,8 @@ int MCE_send_MBMS_SESSION_STOP_REQUEST(instance_t instance, m2ap_session_stop_re } -int MCE_handle_MBMS_SESSION_STOP_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu){ +int MCE_handle_MBMS_SESSION_STOP_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu) +{ //AssertFatal(1==0,"Not implemented yet\n"); LOG_D(M2AP, "MCE_handle_MBMS_SESSION_STOP_RESPONSE\n"); @@ -347,14 +340,9 @@ int MCE_handle_MBMS_SESSION_STOP_RESPONSE(instance_t instance, return 0; } - - -int MCE_handle_MBMS_SESSION_STOP_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu){ +int MCE_handle_MBMS_SESSION_STOP_FAILURE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); - } typedef struct M2AP_MBSFN_Area_Configuration{ M2AP_PMCH_Configuration_List_t PMCH_Configuration_List; @@ -375,8 +363,8 @@ int MCE_handle_MBMS_SESSION_STOP_FAILURE(instance_t instance, 0x00, 0x18, 0x00, 0x01, 0x80, 0x00, 0x1d, 0x00, 0x01, 0x01}; -int MCE_send_MBMS_SCHEDULING_INFORMATION(instance_t instance, /*uint32_t assoc_id,*/m2ap_mbms_scheduling_information_t * m2ap_mbms_scheduling_information){ - +int MCE_send_MBMS_SCHEDULING_INFORMATION(instance_t instance, /*sctp_assoc_t assoc_id,*/ m2ap_mbms_scheduling_information_t * m2ap_mbms_scheduling_information) +{ //module_id_t enb_mod_idP=0; //module_id_t du_mod_idP=0; @@ -573,14 +561,13 @@ ASN_SET_ADD(&ie->value.choice.MBSFN_Area_Configuration_List,m2ap_mbsfn_area_conf } m2ap_MCE_itti_send_sctp_data_req(instance,m2ap_mce_data_from_enb->assoc_id,buffer,len,0); return 0; - -} - -int MCE_handle_MBMS_SCHEDULING_INFORMATION_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu){ + } + int MCE_handle_MBMS_SCHEDULING_INFORMATION_RESPONSE(instance_t instance, + sctp_assoc_t assoc_id, + uint32_t stream, + M2AP_M2AP_PDU_t *pdu) + { LOG_D(M2AP, "MCE_handle_MBMS_SCHEDULING_INFORMATION_RESPONSE\n"); AssertFatal(pdu->present == M2AP_M2AP_PDU_PR_successfulOutcome, @@ -636,8 +623,7 @@ int MCE_handle_MBMS_SCHEDULING_INFORMATION_RESPONSE(instance_t instance, itti_send_msg_to_task(TASK_MCE_APP, ENB_MODULE_ID_TO_INSTANCE(instance), msg_g); // return 0; - -} + } /* * Reset @@ -649,19 +635,13 @@ int MCE_send_RESET(instance_t instance, m2ap_reset_t * m2ap_reset) { } - -int MCE_handle_RESET_ACKKNOWLEDGE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu) { +int MCE_handle_RESET_ACKKNOWLEDGE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); - } -int MCE_handle_RESET(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu) { +int MCE_handle_RESET(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); } @@ -672,10 +652,7 @@ int MCE_send_RESET_ACKNOWLEDGE(instance_t instance, M2AP_ResetAcknowledge_t *Res /* * M2 Setup */ -int MCE_handle_M2_SETUP_REQUEST(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu) +int MCE_handle_M2_SETUP_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu) { LOG_D(M2AP, "MCE_handle_M2_SETUP_REQUEST assoc_id %d\n",assoc_id); @@ -832,7 +809,7 @@ int MCE_handle_M2_SETUP_REQUEST(instance_t instance, return 0; } -int MCE_send_M2_SETUP_RESPONSE(instance_t instance, /*uint32_t assoc_id,*/ +int MCE_send_M2_SETUP_RESPONSE(instance_t instance, /*sctp_assoc_t assoc_id,*/ m2ap_setup_resp_t *m2ap_setup_resp) { //module_id_t mce_mod_idP; @@ -1144,11 +1121,8 @@ int MCE_send_MCE_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod_id } - -int MCE_handle_MCE_CONFIGURATION_UPDATE_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu){ +int MCE_handle_MCE_CONFIGURATION_UPDATE_FAILURE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); LOG_D(M2AP, "MCE_handle_MCE_CONFIGURATION_UPDATE_FAILURE\n"); @@ -1192,11 +1166,12 @@ int MCE_handle_MCE_CONFIGURATION_UPDATE_FAILURE(instance_t instance, } - int MCE_handle_MCE_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu){ + sctp_assoc_t assoc_id, + uint32_t stream, + M2AP_M2AP_PDU_t *pdu) +{ + AssertFatal(1==0,"Not implemented yet\n"); LOG_D(M2AP, "MCE_handle_MCE_CONFIGURATION_UPDATE_ACKNOWLEDGE assoc_id %d\n",assoc_id); @@ -1221,19 +1196,14 @@ int MCE_handle_MCE_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, itti_send_msg_to_task(TASK_MCE_APP, ENB_MODULE_ID_TO_INSTANCE(instance), message_p); return 0; - } - /* * ENB Configuration Update */ - -int MCE_handle_ENB_CONFIGURATION_UPDATE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu){ +int MCE_handle_ENB_CONFIGURATION_UPDATE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); LOG_D(M2AP, "MCE_handle_MCE_CONFIGURATION_UPDATE_ACKNOWLEDGE assoc_id %d\n",assoc_id); @@ -1280,13 +1250,9 @@ int MCE_send_ENB_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, * Error Indication */ -int MCE_handle_ERROR_INDICATION(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu) { +int MCE_handle_ERROR_INDICATION(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); - - } int MCE_send_ERROR_INDICATION(instance_t instance, M2AP_ErrorIndication_t *ErrorIndication) { @@ -1304,18 +1270,11 @@ int MCE_send_MBMS_SESSION_UPDATE_REQUEST(instance_t instance, m2ap_mbms_session_ //M2AP_SessionUpdateRequest_t SessionUpdateRequest; } - - -int MCE_handle_MBMS_SESSION_UPDATE_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu){ +int MCE_handle_MBMS_SESSION_UPDATE_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); - } - - int MCE_handle_MBMS_SESSION_UPDATE_FAILURE(instance_t instance,module_id_t du_mod_idP){ AssertFatal(1==0,"Not implemented yet\n"); @@ -1330,12 +1289,8 @@ int MCE_send_MBMS_SERVICE_COUNTING_REQUEST(instance_t instance, module_id_t du_m //M2AP_MbmsServiceCountingRequest_t MbmsServiceCountingRequest; } - - -int MCE_handle_MBMS_SERVICE_COUNTING_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu){ +int MCE_handle_MBMS_SERVICE_COUNTING_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu) +{ //int i; //AssertFatal(1==0,"Not implemented yet\n"); LOG_D(M2AP, "MCE_handle_MBMS_SERVICE_COUNTING_RESPONSE\n"); @@ -1468,9 +1423,10 @@ int MCE_handle_MBMS_SESSION_COUNTING_FAILURE(instance_t instance, module_id_t d */ int MCE_handle_MBMS_SESSION_COUNTING_RESULTS_REPORT(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu){ + sctp_assoc_t assoc_id, + uint32_t stream, + M2AP_M2AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); } @@ -1479,10 +1435,8 @@ int MCE_handle_MBMS_SESSION_COUNTING_RESULTS_REPORT(instance_t instance, /* * Overload Notification */ -int MCE_handle_MBMS_OVERLOAD_NOTIFICATION(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu){ +int MCE_handle_MBMS_OVERLOAD_NOTIFICATION(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); } diff --git a/openair2/M2AP/m2ap_MCE_interface_management.h b/openair2/M2AP/m2ap_MCE_interface_management.h index 2b1d5824af..c88b3a524c 100644 --- a/openair2/M2AP/m2ap_MCE_interface_management.h +++ b/openair2/M2AP/m2ap_MCE_interface_management.h @@ -35,69 +35,50 @@ /* * MBMS Session start */ -int MCE_send_MBMS_SESSION_START_REQUEST(instance_t instance/*, - uint32_t assoc_id*/,m2ap_session_start_req_t* m2ap_session_start_req); -int MCE_handle_MBMS_SESSION_START_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); +int MCE_send_MBMS_SESSION_START_REQUEST(instance_t instance /*, + sctp_assoc_t assoc_id*/ + , + m2ap_session_start_req_t *m2ap_session_start_req); +int MCE_handle_MBMS_SESSION_START_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); -int MCE_handle_MBMS_SESSION_START_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); +int MCE_handle_MBMS_SESSION_START_FAILURE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); /* * MBMS Session stop */ int MCE_send_MBMS_SESSION_STOP_REQUEST(instance_t instance, m2ap_session_stop_req_t* m2ap_session_stop_req); -int MCE_handle_MBMS_SESSION_STOP_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); +int MCE_handle_MBMS_SESSION_STOP_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); /* * MBMS Scheduling Information */ int MCE_send_MBMS_SCHEDULING_INFORMATION(instance_t instance, - /*uint32_t assoc_id,*/ m2ap_mbms_scheduling_information_t * m2ap_mbms_scheduling_information ); + /*sctp_assoc_t assoc_id,*/ m2ap_mbms_scheduling_information_t *m2ap_mbms_scheduling_information); int MCE_handle_MBMS_SCHEDULING_INFORMATION_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); - - + sctp_assoc_t assoc_id, + uint32_t stream, + M2AP_M2AP_PDU_t *pdu); /* * Reset */ int MCE_send_RESET(instance_t instance, m2ap_reset_t * m2ap_reset); -int MCE_handle_RESET_ACKKNOWLEDGE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); +int MCE_handle_RESET_ACKKNOWLEDGE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); -int MCE_handle_RESET(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); +int MCE_handle_RESET(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); int MCE_send_RESET_ACKNOWLEDGE(instance_t instance, M2AP_ResetAcknowledge_t *ResetAcknowledge); /* * M2AP Setup */ -int MCE_handle_M2_SETUP_REQUEST(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); +int MCE_handle_M2_SETUP_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); -int MCE_send_M2_SETUP_RESPONSE(instance_t instance,/*uint32_t assoc_id,*/ m2ap_setup_resp_t *m2ap_setup_resp); - -int MCE_send_M2_SETUP_FAILURE(instance_t instance, /*uint32_t assoc_id*/ m2ap_setup_failure_t * m2ap_setup_failure); +int MCE_send_M2_SETUP_RESPONSE(instance_t instance, /*sctp_assoc_t assoc_id,*/ m2ap_setup_resp_t *m2ap_setup_resp); +int MCE_send_M2_SETUP_FAILURE(instance_t instance, /*sctp_assoc_t assoc_id*/ m2ap_setup_failure_t *m2ap_setup_failure); /* * MCE Configuration Update @@ -105,25 +86,18 @@ int MCE_send_M2_SETUP_FAILURE(instance_t instance, /*uint32_t assoc_id*/ m2ap_se int MCE_send_MCE_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod_idP); -int MCE_handle_MCE_CONFIGURATION_UPDATE_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); +int MCE_handle_MCE_CONFIGURATION_UPDATE_FAILURE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); int MCE_handle_MCE_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); + sctp_assoc_t assoc_id, + uint32_t stream, + M2AP_M2AP_PDU_t *pdu); /* * ENB Configuration Update */ - -int MCE_handle_ENB_CONFIGURATION_UPDATE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); +int MCE_handle_ENB_CONFIGURATION_UPDATE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); int MCE_send_ENB_CONFIGURATION_UPDATE_FAILURE(instance_t instance, m2ap_enb_configuration_update_failure_t *m2ap_enb_configuration_update_failure); @@ -133,10 +107,7 @@ int MCE_send_ENB_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, /* * Error Indication */ -int MCE_handle_ERROR_INDICATION(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); +int MCE_handle_ERROR_INDICATION(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); int MCE_send_ERROR_INDICATION(instance_t instance, M2AP_ErrorIndication_t *ErrorIndication); @@ -145,10 +116,7 @@ int MCE_send_ERROR_INDICATION(instance_t instance, M2AP_ErrorIndication_t *Error */ int MCE_send_MBMS_SESSION_UPDATE_REQUEST(instance_t instance, m2ap_mbms_session_update_req_t * m2ap_mbms_session_update_req); -int MCE_handle_MBMS_SESSION_UPDATE_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); +int MCE_handle_MBMS_SESSION_UPDATE_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); int MCE_handle_MBMS_SESSION_UPDATE_FAILURE(instance_t instance,module_id_t du_mod_idP); @@ -157,10 +125,7 @@ int MCE_handle_MBMS_SESSION_UPDATE_FAILURE(instance_t instance,module_id_t du_mo */ int MCE_send_MBMS_SERVICE_COUNTING_REQUEST(instance_t instance, module_id_t du_mod_idP); -int MCE_handle_MBMS_SERVICE_COUNTING_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); +int MCE_handle_MBMS_SERVICE_COUNTING_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); int MCE_handle_MBMS_SESSION_COUNTING_FAILURE(instance_t instance, module_id_t du_mod_idP); /* @@ -168,21 +133,14 @@ int MCE_handle_MBMS_SESSION_COUNTING_FAILURE(instance_t instance, module_id_t du */ int MCE_handle_MBMS_SESSION_COUNTING_RESULTS_REPORT(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); + sctp_assoc_t assoc_id, + uint32_t stream, + M2AP_M2AP_PDU_t *pdu); /* * Overload Notification */ -int MCE_handle_MBMS_OVERLOAD_NOTIFICATION(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); - - - - +int MCE_handle_MBMS_OVERLOAD_NOTIFICATION(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); #endif /* M2AP_MCE_INTERFACE_MANAGEMENT_H_ */ diff --git a/openair2/M2AP/m2ap_MCE_management_procedures.c b/openair2/M2AP/m2ap_MCE_management_procedures.c index 3934a57c74..82ae691350 100644 --- a/openair2/M2AP/m2ap_MCE_management_procedures.c +++ b/openair2/M2AP/m2ap_MCE_management_procedures.c @@ -122,9 +122,7 @@ dump_mce_tree_m2(zz->m2ap_mce_head.rbh_root); } } -struct m2ap_MCE_data_s *m2ap_get_MCE(m2ap_MCE_instance_t *instance_p, - int32_t assoc_id, - uint16_t cnx_id) +struct m2ap_MCE_data_s *m2ap_get_MCE(m2ap_MCE_instance_t *instance_p, sctp_assoc_t assoc_id, uint16_t cnx_id) { struct m2ap_MCE_data_s temp; struct m2ap_MCE_data_s *found; diff --git a/openair2/M2AP/m2ap_MCE_management_procedures.h b/openair2/M2AP/m2ap_MCE_management_procedures.h index 4e8997dbc5..e4997a140e 100644 --- a/openair2/M2AP/m2ap_MCE_management_procedures.h +++ b/openair2/M2AP/m2ap_MCE_management_procedures.h @@ -47,8 +47,6 @@ m2ap_MCE_data_t* m2ap_is_MCE_assoc_id_in_list(uint32_t sctp_assoc_id); m2ap_MCE_data_t* m2ap_is_MCE_pci_in_list (const uint32_t pci); -struct m2ap_MCE_data_s *m2ap_get_MCE(m2ap_MCE_instance_t *instance_p, - int32_t assoc_id, - uint16_t cnx_id); +struct m2ap_MCE_data_s *m2ap_get_MCE(m2ap_MCE_instance_t *instance_p, sctp_assoc_t assoc_id, uint16_t cnx_id); #endif /* __M2AP_MCE_MANAGEMENT_PROCEDURES__H__ */ diff --git a/openair2/M2AP/m2ap_common.h b/openair2/M2AP/m2ap_common.h index 7981eaa2a5..92e3274c81 100644 --- a/openair2/M2AP/m2ap_common.h +++ b/openair2/M2AP/m2ap_common.h @@ -76,25 +76,11 @@ extern int asn1_xer_print; /** \brief Function callback prototype. **/ -typedef int (*m2ap_message_decoded_callback)( - instance_t instance, - uint32_t assocId, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); - -typedef int (*m2ap_MCE_message_decoded_callback)( - instance_t instance, - uint32_t assocId, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); - -typedef int (*m2ap_eNB_message_decoded_callback)( - instance_t instance, - uint32_t assocId, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); +typedef int (*m2ap_message_decoded_callback)(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); +typedef int (*m2ap_MCE_message_decoded_callback)(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); +typedef int (*m2ap_eNB_message_decoded_callback)(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); /** \brief Encode a successfull outcome message \param buffer pointer to buffer in which data will be encoded diff --git a/openair2/M2AP/m2ap_eNB_defs.h b/openair2/M2AP/m2ap_eNB_defs.h index 4cc409400e..c7f30c69c7 100644 --- a/openair2/M2AP/m2ap_eNB_defs.h +++ b/openair2/M2AP/m2ap_eNB_defs.h @@ -27,6 +27,8 @@ */ #include +#include +#include #include "queue.h" #include "tree.h" @@ -115,7 +117,7 @@ typedef struct m2ap_eNB_data_s { uint16_t cnx_id; /* SCTP association id */ - int32_t assoc_id; + sctp_assoc_t assoc_id; /* Nid cells */ uint32_t Nid_cell[MAX_NUM_CCs]; diff --git a/openair2/M2AP/m2ap_eNB_generate_messages.c b/openair2/M2AP/m2ap_eNB_generate_messages.c index 8e7e096d13..93ea5a1f19 100644 --- a/openair2/M2AP/m2ap_eNB_generate_messages.c +++ b/openair2/M2AP/m2ap_eNB_generate_messages.c @@ -311,7 +311,7 @@ //} //int m2ap_MCE_generate_m2_setup_failure(instance_t instance, -// uint32_t assoc_id, +// sctp_assoc_t assoc_id, // M2AP_Cause_PR cause_type, // long cause_value, // long time_to_wait) diff --git a/openair2/M2AP/m2ap_eNB_generate_messages.h b/openair2/M2AP/m2ap_eNB_generate_messages.h index 793f7f18cf..a65941ac57 100644 --- a/openair2/M2AP/m2ap_eNB_generate_messages.h +++ b/openair2/M2AP/m2ap_eNB_generate_messages.h @@ -38,7 +38,7 @@ //int m2ap_MCE_generate_m2_setup_response(m2ap_eNB_instance_t *instance_p, m2ap_eNB_data_t *m2ap_eNB_data_p); // /*int m2ap_MCE_generate_m2_setup_failure(instance_t instance, - uint32_t assoc_id, + sctp_assoc_t assoc_id, M2AP_Cause_PR cause_type, long cause_value, long time_to_wait);*/ diff --git a/openair2/M2AP/m2ap_eNB_handler.c b/openair2/M2AP/m2ap_eNB_handler.c index 0a474c72a8..14b657d6ad 100644 --- a/openair2/M2AP/m2ap_eNB_handler.c +++ b/openair2/M2AP/m2ap_eNB_handler.c @@ -72,9 +72,11 @@ static char *m2ap_direction_String[] = { return(m2ap_direction_String[m2ap_dir]); } - -int m2ap_eNB_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, - const uint8_t * const data, const uint32_t data_length) +int m2ap_eNB_handle_message(instance_t instance, + sctp_assoc_t assoc_id, + int32_t stream, + const uint8_t *const data, + const uint32_t data_length) { M2AP_M2AP_PDU_t pdu; int ret; diff --git a/openair2/M2AP/m2ap_eNB_handler.h b/openair2/M2AP/m2ap_eNB_handler.h index ea4231a6e3..1954d20de9 100644 --- a/openair2/M2AP/m2ap_eNB_handler.h +++ b/openair2/M2AP/m2ap_eNB_handler.h @@ -33,10 +33,13 @@ //void m2ap_handle_m2_setup_message(m2ap_eNB_instance_t *instance_p, m2ap_eNB_data_t *eNB_desc_p, int sctp_shutdown); -int m2ap_eNB_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, - const uint8_t * const data, const uint32_t data_length); +int m2ap_eNB_handle_message(instance_t instance, + sctp_assoc_t assoc_id, + int32_t stream, + const uint8_t *const data, + const uint32_t data_length); -//int m2ap_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, +//int m2ap_handle_message(instance_t instance, sctp_assoc_t assoc_id, int32_t stream, //const uint8_t * const data, const uint32_t data_length); diff --git a/openair2/M2AP/m2ap_eNB_interface_management.c b/openair2/M2AP/m2ap_eNB_interface_management.c index a336a559a3..987f02b613 100644 --- a/openair2/M2AP/m2ap_eNB_interface_management.c +++ b/openair2/M2AP/m2ap_eNB_interface_management.c @@ -60,10 +60,8 @@ extern m2ap_setup_req_t *m2ap_enb_data_g; //extern m2ap_setup_req_t *m2ap_mce_data_from_enb; -int eNB_handle_MBMS_SCHEDULING_INFORMATION(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu){ +int eNB_handle_MBMS_SCHEDULING_INFORMATION(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu) +{ LOG_D(M2AP, "eNB_handle_MBMS_SCHEDULING_INFORMATION assoc_id %d\n",assoc_id); MessageDef *message_p/*,*message_p2*/; @@ -258,13 +256,8 @@ int eNB_send_MBMS_SCHEDULING_INFORMATION_RESPONSE(instance_t instance, m2ap_mbms return 0; } - - - -int eNB_handle_MBMS_SESSION_START_REQUEST(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu){ +int eNB_handle_MBMS_SESSION_START_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu) +{ LOG_D(M2AP, "eNB_handle_MBMS_SESSION_START_REQUEST assoc_id %d\n",assoc_id); MessageDef *message_p; @@ -424,10 +417,8 @@ int eNB_send_MBMS_SESSION_START_FAILURE(instance_t instance, m2ap_session_start_ return 0; } -int eNB_handle_MBMS_SESSION_STOP_REQUEST(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu){ +int eNB_handle_MBMS_SESSION_STOP_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu) +{ LOG_D(M2AP, "eNB_handle_MBMS_SESSION_STOP_REQUEST assoc_id %d\n",assoc_id); MessageDef *message_p; @@ -688,10 +679,7 @@ int eNB_send_M2_SETUP_REQUEST(m2ap_eNB_instance_t *instance_p, m2ap_eNB_data_t* } -int eNB_handle_M2_SETUP_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu) +int eNB_handle_M2_SETUP_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu) { LOG_D(M2AP, "eNB_handle_M2_SETUP_RESPONSE\n"); @@ -800,10 +788,8 @@ int eNB_handle_M2_SETUP_RESPONSE(instance_t instance, } // SETUP FAILURE -int eNB_handle_M2_SETUP_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu) { +int eNB_handle_M2_SETUP_FAILURE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu) +{ LOG_D(M2AP, "eNB_handle_M2_SETUP_FAILURE\n"); M2AP_M2SetupFailure_t *in = &pdu->choice.unsuccessfulOutcome.value.choice.M2SetupFailure; @@ -985,10 +971,7 @@ int eNB_send_eNB_CONFIGURATION_UPDATE(instance_t instance, m2ap_enb_configuratio return 0; } -int eNB_handle_eNB_CONFIGURATION_UPDATE_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu) +int eNB_handle_eNB_CONFIGURATION_UPDATE_FAILURE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu) { AssertFatal(1==0,"Not implemented yet\n"); @@ -1032,12 +1015,10 @@ int eNB_handle_eNB_CONFIGURATION_UPDATE_FAILURE(instance_t instance, return 0; } - - int eNB_handle_eNB_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu) + sctp_assoc_t assoc_id, + uint32_t stream, + M2AP_M2AP_PDU_t *pdu) { LOG_D(M2AP, "eNB_handle_eNB_CONFIGURATION_UPDATE_ACKNOWLEDGE assoc_id %d\n",assoc_id); @@ -1069,10 +1050,7 @@ int eNB_handle_eNB_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, /* * MCE Configuration Update */ -int eNB_handle_MCE_CONFIGURATION_UPDATE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu) +int eNB_handle_MCE_CONFIGURATION_UPDATE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu) { LOG_D(M2AP, "eNB_handle_MCE_CONFIGURATION_UPDATE assoc_id %d\n",assoc_id); @@ -1126,10 +1104,7 @@ int eNB_send_ERROR_INDICATION(instance_t instance, m2ap_error_indication_t * m2a return 0; } -int eNB_handle_ERROR_INDICATION(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu) +int eNB_handle_ERROR_INDICATION(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu) { AssertFatal(1==0,"Not implemented yet\n"); return 0; @@ -1140,10 +1115,7 @@ int eNB_handle_ERROR_INDICATION(instance_t instance, /* * Session Update Request */ -int eNB_handle_MBMS_SESSION_UPDATE_REQUEST(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu) +int eNB_handle_MBMS_SESSION_UPDATE_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu) { LOG_D(M2AP, "eNB_handle_MBMS_SESSION_STOP_REQUEST assoc_id %d\n",assoc_id); @@ -1190,10 +1162,7 @@ int eNB_send_MBMS_SESSION_UPDATE_FAILURE(instance_t instance, m2ap_mbms_session_ * Service Counting */ -int eNB_handle_MBMS_SERVICE_COUNTING_REQ(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu) +int eNB_handle_MBMS_SERVICE_COUNTING_REQ(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu) { LOG_D(M2AP, "eNB_handle_MBMS_SERVICE_COUNTING_REQUEST assoc_id %d\n",assoc_id); diff --git a/openair2/M2AP/m2ap_eNB_interface_management.h b/openair2/M2AP/m2ap_eNB_interface_management.h index 09bab1f125..a0c38c0760 100644 --- a/openair2/M2AP/m2ap_eNB_interface_management.h +++ b/openair2/M2AP/m2ap_eNB_interface_management.h @@ -37,10 +37,7 @@ * Session Start */ -int eNB_handle_MBMS_SESSION_START_REQUEST(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); +int eNB_handle_MBMS_SESSION_START_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); int eNB_send_MBMS_SESSION_START_RESPONSE(instance_t instance, m2ap_session_start_resp_t * m2ap_session_start_resp); int eNB_send_MBMS_SESSION_START_FAILURE(instance_t instance, m2ap_session_start_failure_t * m2ap_session_start_failure ); @@ -49,10 +46,7 @@ int eNB_send_MBMS_SESSION_START_FAILURE(instance_t instance, m2ap_session_start_ * Session Stop */ -int eNB_handle_MBMS_SESSION_STOP_REQUEST(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); +int eNB_handle_MBMS_SESSION_STOP_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); int eNB_send_MBMS_SESSION_STOP_RESPONSE(instance_t instance, m2ap_session_stop_resp_t * m2ap_session_stop_resp); @@ -60,10 +54,7 @@ int eNB_send_MBMS_SESSION_STOP_RESPONSE(instance_t instance, m2ap_session_stop_r * MBMS Scheduling Information */ -int eNB_handle_MBMS_SCHEDULING_INFORMATION(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); +int eNB_handle_MBMS_SCHEDULING_INFORMATION(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); int eNB_send_MBMS_SCHEDULING_INFORMATION_RESPONSE(instance_t instance, m2ap_mbms_scheduling_information_resp_t * m2ap_mbms_scheduling_information_resp); @@ -71,54 +62,36 @@ int eNB_send_MBMS_SCHEDULING_INFORMATION_RESPONSE(instance_t instance, m2ap_mbms /* * Reset */ -int eNB_handle_RESET(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); +int eNB_handle_RESET(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); int eNB_send_RESET_ACKKNOWLEDGE(instance_t instance, M2AP_ResetAcknowledge_t *ResetAcknowledge); int eNB_send_RESET(instance_t instance, M2AP_Reset_t *Reset); -int eNB_handle_RESET_ACKNOWLEDGE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); +int eNB_handle_RESET_ACKNOWLEDGE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); /* * M2AP Setup */ int eNB_send_M2_SETUP_REQUEST( m2ap_eNB_instance_t *instance_p, m2ap_eNB_data_t *m2ap_eNB_data_p); -int eNB_handle_M2_SETUP_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); +int eNB_handle_M2_SETUP_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); -int eNB_handle_M2_SETUP_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); +int eNB_handle_M2_SETUP_FAILURE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); /* * eNB Configuration Update */ int eNB_send_eNB_CONFIGURATION_UPDATE(instance_t instance, m2ap_enb_configuration_update_t * m2ap_enb_configuration_update); -int eNB_handle_eNB_CONFIGURATION_UPDATE_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); +int eNB_handle_eNB_CONFIGURATION_UPDATE_FAILURE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); int eNB_handle_eNB_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); + sctp_assoc_t assoc_id, + uint32_t stream, + M2AP_M2AP_PDU_t *pdu); /* * MCE Configuration Update */ -int eNB_handle_MCE_CONFIGURATION_UPDATE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); +int eNB_handle_MCE_CONFIGURATION_UPDATE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); int eNB_send_MCE_CONFIGURATION_UPDATE_FAILURE(instance_t instance, M2AP_MCEConfigurationUpdateFailure_t *MCEConfigurationUpdateFailure); @@ -130,19 +103,12 @@ int eNB_send_MCE_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, * Error Indication */ int eNB_send_ERROR_INDICATION(instance_t instance, m2ap_error_indication_t * m2ap_error_indication); -int eNB_handle_ERROR_INDICATION(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); - +int eNB_handle_ERROR_INDICATION(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); /* * Session Update Request */ -int eNB_handle_MBMS_SESSION_UPDATE_REQUEST(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); +int eNB_handle_MBMS_SESSION_UPDATE_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); int eNB_send_MBMS_SESSION_UPDATE_RESPONSE(instance_t instance, m2ap_mbms_session_update_resp_t * m2ap_mbms_session_update_resp); //?? @@ -152,10 +118,7 @@ int eNB_send_MBMS_SESSION_UPDATE_FAILURE(instance_t instance, m2ap_mbms_session_ * Service Counting */ -int eNB_handle_MBMS_SERVICE_COUNTING_REQ(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); +int eNB_handle_MBMS_SERVICE_COUNTING_REQ(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); int eNB_send_MBMS_SERVICE_COUNTING_REPORT(instance_t instance, m2ap_mbms_service_counting_report_t * m2ap_mbms_service_counting_report); int eNB_send_MBMS_SERVICE_COUNTING_RESP(instance_t instance, m2ap_mbms_service_counting_resp_t * m2ap_mbms_service_counting_resp); int eNB_send_MBMS_SERVICE_COUNTING_FAILURE(instance_t instance, m2ap_mbms_service_counting_failure_t * m2ap_mbms_service_counting_failure); diff --git a/openair2/M2AP/m2ap_eNB_management_procedures.c b/openair2/M2AP/m2ap_eNB_management_procedures.c index 59d91afb74..014ecf08d8 100644 --- a/openair2/M2AP/m2ap_eNB_management_procedures.c +++ b/openair2/M2AP/m2ap_eNB_management_procedures.c @@ -122,9 +122,7 @@ printf("---------------------------------------------\n"); } } -struct m2ap_eNB_data_s *m2ap_get_eNB(m2ap_eNB_instance_t *instance_p, - int32_t assoc_id, - uint16_t cnx_id) +struct m2ap_eNB_data_s *m2ap_get_eNB(m2ap_eNB_instance_t *instance_p, sctp_assoc_t assoc_id, uint16_t cnx_id) { struct m2ap_eNB_data_s temp; struct m2ap_eNB_data_s *found; diff --git a/openair2/M2AP/m2ap_eNB_management_procedures.h b/openair2/M2AP/m2ap_eNB_management_procedures.h index 2b1dc4a44b..e30943b4f2 100644 --- a/openair2/M2AP/m2ap_eNB_management_procedures.h +++ b/openair2/M2AP/m2ap_eNB_management_procedures.h @@ -47,8 +47,6 @@ m2ap_eNB_data_t* m2ap_is_eNB_assoc_id_in_list(uint32_t sctp_assoc_id); m2ap_eNB_data_t* m2ap_is_eNB_pci_in_list (const uint32_t pci); -struct m2ap_eNB_data_s *m2ap_get_eNB(m2ap_eNB_instance_t *instance_p, - int32_t assoc_id, - uint16_t cnx_id); +struct m2ap_eNB_data_s *m2ap_get_eNB(m2ap_eNB_instance_t *instance_p, sctp_assoc_t assoc_id, uint16_t cnx_id); #endif /* __M2AP_ENB_MANAGEMENT_PROCEDURES__H__ */ diff --git a/openair2/M2AP/m2ap_handler.c b/openair2/M2AP/m2ap_handler.c index ce568d3c19..2840f0bce8 100644 --- a/openair2/M2AP/m2ap_handler.c +++ b/openair2/M2AP/m2ap_handler.c @@ -74,9 +74,11 @@ static char *m2ap_direction_String[] = { return(m2ap_direction_String[m2ap_dir]); } - -int m2ap_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, - const uint8_t * const data, const uint32_t data_length) +int m2ap_handle_message(instance_t instance, + sctp_assoc_t assoc_id, + int32_t stream, + const uint8_t *const data, + const uint32_t data_length) { M2AP_M2AP_PDU_t pdu; int ret; diff --git a/openair2/M2AP/m2ap_handler.h b/openair2/M2AP/m2ap_handler.h index 88fb26bc3e..f642c16cc8 100644 --- a/openair2/M2AP/m2ap_handler.h +++ b/openair2/M2AP/m2ap_handler.h @@ -33,11 +33,16 @@ void m2ap_handle_m2_setup_message(m2ap_eNB_instance_t *instance_p, m2ap_eNB_data_t *eNB_desc_p, int sctp_shutdown); -int m2ap_eNB_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, - const uint8_t * const data, const uint32_t data_length); - -int m2ap_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, - const uint8_t * const data, const uint32_t data_length); +int m2ap_eNB_handle_message(instance_t instance, + sctp_assoc_t assoc_id, + int32_t stream, + const uint8_t *const data, + const uint32_t data_length); +int m2ap_handle_message(instance_t instance, + sctp_assoc_t assoc_id, + int32_t stream, + const uint8_t *const data, + const uint32_t data_length); #endif /* M2AP_ENB_OLD_HANDLERS_H_ */ diff --git a/openair2/M2AP/m2ap_itti_messaging.c b/openair2/M2AP/m2ap_itti_messaging.c index e0dcc27175..9c9528c349 100644 --- a/openair2/M2AP/m2ap_itti_messaging.c +++ b/openair2/M2AP/m2ap_itti_messaging.c @@ -30,8 +30,11 @@ #include "m2ap_itti_messaging.h" -void m2ap_eNB_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer, - uint32_t buffer_length, uint16_t stream) +void m2ap_eNB_itti_send_sctp_data_req(instance_t instance, + sctp_assoc_t assoc_id, + uint8_t *buffer, + uint32_t buffer_length, + uint16_t stream) { MessageDef *message_p; sctp_data_req_t *sctp_data_req; @@ -51,7 +54,7 @@ void m2ap_eNB_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uin } -void m2ap_eNB_itti_send_sctp_close_association(instance_t instance, int32_t assoc_id) +void m2ap_eNB_itti_send_sctp_close_association(instance_t instance, sctp_assoc_t assoc_id) { MessageDef *message_p = NULL; sctp_close_association_t *sctp_close_association_p = NULL; @@ -63,9 +66,11 @@ void m2ap_eNB_itti_send_sctp_close_association(instance_t instance, int32_t asso itti_send_msg_to_task(TASK_SCTP, instance, message_p); } - -void m2ap_MCE_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer, - uint32_t buffer_length, uint16_t stream) +void m2ap_MCE_itti_send_sctp_data_req(instance_t instance, + sctp_assoc_t assoc_id, + uint8_t *buffer, + uint32_t buffer_length, + uint16_t stream) { MessageDef *message_p; sctp_data_req_t *sctp_data_req; @@ -83,7 +88,7 @@ void m2ap_MCE_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uin } -void m2ap_MCE_itti_send_sctp_close_association(instance_t instance, int32_t assoc_id) +void m2ap_MCE_itti_send_sctp_close_association(instance_t instance, sctp_assoc_t assoc_id) { MessageDef *message_p = NULL; sctp_close_association_t *sctp_close_association_p = NULL; diff --git a/openair2/M2AP/m2ap_itti_messaging.h b/openair2/M2AP/m2ap_itti_messaging.h index bdc416bca7..11df7c0e64 100644 --- a/openair2/M2AP/m2ap_itti_messaging.h +++ b/openair2/M2AP/m2ap_itti_messaging.h @@ -29,18 +29,21 @@ #ifndef M2AP_ENB_ITTI_MESSAGING_H_ #define M2AP_ENB_ITTI_MESSAGING_H_ -void m2ap_eNB_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer, - uint32_t buffer_length, uint16_t stream); +void m2ap_eNB_itti_send_sctp_data_req(instance_t instance, + sctp_assoc_t assoc_id, + uint8_t *buffer, + uint32_t buffer_length, + uint16_t stream); +void m2ap_eNB_itti_send_sctp_close_association(instance_t instance, sctp_assoc_t assoc_id); -void m2ap_eNB_itti_send_sctp_close_association(instance_t instance, int32_t assoc_id); +void m2ap_MCE_itti_send_sctp_data_req(instance_t instance, + sctp_assoc_t assoc_id, + uint8_t *buffer, + uint32_t buffer_length, + uint16_t stream); - -void m2ap_MCE_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer, - uint32_t buffer_length, uint16_t stream); - - -void m2ap_MCE_itti_send_sctp_close_association(instance_t instance, int32_t assoc_id); +void m2ap_MCE_itti_send_sctp_close_association(instance_t instance, sctp_assoc_t assoc_id); diff --git a/openair2/RRC/LTE/rrc_defs.h b/openair2/RRC/LTE/rrc_defs.h index 30f47b99ac..b233cd502d 100644 --- a/openair2/RRC/LTE/rrc_defs.h +++ b/openair2/RRC/LTE/rrc_defs.h @@ -387,7 +387,7 @@ typedef struct HANDOVER_INFO_s { HO_STATE_t state; //current state of handover uint32_t modid_s; //module_idP of serving cell uint32_t modid_t; //module_idP of target cell - int assoc_id; + sctp_assoc_t assoc_id; uint8_t ueid_s; //UE index in serving cell uint8_t ueid_t; //UE index in target cell LTE_AS_Config_t as_config; /* these two parameters are taken from 36.331 section 10.2.2: HandoverPreparationInformation-r8-IEs */ diff --git a/openair2/RRC/NR/L2_nr_interface.c b/openair2/RRC/NR/L2_nr_interface.c index 3334842616..090486cf65 100644 --- a/openair2/RRC/NR/L2_nr_interface.c +++ b/openair2/RRC/NR/L2_nr_interface.c @@ -52,50 +52,6 @@ extern RAN_CONTEXT_t RC; -void nr_rrc_mac_update_cellgroup(rnti_t rntiMaybeUEid, NR_CellGroupConfig_t *cgc) -{ - gNB_MAC_INST *nrmac = RC.nrmac[0]; - NR_SCHED_LOCK(&nrmac->sched_lock); - nr_mac_update_cellgroup(nrmac, rntiMaybeUEid, cgc); - NR_SCHED_UNLOCK(&nrmac->sched_lock); -} - -uint16_t mac_rrc_nr_data_req(const module_id_t Mod_idP, - const int CC_id, - const frame_t frameP, - const rb_id_t Srb_id, - const rnti_t rnti, - const uint8_t Nb_tb, - uint8_t *const buffer_pP) -{ - - LOG_D(RRC,"[eNB %d] mac_rrc_data_req to SRB ID=%ld\n",Mod_idP,Srb_id); - - // MIBCH - if ((Srb_id & RAB_OFFSET) == MIBCH) { - - int encode_size = 3; - rrc_gNB_carrier_data_t *carrier = &RC.nrrrc[Mod_idP]->carrier; - int encoded = encode_MIB_NR(carrier->mib, frameP, buffer_pP, encode_size); - DevAssert(encoded == encode_size); - LOG_D(NR_RRC, "MIB PDU buffer_pP[0]=%x , buffer_pP[1]=%x, buffer_pP[2]=%x\n", buffer_pP[0], buffer_pP[1], - buffer_pP[2]); - return encode_size; - } - - if ((Srb_id & RAB_OFFSET) == BCCH) { - memcpy(&buffer_pP[0], RC.nrrrc[Mod_idP]->carrier.SIB1, RC.nrrrc[Mod_idP]->carrier.sizeof_SIB1); - return RC.nrrrc[Mod_idP]->carrier.sizeof_SIB1; - } - - // CCCH - if ((Srb_id & RAB_OFFSET) == CCCH) { - AssertFatal(0, "CCCH is managed by rlc of srb 0, not anymore by mac_rrc_nr_data_req\n"); - } - - return 0; -} - int8_t nr_mac_rrc_bwp_switch_req(const module_id_t module_idP, const frame_t frameP, const sub_frame_t sub_frameP, diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 3935c18bfe..4f042d4f05 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -196,8 +196,8 @@ int xer_nr_sprint (char *string, size_t string_size, asn_TYPE_descriptor_t *td, //------------------------------------------------------------------------------ -uint8_t do_SIB23_NR(rrc_gNB_carrier_data_t *carrier, - gNB_RrcConfigurationReq *configuration) { +uint8_t do_SIB23_NR(rrc_gNB_carrier_data_t *carrier) +{ asn_enc_rval_t enc_rval; SystemInformation_IEs__sib_TypeAndInfo__Member *sib2 = NULL; SystemInformation_IEs__sib_TypeAndInfo__Member *sib3 = NULL; @@ -242,16 +242,6 @@ uint8_t do_SIB23_NR(rrc_gNB_carrier_data_t *carrier, return((enc_rval.encoded+7)/8); } -void do_SpCellConfig(gNB_RRC_INST *rrc, - struct NR_SpCellConfig *spconfig){ - //gNB_RrcConfigurationReq *common_configuration; - //common_configuration = CALLOC(1,sizeof(gNB_RrcConfigurationReq)); - //Fill servingcellconfigcommon config value - //Fill common config to structure - // rrc->configuration = common_configuration; - spconfig->reconfigurationWithSync = CALLOC(1,sizeof(struct NR_ReconfigurationWithSync)); -} - //------------------------------------------------------------------------------ int do_RRCReject(uint8_t Mod_id, uint8_t *const buffer) @@ -474,37 +464,6 @@ void free_nr_noS1_bearer_config(NR_RadioBearerConfig_t **rbconfig, *rlc_rbconfig = NULL; } -void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, - NR_CellGroupConfig_t *ue_context_mastercellGroup, - int use_rlc_um_for_drb, - uint8_t configure_srb, - NR_DRB_ToAddModList_t *drb_configList, - long *priority) -{ - cellGroupConfig->cellGroupId = 0; - cellGroupConfig->rlc_BearerToReleaseList = NULL; - cellGroupConfig->rlc_BearerToAddModList = calloc(1, sizeof(*cellGroupConfig->rlc_BearerToAddModList)); - - // RLC Bearer Config - // TS38.331 9.2.1 Default SRB configurations - if (configure_srb){ - NR_RLC_BearerConfig_t *rlc_BearerConfig = get_SRB_RLC_BearerConfig(2, 3, NR_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms5); - asn1cSeqAdd(&cellGroupConfig->rlc_BearerToAddModList->list, rlc_BearerConfig); - asn1cSeqAdd(&ue_context_mastercellGroup->rlc_BearerToAddModList->list, rlc_BearerConfig); - } - - // DRB Configuration - if (drb_configList != NULL) { - for (int i = 0; i < drb_configList->list.count; ++i) { - const NR_RLC_Config_PR rlc_conf = use_rlc_um_for_drb ? NR_RLC_Config_PR_um_Bi_Directional : NR_RLC_Config_PR_am; - int rb_id = drb_configList->list.array[i]->drb_Identity; - NR_RLC_BearerConfig_t *rlc_BearerConfig = get_DRB_RLC_BearerConfig(3 + rb_id, rb_id, rlc_conf, priority[rb_id - 1]); - asn1cSeqAdd(&cellGroupConfig->rlc_BearerToAddModList->list, rlc_BearerConfig); - asn1cSeqAdd(&ue_context_mastercellGroup->rlc_BearerToAddModList->list, rlc_BearerConfig); - } - } -} - //------------------------------------------------------------------------------ int do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP, uint8_t *const buffer, @@ -542,9 +501,6 @@ int do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP, memcpy(ie->masterCellGroup.buf, masterCellGroup, masterCellGroup_len); ie->masterCellGroup.size = masterCellGroup_len; - // decode masterCellGroup OCTET_STRING received from DU and place in ue context - ue_p->masterCellGroup = decode_cellGroupConfig(masterCellGroup, masterCellGroup_len); - if (LOG_DEBUGFLAG(DEBUG_ASN1)) { xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, ue_p->masterCellGroup); xer_fprint(stdout, &asn_DEF_NR_DL_CCCH_Message, (void *)&dl_ccch_msg); @@ -553,6 +509,9 @@ int do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP, asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_DL_CCCH_Message, NULL, (void *)&dl_ccch_msg, buffer, 1000); AssertFatal(enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); + // free what we did not allocate ourselves + ie->radioBearerConfig.srb_ToAddModList = NULL; + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NR_DL_CCCH_Message, &dl_ccch_msg); LOG_D(NR_RRC, "RRCSetup Encoded %zd bits (%zd bytes)\n", enc_rval.encoded, (enc_rval.encoded + 7) / 8); return ((enc_rval.encoded + 7) / 8); @@ -617,7 +576,6 @@ uint8_t do_NR_SA_UECapabilityEnquiry( const protocol_ctxt_t *const ctxt_pP, NR_DL_DCCH_Message_t dl_dcch_msg; NR_UE_CapabilityRAT_Request_t *ue_capabilityrat_request; - asn_enc_rval_t enc_rval; memset(&dl_dcch_msg,0,sizeof(NR_DL_DCCH_Message_t)); dl_dcch_msg.message.present = NR_DL_DCCH_MessageType_PR_c1; dl_dcch_msg.message.choice.c1 = CALLOC(1,sizeof(struct NR_DL_DCCH_MessageType__c1)); @@ -642,25 +600,16 @@ uint8_t do_NR_SA_UECapabilityEnquiry( const protocol_ctxt_t *const ctxt_pP, sa_band_filter = (NR_UE_CapabilityRequestFilterNR_t*)calloc(1,sizeof(NR_UE_CapabilityRequestFilterNR_t)); sa_band_filter->frequencyBandListFilter = sa_band_list; - OCTET_STRING_t req_freq; - unsigned char req_freq_buf[1024]; - enc_rval = uper_encode_to_buffer(&asn_DEF_NR_UE_CapabilityRequestFilterNR, - NULL, - (void *)sa_band_filter, - req_freq_buf, - 1024); - AssertFatal(enc_rval.encoded >0, "ASN1 message encoding failed (%s, %lu)!\n", - enc_rval.failed_type->name, enc_rval.encoded); - + OCTET_STRING_t *req_freq = calloc(1, sizeof(*req_freq)); + AssertFatal(req_freq != NULL, "out of memory\n"); + req_freq->size = uper_encode_to_new_buffer(&asn_DEF_NR_UE_CapabilityRequestFilterNR, NULL, sa_band_filter, (void **)&req_freq->buf); + AssertFatal(req_freq->size > 0, "ASN1 message encoding failed (encoded %lu bytes)!\n", req_freq->size); if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { xer_fprint(stdout, &asn_DEF_NR_UE_CapabilityRequestFilterNR, (void *)sa_band_filter); } - req_freq.buf = req_freq_buf; - req_freq.size = (enc_rval.encoded+7)/8; - - ue_capabilityrat_request->capabilityRequestFilter = &req_freq; + ue_capabilityrat_request->capabilityRequestFilter = req_freq; asn1cSeqAdd(&dl_dcch_msg.message.choice.c1->choice.ueCapabilityEnquiry->criticalExtensions.choice.ueCapabilityEnquiry->ue_CapabilityRAT_RequestList.list, ue_capabilityrat_request); @@ -670,14 +619,11 @@ uint8_t do_NR_SA_UECapabilityEnquiry( const protocol_ctxt_t *const ctxt_pP, xer_fprint(stdout, &asn_DEF_NR_DL_DCCH_Message, (void *)&dl_dcch_msg); } - enc_rval = uper_encode_to_buffer(&asn_DEF_NR_DL_DCCH_Message, - NULL, - (void *)&dl_dcch_msg, - buffer, - 100); + asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_DL_DCCH_Message, NULL, (void *)&dl_dcch_msg, buffer, 100); AssertFatal(enc_rval.encoded >0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NR_DL_DCCH_Message, &dl_dcch_msg); LOG_D(NR_RRC, "[gNB %d] NR UECapabilityRequest for UE %lx Encoded %zd bits (%zd bytes)\n", ctxt_pP->module_id, ctxt_pP->rntiMaybeUEid, enc_rval.encoded, (enc_rval.encoded + 7) / 8); @@ -713,33 +659,27 @@ int do_NR_RRCRelease(uint8_t *buffer, size_t buffer_size, uint8_t Transaction_id buffer_size); AssertFatal(enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NR_DL_DCCH_Message, &dl_dcch_msg); return((enc_rval.encoded+7)/8); } //------------------------------------------------------------------------------ -int16_t do_RRCReconfiguration( - const protocol_ctxt_t *const ctxt_pP, - uint8_t *buffer, - size_t buffer_size, - uint8_t Transaction_id, - NR_SRB_ToAddModList_t *SRB_configList, - NR_DRB_ToAddModList_t *DRB_configList, - NR_DRB_ToReleaseList_t *DRB_releaseList, - NR_SecurityConfig_t *security_config, - NR_SDAP_Config_t *sdap_config, - NR_MeasConfig_t *meas_config, - struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList *dedicatedNAS_MessageList, - rrc_gNB_ue_context_t *const ue_context_pP, - rrc_gNB_carrier_data_t *carrier, - const gNB_RrcConfigurationReq *configuration, - NR_MAC_CellGroupConfig_t *mac_CellGroupConfig, - NR_CellGroupConfig_t *cellGroupConfig) +int16_t do_RRCReconfiguration(const gNB_RRC_UE_t *UE, + uint8_t *buffer, + size_t buffer_size, + uint8_t Transaction_id, + NR_SRB_ToAddModList_t *SRB_configList, + NR_DRB_ToAddModList_t *DRB_configList, + NR_DRB_ToReleaseList_t *DRB_releaseList, + NR_SecurityConfig_t *security_config, + NR_MeasConfig_t *meas_config, + struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList *dedicatedNAS_MessageList, + NR_CellGroupConfig_t *cellGroupConfig) //------------------------------------------------------------------------------ { NR_DL_DCCH_Message_t dl_dcch_msg={0}; asn_enc_rval_t enc_rval; NR_RRCReconfiguration_IEs_t *ie; - unsigned char masterCellGroup_buf[1000]; dl_dcch_msg.message.present = NR_DL_DCCH_MessageType_PR_c1; asn1cCalloc(dl_dcch_msg.message.choice.c1, c1);// = CALLOC(1, sizeof(struct NR_DL_DCCH_MessageType__c1)); @@ -782,23 +722,16 @@ int16_t do_RRCReconfiguration( ie->nonCriticalExtension->dedicatedNAS_MessageList = dedicatedNAS_MessageList; } - if(cellGroupConfig!=NULL){ - update_cellGroupConfig(cellGroupConfig, ue_context_pP->ue_context.rrc_ue_id, ue_context_pP ? ue_context_pP->ue_context.UE_Capability_nr : NULL, configuration); - - enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig, - NULL, - (void *)cellGroupConfig, - masterCellGroup_buf, - 1000); - AssertFatal(enc_rval.encoded >0, "ASN1 message encoding failed (%s, %lu)!\n", - enc_rval.failed_type->name, enc_rval.encoded); + if (cellGroupConfig != NULL) { + uint8_t *buf = NULL; + ssize_t len = uper_encode_to_new_buffer(&asn_DEF_NR_CellGroupConfig, NULL, cellGroupConfig, (void **)&buf); + AssertFatal(len > 0, "ASN1 message encoding failed (%lu)!\n", len); if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void *) cellGroupConfig); } ie->nonCriticalExtension->masterCellGroup = calloc(1,sizeof(OCTET_STRING_t)); - - ie->nonCriticalExtension->masterCellGroup->buf = masterCellGroup_buf; - ie->nonCriticalExtension->masterCellGroup->size = (enc_rval.encoded+7)/8; + ie->nonCriticalExtension->masterCellGroup->buf = buf; + ie->nonCriticalExtension->masterCellGroup->size = len; } dl_dcch_msg.message.choice.c1->choice.rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration = ie; @@ -816,11 +749,24 @@ int16_t do_RRCReconfiguration( AssertFatal(enc_rval.encoded >0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); - LOG_D(NR_RRC,"[gNB %d] RRCReconfiguration for UE %lx Encoded %zd bits (%zd bytes)\n", - ctxt_pP->module_id, - ctxt_pP->rntiMaybeUEid, + // don't free what we did not allocate, so set fields with pointers to NULL + // if memory comes from outside + ie->measConfig = NULL; + if (ie->radioBearerConfig) { + ie->radioBearerConfig->srb_ToAddModList = NULL; + ie->radioBearerConfig->drb_ToAddModList = NULL; + ie->radioBearerConfig->securityConfig = NULL; + ie->radioBearerConfig->srb3_ToRelease = NULL; + ie->radioBearerConfig->drb_ToReleaseList = NULL; + } + if (ie->nonCriticalExtension) + ie->nonCriticalExtension->dedicatedNAS_MessageList = NULL; + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NR_DL_DCCH_Message, &dl_dcch_msg); + LOG_D(NR_RRC, + "RRCReconfiguration for UE %d: Encoded %zd bits (%zd bytes)\n", + UE->rrc_ue_id, enc_rval.encoded, - (enc_rval.encoded+7)/8); + (enc_rval.encoded + 7) / 8); return((enc_rval.encoded+7)/8); } @@ -1002,41 +948,36 @@ uint8_t do_RRCSetupComplete(uint8_t Mod_id, uint8_t *buffer, size_t buffer_size, } //------------------------------------------------------------------------------ -uint8_t -do_NR_DLInformationTransfer( - uint8_t Mod_id, - uint8_t **buffer, - uint8_t transaction_id, - uint32_t pdu_length, - uint8_t *pdu_buffer -) +uint8_t do_NR_DLInformationTransfer(uint8_t Mod_id, + uint8_t *buffer, + size_t buffer_len, + uint8_t transaction_id, + uint32_t pdu_length, + uint8_t *pdu_buffer) //------------------------------------------------------------------------------ { - ssize_t encoded; - NR_DL_DCCH_Message_t dl_dcch_msg={0}; - dl_dcch_msg.message.present = NR_DL_DCCH_MessageType_PR_c1; - asn1cCalloc(dl_dcch_msg.message.choice.c1, c1); - c1->present = NR_DL_DCCH_MessageType__c1_PR_dlInformationTransfer; + NR_DL_DCCH_Message_t dl_dcch_msg = {0}; + dl_dcch_msg.message.present = NR_DL_DCCH_MessageType_PR_c1; + asn1cCalloc(dl_dcch_msg.message.choice.c1, c1); + c1->present = NR_DL_DCCH_MessageType__c1_PR_dlInformationTransfer; - asn1cCalloc(c1->choice.dlInformationTransfer, infoTransfer); - infoTransfer->rrc_TransactionIdentifier = transaction_id; - infoTransfer->criticalExtensions.present = - NR_DLInformationTransfer__criticalExtensions_PR_dlInformationTransfer; + asn1cCalloc(c1->choice.dlInformationTransfer, infoTransfer); + infoTransfer->rrc_TransactionIdentifier = transaction_id; + infoTransfer->criticalExtensions.present = NR_DLInformationTransfer__criticalExtensions_PR_dlInformationTransfer; - asn1cCalloc(infoTransfer->criticalExtensions.choice.dlInformationTransfer, dlInfoTransfer); - asn1cCalloc(dlInfoTransfer->dedicatedNAS_Message,msg); - // we will free the caller buffer, that is ok in the present code logic (else it will leak memory) but not natural, - // comprehensive code design - msg->buf = pdu_buffer; - msg->size = pdu_length; + asn1cCalloc(infoTransfer->criticalExtensions.choice.dlInformationTransfer, dlInfoTransfer); + asn1cCalloc(dlInfoTransfer->dedicatedNAS_Message, msg); + // we will free the caller buffer, that is ok in the present code logic (else it will leak memory) but not natural, + // comprehensive code design + msg->buf = pdu_buffer; + msg->size = pdu_length; - encoded = uper_encode_to_new_buffer (&asn_DEF_NR_DL_DCCH_Message, NULL, (void *) &dl_dcch_msg, (void **)buffer); - AssertFatal(encoded > 0,"ASN1 message encoding failed (%s, %ld)!\n", - "DLInformationTransfer", encoded); - ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NR_DL_DCCH_Message,&dl_dcch_msg ); - LOG_D(NR_RRC,"DLInformationTransfer Encoded %zd bytes\n", encoded); - //for (int i=0;i 0, "ASN1 message encoding failed (%s, %ld)!\n", "DLInformationTransfer", r.encoded); + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NR_DL_DCCH_Message, &dl_dcch_msg); + LOG_D(NR_RRC, "DLInformationTransfer Encoded %zd bytes\n", r.encoded); + // for (int i=0;icriticalExtensions.present = NR_RRCReestablishment__criticalExtensions_PR_rrcReestablishment; rrcReestablishment->criticalExtensions.choice.rrcReestablishment = CALLOC(1, sizeof(NR_RRCReestablishment_IEs_t)); - int module_id = 0; - uint16_t pci = RC.nrrrc[module_id]->carrier.physCellId; - uint32_t nr_arfcn_dl = (uint64_t)*scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB; - LOG_I(NR_RRC, "Reestablishment update key pci=%d, earfcn_dl=%u\n", pci, nr_arfcn_dl); + LOG_I(NR_RRC, "Reestablishment update key pci=%d, earfcn_dl=%lu\n", pci, absoluteFrequencySSB); // 3GPP TS 33.501 Section 6.11 Security handling for RRC connection re-establishment procedure if (ue_context_pP->ue_context.nh_ncc >= 0) { - nr_derive_key_ng_ran_star(pci, nr_arfcn_dl, ue_context_pP->ue_context.nh, ue_context_pP->ue_context.kgnb); + nr_derive_key_ng_ran_star(pci, absoluteFrequencySSB, ue_context_pP->ue_context.nh, ue_context_pP->ue_context.kgnb); rrcReestablishment->criticalExtensions.choice.rrcReestablishment->nextHopChainingCount = ue_context_pP->ue_context.nh_ncc; } else { // first HO - nr_derive_key_ng_ran_star(pci, nr_arfcn_dl, ue_context_pP->ue_context.kgnb, ue_context_pP->ue_context.kgnb); + nr_derive_key_ng_ran_star(pci, absoluteFrequencySSB, ue_context_pP->ue_context.kgnb, ue_context_pP->ue_context.kgnb); // LG: really 1 rrcReestablishment->criticalExtensions.choice.rrcReestablishment->nextHopChainingCount = 0; } @@ -1148,7 +1083,7 @@ int do_RRCReestablishment(rrc_gNB_ue_context_t *const ue_context_pP, xer_fprint(stdout, &asn_DEF_NR_DL_DCCH_Message, (void *)&dl_dcch_msg); } - enc_rval = uper_encode_to_buffer(&asn_DEF_NR_DL_DCCH_Message, NULL, (void *)&dl_dcch_msg, buffer, 100); + enc_rval = uper_encode_to_buffer(&asn_DEF_NR_DL_DCCH_Message, NULL, (void *)&dl_dcch_msg, buffer, buffer_size); AssertFatal(enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); @@ -1190,15 +1125,8 @@ int do_RRCReestablishmentComplete(uint8_t *buffer, size_t buffer_size, int64_t r return((enc_rval.encoded+7)/8); } -NR_MeasConfig_t *get_defaultMeasConfig(const gNB_RrcConfigurationReq *conf) +NR_MeasConfig_t *get_defaultMeasConfig(int arfcn, int band, int scs) { - const NR_FrequencyInfoDL_t *freqInfoDL = conf->scc->downlinkConfigCommon->frequencyInfoDL; - const NR_ARFCN_ValueNR_t absFreqSSB = *freqInfoDL->absoluteFrequencySSB; - DevAssert(freqInfoDL->scs_SpecificCarrierList.list.count == 1); - const NR_SubcarrierSpacing_t scs = freqInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; - DevAssert(freqInfoDL->frequencyBandList.list.count == 1); - const NR_FreqBandIndicatorNR_t band = *freqInfoDL->frequencyBandList.list.array[0]; - NR_MeasConfig_t *mc = calloc(1, sizeof(*mc)); mc->measObjectToAddModList = calloc(1, sizeof(*mc->measObjectToAddModList)); mc->reportConfigToAddModList = calloc(1, sizeof(*mc->reportConfigToAddModList)); @@ -1209,7 +1137,7 @@ NR_MeasConfig_t *get_defaultMeasConfig(const gNB_RrcConfigurationReq *conf) mo1->measObjectId = 1; mo1->measObject.present = NR_MeasObjectToAddMod__measObject_PR_measObjectNR; NR_MeasObjectNR_t *monr1 = calloc(1, sizeof(*monr1)); - asn1cCallocOne(monr1->ssbFrequency, absFreqSSB); + asn1cCallocOne(monr1->ssbFrequency, arfcn); asn1cCallocOne(monr1->ssbSubcarrierSpacing, scs); monr1->referenceSignalConfig.ssb_ConfigMobility = calloc(1, sizeof(*monr1->referenceSignalConfig.ssb_ConfigMobility)); monr1->referenceSignalConfig.ssb_ConfigMobility->deriveSSB_IndexFromCell = true; @@ -1278,6 +1206,11 @@ NR_MeasConfig_t *get_defaultMeasConfig(const gNB_RrcConfigurationReq *conf) return mc; } +void free_defaultMeasConfig(NR_MeasConfig_t *mc) +{ + ASN_STRUCT_FREE(asn_DEF_NR_MeasConfig, mc); +} + uint8_t do_NR_Paging(uint8_t Mod_id, uint8_t *buffer, uint32_t tmsi) { LOG_D(NR_RRC, "[gNB %d] do_NR_Paging start\n", Mod_id); NR_PCCH_Message_t pcch_msg; diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.h b/openair2/RRC/NR/MESSAGES/asn1_msg.h index 5e9a9fa756..5dcff1501a 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.h +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.h @@ -55,11 +55,7 @@ */ int xer_sprint_NR(char *string, size_t string_size, struct asn_TYPE_descriptor_s *td, void *sptr); -uint8_t do_SIB23_NR(rrc_gNB_carrier_data_t *carrier, - gNB_RrcConfigurationReq *configuration); - -void do_SpCellConfig(gNB_RRC_INST *rrc, - struct NR_SpCellConfig *spconfig); +uint8_t do_SIB23_NR(rrc_gNB_carrier_data_t *carrier); int do_RRCReject(uint8_t Mod_id, uint8_t *const buffer); @@ -79,25 +75,6 @@ void fill_nr_noS1_bearer_config(NR_RadioBearerConfig_t **rbconfig, NR_RLC_BearerConfig_t **rlc_rbconfig); void free_nr_noS1_bearer_config(NR_RadioBearerConfig_t **rbconfig, NR_RLC_BearerConfig_t **rlc_rbconfig); -/** - * @brief Function to fill out the master cell group config to be used in RRCReconfiguration. - * If it is misused the ue_context_mastercellGroup, might lead to ASN1 encoding failure, - * because in ue_context_mastercellGroup the rlc_BearerConfigs are added but never removed, - * so the maximum number of rlc_BearerConfigs is exceeded. - * - * @param cellGroupConfig The MCG that will be used in do_RRCReconfiguration. - * @param ue_context_mastercellGroup The MCG that is stored in the ue context. - * @param[in] use_rlc_um_for_drb Set to 1, if RLC uses 'Unacknowledged Mode' for the DRB. - * @param[in] configure_srb Set to 1, if SRB2 needs be added to MCG. - * @param[in] drb_configList The Data Radio Bearer list, to be added. - * @param[in] priority The priorities set for the Data Radio Bearers. - */ -void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, - NR_CellGroupConfig_t *ue_context_mastercellGroup, - int use_rlc_um_for_drb, - uint8_t configure_srb, - NR_DRB_ToAddModList_t *drb_configList, - long *priority); int do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP, uint8_t *const buffer, @@ -120,23 +97,17 @@ uint8_t do_NR_SA_UECapabilityEnquiry( const protocol_ctxt_t *const ctxt_pP, int do_NR_RRCRelease(uint8_t *buffer, size_t buffer_size, uint8_t Transaction_id); -int16_t do_RRCReconfiguration( - const protocol_ctxt_t *const ctxt_pP, - uint8_t *buffer, - size_t buffer_size, - uint8_t Transaction_id, - NR_SRB_ToAddModList_t *SRB_configList, - NR_DRB_ToAddModList_t *DRB_configList, - NR_DRB_ToReleaseList_t *DRB_releaseList, - NR_SecurityConfig_t *security_config, - NR_SDAP_Config_t *sdap_config, - NR_MeasConfig_t *meas_config, - struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList *dedicatedNAS_MessageList, - rrc_gNB_ue_context_t *const ue_context_pP, - rrc_gNB_carrier_data_t *carrier, - const gNB_RrcConfigurationReq *configuration, - NR_MAC_CellGroupConfig_t *mac_CellGroupConfig, - NR_CellGroupConfig_t *cellGroupConfig); +int16_t do_RRCReconfiguration(const gNB_RRC_UE_t *UE, + uint8_t *buffer, + size_t buffer_size, + uint8_t Transaction_id, + NR_SRB_ToAddModList_t *SRB_configList, + NR_DRB_ToAddModList_t *DRB_configList, + NR_DRB_ToReleaseList_t *DRB_releaseList, + NR_SecurityConfig_t *security_config, + NR_MeasConfig_t *meas_config, + struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList *dedicatedNAS_MessageList, + NR_CellGroupConfig_t *cellGroupConfig); uint8_t do_RRCSetupComplete(uint8_t Mod_id, uint8_t *buffer, @@ -157,14 +128,12 @@ uint8_t do_NR_RRCReconfigurationComplete( const uint8_t Transaction_id ); -uint8_t -do_NR_DLInformationTransfer( - uint8_t Mod_id, - uint8_t **buffer, - uint8_t transaction_id, - uint32_t pdu_length, - uint8_t *pdu_buffer -); +uint8_t do_NR_DLInformationTransfer(uint8_t Mod_id, + uint8_t *buffer, + size_t buffer_len, + uint8_t transaction_id, + uint32_t pdu_length, + uint8_t *pdu_buffer); uint8_t do_NR_ULInformationTransfer(uint8_t **buffer, uint32_t pdu_length, @@ -173,18 +142,16 @@ uint8_t do_NR_ULInformationTransfer(uint8_t **buffer, uint8_t do_RRCReestablishmentRequest(uint8_t Mod_id, uint8_t *buffer, uint16_t c_rnti); int do_RRCReestablishment(rrc_gNB_ue_context_t *const ue_context_pP, - int CC_id, uint8_t *const buffer, size_t buffer_size, const uint8_t Transaction_id, - NR_SRB_ToAddModList_t *SRB_configList, - const uint8_t *masterCellGroup_from_DU, - NR_ServingCellConfigCommon_t *scc, - rrc_gNB_carrier_data_t *carrier); + uint16_t pci, + NR_ARFCN_ValueNR_t absoluteFrequencySSB); int do_RRCReestablishmentComplete(uint8_t *buffer, size_t buffer_size, int64_t rrc_TransactionIdentifier); -NR_MeasConfig_t *get_defaultMeasConfig(const gNB_RrcConfigurationReq *conf); +NR_MeasConfig_t *get_defaultMeasConfig(int absFreqSSB, int band, int scs); +void free_defaultMeasConfig(NR_MeasConfig_t *mc); uint8_t do_NR_Paging(uint8_t Mod_id, uint8_t *buffer, uint32_t tmsi); #endif /* __RRC_NR_MESSAGES_ASN1_MSG__H__ */ diff --git a/openair2/RRC/NR/cucp_cuup_direct.c b/openair2/RRC/NR/cucp_cuup_direct.c index 9dccef4286..1d51f67ec6 100644 --- a/openair2/RRC/NR/cucp_cuup_direct.c +++ b/openair2/RRC/NR/cucp_cuup_direct.c @@ -195,7 +195,7 @@ static void cucp_cuup_bearer_context_setup_direct(e1ap_bearer_setup_req_t *const } else { int remote_port = RC.nrrrc[ctxt.module_id]->eth_params_s.remote_portd; in_addr_t my_addr = inet_addr(RC.nrrrc[ctxt.module_id]->eth_params_s.my_addr); - instance_t gtpInst = getCxt(CUtype, instance)->gtpInst; + instance_t gtpInst = getCxt(instance)->gtpInst; // GTP tunnel for DL fill_e1ap_bearer_setup_resp(&resp, req, gtpInst, UE->rrc_ue_id, remote_port, my_addr); } @@ -210,7 +210,7 @@ static void cucp_cuup_bearer_context_mod_direct(e1ap_bearer_setup_req_t *const r // only update GTP tunnels if it is really a CU if (!NODE_IS_CU(RC.nrrrc[0]->node_type)) return; - instance_t gtpInst = getCxt(CUtype, instance)->gtpInst; + instance_t gtpInst = getCxt(instance)->gtpInst; CU_update_UP_DL_tunnel(req, gtpInst, req->gNB_cu_cp_ue_id); } diff --git a/openair2/RRC/NR/mac_rrc_dl.h b/openair2/RRC/NR/mac_rrc_dl.h index 0180f972fe..9fc75b3073 100644 --- a/openair2/RRC/NR/mac_rrc_dl.h +++ b/openair2/RRC/NR/mac_rrc_dl.h @@ -25,6 +25,9 @@ #include "platform_types.h" #include "f1ap_messages_types.h" +typedef void (*f1_setup_response_func_t)(const f1ap_setup_resp_t *resp); +typedef void (*f1_setup_failure_func_t)(const f1ap_setup_failure_t *fail); + typedef void (*ue_context_setup_request_func_t)(const f1ap_ue_context_setup_t *req); typedef void (*ue_context_modification_request_func_t)(const f1ap_ue_context_modif_req_t *req); typedef void (*ue_context_modification_confirm_func_t)(const f1ap_ue_context_modif_confirm_t *confirm); diff --git a/openair2/RRC/NR/mac_rrc_dl_direct.c b/openair2/RRC/NR/mac_rrc_dl_direct.c index 423eac2462..c18a33954c 100644 --- a/openair2/RRC/NR/mac_rrc_dl_direct.c +++ b/openair2/RRC/NR/mac_rrc_dl_direct.c @@ -26,6 +26,8 @@ void mac_rrc_dl_direct_init(nr_mac_rrc_dl_if_t *mac_rrc) { + mac_rrc->f1_setup_response = f1_setup_response; + mac_rrc->f1_setup_failure = f1_setup_failure; mac_rrc->ue_context_setup_request = ue_context_setup_request; mac_rrc->ue_context_modification_request = ue_context_modification_request; mac_rrc->ue_context_modification_confirm = ue_context_modification_confirm; diff --git a/openair2/RRC/NR/mac_rrc_dl_f1ap.c b/openair2/RRC/NR/mac_rrc_dl_f1ap.c index 40eea4861c..88c5ad125e 100644 --- a/openair2/RRC/NR/mac_rrc_dl_f1ap.c +++ b/openair2/RRC/NR/mac_rrc_dl_f1ap.c @@ -24,6 +24,24 @@ #include "mac_rrc_dl.h" #include "nr_rrc_defs.h" +static void f1_setup_response_f1ap(const f1ap_setup_resp_t *resp) +{ + MessageDef *msg = itti_alloc_new_message(TASK_RRC_GNB, 0, F1AP_SETUP_RESP); + f1ap_setup_resp_t *f1ap_msg = &F1AP_SETUP_RESP(msg); + *f1ap_msg = *resp; + if (resp->gNB_CU_name != NULL) + f1ap_msg->gNB_CU_name = strdup(resp->gNB_CU_name); + itti_send_msg_to_task(TASK_CU_F1, 0, msg); +} + +static void f1_setup_failure_f1ap(const f1ap_setup_failure_t *fail) +{ + MessageDef *msg = itti_alloc_new_message(TASK_RRC_GNB, 0, F1AP_SETUP_FAILURE); + f1ap_setup_failure_t *f1ap_msg = &F1AP_SETUP_FAILURE(msg); + *f1ap_msg = *fail; + itti_send_msg_to_task(TASK_CU_F1, 0, msg); +} + static void ue_context_setup_request_f1ap(const f1ap_ue_context_setup_t *req) { MessageDef *msg = itti_alloc_new_message(TASK_RRC_GNB, 0, F1AP_UE_CONTEXT_SETUP_REQ); @@ -46,7 +64,21 @@ static void ue_context_modification_request_f1ap(const f1ap_ue_context_modif_req MessageDef *msg = itti_alloc_new_message(TASK_RRC_GNB, 0, F1AP_UE_CONTEXT_MODIFICATION_REQ); f1ap_ue_context_modif_req_t *f1ap_msg = &F1AP_UE_CONTEXT_MODIFICATION_REQ(msg); *f1ap_msg = *req; - AssertFatal(req->cu_to_du_rrc_information == NULL, "cu_to_du_rrc_information not supported yet\n"); + if (req->cu_to_du_rrc_information != NULL) { + f1ap_msg->cu_to_du_rrc_information = calloc(1, sizeof(*f1ap_msg->cu_to_du_rrc_information)); + AssertFatal(f1ap_msg->cu_to_du_rrc_information != NULL, "out of memory\n"); + AssertFatal(req->cu_to_du_rrc_information->cG_ConfigInfo == NULL && req->cu_to_du_rrc_information->cG_ConfigInfo_length == 0, "cg_ConfigInfo not implemented\n"); + AssertFatal(req->cu_to_du_rrc_information->measConfig == NULL && req->cu_to_du_rrc_information->measConfig_length == 0, "cg_ConfigInfo not implemented\n"); + if (req->cu_to_du_rrc_information->uE_CapabilityRAT_ContainerList != NULL) { + const cu_to_du_rrc_information_t *du2cu_req = req->cu_to_du_rrc_information; + cu_to_du_rrc_information_t* du2cu_new = f1ap_msg->cu_to_du_rrc_information; + DevAssert(du2cu_req->uE_CapabilityRAT_ContainerList_length > 0); + du2cu_new->uE_CapabilityRAT_ContainerList_length = du2cu_req->uE_CapabilityRAT_ContainerList_length; + du2cu_new->uE_CapabilityRAT_ContainerList = malloc(du2cu_new->uE_CapabilityRAT_ContainerList_length); + AssertFatal(du2cu_new->uE_CapabilityRAT_ContainerList != NULL, "out of memory\n"); + memcpy(du2cu_new->uE_CapabilityRAT_ContainerList, du2cu_req->uE_CapabilityRAT_ContainerList, du2cu_new->uE_CapabilityRAT_ContainerList_length); + } + } AssertFatal(req->drbs_to_be_modified_length == 0, "drbs_to_be_modified not supported yet\n"); if (req->drbs_to_be_setup_length > 0) { int n = req->drbs_to_be_setup_length; @@ -133,6 +165,8 @@ static void dl_rrc_message_transfer_f1ap(const f1ap_dl_rrc_message_t *dl_rrc) void mac_rrc_dl_f1ap_init(nr_mac_rrc_dl_if_t *mac_rrc) { + mac_rrc->f1_setup_response = f1_setup_response_f1ap; + mac_rrc->f1_setup_failure = f1_setup_failure_f1ap; mac_rrc->ue_context_setup_request = ue_context_setup_request_f1ap; mac_rrc->ue_context_modification_request = ue_context_modification_request_f1ap; mac_rrc->ue_context_modification_confirm = ue_context_modification_confirm_f1ap; diff --git a/openair2/RRC/NR/nr_rrc_config.c b/openair2/RRC/NR/nr_rrc_config.c index 266d842276..5eaaf7eeac 100644 --- a/openair2/RRC/NR/nr_rrc_config.c +++ b/openair2/RRC/NR/nr_rrc_config.c @@ -28,8 +28,10 @@ * \email: raymond.knopp@eurecom.fr, kroempa@gmail.com */ +#include "openair3/UTILS/conversions.h" #include "nr_rrc_config.h" #include "common/utils/nr/nr_common.h" +#include "openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h" #include "executables/softmodem-common.h" #include "oai_asn1.h" #include "SIMULATION/TOOLS/sim.h" // for taus(); @@ -495,19 +497,7 @@ static void config_srs(const NR_ServingCellConfigCommon_t *scc, NR_SRS_Config_t *srs_Config; if (setup_release_srs_Config->choice.setup) { srs_Config = setup_release_srs_Config->choice.setup; - if (srs_Config->srs_ResourceSetToReleaseList) { - free(srs_Config->srs_ResourceSetToReleaseList); - } - if (srs_Config->srs_ResourceSetToAddModList) { - free(srs_Config->srs_ResourceSetToAddModList); - } - if (srs_Config->srs_ResourceToReleaseList) { - free(srs_Config->srs_ResourceToReleaseList); - } - if (srs_Config->srs_ResourceToAddModList) { - free(srs_Config->srs_ResourceToAddModList); - } - free(srs_Config); + ASN_STRUCT_FREE(asn_DEF_NR_SRS_Config, srs_Config); } setup_release_srs_Config->choice.setup = calloc(1,sizeof(*setup_release_srs_Config->choice.setup)); @@ -1261,7 +1251,7 @@ static void config_uplinkBWP(NR_BWP_Uplink_t *ubwp, long bwp_loop, bool is_SA, int uid, - const gNB_RrcConfigurationReq *configuration, + const nr_mac_config_t *configuration, const NR_ServingCellConfig_t *servingcellconfigdedicated, const NR_ServingCellConfigCommon_t *scc, const NR_UE_NR_Capability_t *uecap) @@ -1394,7 +1384,7 @@ static void set_csi_meas_periodicity(const NR_ServingCellConfigCommon_t *scc, NR } } -static void config_csi_codebook(const rrc_pdsch_AntennaPorts_t *antennaports, +static void config_csi_codebook(const nr_pdsch_AntennaPorts_t *antennaports, const int max_layers, struct NR_CodebookConfig *codebookConfig) { @@ -1499,7 +1489,7 @@ static void config_csi_meas_report(NR_CSI_MeasConfig_t *csi_MeasConfig, const NR_ServingCellConfigCommon_t *servingcellconfigcommon, NR_PUCCH_CSI_Resource_t *pucchcsires, struct NR_SetupRelease_PDSCH_Config *pdsch_Config, - const rrc_pdsch_AntennaPorts_t *antennaports, + const nr_pdsch_AntennaPorts_t *antennaports, const int max_layers, int rep_id, int uid) @@ -1724,8 +1714,10 @@ int encode_MIB_NR(NR_BCCH_BCH_Message_t *mib, int frame, uint8_t *buf, int buf_s return (enc_rval.encoded + 7) / 8; } -NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const gNB_RrcConfigurationReq *configuration) +NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const NR_ServingCellConfigCommon_t *scc, const f1ap_plmn_t *plmn, uint64_t cellID, int tac) { + AssertFatal(cellID < (1l << 36), "cellID must fit within 36 bits, but is %ld\n", cellID); + NR_BCCH_DL_SCH_Message_t *sib1_message = CALLOC(1,sizeof(NR_BCCH_DL_SCH_Message_t)); AssertFatal(sib1_message != NULL, "out of memory\n"); sib1_message->message.present = NR_BCCH_DL_SCH_MessageType_PR_c1; @@ -1752,17 +1744,17 @@ NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const gNB_RrcConfigurationReq *configurati for (int i = 0; i < num_plmn; ++i) { asn1cSequenceAdd(nr_plmn_info->plmn_IdentityList.list, struct NR_PLMN_Identity, nr_plmn); asn1cCalloc(nr_plmn->mcc, mcc); - int confMcc = configuration->mcc[i]; + int confMcc = plmn->mcc; asn1cSequenceAdd(mcc->list, NR_MCC_MNC_Digit_t, mcc0); *mcc0 = (confMcc / 100) % 10; asn1cSequenceAdd(mcc->list, NR_MCC_MNC_Digit_t, mcc1); *mcc1 = (confMcc / 10) % 10; asn1cSequenceAdd(mcc->list, NR_MCC_MNC_Digit_t, mcc2); *mcc2 = confMcc % 10; - int mnc = configuration->mnc[i]; - if (configuration->mnc_digit_length[i] == 3) { + int mnc = plmn->mnc; + if (plmn->mnc_digit_length == 3) { asn1cSequenceAdd(nr_plmn->mnc.list, NR_MCC_MNC_Digit_t, mnc0); - *mnc0 = (configuration->mnc[i] / 100) % 10; + *mnc0 = (0 / 100) % 10; } asn1cSequenceAdd(nr_plmn->mnc.list, NR_MCC_MNC_Digit_t, mnc1); *mnc1 = (mnc / 10) % 10; @@ -1770,17 +1762,12 @@ NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const gNB_RrcConfigurationReq *configurati *mnc2 = (mnc) % 10; } - nr_plmn_info->cellIdentity.buf = CALLOC(1, 5); - AssertFatal(nr_plmn_info->cellIdentity.buf != NULL, "out of memory\n"); - nr_plmn_info->cellIdentity.size = 5; - nr_plmn_info->cellIdentity.bits_unused = 4; - uint64_t tmp = htobe64(configuration->cell_identity) << 4; - memcpy(nr_plmn_info->cellIdentity.buf, ((char *)&tmp) + 3, 5); + NR_CELL_ID_TO_BIT_STRING(cellID, &nr_plmn_info->cellIdentity); nr_plmn_info->cellReservedForOperatorUse = NR_PLMN_IdentityInfo__cellReservedForOperatorUse_notReserved; nr_plmn_info->trackingAreaCode = CALLOC(1, sizeof(NR_TrackingAreaCode_t)); AssertFatal(nr_plmn_info->trackingAreaCode != NULL, "out of memory\n"); - uint32_t tmp2 = htobe32(configuration->tac); + uint32_t tmp2 = htobe32(tac); nr_plmn_info->trackingAreaCode->buf = CALLOC(1, 3); AssertFatal(nr_plmn_info->trackingAreaCode->buf != NULL, "out of memory\n"); memcpy(nr_plmn_info->trackingAreaCode->buf, ((char *)&tmp2) + 1, 3); @@ -1824,9 +1811,9 @@ NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const gNB_RrcConfigurationReq *configurati // servingCellConfigCommon asn1cCalloc(sib1->servingCellConfigCommon, ServCellCom); NR_BWP_DownlinkCommon_t *initialDownlinkBWP = &ServCellCom->downlinkConfigCommon.initialDownlinkBWP; - initialDownlinkBWP->genericParameters = configuration->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters; + initialDownlinkBWP->genericParameters = scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters; - const NR_FrequencyInfoDL_t *frequencyInfoDL = configuration->scc->downlinkConfigCommon->frequencyInfoDL; + const NR_FrequencyInfoDL_t *frequencyInfoDL = scc->downlinkConfigCommon->frequencyInfoDL; for (int i = 0; i < frequencyInfoDL->frequencyBandList.list.count; i++) { asn1cSequenceAdd(ServCellCom->downlinkConfigCommon.frequencyInfoDL.frequencyBandList.list, struct NR_NR_MultiBandInfo, @@ -1835,11 +1822,11 @@ NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const gNB_RrcConfigurationReq *configurati frequencyInfoDL->frequencyBandList.list.array[i]; } - const NR_FreqBandIndicatorNR_t band = *configuration->scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; + const NR_FreqBandIndicatorNR_t band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; frequency_range_t frequency_range = band < 100 ? FR1 : FR2; - sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.offsetToPointA = get_ssb_offset_to_pointA(*configuration->scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB, - configuration->scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA, - configuration->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.subcarrierSpacing, + sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.offsetToPointA = get_ssb_offset_to_pointA(*scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB, + scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA, + scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.subcarrierSpacing, frequency_range); LOG_I(NR_RRC, @@ -1851,7 +1838,7 @@ NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const gNB_RrcConfigurationReq *configurati frequencyInfoDL->scs_SpecificCarrierList.list.array[i]); } - initialDownlinkBWP->pdcch_ConfigCommon = configuration->scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon; + initialDownlinkBWP->pdcch_ConfigCommon = scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon; initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList = CALLOC(1, sizeof(struct NR_PDCCH_ConfigCommon__commonSearchSpaceList)); AssertFatal(initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList != NULL, "out of memory\n"); @@ -1870,7 +1857,7 @@ NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const gNB_RrcConfigurationReq *configurati asn1cCallocOne(initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->pagingSearchSpace, 2); asn1cCallocOne(initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->ra_SearchSpace, 1); - initialDownlinkBWP->pdsch_ConfigCommon = configuration->scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon; + initialDownlinkBWP->pdsch_ConfigCommon = scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon; ServCellCom->downlinkConfigCommon.bcch_Config.modificationPeriodCoeff = NR_BCCH_Config__modificationPeriodCoeff_n2; ServCellCom->downlinkConfigCommon.pcch_Config.defaultPagingCycle = NR_PagingCycle_rf256; ServCellCom->downlinkConfigCommon.pcch_Config.nAndPagingFrameOffset.present = NR_PCCH_Config__nAndPagingFrameOffset_PR_quarterT; @@ -1886,7 +1873,7 @@ NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const gNB_RrcConfigurationReq *configurati asn1cCalloc(ServCellCom->uplinkConfigCommon, UL); asn_set_empty(&UL->frequencyInfoUL.scs_SpecificCarrierList.list); - const NR_FrequencyInfoUL_t *frequencyInfoUL = configuration->scc->uplinkConfigCommon->frequencyInfoUL; + const NR_FrequencyInfoUL_t *frequencyInfoUL = scc->uplinkConfigCommon->frequencyInfoUL; for (int i = 0; i < frequencyInfoUL->scs_SpecificCarrierList.list.count; i++) { asn1cSeqAdd(&UL->frequencyInfoUL.scs_SpecificCarrierList.list, frequencyInfoUL->scs_SpecificCarrierList.list.array[i]); } @@ -1894,14 +1881,14 @@ NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const gNB_RrcConfigurationReq *configurati asn1cCallocOne(UL->frequencyInfoUL.p_Max, *frequencyInfoUL->p_Max); frame_type_t frame_type = - get_frame_type((int)*configuration->scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], - *configuration->scc->ssbSubcarrierSpacing); + get_frame_type((int)*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], + *scc->ssbSubcarrierSpacing); if (frame_type == FDD) { UL->frequencyInfoUL.absoluteFrequencyPointA = malloc(sizeof(*UL->frequencyInfoUL.absoluteFrequencyPointA)); AssertFatal(UL->frequencyInfoUL.absoluteFrequencyPointA != NULL, "out of memory\n"); *UL->frequencyInfoUL.absoluteFrequencyPointA = - *configuration->scc->uplinkConfigCommon->frequencyInfoUL->absoluteFrequencyPointA; + *scc->uplinkConfigCommon->frequencyInfoUL->absoluteFrequencyPointA; UL->frequencyInfoUL.frequencyBandList = calloc(1, sizeof(*UL->frequencyInfoUL.frequencyBandList)); AssertFatal(UL->frequencyInfoUL.frequencyBandList != NULL, "out of memory\n"); for (int i = 0; i < frequencyInfoUL->frequencyBandList->list.count; i++) { @@ -1910,25 +1897,25 @@ NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const gNB_RrcConfigurationReq *configurati } } - UL->initialUplinkBWP.genericParameters = configuration->scc->uplinkConfigCommon->initialUplinkBWP->genericParameters; - UL->initialUplinkBWP.rach_ConfigCommon = configuration->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon; - UL->initialUplinkBWP.pusch_ConfigCommon = configuration->scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon; + UL->initialUplinkBWP.genericParameters = scc->uplinkConfigCommon->initialUplinkBWP->genericParameters; + UL->initialUplinkBWP.rach_ConfigCommon = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon; + UL->initialUplinkBWP.pusch_ConfigCommon = scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon; UL->initialUplinkBWP.pusch_ConfigCommon->choice.setup->groupHoppingEnabledTransformPrecoding = NULL; - UL->initialUplinkBWP.pucch_ConfigCommon = configuration->scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon; + UL->initialUplinkBWP.pucch_ConfigCommon = scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon; UL->timeAlignmentTimerCommon = NR_TimeAlignmentTimer_infinity; - ServCellCom->n_TimingAdvanceOffset = configuration->scc->n_TimingAdvanceOffset; + ServCellCom->n_TimingAdvanceOffset = scc->n_TimingAdvanceOffset; ServCellCom->ssb_PositionsInBurst.inOneGroup.buf = calloc(1, sizeof(uint8_t)); uint8_t bitmap8,temp_bitmap=0; - switch (configuration->scc->ssb_PositionsInBurst->present) { + switch (scc->ssb_PositionsInBurst->present) { case NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR_shortBitmap: - ServCellCom->ssb_PositionsInBurst.inOneGroup = configuration->scc->ssb_PositionsInBurst->choice.shortBitmap; + ServCellCom->ssb_PositionsInBurst.inOneGroup = scc->ssb_PositionsInBurst->choice.shortBitmap; break; case NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR_mediumBitmap: - ServCellCom->ssb_PositionsInBurst.inOneGroup = configuration->scc->ssb_PositionsInBurst->choice.mediumBitmap; + ServCellCom->ssb_PositionsInBurst.inOneGroup = scc->ssb_PositionsInBurst->choice.mediumBitmap; break; /* * groupPresence: This field is present when maximum number of SS/PBCH blocks per half frame equals to 64 as defined in @@ -1952,7 +1939,7 @@ NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const gNB_RrcConfigurationReq *configurati AssertFatal(ServCellCom->ssb_PositionsInBurst.groupPresence->buf != NULL, "out of memory\n"); ServCellCom->ssb_PositionsInBurst.groupPresence->buf[0] = 0; for (int i = 0; i < 8; i++) { - bitmap8 = configuration->scc->ssb_PositionsInBurst->choice.longBitmap.buf[i]; + bitmap8 = scc->ssb_PositionsInBurst->choice.longBitmap.buf[i]; if (bitmap8 != 0) { if (temp_bitmap == 0) temp_bitmap = bitmap8; @@ -1970,15 +1957,15 @@ NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const gNB_RrcConfigurationReq *configurati break; } - ServCellCom->ssb_PeriodicityServingCell = *configuration->scc->ssb_periodicityServingCell; - if (configuration->scc->tdd_UL_DL_ConfigurationCommon) { + ServCellCom->ssb_PeriodicityServingCell = *scc->ssb_periodicityServingCell; + if (scc->tdd_UL_DL_ConfigurationCommon) { ServCellCom->tdd_UL_DL_ConfigurationCommon = CALLOC(1,sizeof(struct NR_TDD_UL_DL_ConfigCommon)); AssertFatal(ServCellCom->tdd_UL_DL_ConfigurationCommon != NULL, "out of memory\n"); - ServCellCom->tdd_UL_DL_ConfigurationCommon->referenceSubcarrierSpacing = configuration->scc->tdd_UL_DL_ConfigurationCommon->referenceSubcarrierSpacing; - ServCellCom->tdd_UL_DL_ConfigurationCommon->pattern1 = configuration->scc->tdd_UL_DL_ConfigurationCommon->pattern1; - ServCellCom->tdd_UL_DL_ConfigurationCommon->pattern2 = configuration->scc->tdd_UL_DL_ConfigurationCommon->pattern2; + ServCellCom->tdd_UL_DL_ConfigurationCommon->referenceSubcarrierSpacing = scc->tdd_UL_DL_ConfigurationCommon->referenceSubcarrierSpacing; + ServCellCom->tdd_UL_DL_ConfigurationCommon->pattern1 = scc->tdd_UL_DL_ConfigurationCommon->pattern1; + ServCellCom->tdd_UL_DL_ConfigurationCommon->pattern2 = scc->tdd_UL_DL_ConfigurationCommon->pattern2; } - ServCellCom->ss_PBCH_BlockPower = configuration->scc->ss_PBCH_BlockPower; + ServCellCom->ss_PBCH_BlockPower = scc->ss_PBCH_BlockPower; // ims-EmergencySupport // TODO: add ims-EmergencySupport @@ -2079,7 +2066,7 @@ static NR_MAC_CellGroupConfig_t *configure_mac_cellgroup(void) static NR_SpCellConfig_t *get_initial_SpCellConfig(int uid, const NR_ServingCellConfigCommon_t *scc, const NR_ServingCellConfig_t *servingcellconfigdedicated, - const gNB_RrcConfigurationReq *configuration) + const nr_mac_config_t *configuration) { const int pdsch_AntennaPorts = configuration->pdsch_AntennaPorts.N1 * configuration->pdsch_AntennaPorts.N2 * configuration->pdsch_AntennaPorts.XP; @@ -2260,9 +2247,7 @@ static NR_SpCellConfig_t *get_initial_SpCellConfig(int uid, csires1->resourceType = NR_CSI_ResourceConfig__resourceType_periodic; asn1cSeqAdd(&csi_MeasConfig->csi_ResourceConfigToAddModList->list, csires1); - NR_PUCCH_CSI_Resource_t *pucchcsires1 = calloc(1, sizeof(*pucchcsires1)); - pucchcsires1->uplinkBandwidthPartId = bwp_id; - pucchcsires1->pucch_Resource = 2; + int pucch_Resource = 2; if (configuration->do_CSIRS) { NR_CSI_ResourceConfig_t *csires0 = calloc(1, sizeof(*csires0)); @@ -2293,16 +2278,22 @@ static NR_SpCellConfig_t *get_initial_SpCellConfig(int uid, csires2->resourceType = NR_CSI_ResourceConfig__resourceType_periodic; asn1cSeqAdd(&csi_MeasConfig->csi_ResourceConfigToAddModList->list, csires2); + NR_PUCCH_CSI_Resource_t *pucchcsi = calloc(1, sizeof(*pucchcsi)); + pucchcsi->uplinkBandwidthPartId = bwp_id; + pucchcsi->pucch_Resource = pucch_Resource; config_csi_meas_report(csi_MeasConfig, scc, - pucchcsires1, + pucchcsi, pdsch_Config, &configuration->pdsch_AntennaPorts, NR_MAX_SUPPORTED_DL_LAYERS, bwp_id, uid); } - config_rsrp_meas_report(csi_MeasConfig, scc, pucchcsires1, configuration->do_CSIRS, bwp_id + 10, uid); + NR_PUCCH_CSI_Resource_t *pucchrsrp = calloc(1, sizeof(*pucchrsrp)); + pucchrsrp->uplinkBandwidthPartId = bwp_id; + pucchrsrp->pucch_Resource = pucch_Resource; + config_rsrp_meas_report(csi_MeasConfig, scc, pucchrsrp, configuration->do_CSIRS, bwp_id + 10, uid); } pdsch_servingcellconfig->codeBlockGroupTransmission = NULL; pdsch_servingcellconfig->xOverhead = NULL; @@ -2322,7 +2313,7 @@ static NR_SpCellConfig_t *get_initial_SpCellConfig(int uid, NR_CellGroupConfig_t *get_initial_cellGroupConfig(int uid, const NR_ServingCellConfigCommon_t *scc, const NR_ServingCellConfig_t *servingcellconfigdedicated, - const gNB_RrcConfigurationReq *configuration) + const nr_mac_config_t *configuration) { NR_CellGroupConfig_t *cellGroupConfig = calloc(1, sizeof(*cellGroupConfig)); cellGroupConfig->cellGroupId = 0; @@ -2353,27 +2344,15 @@ NR_CellGroupConfig_t *get_initial_cellGroupConfig(int uid, void update_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, const int uid, NR_UE_NR_Capability_t *uecap, - const gNB_RrcConfigurationReq *configuration) + const nr_mac_config_t *configuration, + const NR_ServingCellConfigCommon_t *scc) { DevAssert(cellGroupConfig != NULL); - /* this is wrong: we should not call this function is spCellConfig is not - * allocated */ - if (cellGroupConfig->spCellConfig == NULL) - return; - /* same as for spCellConfig */ - if (configuration == NULL) - return; - DevAssert(configuration->scc != NULL); - - /* This is a hack and will be removed once the CellGroupConfig is fully - * handled at the DU */ - if (NODE_IS_CU(RC.nrrrc[0]->node_type)) { - LOG_W(RRC, "update of CellGroupConfig not yet supported in F1\n"); - return; - } + DevAssert(cellGroupConfig->spCellConfig != NULL); + DevAssert(configuration != NULL); + DevAssert(scc != NULL); NR_SpCellConfig_t *SpCellConfig = cellGroupConfig->spCellConfig; - NR_ServingCellConfigCommon_t *scc = configuration->scc; int curr_bwp = NRRIV2BW(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); NR_UplinkConfig_t *uplinkConfig = @@ -2534,10 +2513,10 @@ NR_CellGroupConfig_t *get_default_secondaryCellGroup(const NR_ServingCellConfigC const NR_UE_NR_Capability_t *uecap, int scg_id, int servCellIndex, - const gNB_RrcConfigurationReq *configuration, + const nr_mac_config_t *configuration, int uid) { - const rrc_pdsch_AntennaPorts_t *pdschap = &configuration->pdsch_AntennaPorts; + const nr_pdsch_AntennaPorts_t *pdschap = &configuration->pdsch_AntennaPorts; const int dl_antenna_ports = pdschap->N1 * pdschap->N2 * pdschap->XP; const int do_csirs = configuration->do_CSIRS; diff --git a/openair2/RRC/NR/nr_rrc_config.h b/openair2/RRC/NR/nr_rrc_config.h index 592d14bf01..802d57428c 100644 --- a/openair2/RRC/NR/nr_rrc_config.h +++ b/openair2/RRC/NR/nr_rrc_config.h @@ -34,6 +34,10 @@ #include "nr_rrc_defs.h" #include "openair2/RRC/NR/MESSAGES/asn1_msg.h" +// forward declaration of MAC configuration parameters, definition is included in C file +struct nr_mac_config_t; +typedef struct nr_mac_config_t nr_mac_config_t; + void nr_rrc_config_dl_tda(struct NR_PDSCH_TimeDomainResourceAllocationList *pdsch_TimeDomainAllocationList, frame_type_t frame_type, NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon, @@ -53,18 +57,19 @@ int encode_MIB_NR(NR_BCCH_BCH_Message_t *mib, int frame, uint8_t *buf, int buf_s #define NR_MAX_SIB_LENGTH 2976 // 3GPP TS 38.331 section 5.2.1 -NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const gNB_RrcConfigurationReq *configuration); +NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const NR_ServingCellConfigCommon_t *scc, const f1ap_plmn_t *plmn, uint64_t cellID, int tac); void free_SIB1_NR(NR_BCCH_DL_SCH_Message_t *sib1); int encode_SIB1_NR(NR_BCCH_DL_SCH_Message_t *sib1, uint8_t *buffer, int max_buffer_size); NR_CellGroupConfig_t *get_initial_cellGroupConfig(int uid, const NR_ServingCellConfigCommon_t *scc, const NR_ServingCellConfig_t *servingcellconfigdedicated, - const gNB_RrcConfigurationReq *configuration); + const nr_mac_config_t *configuration); void update_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, const int uid, NR_UE_NR_Capability_t *uecap, - const gNB_RrcConfigurationReq *configuration); + const nr_mac_config_t *configuration, + const NR_ServingCellConfigCommon_t *scc); void free_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig); int encode_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, uint8_t *buffer, int max_buffer_size); NR_CellGroupConfig_t *decode_cellGroupConfig(const uint8_t *buffer, int max_buffer_size); @@ -77,7 +82,7 @@ NR_CellGroupConfig_t *get_default_secondaryCellGroup(const NR_ServingCellConfigC const NR_UE_NR_Capability_t *uecap, int scg_id, int servCellIndex, - const gNB_RrcConfigurationReq *configuration, + const nr_mac_config_t *configuration, int uid); #endif diff --git a/openair2/RRC/NR/nr_rrc_defs.h b/openair2/RRC/NR/nr_rrc_defs.h index 35ff709378..215fc9851d 100644 --- a/openair2/RRC/NR/nr_rrc_defs.h +++ b/openair2/RRC/NR/nr_rrc_defs.h @@ -38,6 +38,7 @@ #include "collection/tree.h" #include "collection/linear_alloc.h" #include "nr_rrc_common.h" +#include "ds/byte_array.h" #include "common/ngran_types.h" #include "common/platform_constants.h" @@ -243,7 +244,7 @@ typedef struct gNB_RRC_UE_s { NR_HANDOVER_INFO *handover_info; NR_MeasResults_t *measResults; - + byte_array_t ue_cap_buffer; NR_UE_NR_Capability_t* UE_Capability_nr; int UE_Capability_size; NR_UE_MRDC_Capability_t* UE_Capability_MRDC; @@ -325,24 +326,13 @@ typedef struct rrc_gNB_ue_context_s { typedef struct { - uint8_t *SIB1; - uint16_t sizeof_SIB1; - uint8_t *SIB23; uint8_t sizeof_SIB23; - long physCellId; - - NR_BCCH_BCH_Message_t *mib; - NR_SIB1_t *siblock1_DU; - NR_SIB1_t *sib1; NR_SIB2_t *sib2; NR_SIB3_t *sib3; NR_BCCH_DL_SCH_Message_t systemInformation; // SIB23 - NR_BCCH_DL_SCH_Message_t *siblock1; - NR_ServingCellConfigCommon_t *servingcellconfigcommon; NR_CellGroupConfig_t *secondaryCellGroup[MAX_NR_RRC_UE_CONTEXTS]; - int p_gNB; } rrc_gNB_carrier_data_t; //--------------------------------------------------- @@ -363,6 +353,8 @@ typedef struct { } nr_security_configuration_t; typedef struct nr_mac_rrc_dl_if_s { + f1_setup_response_func_t f1_setup_response; + f1_setup_failure_func_t f1_setup_failure; ue_context_setup_request_func_t ue_context_setup_request; ue_context_modification_request_func_t ue_context_modification_request; ue_context_modification_confirm_func_t ue_context_modification_confirm; @@ -376,6 +368,13 @@ typedef struct cucp_cuup_if_s { cucp_cuup_bearer_context_setup_func_t bearer_context_mod; } cucp_cuup_if_t; +typedef struct nr_rrc_du_container_t { + sctp_assoc_t assoc_id; + f1ap_setup_req_t *setup_req; + NR_MIB_t *mib; + NR_SIB1_t *sib1; +} nr_rrc_du_container_t; + //---NR---(completely change)--------------------- typedef struct gNB_RRC_INST_s { @@ -413,10 +412,6 @@ typedef struct gNB_RRC_INST_s { int srb1_timer_status_prohibit; int um_on_default_drb; int srs_enable[MAX_NUM_CCs]; - uint16_t sctp_in_streams; - uint16_t sctp_out_streams; - int cell_info_configured; - pthread_mutex_t cell_info_mutex; char *uecap_file; @@ -426,6 +421,8 @@ typedef struct gNB_RRC_INST_s { nr_mac_rrc_dl_if_t mac_rrc; cucp_cuup_if_t cucp_cuup; + nr_rrc_du_container_t *du; + } gNB_RRC_INST; #include "nr_rrc_proto.h" //should be put here otherwise compilation error diff --git a/openair2/RRC/NR/nr_rrc_extern.h b/openair2/RRC/NR/nr_rrc_extern.h index 18185fa081..64e6095dcd 100644 --- a/openair2/RRC/NR/nr_rrc_extern.h +++ b/openair2/RRC/NR/nr_rrc_extern.h @@ -35,6 +35,8 @@ #include "LAYER2/RLC/rlc.h" #include "openair2/RRC/common.h" +void openair_rrc_gNB_configuration(gNB_RRC_INST *rrc, gNB_RrcConfigurationReq *configuration); + extern UE_RRC_INST *UE_rrc_inst; extern uint8_t DRB2LCHAN[8]; diff --git a/openair2/RRC/NR/nr_rrc_proto.h b/openair2/RRC/NR/nr_rrc_proto.h index 7502662da3..d132b8291d 100644 --- a/openair2/RRC/NR/nr_rrc_proto.h +++ b/openair2/RRC/NR/nr_rrc_proto.h @@ -46,14 +46,6 @@ #define NR_MAX_SUPPORTED_DL_LAYERS 2 -uint16_t mac_rrc_nr_data_req(const module_id_t Mod_idP, - const int CC_id, - const frame_t frameP, - const rb_id_t Srb_id, - const rnti_t rnti, - const uint8_t Nb_tb, - uint8_t *const buffer_pP); - void rrc_gNB_process_SgNBAdditionRequest( const protocol_ctxt_t *const ctxt_pP, rrc_gNB_ue_context_t *ue_context_pP @@ -77,7 +69,6 @@ void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon NR_RRCReconfiguration_IEs_t *reconfig, NR_CellGroupConfig_t *secondaryCellGroup, NR_UE_NR_Capability_t *uecap, - const gNB_RrcConfigurationReq *configuration, int uid); int generate_CG_Config(gNB_RRC_INST *rrc, @@ -119,8 +110,6 @@ void *rrc_gnb_task(void *args_p); \ *reOffset Pointer to RE Offset Value */ void rrc_config_dl_ptrs_params(NR_BWP_Downlink_t *bwp, long *ptrsNrb, long *ptrsMcs, long *epre_Ratio, long *reOffset); -void nr_rrc_mac_update_cellgroup(rnti_t rntiMaybeUEid, NR_CellGroupConfig_t *cgc); - int8_t nr_mac_rrc_bwp_switch_req(const module_id_t module_idP, const frame_t frameP, const sub_frame_t sub_frameP, diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 2e4c46983f..228056ce37 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -45,7 +45,6 @@ #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" #include "LAYER2/NR_MAC_gNB/mac_proto.h" #include "common/utils/LOG/log.h" -#include "COMMON/mac_rrc_primitives.h" #include "RRC/NR/MESSAGES/asn1_msg.h" #include "NR_BCCH-BCH-Message.h" @@ -210,57 +209,90 @@ void nr_rrc_transfer_protected_rrc_message(const gNB_RRC_INST *rrc, const gNB_RR nr_pdcp_data_req_srb(ue_p->rrc_ue_id, srb_id, rrc_gNB_mui++, size, (unsigned char *const)buffer, rrc_deliver_dl_rrc_message, &data); } -///---------------------------------------------------------------------------------------------------------------/// -///---------------------------------------------------------------------------------------------------------------/// - -static void init_NR_SI(gNB_RRC_INST *rrc, gNB_RrcConfigurationReq *configuration) +static int get_dl_band(const f1ap_served_cell_info_t *cell_info) { + return cell_info->mode == F1AP_MODE_TDD ? cell_info->tdd.freqinfo.band : cell_info->fdd.dl_freqinfo.band; +} - LOG_D(RRC,"%s()\n\n\n\n",__FUNCTION__); - if (NODE_IS_DU(rrc->node_type) || NODE_IS_MONOLITHIC(rrc->node_type)) - rrc->carrier.mib = get_new_MIB_NR(rrc->carrier.servingcellconfigcommon); +static int get_ul_band(const f1ap_served_cell_info_t *cell_info) +{ + return cell_info->mode == F1AP_MODE_TDD ? cell_info->tdd.freqinfo.band : cell_info->fdd.ul_freqinfo.band; +} - if((get_softmodem_params()->sa) && ( (NODE_IS_DU(rrc->node_type) || NODE_IS_MONOLITHIC(rrc->node_type)))) { - NR_BCCH_DL_SCH_Message_t *sib1 = get_SIB1_NR(configuration); - rrc->carrier.SIB1 = calloc(NR_MAX_SIB_LENGTH / 8, sizeof(*rrc->carrier.SIB1)); - AssertFatal(rrc->carrier.SIB1 != NULL, "out of memory\n"); - rrc->carrier.sizeof_SIB1 = encode_SIB1_NR(sib1, rrc->carrier.SIB1, NR_MAX_SIB_LENGTH / 8); - rrc->carrier.siblock1 = sib1; - nr_mac_config_sib1(RC.nrmac[rrc->module_id], sib1); +static int get_ssb_scs(const f1ap_served_cell_info_t *cell_info) +{ + return cell_info->mode == F1AP_MODE_TDD ? cell_info->tdd.tbw.scs : cell_info->fdd.dl_tbw.scs; +} + +static int get_dl_arfcn(const f1ap_served_cell_info_t *cell_info) +{ + return cell_info->mode == F1AP_MODE_TDD ? cell_info->tdd.freqinfo.arfcn : cell_info->fdd.dl_freqinfo.arfcn; +} + +static int get_dl_bw(const f1ap_served_cell_info_t *cell_info) +{ + return cell_info->mode == F1AP_MODE_TDD ? cell_info->tdd.tbw.nrb : cell_info->fdd.dl_tbw.nrb; +} + +static int get_ssb_arfcn(const f1ap_served_cell_info_t *cell_info, const NR_MIB_t *mib, const NR_SIB1_t *sib1) +{ + DevAssert(cell_info != NULL && sib1 != NULL && mib != NULL); + const NR_FrequencyInfoDL_SIB_t* freq_info = &sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL; + AssertFatal(freq_info->scs_SpecificCarrierList.list.count == 1, "cannot handle more than one carrier, but has %d\n", freq_info->scs_SpecificCarrierList.list.count); + AssertFatal(freq_info->scs_SpecificCarrierList.list.array[0]->offsetToCarrier == 0, "cannot handle offsetToCarrier != 0, but is %ld\n", freq_info->scs_SpecificCarrierList.list.array[0]->offsetToCarrier); + + long offsetToPointA = freq_info->offsetToPointA; + long kssb = mib->ssb_SubcarrierOffset; + uint32_t dl_arfcn = get_dl_arfcn(cell_info); + int scs = get_ssb_scs(cell_info); + int band = get_dl_band(cell_info); + uint64_t scaling = band < 100 ? 1 : 3; + + uint64_t freqpointa = from_nrarfcn(band, scs, dl_arfcn); + // offsetToPointA and kSSB are both on 15kHz SCS (see 38.211 sections 7.4.3.1 + // and 4.4.4.2) + // SSB uses the SCS of the cell and is 20 RBs wide, so use 10 + uint64_t freqssb = freqpointa + scaling * 15000 * (offsetToPointA * 12 + kssb) + 10ll * 12 * (1 << scs) * 15000; + int bw_index = get_supported_band_index(scs, band, get_dl_bw(cell_info)); + int band_size_hz = get_supported_bw_mhz(band > 256 ? FR2 : FR1, bw_index) * 1000 * 1000; + uint32_t ssb_arfcn = to_nrarfcn(band, freqssb, scs, band_size_hz); + + LOG_W(RRC, "freqpointa %ld Hz/%d offsetToPointA %ld kssb %ld scs %d band %d band_size_hz %d freqssb %ld Hz/%d\n", freqpointa, dl_arfcn, offsetToPointA, kssb, scs, band, band_size_hz, freqssb, ssb_arfcn); + + if (RC.nrmac) { + // debugging: let's test this is the correct ARFCN + // in the CU, we have no access to the SSB ARFCN and therefore need to + // compute it ourselves. If we are running in monolithic, though, we have + // access to the MAC structures and hence can read and compare to the + // original SSB ARFCN. If the below creates problems, it can safely be + // taken out (but the reestablishment will likely not work). + const NR_ServingCellConfigCommon_t *scc = RC.nrmac[0]->common_channels[0].ServingCellConfigCommon; + uint32_t scc_ssb_arfcn = *scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB; + AssertFatal(ssb_arfcn == scc_ssb_arfcn, "fuck: SCC SSB ARFCN original %d vs. computed %d\n", scc_ssb_arfcn, ssb_arfcn); } + return ssb_arfcn; +} + +///---------------------------------------------------------------------------------------------------------------/// +///---------------------------------------------------------------------------------------------------------------/// + +static void init_NR_SI(gNB_RRC_INST *rrc) +{ if (!NODE_IS_DU(rrc->node_type)) { rrc->carrier.SIB23 = (uint8_t *) malloc16(100); AssertFatal(rrc->carrier.SIB23 != NULL, "cannot allocate memory for SIB"); - rrc->carrier.sizeof_SIB23 = do_SIB23_NR(&rrc->carrier, configuration); + rrc->carrier.sizeof_SIB23 = do_SIB23_NR(&rrc->carrier); LOG_I(NR_RRC,"do_SIB23_NR, size %d \n ", rrc->carrier.sizeof_SIB23); AssertFatal(rrc->carrier.sizeof_SIB23 != 255,"FATAL, RC.nrrrc[mod].carrier[CC_id].sizeof_SIB23 == 255"); } - LOG_I(NR_RRC,"Done init_NR_SI\n"); - - if (NODE_IS_MONOLITHIC(rrc->node_type) || NODE_IS_DU(rrc->node_type)){ - // update SI info - nr_mac_config_scc(RC.nrmac[rrc->module_id], - rrc->configuration.pdsch_AntennaPorts, - rrc->configuration.pusch_AntennaPorts, - rrc->configuration.sib1_tda, - rrc->configuration.minRXTXTIME, - rrc->carrier.servingcellconfigcommon); - nr_mac_config_mib(RC.nrmac[rrc->module_id], rrc->carrier.mib); - } - - /* set flag to indicate that cell information is configured. This is required - * in DU to trigger F1AP_SETUP procedure */ - pthread_mutex_lock(&rrc->cell_info_mutex); - rrc->cell_info_configured=1; - pthread_mutex_unlock(&rrc->cell_info_mutex); - if (get_softmodem_params()->phy_test > 0 || get_softmodem_params()->do_ra > 0) { + AssertFatal(NODE_IS_MONOLITHIC(rrc->node_type), "phy_test and do_ra only work in monolithic\n"); rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_allocate_new_ue_context(rrc); gNB_RRC_UE_t *UE = &ue_context_p->ue_context; UE->spCellConfig = calloc(1, sizeof(struct NR_SpCellConfig)); - UE->spCellConfig->spCellConfigDedicated = configuration->scd; + UE->spCellConfig->spCellConfigDedicated = RC.nrmac[0]->common_channels[0].pre_ServingCellConfig; LOG_I(NR_RRC,"Adding new user (%p)\n",ue_context_p); if (!NODE_IS_CU(RC.nrrrc[0]->node_type)) { rrc_add_nsa_user(rrc,ue_context_p,NULL); @@ -295,29 +327,18 @@ static void rrc_gNB_CU_DU_init(gNB_RRC_INST *rrc) cu_init_f1_ue_data(); } -static void openair_rrc_gNB_configuration(const module_id_t gnb_mod_idP, gNB_RrcConfigurationReq *configuration) +void openair_rrc_gNB_configuration(gNB_RRC_INST *rrc, gNB_RrcConfigurationReq *configuration) { - protocol_ctxt_t ctxt = { 0 }; - gNB_RRC_INST *rrc=RC.nrrrc[gnb_mod_idP]; - PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, gnb_mod_idP, GNB_FLAG_YES, NOT_A_RNTI, 0, 0,gnb_mod_idP); - LOG_I(NR_RRC, - PROTOCOL_NR_RRC_CTXT_FMT" Init...\n", - PROTOCOL_NR_RRC_CTXT_ARGS(&ctxt)); AssertFatal(rrc != NULL, "RC.nrrrc not initialized!"); AssertFatal(NUMBER_OF_UE_MAX < (module_id_t)0xFFFFFFFFFFFFFFFF, " variable overflow"); AssertFatal(configuration!=NULL,"configuration input is null\n"); - rrc->module_id = gnb_mod_idP; + rrc->module_id = 0; rrc_gNB_CU_DU_init(rrc); uid_linear_allocator_init(&rrc->uid_allocator); RB_INIT(&rrc->rrc_ue_head); rrc->configuration = *configuration; - rrc->carrier.servingcellconfigcommon = configuration->scc; - nr_rrc_config_ul_tda(configuration->scc,configuration->minRXTXTIME); /// System Information INIT - pthread_mutex_init(&rrc->cell_info_mutex,NULL); - rrc->cell_info_configured = 0; - LOG_I(NR_RRC, PROTOCOL_NR_RRC_CTXT_FMT" Checking release \n",PROTOCOL_NR_RRC_CTXT_ARGS(&ctxt)); - init_NR_SI(rrc, configuration); + init_NR_SI(rrc); return; } // END openair_rrc_gNB_configuration @@ -506,6 +527,9 @@ static void rrc_gNB_generate_defaultRRCReconfiguration(const protocol_ctxt_t *co uint8_t xid = rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id); ue_p->xids[xid] = RRC_DEFAULT_RECONF; + const nr_rrc_du_container_t *du = rrc->du; + DevAssert(du != NULL); + struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList *dedicatedNAS_MessageList = CALLOC(1, sizeof(*dedicatedNAS_MessageList)); /* Add all NAS PDUs to the list */ @@ -530,10 +554,15 @@ static void rrc_gNB_generate_defaultRRCReconfiguration(const protocol_ctxt_t *co dedicatedNAS_MessageList = NULL; } - NR_MeasConfig_t *measconfig = get_defaultMeasConfig(&rrc->configuration); + AssertFatal(du->setup_req->num_cells_available == 1, "cannot handle more than one cell, but have %d\n", du->setup_req->num_cells_available); + f1ap_served_cell_info_t *cell_info = &du->setup_req->cell[0].info; + int scs = get_ssb_scs(cell_info); + int band = get_dl_band(cell_info); + int arfcn = get_dl_arfcn(cell_info); + NR_MeasConfig_t *measconfig = get_defaultMeasConfig(arfcn, band, scs); uint8_t buffer[RRC_BUF_SIZE] = {0}; - int size = do_RRCReconfiguration(ctxt_pP, + int size = do_RRCReconfiguration(ue_p, buffer, RRC_BUF_SIZE, xid, @@ -541,16 +570,12 @@ static void rrc_gNB_generate_defaultRRCReconfiguration(const protocol_ctxt_t *co NULL, //*DRB_configList, NULL, NULL, - NULL, measconfig, dedicatedNAS_MessageList, - ue_context_pP, - &rrc->carrier, - &rrc->configuration, - NULL, ue_p->masterCellGroup); AssertFatal(size > 0, "cannot encode RRCReconfiguration in %s()\n", __func__); LOG_W(NR_RRC, "do_RRCReconfiguration(): size %d\n", size); + free_defaultMeasConfig(measconfig); if (LOG_DEBUGFLAG(DEBUG_ASN1)) { xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, ue_p->masterCellGroup); @@ -577,18 +602,6 @@ static void rrc_gNB_generate_defaultRRCReconfiguration(const protocol_ctxt_t *co AssertFatal(!NODE_IS_DU(rrc->node_type), "illegal node type DU!\n"); nr_rrc_transfer_protected_rrc_message(rrc, ue_p, DCCH, buffer, size); - - if (NODE_IS_DU(rrc->node_type) || NODE_IS_MONOLITHIC(rrc->node_type)) { - gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context; - nr_rrc_mac_update_cellgroup(ue_p->rnti, ue_p->masterCellGroup); - - uint32_t delay_ms = ue_p->masterCellGroup && ue_p->masterCellGroup->spCellConfig && ue_p->masterCellGroup->spCellConfig->spCellConfigDedicated - && ue_p->masterCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList - ? NR_RRC_RECONFIGURATION_DELAY_MS + NR_RRC_BWP_SWITCHING_DELAY_MS - : NR_RRC_RECONFIGURATION_DELAY_MS; - - nr_mac_enable_ue_rrc_processing_timer(ctxt_pP->module_id, ue_p->rnti, *rrc->carrier.servingcellconfigcommon->ssbSubcarrierSpacing, delay_ms); - } } //----------------------------------------------------------------------------- @@ -653,7 +666,7 @@ void rrc_gNB_generate_dedicatedRRCReconfiguration(const protocol_ctxt_t *const c NR_SRB_ToAddModList_t *SRBs = createSRBlist(ue_p, false); NR_DRB_ToAddModList_t *DRBs = createDRBlist(ue_p, false); - int size = do_RRCReconfiguration(ctxt_pP, + int size = do_RRCReconfiguration(ue_p, buffer, RRC_BUF_SIZE, xid, @@ -662,12 +675,7 @@ void rrc_gNB_generate_dedicatedRRCReconfiguration(const protocol_ctxt_t *const c NULL, NULL, NULL, - NULL, dedicatedNAS_MessageList, - ue_context_pP, - &rrc->carrier, - &rrc->configuration, - NULL, cellGroupConfig); LOG_DUMPMSG(NR_RRC,DEBUG_RRC,(char *)buffer,size,"[MSG] RRC Reconfiguration\n"); freeSRBlist(SRBs); @@ -684,17 +692,6 @@ void rrc_gNB_generate_dedicatedRRCReconfiguration(const protocol_ctxt_t *const c DCCH); nr_rrc_transfer_protected_rrc_message(rrc, ue_p, DCCH, buffer, size); - - if (NODE_IS_DU(rrc->node_type) || NODE_IS_MONOLITHIC(rrc->node_type)) { - nr_rrc_mac_update_cellgroup(ue_context_pP->ue_context.rnti, ue_context_pP->ue_context.masterCellGroup); - - uint32_t delay_ms = ue_p->masterCellGroup && ue_p->masterCellGroup->spCellConfig && ue_p->masterCellGroup->spCellConfig->spCellConfigDedicated - && ue_p->masterCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList - ? NR_RRC_RECONFIGURATION_DELAY_MS + NR_RRC_BWP_SWITCHING_DELAY_MS - : NR_RRC_RECONFIGURATION_DELAY_MS; - - nr_mac_enable_ue_rrc_processing_timer(ctxt_pP->module_id, ue_p->rnti, *rrc->carrier.servingcellconfigcommon->ssbSubcarrierSpacing, delay_ms); - } } //----------------------------------------------------------------------------- @@ -797,7 +794,7 @@ rrc_gNB_modify_dedicatedRRCReconfiguration( } uint8_t buffer[RRC_BUF_SIZE]; - int size = do_RRCReconfiguration(ctxt_pP, + int size = do_RRCReconfiguration(ue_p, buffer, RRC_BUF_SIZE, xid, @@ -806,12 +803,7 @@ rrc_gNB_modify_dedicatedRRCReconfiguration( NULL, NULL, NULL, - NULL, dedicatedNAS_MessageList, - NULL, - NULL, - NULL, - NULL, NULL); LOG_DUMPMSG(NR_RRC, DEBUG_RRC, (char *)buffer, size, "[MSG] RRC Reconfiguration\n"); @@ -837,15 +829,6 @@ rrc_gNB_modify_dedicatedRRCReconfiguration( gNB_RRC_INST *rrc = RC.nrrrc[ctxt_pP->module_id]; nr_rrc_transfer_protected_rrc_message(rrc, ue_p, DCCH, buffer, size); - - if (NODE_IS_DU(rrc->node_type) || NODE_IS_MONOLITHIC(rrc->node_type)) { - uint32_t delay_ms = ue_p->masterCellGroup && ue_p->masterCellGroup->spCellConfig && ue_p->masterCellGroup->spCellConfig->spCellConfigDedicated - && ue_p->masterCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList - ? NR_RRC_RECONFIGURATION_DELAY_MS + NR_RRC_BWP_SWITCHING_DELAY_MS - : NR_RRC_RECONFIGURATION_DELAY_MS; - - nr_mac_enable_ue_rrc_processing_timer(ctxt_pP->module_id, ue_p->rnti, *rrc->carrier.servingcellconfigcommon->ssbSubcarrierSpacing, delay_ms); - } } //----------------------------------------------------------------------------- @@ -881,7 +864,7 @@ rrc_gNB_generate_dedicatedRRCReconfiguration_release( } uint8_t buffer[RRC_BUF_SIZE] = {0}; - int size = do_RRCReconfiguration(ctxt_pP, + int size = do_RRCReconfiguration(ue_p, buffer, RRC_BUF_SIZE, xid, @@ -890,12 +873,7 @@ rrc_gNB_generate_dedicatedRRCReconfiguration_release( DRB_Release_configList2, NULL, NULL, - NULL, dedicatedNAS_MessageList, - NULL, - NULL, - NULL, - NULL, NULL); LOG_DUMPMSG(NR_RRC,DEBUG_RRC,(char *)buffer,size, "[MSG] RRC Reconfiguration\n"); @@ -918,15 +896,6 @@ rrc_gNB_generate_dedicatedRRCReconfiguration_release( gNB_RRC_INST *rrc = RC.nrrrc[ctxt_pP->module_id]; nr_rrc_transfer_protected_rrc_message(rrc, ue_p, DCCH, buffer, size); - - if (NODE_IS_DU(rrc->node_type) || NODE_IS_MONOLITHIC(rrc->node_type)) { - uint32_t delay_ms = ue_p->masterCellGroup && ue_p->masterCellGroup->spCellConfig && ue_p->masterCellGroup->spCellConfig->spCellConfigDedicated - && ue_p->masterCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList - ? NR_RRC_RECONFIGURATION_DELAY_MS + NR_RRC_BWP_SWITCHING_DELAY_MS - : NR_RRC_RECONFIGURATION_DELAY_MS; - - nr_mac_enable_ue_rrc_processing_timer(ctxt_pP->module_id, ue_p->rnti, *rrc->carrier.servingcellconfigcommon->ssbSubcarrierSpacing, delay_ms); - } } //----------------------------------------------------------------------------- @@ -1030,8 +999,8 @@ static void rrc_gNB_process_RRCReconfigurationComplete(const protocol_ctxt_t *co //----------------------------------------------------------------------------- static void rrc_gNB_generate_RRCReestablishment(rrc_gNB_ue_context_t *ue_context_pP, const uint8_t *masterCellGroup_from_DU, - NR_ServingCellConfigCommon_t *scc, - const rnti_t old_rnti) + const rnti_t old_rnti, + const nr_rrc_du_container_t *du) //----------------------------------------------------------------------------- { module_id_t module_id = 0; @@ -1043,15 +1012,9 @@ static void rrc_gNB_generate_RRCReestablishment(rrc_gNB_ue_context_t *ue_context uint8_t xid = rrc_gNB_get_next_transaction_identifier(module_id); ue_p->xids[xid] = RRC_REESTABLISH; NR_SRB_ToAddModList_t *SRBs = createSRBlist(ue_p, true); - int size = do_RRCReestablishment(ue_context_pP, - 0 /* CC_id */, - buffer, - RRC_BUF_SIZE, - xid, - SRBs, - masterCellGroup_from_DU, - scc, - &rrc->carrier); + const f1ap_served_cell_info_t *cell_info = &du->setup_req->cell[0].info; + uint32_t ssb_arfcn = get_ssb_arfcn(cell_info, du->mib, du->sib1); + int size = do_RRCReestablishment(ue_context_pP, buffer, RRC_BUF_SIZE, xid, cell_info->nr_pci, ssb_arfcn); LOG_I(NR_RRC, "[RAPROC] UE %04x Logical Channel DL-DCCH, Generating NR_RRCReestablishment (bytes %d)\n", ue_p->rnti, size); @@ -1139,7 +1102,7 @@ static void rrc_gNB_process_RRCReestablishmentComplete(const protocol_ctxt_t *co NR_DRB_ToAddModList_t *DRBs = createDRBlist(ue_p, true); uint8_t buffer[RRC_BUF_SIZE] = {0}; - int size = do_RRCReconfiguration(ctxt_pP, + int size = do_RRCReconfiguration(ue_p, buffer, RRC_BUF_SIZE, new_xid, @@ -1147,13 +1110,8 @@ static void rrc_gNB_process_RRCReestablishmentComplete(const protocol_ctxt_t *co DRBs, NULL, NULL, - NULL, NULL, // MeasObj_list, NULL, - ue_context_pP, - &rrc->carrier, - NULL, - NULL, cellGroupConfig); freeSRBlist(SRBs); freeDRBlist(DRBs); @@ -1166,19 +1124,6 @@ static void rrc_gNB_process_RRCReestablishmentComplete(const protocol_ctxt_t *co ue_p->rnti, size); nr_rrc_transfer_protected_rrc_message(rrc, ue_p, DCCH, buffer, size); - - if (NODE_IS_DU(RC.nrrrc[ctxt_pP->module_id]->node_type) || NODE_IS_MONOLITHIC(RC.nrrrc[ctxt_pP->module_id]->node_type)) { - uint32_t delay_ms = ue_p->masterCellGroup && ue_p->masterCellGroup->spCellConfig - && ue_p->masterCellGroup->spCellConfig->spCellConfigDedicated - && ue_p->masterCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList - ? NR_RRC_RECONFIGURATION_DELAY_MS + NR_RRC_BWP_SWITCHING_DELAY_MS - : NR_RRC_RECONFIGURATION_DELAY_MS; - - nr_mac_enable_ue_rrc_processing_timer(ctxt_pP->module_id, - ue_p->rnti, - *RC.nrrrc[ctxt_pP->module_id]->carrier.servingcellconfigcommon->ssbSubcarrierSpacing, - delay_ms); - } } //----------------------------------------------------------------------------- @@ -1201,41 +1146,11 @@ int nr_rrc_reconfiguration_req(rrc_gNB_ue_context_t *const ue_context_pP } uint8_t buffer[RRC_BUF_SIZE]; - int size = do_RRCReconfiguration(ctxt_pP, - buffer, - RRC_BUF_SIZE, - xid, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - ue_context_pP, - NULL, - NULL, - NULL, - masterCellGroup); + int size = do_RRCReconfiguration(ue_p, buffer, RRC_BUF_SIZE, xid, NULL, NULL, NULL, NULL, NULL, NULL, masterCellGroup); gNB_RRC_INST *rrc = RC.nrrrc[ctxt_pP->module_id]; nr_rrc_transfer_protected_rrc_message(rrc, ue_p, DCCH, buffer, size); - if (NODE_IS_DU(rrc->node_type) || NODE_IS_MONOLITHIC(rrc->node_type)) { - nr_rrc_mac_update_cellgroup(ue_context_pP->ue_context.rnti, masterCellGroup); - - uint32_t delay_ms = ue_p->masterCellGroup && ue_p->masterCellGroup->spCellConfig - && ue_p->masterCellGroup->spCellConfig->spCellConfigDedicated - && ue_p->masterCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList - ? NR_RRC_RECONFIGURATION_DELAY_MS + NR_RRC_BWP_SWITCHING_DELAY_MS - : NR_RRC_RECONFIGURATION_DELAY_MS; - - nr_mac_enable_ue_rrc_processing_timer(ctxt_pP->module_id, - ue_p->rnti, - *rrc->carrier.servingcellconfigcommon->ssbSubcarrierSpacing, - delay_ms); - } - return 0; } @@ -1249,6 +1164,10 @@ static int nr_rrc_gNB_decode_ccch(module_id_t module_id, const f1ap_initial_ul_r NR_RRCReestablishmentRequest_IEs_t rrcReestablishmentRequest; rnti_t rnti = msg->crnti; + /* look up corresponding DU. For the moment, there is only one */ + const nr_rrc_du_container_t *du = gnb_rrc_inst->du; + AssertFatal(du != NULL, "received CCCH message, but no corresponding DU found\n"); + LOG_I(NR_RRC, "Decoding CCCH: RNTI %04x, payload_size %d\n", rnti, msg->rrc_container_length); dec_rval = uper_decode(NULL, &asn_DEF_NR_UL_CCCH_Message, (void **)&ul_ccch_msg, msg->rrc_container, msg->rrc_container_length, 0, 0); @@ -1274,6 +1193,7 @@ static int nr_rrc_gNB_decode_ccch(module_id_t module_id, const f1ap_initial_ul_r /* randomValue BIT STRING (SIZE (39)) */ if (rrcSetupRequest->ue_Identity.choice.randomValue.size != 5) { // 39-bit random value LOG_E(NR_RRC, "wrong InitialUE-Identity randomValue size, expected 5, provided %lu", (long unsigned int)rrcSetupRequest->ue_Identity.choice.randomValue.size); + ASN_STRUCT_FREE(asn_DEF_NR_UL_CCCH_Message, ul_ccch_msg); return -1; } uint64_t random_value = 0; @@ -1294,6 +1214,7 @@ static int nr_rrc_gNB_decode_ccch(module_id_t module_id, const f1ap_initial_ul_r /* ng-5G-S-TMSI-Part1 BIT STRING (SIZE (39)) */ if (rrcSetupRequest->ue_Identity.choice.ng_5G_S_TMSI_Part1.size != 5) { LOG_E(NR_RRC, "wrong ng_5G_S_TMSI_Part1 size, expected 5, provided %lu \n", (long unsigned int)rrcSetupRequest->ue_Identity.choice.ng_5G_S_TMSI_Part1.size); + ASN_STRUCT_FREE(asn_DEF_NR_UL_CCCH_Message, ul_ccch_msg); return -1; } @@ -1314,10 +1235,7 @@ static int nr_rrc_gNB_decode_ccch(module_id_t module_id, const f1ap_initial_ul_r LOG_I(NR_RRC, "UE %04x 5G-S-TMSI-Part1 doesn't exist, setting ng_5G_S_TMSI_Part1 => %ld\n", rnti, s_tmsi_part1); ue_context_p = rrc_gNB_create_ue_context(rnti, gnb_rrc_inst, s_tmsi_part1, msg->gNB_DU_ue_id); - if (ue_context_p == NULL) { - LOG_E(NR_RRC, "rrc_gNB_get_next_free_ue_context returned NULL\n"); - return -1; - } + AssertFatal(ue_context_p != NULL, "out of memory\n"); gNB_RRC_UE_t *UE = &ue_context_p->ue_context; UE->Initialue_identity_5g_s_TMSI.presence = true; UE->ng_5G_S_TMSI_Part1 = s_tmsi_part1; @@ -1364,12 +1282,15 @@ static int nr_rrc_gNB_decode_ccch(module_id_t module_id, const f1ap_initial_ul_r cause == NR_ReestablishmentCause_otherFailure ? "Other Failure" : (cause == NR_ReestablishmentCause_handoverFailure ? "Handover Failure" : "reconfigurationFailure")); - if (physCellId != gnb_rrc_inst->carrier.physCellId) { + + AssertFatal(du->setup_req->num_cells_available == 1, "cannot handle more than one cell\n"); + const f1ap_served_cell_info_t *cell_info = &du->setup_req->cell[0].info; + if (physCellId != cell_info->nr_pci) { /* UE was moving from previous cell so quickly that RRCReestablishment for previous cell was received in this cell */ LOG_E(NR_RRC, - " NR_RRCReestablishmentRequest ue_Identity.physCellId(%ld) is not equal to current physCellId(%ld), fallback to RRC establishment\n", + " NR_RRCReestablishmentRequest ue_Identity.physCellId(%ld) is not equal to current physCellId(%d), fallback to RRC establishment\n", physCellId, - gnb_rrc_inst->carrier.physCellId); + cell_info->nr_pci); /* 38.401 8.7: "If the UE accessed from a gNB-DU other than the * original one, the gNB-CU should trigger the UE Context Setup * procedure" we did not implement this yet; TBD for Multi-DU */ @@ -1422,8 +1343,8 @@ static int nr_rrc_gNB_decode_ccch(module_id_t module_id, const f1ap_initial_ul_r rrc_gNB_generate_RRCReestablishment(ue_context_p, msg->du2cu_rrc_container, - gnb_rrc_inst->carrier.servingcellconfigcommon, - old_rnti); + old_rnti, + du); } break; case NR_UL_CCCH_MessageType__c1_PR_rrcSystemInfoRequest: @@ -1436,6 +1357,7 @@ static int nr_rrc_gNB_decode_ccch(module_id_t module_id, const f1ap_initial_ul_r break; } } + ASN_STRUCT_FREE(asn_DEF_NR_UL_CCCH_Message, ul_ccch_msg); return 0; } @@ -1462,7 +1384,7 @@ static inline uint64_t bitStr_to_uint64(BIT_STRING_t *asn) { return result; } -static void rrc_gNB_process_MeasurementReport(rrc_gNB_ue_context_t *ue_context, const NR_MeasurementReport_t *measurementReport) +static void rrc_gNB_process_MeasurementReport(rrc_gNB_ue_context_t *ue_context, NR_MeasurementReport_t *measurementReport) { if (LOG_DEBUGFLAG(DEBUG_ASN1)) xer_fprint(stdout, &asn_DEF_NR_MeasurementReport, (void *)measurementReport); @@ -1471,14 +1393,15 @@ static void rrc_gNB_process_MeasurementReport(rrc_gNB_ue_context_t *ue_context, && measurementReport->criticalExtensions.choice.measurementReport != NULL); gNB_RRC_UE_t *ue_ctxt = &ue_context->ue_context; - if (ue_ctxt->measResults != NULL) { - ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NR_MeasResults, ue_ctxt->measResults); - ue_ctxt->measResults = NULL; - } + ASN_STRUCT_FREE(asn_DEF_NR_MeasResults, ue_ctxt->measResults); + ue_ctxt->measResults = NULL; const NR_MeasId_t id = measurementReport->criticalExtensions.choice.measurementReport->measResults.measId; AssertFatal(id, "unexpected MeasResult for MeasurementId %ld received\n", id); asn1cCallocOne(ue_ctxt->measResults, measurementReport->criticalExtensions.choice.measurementReport->measResults); + /* we "keep" the measurement report, so set to 0 */ + free(measurementReport->criticalExtensions.choice.measurementReport); + measurementReport->criticalExtensions.choice.measurementReport = NULL; } static int handle_rrcReestablishmentComplete(const protocol_ctxt_t *const ctxt_pP, @@ -1511,6 +1434,18 @@ static int handle_ueCapabilityInformation(const protocol_ctxt_t *const ctxt_pP, if (ue_cap_info->criticalExtensions.present == NR_UECapabilityInformation__criticalExtensions_PR_ueCapabilityInformation) { const NR_UE_CapabilityRAT_ContainerList_t *ue_CapabilityRAT_ContainerList = ue_cap_info->criticalExtensions.choice.ueCapabilityInformation->ue_CapabilityRAT_ContainerList; + + /* Encode UE-CapabilityRAT-ContainerList for sending to the DU */ + free(UE->ue_cap_buffer.buf); + UE->ue_cap_buffer.len = uper_encode_to_new_buffer(&asn_DEF_NR_UE_CapabilityRAT_ContainerList, + NULL, + ue_CapabilityRAT_ContainerList, + (void **)&UE->ue_cap_buffer.buf); + if (UE->ue_cap_buffer.len <= 0) { + LOG_E(RRC, "could not encode UE-CapabilityRAT-ContainerList, abort handling capabilities\n"); + return -1; + } + for (int i = 0; i < ue_CapabilityRAT_ContainerList->list.count; i++) { const NR_UE_CapabilityRAT_Container_t *ue_cap_container = ue_CapabilityRAT_ContainerList->list.array[i]; if (ue_cap_container->rat_Type == NR_RAT_Type_nr) { @@ -1701,9 +1636,9 @@ static void handle_rrcReconfigurationComplete(const protocol_ctxt_t *const ctxt_ f1ap_ue_context_modif_req_t ue_context_modif_req = { .gNB_CU_ue_id = UE->rrc_ue_id, .gNB_DU_ue_id = ue_data.secondary_ue, - .mcc = rrc->configuration.mcc[0], - .mnc = rrc->configuration.mnc[0], - .mnc_digit_length = rrc->configuration.mnc_digit_length[0], + .plmn.mcc = rrc->configuration.mcc[0], + .plmn.mnc = rrc->configuration.mnc[0], + .plmn.mnc_digit_length = rrc->configuration.mnc_digit_length[0], .nr_cellid = rrc->nr_cellid, .servCellId = 0, /* TODO: correct value? */ .ReconfigComplOutcome = successful_reconfig ? RRCreconf_success : RRCreconf_failure, @@ -1853,96 +1788,139 @@ int rrc_gNB_decode_dcch(const protocol_ctxt_t *const ctxt_pP, break; } } + ASN_STRUCT_FREE(asn_DEF_NR_UL_DCCH_Message, ul_dcch_msg); return 0; } -void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *f1_setup_req) { - LOG_I(NR_RRC,"Received F1 Setup Request from gNB_DU %llu (%s)\n",(unsigned long long int)f1_setup_req->gNB_DU_id,f1_setup_req->gNB_DU_name); - int cu_cell_ind = 0; - MessageDef *msg_p =itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_SETUP_RESP); - F1AP_SETUP_RESP (msg_p).num_cells_to_activate = 0; - MessageDef *msg_p2=itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_GNB_CU_CONFIGURATION_UPDATE); +static bool rrc_gNB_plmn_matches(const gNB_RRC_INST *rrc, const f1ap_served_cell_info_t *info) +{ + const gNB_RrcConfigurationReq *conf = &rrc->configuration; + return conf->num_plmn == 1 // F1 supports only one + && conf->mcc[0] == info->plmn.mcc + && conf->mnc[0] == info->plmn.mnc + && rrc->nr_cellid == info->nr_cellid; +} - for (int i = 0; i < f1_setup_req->num_cells_available; i++) { - for (int j=0; jconfiguration.mcc[0] == f1_setup_req->cell[i].mcc && - rrc->configuration.mnc[0] == f1_setup_req->cell[i].mnc && - rrc->nr_cellid == f1_setup_req->cell[i].nr_cellid) { - //fixme: multi instance is not consistent here - F1AP_SETUP_RESP (msg_p).gNB_CU_name = rrc->node_name; - // check that CU rrc instance corresponds to mcc/mnc/cgi (normally cgi should be enough, but just in case) - LOG_W(NR_RRC, "instance %d sib1 length %d\n", i, f1_setup_req->sib1_length[i]); - AssertFatal(rrc->carrier.mib == NULL, "CU MIB is already initialized: double F1 setup request?\n"); - asn_dec_rval_t dec_rval = uper_decode_complete(NULL, - &asn_DEF_NR_BCCH_BCH_Message, - (void **)&rrc->carrier.mib, - f1_setup_req->mib[i], - f1_setup_req->mib_length[i]); - AssertFatal(dec_rval.code == RC_OK, - "[gNB_CU %"PRIu8"] Failed to decode NR_BCCH_BCH_MESSAGE (%zu bits)\n", - j, - dec_rval.consumed ); + LOG_I(NR_RRC, "Received F1 Setup Request from gNB_DU %lu (%s) on assoc_id %d\n", req->gNB_DU_id, req->gNB_DU_name, assoc_id); - dec_rval = uper_decode_complete(NULL, - &asn_DEF_NR_SIB1, //&asn_DEF_NR_BCCH_DL_SCH_Message, - (void **)&rrc->carrier.siblock1_DU, - f1_setup_req->sib1[i], - f1_setup_req->sib1_length[i]); - AssertFatal(dec_rval.code == RC_OK, - "[gNB_DU %"PRIu8"] Failed to decode NR_BCCH_DLSCH_MESSAGE (%zu bits)\n", - j, - dec_rval.consumed ); + // check: + // - it is the first DU + // - it is one cell + // - PLMN and Cell ID matches + // else reject + f1ap_setup_failure_t fail = {.cause = F1AP_CauseRadioNetwork_gNB_CU_Cell_Capacity_Exceeded}; + if (rrc->du != NULL) { + const f1ap_setup_req_t *other = rrc->du->setup_req; + LOG_E(NR_RRC, "can only handle one DU, but already serving DU %ld (%s)\n", other->gNB_DU_id, other->gNB_DU_name); + rrc->mac_rrc.f1_setup_failure(&fail); + return; + } + if (req->num_cells_available != 1) { + LOG_E(NR_RRC, "can only handle on DU cell, but gNB_DU %ld has %d\n", req->gNB_DU_id, req->num_cells_available); + rrc->mac_rrc.f1_setup_failure(&fail); + return; + } + f1ap_served_cell_info_t *cell_info = &req->cell[0].info; + if (!rrc_gNB_plmn_matches(rrc, cell_info)) { + LOG_E(NR_RRC, + "PLMN mismatch: CU %d%d cellID %ld, DU %d%d cellID %ld\n", + rrc->configuration.mcc[0], + rrc->configuration.mnc[0], + rrc->nr_cellid, + cell_info->plmn.mcc, + cell_info->plmn.mnc, + cell_info->nr_cellid); + rrc->mac_rrc.f1_setup_failure(&fail); + return; + } + // if there is no system info or no SIB1 and we run in SA mode, we cannot handle it + const f1ap_gnb_du_system_info_t *sys_info = req->cell[0].sys_info; + if (sys_info == NULL || sys_info->mib == NULL || (sys_info->sib1 == NULL && get_softmodem_params()->sa)) { + LOG_E(NR_RRC, "no system information provided by DU, rejecting\n"); + rrc->mac_rrc.f1_setup_failure(&fail); + return; + } - // Parse message and extract SystemInformationBlockType1 field - rrc->carrier.sib1 = rrc->carrier.siblock1_DU; - if ( LOG_DEBUGFLAG(DEBUG_ASN1)){ - LOG_I(NR_RRC, "Printing received SIB1 container inside F1 setup request message:\n"); - xer_fprint(stdout, &asn_DEF_NR_SIB1,(void *)rrc->carrier.sib1); - } - - rrc->carrier.physCellId = f1_setup_req->cell[i].nr_pci; - - F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).gNB_CU_name = rrc->node_name; - F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).cells_to_activate[cu_cell_ind].mcc = rrc->configuration.mcc[0]; - F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).cells_to_activate[cu_cell_ind].mnc = rrc->configuration.mnc[0]; - F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).cells_to_activate[cu_cell_ind].mnc_digit_length = rrc->configuration.mnc_digit_length[0]; - F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).cells_to_activate[cu_cell_ind].nr_cellid = rrc->nr_cellid; - F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).cells_to_activate[cu_cell_ind].nrpci = f1_setup_req->cell[i].nr_pci; - int num_SI= 0; - - if (rrc->carrier.SIB23) { - F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).cells_to_activate[cu_cell_ind].SI_container[2] = rrc->carrier.SIB23; - F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).cells_to_activate[cu_cell_ind].SI_container_length[2] = rrc->carrier.sizeof_SIB23; - num_SI++; - } - - F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).cells_to_activate[cu_cell_ind].num_SI = num_SI; - cu_cell_ind++; - F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).num_cells_to_activate = cu_cell_ind; - // send - break; - } else {// setup_req mcc/mnc match rrc internal list element - LOG_W(NR_RRC,"[Inst %d] No matching MCC/MNC: rrc->mcc/f1_setup_req->mcc %d/%d rrc->mnc/f1_setup_req->mnc %d/%d rrc->nr_cellid/f1_setup_req->nr_cellid %ld/%ld \n", - j, rrc->configuration.mcc[0], f1_setup_req->cell[i].mcc, - rrc->configuration.mnc[0], f1_setup_req->cell[i].mnc, - rrc->nr_cellid, f1_setup_req->cell[i].nr_cellid); - } - }// for (int j=0;jmib, sys_info->mib_length); + if (dec_rval.code != RC_OK || mib->message.present != NR_BCCH_BCH_MessageType_PR_mib + || mib->message.choice.messageClassExtension == NULL) { + LOG_E(RRC, "Failed to decode NR_BCCH_BCH_MESSAGE (%zu bits) of DU, rejecting DU\n", dec_rval.consumed); + rrc->mac_rrc.f1_setup_failure(&fail); + ASN_STRUCT_FREE(asn_DEF_NR_BCCH_BCH_Message, mib); + return; + } + NR_SIB1_t *sib1 = NULL; + if (sys_info->sib1) { + dec_rval = uper_decode_complete(NULL, &asn_DEF_NR_SIB1, (void **)&sib1, sys_info->sib1, sys_info->sib1_length); + if (dec_rval.code != RC_OK) { + LOG_E(RRC, "Failed to decode NR_SIB1 (%zu bits) of DU, rejecting DU\n", dec_rval.consumed); + rrc->mac_rrc.f1_setup_failure(&fail); + ASN_STRUCT_FREE(asn_DEF_NR_SIB1, sib1); + return; } + if (LOG_DEBUGFLAG(DEBUG_ASN1)) + xer_fprint(stdout, &asn_DEF_NR_SIB1, sib1); + } - // handle other failure cases - }//for (int i=0;inum_cells_available;i++) + LOG_I(RRC, "Accepting DU %ld (%s), sending F1 Setup Response\n", req->gNB_DU_id, req->gNB_DU_name); + + // we accept the DU + rrc->du = calloc(1, sizeof(*rrc->du)); + AssertFatal(rrc->du != NULL, "out of memory\n"); + rrc->du->assoc_id = assoc_id; + + /* ITTI will free the setup request message via free(). So the memory + * "inside" of the message will remain, but the "outside" container no, so + * allocate memory and copy it in */ + rrc->du->setup_req = malloc(sizeof(*rrc->du->setup_req)); + AssertFatal(rrc->du->setup_req != NULL, "out of memory\n"); + *rrc->du->setup_req = *req; + rrc->du->mib = mib->message.choice.mib; + mib->message.choice.mib = NULL; + ASN_STRUCT_FREE(asn_DEF_NR_BCCH_BCH_MessageType, mib); + rrc->du->sib1 = sib1; + + served_cells_to_activate_t cell = { + .plmn = cell_info->plmn, + .nr_cellid = cell_info->nr_cellid, + .nrpci = cell_info->nr_pci, + .num_SI = 0, + }; + f1ap_setup_resp_t resp = {.num_cells_to_activate = 1, .cells_to_activate[0] = cell}; + if (rrc->node_name != NULL) + resp.gNB_CU_name = strdup(rrc->node_name); + rrc->mac_rrc.f1_setup_response(&resp); + + /* + MessageDef *msg_p2 = itti_alloc_new_message(TASK_RRC_GNB, 0, F1AP_GNB_CU_CONFIGURATION_UPDATE); + F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p2).gNB_CU_name = rrc->node_name; + F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p2).cells_to_activate[0].plmn.mcc = rrc->configuration.mcc[0]; + F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p2).cells_to_activate[0].plmn.mnc = rrc->configuration.mnc[0]; + F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p2).cells_to_activate[0].plmn.mnc_digit_length = rrc->configuration.mnc_digit_length[0]; + F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p2).cells_to_activate[0].nr_cellid = rrc->nr_cellid; + F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p2).cells_to_activate[0].nrpci = req->cell[0].info.nr_pci; + int num_SI = 0; + + if (rrc->carrier.SIB23) { + F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p2).cells_to_activate[0].SI_container[2] = rrc->carrier.SIB23; + F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p2).cells_to_activate[0].SI_container_length[2] = rrc->carrier.sizeof_SIB23; + num_SI++; + } + + F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p2).cells_to_activate[0].num_SI = num_SI; + F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p2).num_cells_to_activate = 1; + // send + itti_send_msg_to_task(TASK_CU_F1, 0, msg_p2); + */ } void rrc_gNB_process_initial_ul_rrc_message(const f1ap_initial_ul_rrc_message_t *ul_rrc) @@ -2033,6 +2011,13 @@ static void rrc_CU_process_ue_context_release_request(MessageDef *msg_p) NGAP_CAUSE_RADIO_NETWORK_RADIO_CONNECTION_WITH_UE_LOST); } +static void rrc_delete_ue_data(gNB_RRC_UE_t *UE) +{ + ASN_STRUCT_FREE(asn_DEF_NR_UE_NR_Capability, UE->UE_Capability_nr); + ASN_STRUCT_FREE(asn_DEF_NR_CellGroupConfig, UE->masterCellGroup); + ASN_STRUCT_FREE(asn_DEF_NR_MeasResults, UE->measResults); +} + static void rrc_CU_process_ue_context_release_complete(MessageDef *msg_p) { const int instance = 0; @@ -2049,6 +2034,7 @@ static void rrc_CU_process_ue_context_release_complete(MessageDef *msg_p) newGtpuDeleteAllTunnels(instance, UE->rrc_ue_id); rrc_gNB_send_NGAP_UE_CONTEXT_RELEASE_COMPLETE(instance, UE->rrc_ue_id); LOG_I(NR_RRC, "removed UE CU UE ID %u/RNTI %04x \n", UE->rrc_ue_id, UE->rnti); + rrc_delete_ue_data(UE); rrc_gNB_remove_ue_context(rrc, ue_context_p); } @@ -2174,10 +2160,10 @@ unsigned int mask_flip(unsigned int x) { return((((x>>8) + (x<<8))&0xffff)>>6); } -static unsigned int get_dl_bw_mask(const gNB_RRC_INST *rrc, const NR_UE_NR_Capability_t *cap) +static unsigned int get_dl_bw_mask(const f1ap_served_cell_info_t *cell_info, const NR_UE_NR_Capability_t *cap) { - int common_band = *rrc->carrier.servingcellconfigcommon->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; - int common_scs = rrc->carrier.servingcellconfigcommon->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; + int common_band = get_dl_band(cell_info); + int common_scs = get_ssb_scs(cell_info); for (int i=0;irf_Parameters.supportedBandListNR.list.count;i++) { NR_BandNR_t *bandNRinfo = cap->rf_Parameters.supportedBandListNR.list.array[i]; if (bandNRinfo->bandNR == common_band) { @@ -2224,10 +2210,10 @@ static unsigned int get_dl_bw_mask(const gNB_RRC_INST *rrc, const NR_UE_NR_Capab return(0); } -static unsigned int get_ul_bw_mask(const gNB_RRC_INST *rrc, const NR_UE_NR_Capability_t *cap) +static unsigned int get_ul_bw_mask(const f1ap_served_cell_info_t *cell_info, const NR_UE_NR_Capability_t *cap) { - int common_band = *rrc->carrier.servingcellconfigcommon->uplinkConfigCommon->frequencyInfoUL->frequencyBandList->list.array[0]; - int common_scs = rrc->carrier.servingcellconfigcommon->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; + int common_band = get_ul_band(cell_info); + int common_scs = get_ssb_scs(cell_info); for (int i=0;irf_Parameters.supportedBandListNR.list.count;i++) { NR_BandNR_t *bandNRinfo = cap->rf_Parameters.supportedBandListNR.list.array[i]; if (bandNRinfo->bandNR == common_band) { @@ -2274,9 +2260,9 @@ static unsigned int get_ul_bw_mask(const gNB_RRC_INST *rrc, const NR_UE_NR_Capab return(0); } -static int get_ul_mimo_layersCB(const gNB_RRC_INST *rrc, const NR_UE_NR_Capability_t *cap) +static int get_ul_mimo_layersCB(const f1ap_served_cell_info_t *cell_info, const NR_UE_NR_Capability_t *cap) { - int common_scs = rrc->carrier.servingcellconfigcommon->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; + int common_scs = get_ssb_scs(cell_info); // check featureSet NR_FeatureSets_t *fs=cap->featureSets; @@ -2292,9 +2278,9 @@ static int get_ul_mimo_layersCB(const gNB_RRC_INST *rrc, const NR_UE_NR_Capabili return(1); } -static int get_ul_mimo_layers(const gNB_RRC_INST *rrc, const NR_UE_NR_Capability_t *cap) +static int get_ul_mimo_layers(const f1ap_served_cell_info_t *cell_info, const NR_UE_NR_Capability_t *cap) { - int common_scs = rrc->carrier.servingcellconfigcommon->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; + int common_scs = get_ssb_scs(cell_info); // check featureSet NR_FeatureSets_t *fs=cap->featureSets; @@ -2309,9 +2295,9 @@ static int get_ul_mimo_layers(const gNB_RRC_INST *rrc, const NR_UE_NR_Capability return(1); } -static int get_dl_mimo_layers(const gNB_RRC_INST *rrc, const NR_UE_NR_Capability_t *cap) +static int get_dl_mimo_layers(const f1ap_served_cell_info_t *cell_info, const NR_UE_NR_Capability_t *cap) { - int common_scs = rrc->carrier.servingcellconfigcommon->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; + int common_scs = get_ssb_scs(cell_info); // check featureSet NR_FeatureSets_t *fs=cap->featureSets; @@ -2380,19 +2366,28 @@ void prepare_and_send_ue_context_modification_f1(rrc_gNB_ue_context_t *ue_contex srbs[0].lcid = 2; } + cu_to_du_rrc_information_t cu2du = {0}; + cu_to_du_rrc_information_t *cu2du_p = NULL; + if (UE->ue_cap_buffer.len > 0 && UE->ue_cap_buffer.buf != NULL) { + cu2du_p = &cu2du; + cu2du.uE_CapabilityRAT_ContainerList = UE->ue_cap_buffer.buf; + cu2du.uE_CapabilityRAT_ContainerList_length = UE->ue_cap_buffer.len; + } + f1_ue_data_t ue_data = cu_get_f1_ue_data(UE->rrc_ue_id); f1ap_ue_context_modif_req_t ue_context_modif_req = { - .gNB_CU_ue_id = UE->rrc_ue_id, - .gNB_DU_ue_id = ue_data.secondary_ue, - .mcc = rrc->configuration.mcc[0], - .mnc = rrc->configuration.mnc[0], - .mnc_digit_length = rrc->configuration.mnc_digit_length[0], - .nr_cellid = rrc->nr_cellid, - .servCellId = 0, /* TODO: correct value? */ - .srbs_to_be_setup_length = nb_srb, - .srbs_to_be_setup = srbs, - .drbs_to_be_setup_length = nb_drb, - .drbs_to_be_setup = drbs, + .gNB_CU_ue_id = UE->rrc_ue_id, + .gNB_DU_ue_id = ue_data.secondary_ue, + .plmn.mcc = rrc->configuration.mcc[0], + .plmn.mnc = rrc->configuration.mnc[0], + .plmn.mnc_digit_length = rrc->configuration.mnc_digit_length[0], + .nr_cellid = rrc->nr_cellid, + .servCellId = 0, /* TODO: correct value? */ + .srbs_to_be_setup_length = nb_srb, + .srbs_to_be_setup = srbs, + .drbs_to_be_setup_length = nb_drb, + .drbs_to_be_setup = drbs, + .cu_to_du_rrc_information = cu2du_p, }; rrc->mac_rrc.ue_context_modification_request(&ue_context_modif_req); } @@ -2429,6 +2424,21 @@ void rrc_gNB_process_e1_bearer_context_setup_resp(e1ap_bearer_setup_resp_t *resp prepare_and_send_ue_context_modification_f1(ue_context_p, resp); } +static void rrc_CU_process_f1_lost_connection(gNB_RRC_INST *rrc, f1ap_lost_connection_t *lc, sctp_assoc_t assoc_id) +{ + AssertFatal(rrc->du != NULL, "no DU connected, cannot received F1 lost connection\n"); + AssertFatal(rrc->du->assoc_id == assoc_id, + "previously connected DU (%d) does not match DU for which connection has been lost (%d)\n", + rrc->du->assoc_id, + assoc_id); + (void) lc; // unused for the moment + ASN_STRUCT_FREE(asn_DEF_NR_MIB, rrc->du->mib); + ASN_STRUCT_FREE(asn_DEF_NR_SIB1, rrc->du->sib1); + free(rrc->du); + rrc->du = NULL; + LOG_I(RRC, "dropping DU with assoc_id %d (UE connections remain, if any)\n", assoc_id); +} + static void print_rrc_meas(FILE *f, const NR_MeasResults_t *measresults) { DevAssert(measresults->measResultServingMOList.list.count >= 1); @@ -2496,6 +2506,10 @@ static void write_rrc_stats(const gNB_RRC_INST *rrc) { const gNB_RRC_UE_t *ue_ctxt = &ue_context_p->ue_context; f1_ue_data_t ue_data = cu_get_f1_ue_data(ue_ctxt->rrc_ue_id); + /* currently, we support only one DU. If we support multiple, need to + * search for the DU corresponding to this UE here */ + const nr_rrc_du_container_t *du = rrc->du; + DevAssert(du != NULL); fprintf(f, "UE %d CU UE ID %d DU UE ID %d RNTI %04x random identity %016lx", @@ -2518,13 +2532,15 @@ static void write_rrc_stats(const gNB_RRC_INST *rrc) } if (ue_ctxt->UE_Capability_nr) { + AssertFatal(du->setup_req->num_cells_available == 1, "only one cell supported at the moment\n"); + const f1ap_served_cell_info_t *cell_info = &du->setup_req->cell[0].info; fprintf(f, " UE cap: BW DL %x. BW UL %x, DL MIMO Layers %d UL MIMO Layers (CB) %d UL MIMO Layers (nonCB) %d\n", - get_dl_bw_mask(rrc, ue_ctxt->UE_Capability_nr), - get_ul_bw_mask(rrc, ue_ctxt->UE_Capability_nr), - get_dl_mimo_layers(rrc, ue_ctxt->UE_Capability_nr), - get_ul_mimo_layersCB(rrc, ue_ctxt->UE_Capability_nr), - get_ul_mimo_layers(rrc, ue_ctxt->UE_Capability_nr)); + get_dl_bw_mask(cell_info, ue_ctxt->UE_Capability_nr), + get_ul_bw_mask(cell_info, ue_ctxt->UE_Capability_nr), + get_dl_mimo_layers(cell_info, ue_ctxt->UE_Capability_nr), + get_ul_mimo_layersCB(cell_info, ue_ctxt->UE_Capability_nr), + get_ul_mimo_layers(cell_info, ue_ctxt->UE_Capability_nr)); } if (ue_ctxt->measResults) @@ -2618,15 +2634,10 @@ void *rrc_gnb_task(void *args_p) { rrc_gNB_process_NGAP_PDUSESSION_RELEASE_COMMAND(msg_p, instance); break; - /* Messages from gNB app */ - case NRRRC_CONFIGURATION_REQ: - openair_rrc_gNB_configuration(instance, &NRRRC_CONFIGURATION_REQ(msg_p)); - break; - /* Messages from F1AP task */ case F1AP_SETUP_REQ: - AssertFatal(NODE_IS_CU(RC.nrrrc[instance]->node_type), "should not receive F1AP_SETUP_REQUEST, need call by CU!\n"); - rrc_gNB_process_f1_setup_req(&F1AP_SETUP_REQ(msg_p)); + AssertFatal(!NODE_IS_DU(RC.nrrrc[instance]->node_type), "should not receive F1AP_SETUP_REQUEST in DU!\n"); + rrc_gNB_process_f1_setup_req(&F1AP_SETUP_REQ(msg_p), msg_p->ittiMsgHeader.originInstance); break; case F1AP_UE_CONTEXT_SETUP_RESP: @@ -2649,6 +2660,10 @@ void *rrc_gnb_task(void *args_p) { rrc_CU_process_ue_context_release_complete(msg_p); break; + case F1AP_LOST_CONNECTION: + rrc_CU_process_f1_lost_connection(RC.nrrrc[0], &F1AP_LOST_CONNECTION(msg_p), msg_p->ittiMsgHeader.originInstance); + break; + /* Messages from X2AP */ case X2AP_ENDC_SGNB_ADDITION_REQ: LOG_I(NR_RRC, "Received ENDC sgNB addition request from X2AP \n"); @@ -2736,18 +2751,30 @@ rrc_gNB_generate_SecurityModeCommand( gNB_RRC_INST *rrc = RC.nrrrc[ctxt_pP->module_id]; AssertFatal(!NODE_IS_DU(rrc->node_type), "illegal node type DU!\n"); + cu_to_du_rrc_information_t cu2du = {0}; + cu_to_du_rrc_information_t *cu2du_p = NULL; + if (ue_p->ue_cap_buffer.len > 0 && ue_p->ue_cap_buffer.buf != NULL) { + cu2du_p = &cu2du; + cu2du.uE_CapabilityRAT_ContainerList = ue_p->ue_cap_buffer.buf; + cu2du.uE_CapabilityRAT_ContainerList_length = ue_p->ue_cap_buffer.len; + } + + const nr_rrc_du_container_t *du = rrc->du; + DevAssert(du != NULL); + /* the callback will fill the UE context setup request and forward it */ f1_ue_data_t ue_data = cu_get_f1_ue_data(ue_p->rrc_ue_id); f1ap_ue_context_setup_t ue_context_setup_req = { - .gNB_CU_ue_id = ue_p->rrc_ue_id, - .gNB_DU_ue_id = ue_data.secondary_ue, - .mcc = rrc->configuration.mcc[0], - .mnc = rrc->configuration.mnc[0], - .mnc_digit_length = rrc->configuration.mnc_digit_length[0], - .nr_cellid = rrc->nr_cellid, - .servCellId = 0, /* TODO: correct value? */ - .srbs_to_be_setup = 0, /* no new SRBs */ - .drbs_to_be_setup = 0, /* no new DRBs */ + .gNB_CU_ue_id = ue_p->rrc_ue_id, + .gNB_DU_ue_id = ue_data.secondary_ue, + .plmn.mcc = rrc->configuration.mcc[0], + .plmn.mnc = rrc->configuration.mnc[0], + .plmn.mnc_digit_length = rrc->configuration.mnc_digit_length[0], + .nr_cellid = rrc->nr_cellid, + .servCellId = 0, /* TODO: correct value? */ + .srbs_to_be_setup = 0, /* no new SRBs */ + .drbs_to_be_setup = 0, /* no new DRBs */ + .cu_to_du_rrc_information = cu2du_p, }; deliver_ue_ctxt_setup_data_t data = {.rrc = rrc, .setup_req = &ue_context_setup_req}; nr_pdcp_data_req_srb(ctxt_pP->rntiMaybeUEid, DCCH, rrc_gNB_mui++, size, buffer, rrc_deliver_ue_ctxt_setup_req, &data); @@ -2840,7 +2867,9 @@ int rrc_gNB_generate_pcch_msg(uint32_t tmsi, uint8_t paging_drx, instance_t inst uint32_t T; /* DRX cycle */ uint32_t length; uint8_t buffer[RRC_BUF_SIZE]; - struct NR_SIB1 *sib1 = RC.nrrrc[instance]->carrier.siblock1->message.choice.c1->choice.systemInformationBlockType1; + const nr_rrc_du_container_t *du = RC.nrrrc[0]->du; + DevAssert(du != NULL); + struct NR_SIB1 *sib1 = du->sib1; /* get default DRX cycle from configuration */ Tc = sib1->servingCellConfigCommon->downlinkConfigCommon.pcch_Config.defaultPagingCycle; diff --git a/openair2/RRC/NR/rrc_gNB_NGAP.c b/openair2/RRC/NR/rrc_gNB_NGAP.c index 8a9a08abd7..cac6884631 100644 --- a/openair2/RRC/NR/rrc_gNB_NGAP.c +++ b/openair2/RRC/NR/rrc_gNB_NGAP.c @@ -190,8 +190,10 @@ rrc_gNB_send_NGAP_NAS_FIRST_REQ( req->establishment_cause = UE->establishment_cause; /* Forward NAS message */ - req->nas_pdu.buffer = rrcSetupComplete->dedicatedNAS_Message.buf; req->nas_pdu.length = rrcSetupComplete->dedicatedNAS_Message.size; + req->nas_pdu.buffer = malloc(req->nas_pdu.length); + AssertFatal(req->nas_pdu.buffer != NULL, "out of memory\n"); + memcpy(req->nas_pdu.buffer, rrcSetupComplete->dedicatedNAS_Message.buf, req->nas_pdu.length); // extract_imsi(NGAP_NAS_FIRST_REQ (message_p).nas_pdu.buffer, // NGAP_NAS_FIRST_REQ (message_p).nas_pdu.length, // ue_context_pP); @@ -588,7 +590,7 @@ int rrc_gNB_process_NGAP_DOWNLINK_NAS(MessageDef *msg_p, instance_t instance, mu //------------------------------------------------------------------------------ { uint32_t length; - uint8_t *buffer; + uint8_t buffer[4096]; protocol_ctxt_t ctxt = {0}; ngap_downlink_nas_t *req = &NGAP_DOWNLINK_NAS(msg_p); rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[instance], req->gNB_ue_ngap_id); @@ -611,7 +613,12 @@ int rrc_gNB_process_NGAP_DOWNLINK_NAS(MessageDef *msg_p, instance_t instance, mu PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, GNB_FLAG_YES, UE->rrc_ue_id, 0, 0); /* Create message for PDCP (DLInformationTransfer_t) */ - length = do_NR_DLInformationTransfer(instance, &buffer, rrc_gNB_get_next_transaction_identifier(instance), req->nas_pdu.length, req->nas_pdu.buffer); + length = do_NR_DLInformationTransfer(instance, + buffer, + sizeof(buffer), + rrc_gNB_get_next_transaction_identifier(instance), + req->nas_pdu.length, + req->nas_pdu.buffer); LOG_DUMPMSG(NR_RRC, DEBUG_RRC, buffer, length, "[MSG] RRC DL Information Transfer\n"); /* * switch UL or DL NAS message without RRC piggybacked to SRB2 if active. @@ -632,19 +639,19 @@ rrc_gNB_send_NGAP_UPLINK_NAS( ) //------------------------------------------------------------------------------ { - uint32_t pdu_length; - uint8_t *pdu_buffer; MessageDef *msg_p; NR_ULInformationTransfer_t *ulInformationTransfer = ul_dcch_msg->message.choice.c1->choice.ulInformationTransfer; gNB_RRC_UE_t *UE = &ue_context_pP->ue_context; if (ulInformationTransfer->criticalExtensions.present == NR_ULInformationTransfer__criticalExtensions_PR_ulInformationTransfer) { - pdu_length = ulInformationTransfer->criticalExtensions.choice.ulInformationTransfer->dedicatedNAS_Message->size; - pdu_buffer = ulInformationTransfer->criticalExtensions.choice.ulInformationTransfer->dedicatedNAS_Message->buf; + NR_DedicatedNAS_Message_t *nas = ulInformationTransfer->criticalExtensions.choice.ulInformationTransfer->dedicatedNAS_Message; + uint8_t *buf = malloc(nas->size); + AssertFatal(buf != NULL, "out of memory\n"); + memcpy(buf, nas->buf, nas->size); msg_p = itti_alloc_new_message (TASK_RRC_GNB, 0, NGAP_UPLINK_NAS); NGAP_UPLINK_NAS(msg_p).gNB_ue_ngap_id = UE->rrc_ue_id; - NGAP_UPLINK_NAS (msg_p).nas_pdu.length = pdu_length; - NGAP_UPLINK_NAS (msg_p).nas_pdu.buffer = pdu_buffer; + NGAP_UPLINK_NAS (msg_p).nas_pdu.length = nas->size; + NGAP_UPLINK_NAS (msg_p).nas_pdu.buffer = buf; // extract_imsi(NGAP_UPLINK_NAS (msg_p).nas_pdu.buffer, // NGAP_UPLINK_NAS (msg_p).nas_pdu.length, // ue_context_pP); @@ -1333,9 +1340,9 @@ int rrc_gNB_process_PAGING_IND(MessageDef *msg_p, instance_t instance) for (uint8_t CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { if (NODE_IS_CU(RC.nrrrc[instance]->node_type)) { MessageDef *m = itti_alloc_new_message(TASK_RRC_GNB, 0, F1AP_PAGING_IND); - F1AP_PAGING_IND (m).mcc = RC.nrrrc[j]->configuration.mcc[0]; - F1AP_PAGING_IND (m).mnc = RC.nrrrc[j]->configuration.mnc[0]; - F1AP_PAGING_IND (m).mnc_digit_length = RC.nrrrc[j]->configuration.mnc_digit_length[0]; + F1AP_PAGING_IND(m).plmn.mcc = RC.nrrrc[j]->configuration.mcc[0]; + F1AP_PAGING_IND(m).plmn.mnc = RC.nrrrc[j]->configuration.mnc[0]; + F1AP_PAGING_IND(m).plmn.mnc_digit_length = RC.nrrrc[j]->configuration.mnc_digit_length[0]; F1AP_PAGING_IND (m).nr_cellid = RC.nrrrc[j]->nr_cellid; F1AP_PAGING_IND (m).ueidentityindexvalue = (uint16_t)(NGAP_PAGING_IND(msg_p).ue_paging_identity.s_tmsi.m_tmsi%1024); F1AP_PAGING_IND (m).fiveg_s_tmsi = NGAP_PAGING_IND(msg_p).ue_paging_identity.s_tmsi.m_tmsi; diff --git a/openair2/RRC/NR/rrc_gNB_nsa.c b/openair2/RRC/NR/rrc_gNB_nsa.c index 79adaa3737..0b22621c0e 100644 --- a/openair2/RRC/NR/rrc_gNB_nsa.c +++ b/openair2/RRC/NR/rrc_gNB_nsa.c @@ -105,8 +105,9 @@ void rrc_parse_ue_capabilities(gNB_RRC_INST *rrc, NR_UE_CapabilityRAT_ContainerL } LOG_A(NR_RRC, "Successfully decoded UE NR capabilities (NR and MRDC)\n"); + AssertFatal(NODE_IS_MONOLITHIC(rrc->node_type), "phy_test and do_ra only work in monolithic\n"); UE->spCellConfig = calloc(1, sizeof(struct NR_SpCellConfig)); - UE->spCellConfig->spCellConfigDedicated = rrc->configuration.scd; + UE->spCellConfig->spCellConfigDedicated = RC.nrmac[0]->common_channels[0].pre_ServingCellConfig; LOG_I(NR_RRC,"Adding new NSA user (%p)\n",ue_context_p); rrc_add_nsa_user(rrc,ue_context_p, m); } @@ -119,8 +120,7 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc, rrc_gNB_ue_context_t *ue_context_p, x2a { 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; + const nr_mac_config_t *configuration = &RC.nrmac[0]->radio_config; MessageDef *msg; msg = itti_alloc_new_message(TASK_RRC_ENB, 0, X2AP_ENDC_SGNB_ADDITION_REQ_ACK); gtpv1u_enb_create_tunnel_req_t create_tunnel_req; @@ -243,7 +243,11 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc, rrc_gNB_ue_context_t *ue_context_p, x2a } NR_ServingCellConfig_t *scc = UE->spCellConfig ? UE->spCellConfig->spCellConfigDedicated : NULL; - UE->secondaryCellGroup = get_default_secondaryCellGroup(carrier->servingcellconfigcommon, + // The MAC has the ServingCellConfigCommon; the below code is incorrect: the + // CU should send a UE Context Setup Request to request the creating of the + // MAC Context + NR_ServingCellConfigCommon_t *sccc = RC.nrmac[0]->common_channels[0].ServingCellConfigCommon; + UE->secondaryCellGroup = get_default_secondaryCellGroup(sccc, scc, UE->UE_Capability_nr, 1, @@ -253,7 +257,7 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc, rrc_gNB_ue_context_t *ue_context_p, x2a AssertFatal(UE->secondaryCellGroup != NULL, "out of memory\n"); xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, UE->secondaryCellGroup); - fill_default_reconfig(carrier->servingcellconfigcommon, scc, reconfig_ies, UE->secondaryCellGroup, UE->UE_Capability_nr, configuration, ue_context_p->ue_context.rrc_ue_id); + fill_default_reconfig(sccc, scc, reconfig_ies, UE->secondaryCellGroup, UE->UE_Capability_nr, ue_context_p->ue_context.rrc_ue_id); UE->rnti = UE->secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity; NR_CG_Config_t *CG_Config = calloc(1,sizeof(*CG_Config)); memset((void *)CG_Config,0,sizeof(*CG_Config)); diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index c657d35831..d2ef7443c3 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -54,7 +54,6 @@ void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon NR_RRCReconfiguration_IEs_t *reconfig, NR_CellGroupConfig_t *secondaryCellGroup, NR_UE_NR_Capability_t *uecap, - const gNB_RrcConfigurationReq *configuration, int uid) { AssertFatal(servingcellconfigcommon!=NULL,"servingcellconfigcommon is null\n"); AssertFatal(reconfig!=NULL,"reconfig is null\n"); diff --git a/openair2/X2AP/x2ap_common.h b/openair2/X2AP/x2ap_common.h index 9535e9fb69..f42ec6bc4c 100644 --- a/openair2/X2AP/x2ap_common.h +++ b/openair2/X2AP/x2ap_common.h @@ -20,6 +20,8 @@ */ #ifndef X2AP_COMMON_H_ #define X2AP_COMMON_H_ +#include +#include #include "oai_asn1.h" #include "X2AP_ProtocolIE-Field.h" #include "X2AP_X2AP-PDU.h" @@ -72,11 +74,7 @@ extern int asn1_xer_print; /** \brief Function callback prototype. **/ -typedef int (*x2ap_message_decoded_callback)( - instance_t instance, - uint32_t assocId, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu); +typedef int (*x2ap_message_decoded_callback)(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, X2AP_X2AP_PDU_t *pdu); /** \brief Encode a successfull outcome message \param buffer pointer to buffer in which data will be encoded diff --git a/openair2/X2AP/x2ap_eNB_defs.h b/openair2/X2AP/x2ap_eNB_defs.h index 96e76f5603..d22f6efeb7 100644 --- a/openair2/X2AP/x2ap_eNB_defs.h +++ b/openair2/X2AP/x2ap_eNB_defs.h @@ -116,7 +116,7 @@ typedef struct x2ap_eNB_data_s { uint16_t cnx_id; /* SCTP association id */ - int32_t assoc_id; + sctp_assoc_t assoc_id; /* Nid cells */ uint32_t Nid_cell[MAX_NUM_CCs]; diff --git a/openair2/X2AP/x2ap_eNB_generate_messages.c b/openair2/X2AP/x2ap_eNB_generate_messages.c index de797293de..25d257eb1d 100644 --- a/openair2/X2AP/x2ap_eNB_generate_messages.c +++ b/openair2/X2AP/x2ap_eNB_generate_messages.c @@ -489,7 +489,7 @@ int x2ap_eNB_generate_x2_setup_response(x2ap_eNB_instance_t *instance_p, x2ap_eN } int x2ap_eNB_generate_x2_setup_failure(instance_t instance, - uint32_t assoc_id, + sctp_assoc_t assoc_id, X2AP_Cause_PR cause_type, long cause_value, long time_to_wait) diff --git a/openair2/X2AP/x2ap_eNB_generate_messages.h b/openair2/X2AP/x2ap_eNB_generate_messages.h index a920020b81..44ca57597b 100644 --- a/openair2/X2AP/x2ap_eNB_generate_messages.h +++ b/openair2/X2AP/x2ap_eNB_generate_messages.h @@ -38,7 +38,7 @@ int x2ap_eNB_generate_x2_setup_request(x2ap_eNB_instance_t *instance_p, int x2ap_eNB_generate_x2_setup_response(x2ap_eNB_instance_t *instance_p, x2ap_eNB_data_t *x2ap_eNB_data_p); int x2ap_eNB_generate_x2_setup_failure(instance_t instance, - uint32_t assoc_id, + sctp_assoc_t assoc_id, X2AP_Cause_PR cause_type, long cause_value, long time_to_wait); diff --git a/openair2/X2AP/x2ap_eNB_handler.c b/openair2/X2AP/x2ap_eNB_handler.c index 6fa9c4af11..09661149a4 100644 --- a/openair2/X2AP/x2ap_eNB_handler.c +++ b/openair2/X2AP/x2ap_eNB_handler.c @@ -43,127 +43,70 @@ #include "conversions.h" #include "X2AP_FreqBandNrItem.h" -static -int x2ap_eNB_handle_x2_setup_request (instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu); -static -int x2ap_eNB_handle_x2_setup_response (instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu); -static -int x2ap_eNB_handle_x2_reset_request (instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu); -static -int x2ap_eNB_handle_x2_reset_response (instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu); +static int x2ap_eNB_handle_x2_setup_request(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, X2AP_X2AP_PDU_t *pdu); +static int x2ap_eNB_handle_x2_setup_response(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, X2AP_X2AP_PDU_t *pdu); +static int x2ap_eNB_handle_x2_reset_request(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, X2AP_X2AP_PDU_t *pdu); +static int x2ap_eNB_handle_x2_reset_response(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, X2AP_X2AP_PDU_t *pdu); -static -int x2ap_eNB_handle_x2_setup_failure (instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu); +static int x2ap_eNB_handle_x2_setup_failure(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, X2AP_X2AP_PDU_t *pdu); -static -int x2ap_eNB_handle_handover_preparation (instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu); -static -int x2ap_eNB_handle_handover_response (instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu); +static int x2ap_eNB_handle_handover_preparation(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, X2AP_X2AP_PDU_t *pdu); +static int x2ap_eNB_handle_handover_response(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, X2AP_X2AP_PDU_t *pdu); -static -int x2ap_eNB_handle_ue_context_release (instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu); +static int x2ap_eNB_handle_ue_context_release(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, X2AP_X2AP_PDU_t *pdu); -static -int x2ap_eNB_handle_handover_cancel (instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu); +static int x2ap_eNB_handle_handover_cancel(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, X2AP_X2AP_PDU_t *pdu); -static -int x2ap_eNB_handle_senb_addition_request (instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu); +static int x2ap_eNB_handle_senb_addition_request(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, X2AP_X2AP_PDU_t *pdu); +static int x2ap_eNB_handle_senb_addition_request_ack(instance_t instance, + sctp_assoc_t assoc_id, + uint32_t stream, + X2AP_X2AP_PDU_t *pdu); -static -int x2ap_eNB_handle_senb_addition_request_ack (instance_t instance, - uint32_t assoc_id, +static int x2ap_eNB_handle_senb_addition_request_reject(instance_t instance, + sctp_assoc_t assoc_id, + uint32_t stream, + X2AP_X2AP_PDU_t *pdu); + +int x2ap_eNB_handle_ENDC_x2_setup_request(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, X2AP_X2AP_PDU_t *pdu); + +int x2ap_gNB_handle_ENDC_x2_setup_response(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, X2AP_X2AP_PDU_t *pdu); + +static int x2ap_gNB_handle_ENDC_sGNB_addition_request(instance_t instance, + sctp_assoc_t assoc_id, + uint32_t stream, + X2AP_X2AP_PDU_t *pdu); + +static int x2ap_eNB_handle_ENDC_sGNB_addition_response(instance_t instance, + sctp_assoc_t assoc_id, uint32_t stream, X2AP_X2AP_PDU_t *pdu); -static -int x2ap_eNB_handle_senb_addition_request_reject (instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu); +static int x2ap_gNB_handle_ENDC_sGNB_reconfiguration_complete(instance_t instance, + sctp_assoc_t assoc_id, + uint32_t stream, + X2AP_X2AP_PDU_t *pdu); -int x2ap_eNB_handle_ENDC_x2_setup_request(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu); +static int x2ap_gNB_handle_ENDC_sGNB_release_request(instance_t instance, + sctp_assoc_t assoc_id, + uint32_t stream, + X2AP_X2AP_PDU_t *pdu); -int -x2ap_gNB_handle_ENDC_x2_setup_response(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu); +static int x2ap_gNB_handle_ENDC_sGNB_release_request_acknowledge(instance_t instance, + sctp_assoc_t assoc_id, + uint32_t stream, + X2AP_X2AP_PDU_t *pdu); -static -int x2ap_gNB_handle_ENDC_sGNB_addition_request (instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu); +static int x2ap_gNB_handle_ENDC_sGNB_release_required(instance_t instance, + sctp_assoc_t assoc_id, + uint32_t stream, + X2AP_X2AP_PDU_t *pdu); -static -int x2ap_eNB_handle_ENDC_sGNB_addition_response (instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu); - -static -int x2ap_gNB_handle_ENDC_sGNB_reconfiguration_complete (instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu); - -static -int x2ap_gNB_handle_ENDC_sGNB_release_request(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu); - -static -int x2ap_gNB_handle_ENDC_sGNB_release_request_acknowledge(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu); - -static -int x2ap_gNB_handle_ENDC_sGNB_release_required(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu); - -static -int x2ap_gNB_handle_ENDC_sGNB_release_confirm(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu); +static int x2ap_gNB_handle_ENDC_sGNB_release_confirm(instance_t instance, + sctp_assoc_t assoc_id, + uint32_t stream, + X2AP_X2AP_PDU_t *pdu); /* Handlers matrix. Only eNB related procedure present here. Placement of callback functions according to X2AP_ProcedureCode.h */ static const x2ap_message_decoded_callback x2ap_messages_callback[][3] = { @@ -272,9 +215,11 @@ void x2ap_handle_x2_setup_message(x2ap_eNB_instance_t *instance_p, x2ap_eNB_data } } - -int x2ap_eNB_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, - const uint8_t *const data, const uint32_t data_length) +int x2ap_eNB_handle_message(instance_t instance, + sctp_assoc_t assoc_id, + int32_t stream, + const uint8_t *const data, + const uint32_t data_length) { X2AP_X2AP_PDU_t pdu; int ret = 0; @@ -380,11 +325,7 @@ int x2ap_eNB_handle_message(instance_t instance, uint32_t assoc_id, int32_t stre return ret; } -int -x2ap_eNB_handle_x2_setup_request(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu) +int x2ap_eNB_handle_x2_setup_request(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, X2AP_X2AP_PDU_t *pdu) { X2AP_X2SetupRequest_t *x2SetupRequest; @@ -516,22 +457,13 @@ x2ap_eNB_handle_x2_setup_request(instance_t instance, return x2ap_eNB_generate_x2_setup_response(instance_p, x2ap_eNB_data); } -int -x2ap_eNB_handle_x2_reset_response(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu) +int x2ap_eNB_handle_x2_reset_response(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, X2AP_X2AP_PDU_t *pdu) { return (0); } - -int -x2ap_eNB_handle_x2_reset_request(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu) +int x2ap_eNB_handle_x2_reset_request(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, X2AP_X2AP_PDU_t *pdu) { const char *const X2AP_ResetRequest_str[2] = {"X2AP_ResetRequest_IEs__value_PR_Cause", "X2AP_ResetRequest_IEs__value_PR_InterfaceInstanceIndication"}; @@ -608,12 +540,7 @@ x2ap_eNB_handle_x2_reset_request(instance_t instance, return x2ap_eNB_generate_x2_setup_response(instance_p, x2ap_eNB_data); } - -static -int x2ap_eNB_handle_x2_setup_response(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu) +static int x2ap_eNB_handle_x2_setup_response(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, X2AP_X2AP_PDU_t *pdu) { X2AP_X2SetupResponse_t *x2SetupResponse; @@ -744,11 +671,7 @@ int x2ap_eNB_handle_x2_setup_response(instance_t instance, return 0; } -static -int x2ap_eNB_handle_x2_setup_failure(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu) +static int x2ap_eNB_handle_x2_setup_failure(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, X2AP_X2AP_PDU_t *pdu) { X2AP_X2SetupFailure_t *x2SetupFailure; @@ -814,11 +737,7 @@ int x2ap_eNB_handle_x2_setup_failure(instance_t instance, return 0; } -static -int x2ap_eNB_handle_handover_preparation (instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu) +static int x2ap_eNB_handle_handover_preparation(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, X2AP_X2AP_PDU_t *pdu) { X2AP_HandoverRequest_t *x2HandoverRequest; @@ -960,11 +879,7 @@ int x2ap_eNB_handle_handover_preparation (instance_t instance, return 0; } -static -int x2ap_eNB_handle_handover_response (instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu) +static int x2ap_eNB_handle_handover_response(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, X2AP_X2AP_PDU_t *pdu) { X2AP_HandoverRequestAcknowledge_t *x2HandoverRequestAck; X2AP_HandoverRequestAcknowledge_IEs_t *ie; @@ -1111,12 +1026,7 @@ int x2ap_eNB_handle_handover_response (instance_t instance, return 0; } - -static -int x2ap_eNB_handle_ue_context_release (instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu) +static int x2ap_eNB_handle_ue_context_release(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, X2AP_X2AP_PDU_t *pdu) { X2AP_UEContextRelease_t *x2UEContextRelease; X2AP_UEContextRelease_IEs_t *ie; @@ -1196,11 +1106,7 @@ int x2ap_eNB_handle_ue_context_release (instance_t instance, return 0; } -static -int x2ap_eNB_handle_handover_cancel (instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu) +static int x2ap_eNB_handle_handover_cancel(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, X2AP_X2AP_PDU_t *pdu) { X2AP_HandoverCancel_t *x2HandoverCancel; X2AP_HandoverCancel_IEs_t *ie; @@ -1304,12 +1210,7 @@ int x2ap_eNB_handle_handover_cancel (instance_t instance, return 0; } - -static -int x2ap_eNB_handle_senb_addition_request (instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu) +static int x2ap_eNB_handle_senb_addition_request(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, X2AP_X2AP_PDU_t *pdu) { X2AP_SeNBAdditionRequest_t *x2SeNBAdditionRequest; @@ -1487,32 +1388,25 @@ int x2ap_eNB_handle_senb_addition_request (instance_t instance, return 0; } -static -int x2ap_eNB_handle_senb_addition_request_ack (instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu) +static int x2ap_eNB_handle_senb_addition_request_ack(instance_t instance, + sctp_assoc_t assoc_id, + uint32_t stream, + X2AP_X2AP_PDU_t *pdu) { printf("%s:%d:%s:TODO\n", __FILE__, __LINE__, __FUNCTION__); return 0; } - -static -int x2ap_eNB_handle_senb_addition_request_reject (instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu) +static int x2ap_eNB_handle_senb_addition_request_reject(instance_t instance, + sctp_assoc_t assoc_id, + uint32_t stream, + X2AP_X2AP_PDU_t *pdu) { printf("%s:%d:%s:TODO\n", __FILE__, __LINE__, __FUNCTION__); return 0; } -int -x2ap_eNB_handle_ENDC_x2_setup_request(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu) +int x2ap_eNB_handle_ENDC_x2_setup_request(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, X2AP_X2AP_PDU_t *pdu) { X2AP_ENDCX2SetupRequest_t *x2_ENDC_SetupRequest; @@ -1659,11 +1553,7 @@ x2ap_eNB_handle_ENDC_x2_setup_request(instance_t instance, return x2ap_eNB_generate_ENDC_x2_setup_response(instance_p, x2ap_eNB_data); } -int -x2ap_gNB_handle_ENDC_x2_setup_response(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu) +int x2ap_gNB_handle_ENDC_x2_setup_response(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, X2AP_X2AP_PDU_t *pdu) { X2AP_ENDCX2SetupResponse_t *x2_ENDC_SetupResponse; @@ -1809,11 +1699,10 @@ x2ap_gNB_handle_ENDC_x2_setup_response(instance_t instance, return 0; } -static -int x2ap_gNB_handle_ENDC_sGNB_addition_request (instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu) +static int x2ap_gNB_handle_ENDC_sGNB_addition_request(instance_t instance, + sctp_assoc_t assoc_id, + uint32_t stream, + X2AP_X2AP_PDU_t *pdu) { X2AP_SgNBAdditionRequest_t *x2SgNBAdditionRequest; X2AP_SgNBAdditionRequest_IEs_t *ie; @@ -1951,12 +1840,10 @@ LOG_I(RRC,"x2u tunnel: index %d target sgw ip %d.%d.%d.%d length %d gtp teid %u\ return 0; } - -static -int x2ap_eNB_handle_ENDC_sGNB_addition_response (instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu) +static int x2ap_eNB_handle_ENDC_sGNB_addition_response(instance_t instance, + sctp_assoc_t assoc_id, + uint32_t stream, + X2AP_X2AP_PDU_t *pdu) { X2AP_SgNBAdditionRequestAcknowledge_t *x2SgNBAdditionRequest_ack; @@ -2103,11 +1990,10 @@ int x2ap_eNB_handle_ENDC_sGNB_addition_response (instance_t instance, return 0; } -static -int x2ap_gNB_handle_ENDC_sGNB_reconfiguration_complete (instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu) +static int x2ap_gNB_handle_ENDC_sGNB_reconfiguration_complete(instance_t instance, + sctp_assoc_t assoc_id, + uint32_t stream, + X2AP_X2AP_PDU_t *pdu) { X2AP_SgNBReconfigurationComplete_t *x2SgNBReconfigurationComplete; X2AP_SgNBReconfigurationComplete_IEs_t *ie; @@ -2190,11 +2076,10 @@ int x2ap_gNB_handle_ENDC_sGNB_reconfiguration_complete (instance_t instance, return 0; } -static -int x2ap_gNB_handle_ENDC_sGNB_release_request(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu) +static int x2ap_gNB_handle_ENDC_sGNB_release_request(instance_t instance, + sctp_assoc_t assoc_id, + uint32_t stream, + X2AP_X2AP_PDU_t *pdu) { /* the logic in this function is the following: when receiving a release * request, the UE may exist in X2. Or not. If it's not in X2, it can @@ -2294,22 +2179,20 @@ int x2ap_gNB_handle_ENDC_sGNB_release_request(instance_t instance, return 0; } -static -int x2ap_gNB_handle_ENDC_sGNB_release_request_acknowledge(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu) +static int x2ap_gNB_handle_ENDC_sGNB_release_request_acknowledge(instance_t instance, + sctp_assoc_t assoc_id, + uint32_t stream, + X2AP_X2AP_PDU_t *pdu) { /* nothing to do - may change at some point */ X2AP_INFO("received release request acknowledge\n"); return 0; } -static -int x2ap_gNB_handle_ENDC_sGNB_release_required(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu) +static int x2ap_gNB_handle_ENDC_sGNB_release_required(instance_t instance, + sctp_assoc_t assoc_id, + uint32_t stream, + X2AP_X2AP_PDU_t *pdu) { /* the logic in this function is the following: when receiving a release * required we don't care about the UE in X2. We simply send a message @@ -2383,11 +2266,10 @@ int x2ap_gNB_handle_ENDC_sGNB_release_required(instance_t instance, return 0; } -static -int x2ap_gNB_handle_ENDC_sGNB_release_confirm(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu) +static int x2ap_gNB_handle_ENDC_sGNB_release_confirm(instance_t instance, + sctp_assoc_t assoc_id, + uint32_t stream, + X2AP_X2AP_PDU_t *pdu) { /* nothing to do - may change at some point */ X2AP_INFO("received release confirm\n"); diff --git a/openair2/X2AP/x2ap_eNB_handler.h b/openair2/X2AP/x2ap_eNB_handler.h index 65f411895f..b0a4d33d58 100644 --- a/openair2/X2AP/x2ap_eNB_handler.h +++ b/openair2/X2AP/x2ap_eNB_handler.h @@ -33,7 +33,10 @@ void x2ap_handle_x2_setup_message(x2ap_eNB_instance_t *instance_p, x2ap_eNB_data_t *eNB_desc_p, int sctp_shutdown); -int x2ap_eNB_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, - const uint8_t * const data, const uint32_t data_length); +int x2ap_eNB_handle_message(instance_t instance, + sctp_assoc_t assoc_id, + int32_t stream, + const uint8_t *const data, + const uint32_t data_length); #endif /* X2AP_ENB_HANDLERS_H_ */ diff --git a/openair2/X2AP/x2ap_eNB_itti_messaging.c b/openair2/X2AP/x2ap_eNB_itti_messaging.c index 66be3520e2..f80e2da34b 100644 --- a/openair2/X2AP/x2ap_eNB_itti_messaging.c +++ b/openair2/X2AP/x2ap_eNB_itti_messaging.c @@ -30,8 +30,11 @@ #include "x2ap_eNB_itti_messaging.h" -void x2ap_eNB_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer, - uint32_t buffer_length, uint16_t stream) +void x2ap_eNB_itti_send_sctp_data_req(instance_t instance, + sctp_assoc_t assoc_id, + uint8_t *buffer, + uint32_t buffer_length, + uint16_t stream) { MessageDef *message_p; sctp_data_req_t *sctp_data_req; @@ -49,7 +52,7 @@ void x2ap_eNB_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uin } -void x2ap_eNB_itti_send_sctp_close_association(instance_t instance, int32_t assoc_id) +void x2ap_eNB_itti_send_sctp_close_association(instance_t instance, sctp_assoc_t assoc_id) { MessageDef *message_p = NULL; sctp_close_association_t *sctp_close_association_p = NULL; diff --git a/openair2/X2AP/x2ap_eNB_itti_messaging.h b/openair2/X2AP/x2ap_eNB_itti_messaging.h index ee946880ac..7358f3bdb1 100644 --- a/openair2/X2AP/x2ap_eNB_itti_messaging.h +++ b/openair2/X2AP/x2ap_eNB_itti_messaging.h @@ -29,11 +29,13 @@ #ifndef X2AP_ENB_ITTI_MESSAGING_H_ #define X2AP_ENB_ITTI_MESSAGING_H_ -void x2ap_eNB_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer, - uint32_t buffer_length, uint16_t stream); +void x2ap_eNB_itti_send_sctp_data_req(instance_t instance, + sctp_assoc_t assoc_id, + uint8_t *buffer, + uint32_t buffer_length, + uint16_t stream); - -void x2ap_eNB_itti_send_sctp_close_association(instance_t instance, int32_t assoc_id); +void x2ap_eNB_itti_send_sctp_close_association(instance_t instance, sctp_assoc_t assoc_id); #endif /* X2AP_ENB_ITTI_MESSAGING_H_ */ diff --git a/openair2/X2AP/x2ap_eNB_management_procedures.c b/openair2/X2AP/x2ap_eNB_management_procedures.c index a0cc0d1124..465949a58e 100644 --- a/openair2/X2AP/x2ap_eNB_management_procedures.c +++ b/openair2/X2AP/x2ap_eNB_management_procedures.c @@ -122,9 +122,7 @@ printf("---------------------------------------------\n"); } } -struct x2ap_eNB_data_s *x2ap_get_eNB(x2ap_eNB_instance_t *instance_p, - int32_t assoc_id, - uint16_t cnx_id) +struct x2ap_eNB_data_s *x2ap_get_eNB(x2ap_eNB_instance_t *instance_p, sctp_assoc_t assoc_id, uint16_t cnx_id) { struct x2ap_eNB_data_s temp; struct x2ap_eNB_data_s *found; diff --git a/openair2/X2AP/x2ap_eNB_management_procedures.h b/openair2/X2AP/x2ap_eNB_management_procedures.h index 7082f5ac95..5b5ed993a2 100644 --- a/openair2/X2AP/x2ap_eNB_management_procedures.h +++ b/openair2/X2AP/x2ap_eNB_management_procedures.h @@ -47,8 +47,6 @@ x2ap_eNB_data_t* x2ap_is_eNB_assoc_id_in_list(uint32_t sctp_assoc_id); x2ap_eNB_data_t* x2ap_is_eNB_pci_in_list (const uint32_t pci); -struct x2ap_eNB_data_s *x2ap_get_eNB(x2ap_eNB_instance_t *instance_p, - int32_t assoc_id, - uint16_t cnx_id); +struct x2ap_eNB_data_s *x2ap_get_eNB(x2ap_eNB_instance_t *instance_p, sctp_assoc_t assoc_id, uint16_t cnx_id); #endif /* __X2AP_ENB_MANAGEMENT_PROCEDURES__H__ */ diff --git a/openair3/M3AP/m3ap_MCE_defs.h b/openair3/M3AP/m3ap_MCE_defs.h index c90ba38a66..06386301c4 100644 --- a/openair3/M3AP/m3ap_MCE_defs.h +++ b/openair3/M3AP/m3ap_MCE_defs.h @@ -115,7 +115,7 @@ typedef struct m3ap_MCE_data_s { uint16_t cnx_id; /* SCTP association id */ - int32_t assoc_id; + sctp_assoc_t assoc_id; /* Nid cells */ uint32_t Nid_cell[MAX_NUM_CCs]; diff --git a/openair3/M3AP/m3ap_MCE_generate_messsages.c b/openair3/M3AP/m3ap_MCE_generate_messsages.c index 0bedc0e4a2..490ba2fd4f 100644 --- a/openair3/M3AP/m3ap_MCE_generate_messsages.c +++ b/openair3/M3AP/m3ap_MCE_generate_messsages.c @@ -312,7 +312,7 @@ int m2ap_eNB_generate_m2_setup_request( //} //int m2ap_MCE_generate_m2_setup_failure(instance_t instance, -// uint32_t assoc_id, +// sctp_assoc_t assoc_id, // M2AP_Cause_PR cause_type, // long cause_value, // long time_to_wait) diff --git a/openair3/M3AP/m3ap_MCE_handler.c b/openair3/M3AP/m3ap_MCE_handler.c index dc40829aec..e791b2a47c 100644 --- a/openair3/M3AP/m3ap_MCE_handler.c +++ b/openair3/M3AP/m3ap_MCE_handler.c @@ -69,9 +69,11 @@ static char *m3ap_direction_String[] = { return(m3ap_direction_String[m3ap_dir]); } - -int m3ap_MCE_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, - const uint8_t * const data, const uint32_t data_length) +int m3ap_MCE_handle_message(instance_t instance, + sctp_assoc_t assoc_id, + int32_t stream, + const uint8_t *const data, + const uint32_t data_length) { M3AP_M3AP_PDU_t pdu; int ret; diff --git a/openair3/M3AP/m3ap_MCE_handler.h b/openair3/M3AP/m3ap_MCE_handler.h index 09eca351b6..b09195c180 100644 --- a/openair3/M3AP/m3ap_MCE_handler.h +++ b/openair3/M3AP/m3ap_MCE_handler.h @@ -33,11 +33,13 @@ //void m3ap_handle_m2_setup_message(m2ap_eNB_instance_t *instance_p, m2ap_eNB_data_t *eNB_desc_p, int sctp_shutdown); -//int m3ap_eNB_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, +//int m3ap_eNB_handle_message(instance_t instance, sctp_assoc_t assoc_id, int32_t stream, //const uint8_t * const data, const uint32_t data_length); -int m3ap_MCE_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, - const uint8_t * const data, const uint32_t data_length); - +int m3ap_MCE_handle_message(instance_t instance, + sctp_assoc_t assoc_id, + int32_t stream, + const uint8_t *const data, + const uint32_t data_length); #endif /* __M3AP_MCE_HANDLER__H__ */ diff --git a/openair3/M3AP/m3ap_MCE_interface_management.c b/openair3/M3AP/m3ap_MCE_interface_management.c index 82fc044d3e..5d58e49bb7 100644 --- a/openair3/M3AP/m3ap_MCE_interface_management.c +++ b/openair3/M3AP/m3ap_MCE_interface_management.c @@ -57,11 +57,8 @@ extern m3ap_setup_req_t * m3ap_mce_data_g; - -int MCE_handle_MBMS_SESSION_START_REQUEST(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu){ +int MCE_handle_MBMS_SESSION_START_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu) +{ // LOG_W(M3AP, "MCE_handle_MBMS_SESSION_START_REQUEST assoc_id %d\n",assoc_id); // MessageDef *message_p; @@ -212,11 +209,8 @@ int MCE_send_MBMS_SESSION_START_FAILURE(instance_t instance, m3ap_session_start_ return 0; } -int MCE_handle_MBMS_SESSION_STOP_REQUEST(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu){ - +int MCE_handle_MBMS_SESSION_STOP_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu) +{ //AssertFatal(1==0,"Not implemented yet\n"); LOG_D(M3AP, "MCE_handle_MBMS_SESSION_STOP_REQUEST assoc_id %d\n",assoc_id); @@ -317,10 +311,7 @@ int MCE_send_MBMS_SESSION_STOP_RESPONSE(instance_t instance, m3ap_session_start_ /* * Session Update */ -int MCE_handle_MBMS_SESSION_UPDATE_REQUEST(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu) +int MCE_handle_MBMS_SESSION_UPDATE_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu) { //AssertFatal(1==0,"Not implemented yet\n"); LOG_D(M3AP, "MCE_handle_MBMS_SESSION_UPDATE_REQUEST assoc_id %d\n",assoc_id); @@ -653,10 +644,7 @@ int MCE_send_M3_SETUP_REQUEST(m3ap_MCE_instance_t *instance_p, m3ap_MCE_data_t * -int MCE_handle_M3_SETUP_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu) +int MCE_handle_M3_SETUP_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu) { LOG_D(M3AP, "MCE_handle_M3_SETUP_RESPONSE\n"); @@ -700,15 +688,8 @@ int MCE_handle_M3_SETUP_RESPONSE(instance_t instance, } // SETUP FAILURE -int MCE_handle_M3_SETUP_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu) { - LOG_E(M3AP, "MCE_handle_M3_SETUP_FAILURE\n"); - return 0; +int MCE_handle_M3_SETUP_FAILURE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu) +{ + LOG_E(M3AP, "MCE_handle_M3_SETUP_FAILURE\n"); + return 0; } - - - - - diff --git a/openair3/M3AP/m3ap_MCE_interface_management.h b/openair3/M3AP/m3ap_MCE_interface_management.h index 76e13bb8d8..974332f497 100644 --- a/openair3/M3AP/m3ap_MCE_interface_management.h +++ b/openair3/M3AP/m3ap_MCE_interface_management.h @@ -37,10 +37,7 @@ * Session Start */ -int MCE_handle_MBMS_SESSION_START_REQUEST(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu); +int MCE_handle_MBMS_SESSION_START_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu); int MCE_send_MBMS_SESSION_START_RESPONSE(instance_t instance, m3ap_session_start_resp_t * m3ap_session_start_resp); int MCE_send_MBMS_SESSION_START_FAILURE(instance_t instance, m3ap_session_start_failure_t * m3ap_session_start_failure); @@ -48,18 +45,12 @@ int MCE_send_MBMS_SESSION_START_FAILURE(instance_t instance, m3ap_session_start_ * Session Stop */ -int MCE_handle_MBMS_SESSION_STOP_REQUEST(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu); +int MCE_handle_MBMS_SESSION_STOP_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu); /* * Session Update */ -int MCE_handle_MBMS_SESSION_UPDATE_REQUEST(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu); +int MCE_handle_MBMS_SESSION_UPDATE_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu); int MCE_send_MBMS_SESSION_UPDATE_RESPONSE(instance_t instance, m3ap_mbms_session_update_resp_t * m3ap_mbms_session_update_resp); int MCE_send_MBMS_SESSION_UPDATE_FAILURE(instance_t instance, m3ap_mbms_session_update_failure_t * m3ap_mbms_session_update_failure); @@ -75,43 +66,25 @@ int MCE_send_MBMS_SESSION_STOP_RESPONSE(instance_t instance, m3ap_session_start_ /* * Reset */ -int MCE_handle_RESET(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu); +int MCE_handle_RESET(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu); int MCE_send_RESET_ACKKNOWLEDGE(instance_t instance, M3AP_ResetAcknowledge_t *ResetAcknowledge); int MCE_send_RESET(instance_t instance, M3AP_Reset_t *Reset); -int MCE_handle_RESET_ACKNOWLEDGE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu); +int MCE_handle_RESET_ACKNOWLEDGE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu); /* * M3AP Setup */ int MCE_send_M3_SETUP_REQUEST( m3ap_MCE_instance_t *instance_p, m3ap_MCE_data_t *m3ap_MCE_data_p); -int MCE_handle_M3_SETUP_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu); +int MCE_handle_M3_SETUP_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu); -int MCE_handle_M3_SETUP_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu); +int MCE_handle_M3_SETUP_FAILURE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu); /* * Error Indication */ int MCE_send_ERROR_INDICATION(instance_t instance, M3AP_M3AP_PDU_t *pdu_p); -int MCE_handle_ERROR_INDICATION(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu); - - - +int MCE_handle_ERROR_INDICATION(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu); #endif /* M3AP_MCE_INTERFACE_MANAGEMENT_H_ */ diff --git a/openair3/M3AP/m3ap_MCE_management_procedures.c b/openair3/M3AP/m3ap_MCE_management_procedures.c index 065d4b9616..c58cc7c5f1 100644 --- a/openair3/M3AP/m3ap_MCE_management_procedures.c +++ b/openair3/M3AP/m3ap_MCE_management_procedures.c @@ -122,9 +122,7 @@ printf("---------------------------------------------\n"); } } -struct m3ap_MCE_data_s *m3ap_get_MCE(m3ap_MCE_instance_t *instance_p, - int32_t assoc_id, - uint16_t cnx_id) +struct m3ap_MCE_data_s *m3ap_get_MCE(m3ap_MCE_instance_t *instance_p, sctp_assoc_t assoc_id, uint16_t cnx_id) { struct m3ap_MCE_data_s temp; struct m3ap_MCE_data_s *found; diff --git a/openair3/M3AP/m3ap_MCE_management_procedures.h b/openair3/M3AP/m3ap_MCE_management_procedures.h index 27e8c928a0..2a5ada2fbe 100644 --- a/openair3/M3AP/m3ap_MCE_management_procedures.h +++ b/openair3/M3AP/m3ap_MCE_management_procedures.h @@ -46,8 +46,6 @@ m3ap_MCE_data_t* m3ap_is_MCE_assoc_id_in_list(uint32_t sctp_assoc_id); m3ap_MCE_data_t* m3ap_is_MCE_pci_in_list (const uint32_t pci); -struct m3ap_MCE_data_s *m3ap_get_MCE(m3ap_MCE_instance_t *instance_p, - int32_t assoc_id, - uint16_t cnx_id); +struct m3ap_MCE_data_s *m3ap_get_MCE(m3ap_MCE_instance_t *instance_p, sctp_assoc_t assoc_id, uint16_t cnx_id); #endif /* __M3AP_MCE_MANAGEMENT_PROCEDURES__H__ */ diff --git a/openair3/M3AP/m3ap_MME_defs.h b/openair3/M3AP/m3ap_MME_defs.h index 7d3186915f..54603c6997 100644 --- a/openair3/M3AP/m3ap_MME_defs.h +++ b/openair3/M3AP/m3ap_MME_defs.h @@ -115,7 +115,7 @@ typedef struct m3ap_MME_data_s { uint16_t cnx_id; /* SCTP association id */ - int32_t assoc_id; + sctp_assoc_t assoc_id; /* Nid cells */ uint32_t Nid_cell[MAX_NUM_CCs]; diff --git a/openair3/M3AP/m3ap_MME_generate_messages.c b/openair3/M3AP/m3ap_MME_generate_messages.c index 3a4c1bb473..d513fcd3db 100644 --- a/openair3/M3AP/m3ap_MME_generate_messages.c +++ b/openair3/M3AP/m3ap_MME_generate_messages.c @@ -314,7 +314,7 @@ int m2ap_MCE_generate_m2_setup_response(m2ap_MCE_instance_t *instance_p, m2ap_MC } int m2ap_MCE_generate_m2_setup_failure(instance_t instance, - uint32_t assoc_id, + sctp_assoc_t assoc_id, M2AP_Cause_PR cause_type, long cause_value, long time_to_wait) diff --git a/openair3/M3AP/m3ap_MME_generate_messages.h b/openair3/M3AP/m3ap_MME_generate_messages.h index 146f58825a..a1dbe837c3 100644 --- a/openair3/M3AP/m3ap_MME_generate_messages.h +++ b/openair3/M3AP/m3ap_MME_generate_messages.h @@ -38,7 +38,7 @@ int m2ap_MCE_generate_m2_setup_request(m2ap_MCE_instance_t *instance_p, int m2ap_MCE_generate_m2_setup_response(m2ap_MCE_instance_t *instance_p, m2ap_MCE_data_t *m2ap_MCE_data_p); int m2ap_MCE_generate_m2_setup_failure(instance_t instance, - uint32_t assoc_id, + sctp_assoc_t assoc_id, M2AP_Cause_PR cause_type, long cause_value, long time_to_wait); diff --git a/openair3/M3AP/m3ap_MME_handler.c b/openair3/M3AP/m3ap_MME_handler.c index 6c8184336e..a459d1000c 100644 --- a/openair3/M3AP/m3ap_MME_handler.c +++ b/openair3/M3AP/m3ap_MME_handler.c @@ -68,9 +68,11 @@ static char *m3ap_direction_String[] = { return(m3ap_direction_String[m3ap_dir]); } - -int m3ap_MME_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, - const uint8_t * const data, const uint32_t data_length) +int m3ap_MME_handle_message(instance_t instance, + sctp_assoc_t assoc_id, + int32_t stream, + const uint8_t *const data, + const uint32_t data_length) { M3AP_M3AP_PDU_t pdu; int ret; diff --git a/openair3/M3AP/m3ap_MME_handler.h b/openair3/M3AP/m3ap_MME_handler.h index feabfe256c..ce8939ada7 100644 --- a/openair3/M3AP/m3ap_MME_handler.h +++ b/openair3/M3AP/m3ap_MME_handler.h @@ -33,11 +33,13 @@ //void m3ap_handle_m2_setup_message(m2ap_eNB_instance_t *instance_p, m2ap_eNB_data_t *eNB_desc_p, int sctp_shutdown); -//int m3ap_eNB_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, +//int m3ap_eNB_handle_message(instance_t instance, sctp_assoc_t assoc_id, int32_t stream, //const uint8_t * const data, const uint32_t data_length); -int m3ap_MME_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, - const uint8_t * const data, const uint32_t data_length); - +int m3ap_MME_handle_message(instance_t instance, + sctp_assoc_t assoc_id, + int32_t stream, + const uint8_t *const data, + const uint32_t data_length); #endif /* M3AP_MME_HANDLERS_H_ */ diff --git a/openair3/M3AP/m3ap_MME_interface_management.c b/openair3/M3AP/m3ap_MME_interface_management.c index 38e58c9b98..823cccc6a1 100644 --- a/openair3/M3AP/m3ap_MME_interface_management.c +++ b/openair3/M3AP/m3ap_MME_interface_management.c @@ -61,8 +61,9 @@ uint8_t m3ap_start_message[] = { /* * MBMS Session start */ -int MME_send_MBMS_SESSION_START_REQUEST(instance_t instance/*, uint32_t assoc_id*/,m3ap_session_start_req_t* m3ap_session_start_req){ - +int MME_send_MBMS_SESSION_START_REQUEST(instance_t instance /*, sctp_assoc_t assoc_id*/, + m3ap_session_start_req_t *m3ap_session_start_req) +{ //AssertFatal(1==0,"Not implemented yet\n"); //module_id_t enb_mod_idP=0; @@ -239,13 +240,10 @@ int MME_send_MBMS_SESSION_START_REQUEST(instance_t instance/*, uint32_t assoc_id m3ap_MME_itti_send_sctp_data_req(instance, m3ap_mme_data_from_mce->assoc_id, buffer, len, 0); return 0; - } -int MME_handle_MBMS_SESSION_START_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu){ +int MME_handle_MBMS_SESSION_START_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu) +{ // AssertFatal(1==0,"Not implemented yet\n"); LOG_D(M3AP, "MME_handle_MBMS_SESSION_START_RESPONSE\n"); @@ -300,12 +298,9 @@ int MME_handle_MBMS_SESSION_START_RESPONSE(instance_t instance, // assoc_id,ENB_MODULE_ID_TO_INSTANCE(assoc_id)); itti_send_msg_to_task(TASK_MME_APP, ENB_MODULE_ID_TO_INSTANCE(assoc_id), msg_g); return 0; - } -int MME_handle_MBMS_SESSION_START_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu){ +int MME_handle_MBMS_SESSION_START_FAILURE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); } @@ -370,10 +365,8 @@ int MME_send_MBMS_SESSION_STOP_REQUEST(instance_t instance, m3ap_session_stop_re } -int MME_handle_MBMS_SESSION_STOP_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu){ +int MME_handle_MBMS_SESSION_STOP_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu) +{ //AssertFatal(1==0,"Not implemented yet\n"); LOG_D(M3AP, "eNB_handle_MBMS_SESSION_STOP_RESPONSE\n"); @@ -432,12 +425,8 @@ int MME_handle_MBMS_SESSION_STOP_RESPONSE(instance_t instance, return 0; } - - -int MME_handle_MBMS_SESSION_STOP_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu){ +int MME_handle_MBMS_SESSION_STOP_FAILURE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); } @@ -456,19 +445,14 @@ int MME_send_RESET(instance_t instance, m3ap_reset_t * m3ap_reset) { } - -int MME_handle_RESET_ACKKNOWLEDGE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu) { +int MME_handle_RESET_ACKKNOWLEDGE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); } -int MME_handle_RESET(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu) { +int MME_handle_RESET(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); } @@ -479,10 +463,7 @@ int MME_send_RESET_ACKNOWLEDGE(instance_t instance, M3AP_ResetAcknowledge_t *Res /* * M3 Setup */ -int MME_handle_M3_SETUP_REQUEST(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu) +int MME_handle_M3_SETUP_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu) { LOG_D(M2AP, "MCE_handle_M3_SETUP_REQUEST assoc_id %d\n",assoc_id); @@ -632,8 +613,9 @@ int MME_handle_M3_SETUP_REQUEST(instance_t instance, return 0; } -int MME_send_M3_SETUP_RESPONSE(instance_t instance, /*uint32_t assoc_id,*/ - m3ap_setup_resp_t *m3ap_setup_resp) { +int MME_send_M3_SETUP_RESPONSE(instance_t instance, /*sctp_assoc_t assoc_id,*/ + m3ap_setup_resp_t *m3ap_setup_resp) +{ M3AP_M3AP_PDU_t pdu; M3AP_M3SetupResponse_t *out; M3AP_M3SetupResponseIEs_t *ie; @@ -774,19 +756,16 @@ int MME_send_M3_SETUP_FAILURE(instance_t instance,m3ap_setup_failure_t* m3ap_set * MME Configuration Update */ - -int MME_handle_MME_CONFIGURATION_UPDATE_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu){ +int MME_handle_MME_CONFIGURATION_UPDATE_FAILURE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); } - int MME_handle_MME_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu){ + sctp_assoc_t assoc_id, + uint32_t stream, + M3AP_M3AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); } @@ -795,11 +774,8 @@ int MME_handle_MME_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, * MCE Configuration Update */ - -int MME_handle_MCE_CONFIGURATION_UPDATE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu){ +int MME_handle_MCE_CONFIGURATION_UPDATE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); } @@ -812,10 +788,8 @@ int MME_handle_MCE_CONFIGURATION_UPDATE(instance_t instance, * Error Indication */ -int MME_handle_ERROR_INDICATION(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu) { +int MME_handle_ERROR_INDICATION(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); @@ -1003,12 +977,8 @@ int MME_send_MBMS_SESSION_UPDATE_REQUEST(instance_t instance, m3ap_mbms_session_ } - - -int MME_handle_MBMS_SESSION_UPDATE_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu){ +int MME_handle_MBMS_SESSION_UPDATE_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu) +{ //AssertFatal(1==0,"Not implemented yet\n"); LOG_D(M3AP, "MME_handle_MBMS_SESSION_UPDATE_RESPONSE\n"); @@ -1067,30 +1037,18 @@ int MME_handle_MBMS_SESSION_UPDATE_RESPONSE(instance_t instance, } - - -int MME_handle_MBMS_SESSION_UPDATE_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu){ +int MME_handle_MBMS_SESSION_UPDATE_FAILURE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); } - - -int MME_handle_MBMS_SERVICE_COUNTING_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu){ +int MME_handle_MBMS_SERVICE_COUNTING_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); } - - -int MME_handle_MBMS_SESSION_COUNTING_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu){ +int MME_handle_MBMS_SESSION_COUNTING_FAILURE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); } @@ -1101,9 +1059,10 @@ int MME_handle_MBMS_SESSION_COUNTING_FAILURE(instance_t instance, */ int MME_handle_MBMS_SESSION_COUNTING_RESULTS_REPORT(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu){ + sctp_assoc_t assoc_id, + uint32_t stream, + M3AP_M3AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); } @@ -1112,10 +1071,8 @@ int MME_handle_MBMS_SESSION_COUNTING_RESULTS_REPORT(instance_t instance, /* * Overload Notification */ -int MME_handle_MBMS_OVERLOAD_NOTIFICATION(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu){ +int MME_handle_MBMS_OVERLOAD_NOTIFICATION(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); } diff --git a/openair3/M3AP/m3ap_MME_interface_management.h b/openair3/M3AP/m3ap_MME_interface_management.h index d3765182ce..a4f8db8946 100644 --- a/openair3/M3AP/m3ap_MME_interface_management.h +++ b/openair3/M3AP/m3ap_MME_interface_management.h @@ -35,75 +35,45 @@ /* * MBMS Session start */ -int MME_send_MBMS_SESSION_START_REQUEST(instance_t instance/*, - uint32_t assoc_id*/,m3ap_session_start_req_t* m3ap_session_start_req); -int MME_handle_MBMS_SESSION_START_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu); +int MME_send_MBMS_SESSION_START_REQUEST(instance_t instance, + /*sctp_assoc_t assoc_id,*/ + m3ap_session_start_req_t *m3ap_session_start_req); +int MME_handle_MBMS_SESSION_START_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu); -int MME_handle_MBMS_SESSION_START_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu); +int MME_handle_MBMS_SESSION_START_FAILURE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu); /* * MBMS Session stop */ int MME_send_MBMS_SESSION_STOP_REQUEST(instance_t instance, m3ap_session_stop_req_t* m3ap_session_stop_req); -int MME_handle_MBMS_SESSION_STOP_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu); +int MME_handle_MBMS_SESSION_STOP_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu); /* * Update */ -int MME_handle_MBMS_SESSION_UPDATE_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu); - -int MME_handle_MBMS_SESSION_UPDATE_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu); - +int MME_handle_MBMS_SESSION_UPDATE_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu); +int MME_handle_MBMS_SESSION_UPDATE_FAILURE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu); /* * Reset */ int MME_send_RESET(instance_t instance, m3ap_reset_t * m3ap_reset); -int MME_handle_RESET_ACKKNOWLEDGE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu); +int MME_handle_RESET_ACKKNOWLEDGE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu); -int MME_handle_RESET(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu); +int MME_handle_RESET(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu); int MME_send_RESET_ACKNOWLEDGE(instance_t instance, M3AP_ResetAcknowledge_t *ResetAcknowledge); /* * M3AP Setup */ -int MME_handle_M3_SETUP_REQUEST(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu); - -int MME_send_M3_SETUP_RESPONSE(instance_t instance,/*uint32_t assoc_id,*/ m3ap_setup_resp_t *m3ap_setup_resp); - -int MME_send_M3_SETUP_FAILURE(instance_t instance, /*uint32_t assoc_id*/ m3ap_setup_failure_t * m3ap_setup_failure); - - - +int MME_handle_M3_SETUP_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu); +int MME_send_M3_SETUP_RESPONSE(instance_t instance, /*sctp_assoc_t assoc_id,*/ m3ap_setup_resp_t *m3ap_setup_resp); +int MME_send_M3_SETUP_FAILURE(instance_t instance, /*sctp_assoc_t assoc_id*/ m3ap_setup_failure_t *m3ap_setup_failure); #endif /* M3AP_MME_INTERFACE_MANAGEMENT_H_ */ diff --git a/openair3/M3AP/m3ap_MME_management_procedures.c b/openair3/M3AP/m3ap_MME_management_procedures.c index 151aba04e4..1225db2213 100644 --- a/openair3/M3AP/m3ap_MME_management_procedures.c +++ b/openair3/M3AP/m3ap_MME_management_procedures.c @@ -122,9 +122,7 @@ printf("---------------------------------------------\n"); } } -struct m3ap_MME_data_s *m3ap_get_MME(m3ap_MME_instance_t *instance_p, - int32_t assoc_id, - uint16_t cnx_id) +struct m3ap_MME_data_s *m3ap_get_MME(m3ap_MME_instance_t *instance_p, sctp_assoc_t assoc_id, uint16_t cnx_id) { struct m3ap_MME_data_s temp; struct m3ap_MME_data_s *found; diff --git a/openair3/M3AP/m3ap_MME_management_procedures.h b/openair3/M3AP/m3ap_MME_management_procedures.h index b21189b915..b5a75f8a23 100644 --- a/openair3/M3AP/m3ap_MME_management_procedures.h +++ b/openair3/M3AP/m3ap_MME_management_procedures.h @@ -47,8 +47,6 @@ m3ap_MME_data_t* m3ap_is_MME_assoc_id_in_list(uint32_t sctp_assoc_id); m3ap_MME_data_t* m3ap_is_MME_pci_in_list (const uint32_t pci); -struct m3ap_MME_data_s *m3ap_get_MME(m3ap_MME_instance_t *instance_p, - int32_t assoc_id, - uint16_t cnx_id); +struct m3ap_MME_data_s *m3ap_get_MME(m3ap_MME_instance_t *instance_p, sctp_assoc_t assoc_id, uint16_t cnx_id); #endif /* __M3AP_MME_MANAGEMENT_PROCEDURES__H__ */ diff --git a/openair3/M3AP/m3ap_common.h b/openair3/M3AP/m3ap_common.h index 5d40b29363..d59407c2ec 100644 --- a/openair3/M3AP/m3ap_common.h +++ b/openair3/M3AP/m3ap_common.h @@ -74,30 +74,15 @@ extern int asn1_xer_print; /** \brief Function callback prototype. **/ -typedef int (*m3ap_message_decoded_callback)( - instance_t instance, - uint32_t assocId, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu); - +typedef int (*m3ap_message_decoded_callback)(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu); /** \brief Function callback prototype. **/ -typedef int (*m3ap_MCE_message_decoded_callback)( - instance_t instance, - uint32_t assocId, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu); +typedef int (*m3ap_MCE_message_decoded_callback)(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu); /** \brief Function callback prototype. **/ -typedef int (*m3ap_MME_message_decoded_callback)( - instance_t instance, - uint32_t assocId, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu); - - +typedef int (*m3ap_MME_message_decoded_callback)(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu); /** \brief Encode a successfull outcome message \param buffer pointer to buffer in which data will be encoded diff --git a/openair3/M3AP/m3ap_handler.c b/openair3/M3AP/m3ap_handler.c index 41675ac749..f4cad1bd08 100644 --- a/openair3/M3AP/m3ap_handler.c +++ b/openair3/M3AP/m3ap_handler.c @@ -69,9 +69,11 @@ static char *m3ap_direction_String[] = { return(m3ap_direction_String[m3ap_dir]); } - -int m3ap_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, - const uint8_t * const data, const uint32_t data_length) +int m3ap_handle_message(instance_t instance, + sctp_assoc_t assoc_id, + int32_t stream, + const uint8_t *const data, + const uint32_t data_length) { M3AP_M3AP_PDU_t pdu; int ret; diff --git a/openair3/M3AP/m3ap_handler.h b/openair3/M3AP/m3ap_handler.h index 4b01307807..5dcc71204e 100644 --- a/openair3/M3AP/m3ap_handler.h +++ b/openair3/M3AP/m3ap_handler.h @@ -33,11 +33,14 @@ //void m3ap_handle_m2_setup_message(m2ap_eNB_instance_t *instance_p, m2ap_eNB_data_t *eNB_desc_p, int sctp_shutdown); -//int m3ap_eNB_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, +//int m3ap_eNB_handle_message(instance_t instance, sctp_assoc_t assoc_id, int32_t stream, //const uint8_t * const data, const uint32_t data_length); -int m3ap_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, - const uint8_t * const data, const uint32_t data_length); +int m3ap_handle_message(instance_t instance, + sctp_assoc_t assoc_id, + int32_t stream, + const uint8_t *const data, + const uint32_t data_length); #endif /* M2AP_MCE_HANDLERS_H_ */ diff --git a/openair3/M3AP/m3ap_itti_messaging.c b/openair3/M3AP/m3ap_itti_messaging.c index 42e689343f..83b51f0091 100644 --- a/openair3/M3AP/m3ap_itti_messaging.c +++ b/openair3/M3AP/m3ap_itti_messaging.c @@ -30,8 +30,11 @@ #include "m3ap_itti_messaging.h" -void m3ap_MCE_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer, - uint32_t buffer_length, uint16_t stream) +void m3ap_MCE_itti_send_sctp_data_req(instance_t instance, + sctp_assoc_t assoc_id, + uint8_t *buffer, + uint32_t buffer_length, + uint16_t stream) { MessageDef *message_p; sctp_data_req_t *sctp_data_req; @@ -51,7 +54,7 @@ void m3ap_MCE_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uin } -void m3ap_MCE_itti_send_sctp_close_association(instance_t instance, int32_t assoc_id) +void m3ap_MCE_itti_send_sctp_close_association(instance_t instance, sctp_assoc_t assoc_id) { MessageDef *message_p = NULL; sctp_close_association_t *sctp_close_association_p = NULL; @@ -63,9 +66,11 @@ void m3ap_MCE_itti_send_sctp_close_association(instance_t instance, int32_t asso itti_send_msg_to_task(TASK_SCTP, instance, message_p); } - -void m3ap_MME_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer, - uint32_t buffer_length, uint16_t stream) +void m3ap_MME_itti_send_sctp_data_req(instance_t instance, + sctp_assoc_t assoc_id, + uint8_t *buffer, + uint32_t buffer_length, + uint16_t stream) { MessageDef *message_p; sctp_data_req_t *sctp_data_req; @@ -83,7 +88,7 @@ void m3ap_MME_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uin } -void m3ap_MME_itti_send_sctp_close_association(instance_t instance, int32_t assoc_id) +void m3ap_MME_itti_send_sctp_close_association(instance_t instance, sctp_assoc_t assoc_id) { MessageDef *message_p = NULL; sctp_close_association_t *sctp_close_association_p = NULL; diff --git a/openair3/M3AP/m3ap_itti_messaging.h b/openair3/M3AP/m3ap_itti_messaging.h index 8a4069da9b..bd22cc87f8 100644 --- a/openair3/M3AP/m3ap_itti_messaging.h +++ b/openair3/M3AP/m3ap_itti_messaging.h @@ -29,18 +29,21 @@ #ifndef M3AP_MCE_ITTI_MESSAGING_H_ #define M3AP_MCE_ITTI_MESSAGING_H_ -void m3ap_MCE_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer, - uint32_t buffer_length, uint16_t stream); +void m3ap_MCE_itti_send_sctp_data_req(instance_t instance, + sctp_assoc_t assoc_id, + uint8_t *buffer, + uint32_t buffer_length, + uint16_t stream); +void m3ap_MCE_itti_send_sctp_close_association(instance_t instance, sctp_assoc_t assoc_id); -void m3ap_MCE_itti_send_sctp_close_association(instance_t instance, int32_t assoc_id); +void m3ap_MME_itti_send_sctp_data_req(instance_t instance, + sctp_assoc_t assoc_id, + uint8_t *buffer, + uint32_t buffer_length, + uint16_t stream); - -void m3ap_MME_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer, - uint32_t buffer_length, uint16_t stream); - - -void m3ap_MME_itti_send_sctp_close_association(instance_t instance, int32_t assoc_id); +void m3ap_MME_itti_send_sctp_close_association(instance_t instance, sctp_assoc_t assoc_id); diff --git a/openair3/NGAP/ngap_common.h b/openair3/NGAP/ngap_common.h index 41f6093c08..8c66a11cd0 100644 --- a/openair3/NGAP/ngap_common.h +++ b/openair3/NGAP/ngap_common.h @@ -127,11 +127,7 @@ extern int asn1_xer_print; /** \brief Function callback prototype. **/ -typedef int (*ngap_message_decoded_callback)( - uint32_t assoc_id, - uint32_t stream, - NGAP_NGAP_PDU_t *pdu -); +typedef int (*ngap_message_decoded_callback)(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu); /** \brief Handle criticality \param criticality Criticality of the IE diff --git a/openair3/NGAP/ngap_gNB_defs.h b/openair3/NGAP/ngap_gNB_defs.h index 5591ecb061..c93d448723 100644 --- a/openair3/NGAP/ngap_gNB_defs.h +++ b/openair3/NGAP/ngap_gNB_defs.h @@ -203,7 +203,7 @@ typedef struct ngap_gNB_amf_data_s { uint16_t cnx_id; /* SCTP association id */ - int32_t assoc_id; + sctp_assoc_t assoc_id; /* This is served PLMN IDs communicated to the AMF via an index over the * MCC/MNC array in ngap_gNB_instance */ diff --git a/openair3/NGAP/ngap_gNB_handlers.c b/openair3/NGAP/ngap_gNB_handlers.c index 788f56381f..1835b51cb6 100644 --- a/openair3/NGAP/ngap_gNB_handlers.c +++ b/openair3/NGAP/ngap_gNB_handlers.c @@ -105,10 +105,8 @@ void ngap_handle_ng_setup_message(ngap_gNB_amf_data_t *amf_desc_p, int sctp_shut } } -static -int ngap_gNB_handle_ng_setup_failure(uint32_t assoc_id, - uint32_t stream, - NGAP_NGAP_PDU_t *pdu) { +static int ngap_gNB_handle_ng_setup_failure(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) +{ NGAP_NGSetupFailure_t *container; NGAP_NGSetupFailureIEs_t *ie; ngap_gNB_amf_data_t *amf_desc_p; @@ -142,10 +140,8 @@ int ngap_gNB_handle_ng_setup_failure(uint32_t assoc_id, return 0; } -static -int ngap_gNB_handle_ng_setup_response(uint32_t assoc_id, - uint32_t stream, - NGAP_NGAP_PDU_t *pdu) { +static int ngap_gNB_handle_ng_setup_response(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) +{ NGAP_NGSetupResponse_t *container; NGAP_NGSetupResponseIEs_t *ie; ngap_gNB_amf_data_t *amf_desc_p; @@ -297,12 +293,8 @@ int ngap_gNB_handle_ng_setup_response(uint32_t assoc_id, return 0; } - -static -int ngap_gNB_handle_error_indication(uint32_t assoc_id, - uint32_t stream, - NGAP_NGAP_PDU_t *pdu) { - +static int ngap_gNB_handle_error_indication(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) +{ NGAP_ErrorIndication_t *container; NGAP_ErrorIndicationIEs_t *ie; ngap_gNB_amf_data_t *amf_desc_p; @@ -678,7 +670,7 @@ int ngap_gNB_handle_error_indication(uint32_t assoc_id, return 0; } -static int ngap_gNB_handle_initial_context_request(uint32_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) +static int ngap_gNB_handle_initial_context_request(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) { int i; ngap_gNB_amf_data_t *amf_desc_p = NULL; @@ -838,10 +830,8 @@ static int ngap_gNB_handle_initial_context_request(uint32_t assoc_id, uint32_t s return 0; } -static -int ngap_gNB_handle_ue_context_release_command(uint32_t assoc_id, - uint32_t stream, - NGAP_NGAP_PDU_t *pdu) { +static int ngap_gNB_handle_ue_context_release_command(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) +{ ngap_gNB_amf_data_t *amf_desc_p = NULL; MessageDef *message_p = NULL; uint64_t amf_ue_ngap_id; @@ -906,11 +896,9 @@ int ngap_gNB_handle_ue_context_release_command(uint32_t assoc_id, return 0; } -static -int ngap_gNB_handle_pdusession_setup_request(uint32_t assoc_id, - uint32_t stream, - NGAP_NGAP_PDU_t *pdu) { -// NGAP_AMF_UE_NGAP_ID_t amf_ue_ngap_id; +static int ngap_gNB_handle_pdusession_setup_request(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) +{ + // NGAP_AMF_UE_NGAP_ID_t amf_ue_ngap_id; uint64_t amf_ue_ngap_id; NGAP_RAN_UE_NGAP_ID_t ran_ue_ngap_id; ngap_gNB_amf_data_t *amf_desc_p = NULL; @@ -989,12 +977,8 @@ int ngap_gNB_handle_pdusession_setup_request(uint32_t assoc_id, return 0; } - -static -int ngap_gNB_handle_paging(uint32_t assoc_id, - uint32_t stream, - NGAP_NGAP_PDU_t *pdu) { - +static int ngap_gNB_handle_paging(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) +{ ngap_gNB_amf_data_t *amf_desc_p = NULL; ngap_gNB_instance_t *ngap_gNB_instance = NULL; NGAP_Paging_t *container; @@ -1082,7 +1066,7 @@ int ngap_gNB_handle_paging(uint32_t assoc_id, return 0; } -static int ngap_gNB_handle_pdusession_modify_request(uint32_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) +static int ngap_gNB_handle_pdusession_modify_request(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) { ngap_gNB_amf_data_t *amf_desc_p = NULL; NGAP_PDUSessionResourceModifyRequest_t *container; @@ -1176,11 +1160,8 @@ static int ngap_gNB_handle_pdusession_modify_request(uint32_t assoc_id, uint32_t } // handle pdu session release command and send it to rrc_end -static -int ngap_gNB_handle_pdusession_release_command(uint32_t assoc_id, - uint32_t stream, - NGAP_NGAP_PDU_t *pdu) { - +static int ngap_gNB_handle_pdusession_release_command(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) +{ int i; ngap_gNB_amf_data_t *amf_desc_p = NULL; NGAP_PDUSessionResourceReleaseCommand_t *container; @@ -1263,29 +1244,21 @@ int ngap_gNB_handle_pdusession_release_command(uint32_t assoc_id, return 0; } -static -int ngap_gNB_handle_ng_path_switch_request_ack(uint32_t assoc_id, - uint32_t stream, - NGAP_NGAP_PDU_t *pdu) { +static int ngap_gNB_handle_ng_path_switch_request_ack(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) +{ // TODO return 0; } -static -int ngap_gNB_handle_ng_path_switch_request_failure(uint32_t assoc_id, - uint32_t stream, - NGAP_NGAP_PDU_t *pdu) { - +static int ngap_gNB_handle_ng_path_switch_request_failure(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) +{ // TODO return 0; } -static -int ngap_gNB_handle_ng_ENDC_pdusession_modification_confirm(uint32_t assoc_id, - uint32_t stream, - NGAP_NGAP_PDU_t *pdu){ - - LOG_W(NGAP, "Implementation of NGAP Pdusession Modification confirm handler is pending...\n"); +static int ngap_gNB_handle_ng_ENDC_pdusession_modification_confirm(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) +{ + LOG_W(NGAP, "Implementation of NGAP Pdusession Modification confirm handler is pending...\n"); return 0; } @@ -1347,7 +1320,7 @@ const ngap_message_decoded_callback ngap_messages_callback[][3] = { }; -int ngap_gNB_handle_message(uint32_t assoc_id, int32_t stream, const uint8_t *const data, const uint32_t data_length) +int ngap_gNB_handle_message(sctp_assoc_t assoc_id, int32_t stream, const uint8_t *const data, const uint32_t data_length) { NGAP_NGAP_PDU_t pdu; int ret; diff --git a/openair3/NGAP/ngap_gNB_handlers.h b/openair3/NGAP/ngap_gNB_handlers.h index 889946dd44..5291b78fa8 100644 --- a/openair3/NGAP/ngap_gNB_handlers.h +++ b/openair3/NGAP/ngap_gNB_handlers.h @@ -32,7 +32,6 @@ void ngap_handle_ng_setup_message(ngap_gNB_amf_data_t *amf_desc_p, int sctp_shutdown); -int ngap_gNB_handle_message(uint32_t assoc_id, int32_t stream, - const uint8_t * const data, const uint32_t data_length); +int ngap_gNB_handle_message(sctp_assoc_t assoc_id, int32_t stream, const uint8_t *const data, const uint32_t data_length); #endif /* NGAP_GNB_HANDLERS_H_ */ diff --git a/openair3/NGAP/ngap_gNB_itti_messaging.c b/openair3/NGAP/ngap_gNB_itti_messaging.c index 87b4ba4c73..4f4a3b2654 100644 --- a/openair3/NGAP/ngap_gNB_itti_messaging.c +++ b/openair3/NGAP/ngap_gNB_itti_messaging.c @@ -31,8 +31,11 @@ #include "ngap_gNB_itti_messaging.h" -void ngap_gNB_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer, - uint32_t buffer_length, uint16_t stream) +void ngap_gNB_itti_send_sctp_data_req(instance_t instance, + sctp_assoc_t assoc_id, + uint8_t *buffer, + uint32_t buffer_length, + uint16_t stream) { MessageDef *message_p; sctp_data_req_t *sctp_data_req; @@ -66,7 +69,7 @@ void ngap_gNB_itti_send_nas_downlink_ind(instance_t instance, uint32_t gNB_ue_ng itti_send_msg_to_task(TASK_RRC_GNB, instance, message_p); } -void ngap_gNB_itti_send_sctp_close_association(instance_t instance, int32_t assoc_id) +void ngap_gNB_itti_send_sctp_close_association(instance_t instance, sctp_assoc_t assoc_id) { MessageDef *message_p = NULL; sctp_close_association_t *sctp_close_association_p = NULL; diff --git a/openair3/NGAP/ngap_gNB_itti_messaging.h b/openair3/NGAP/ngap_gNB_itti_messaging.h index 08224a27f5..362c9a0266 100644 --- a/openair3/NGAP/ngap_gNB_itti_messaging.h +++ b/openair3/NGAP/ngap_gNB_itti_messaging.h @@ -30,13 +30,14 @@ #ifndef NGAP_GNB_ITTI_MESSAGING_H_ #define NGAP_GNB_ITTI_MESSAGING_H_ -void ngap_gNB_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer, - uint32_t buffer_length, uint16_t stream); +void ngap_gNB_itti_send_sctp_data_req(instance_t instance, + sctp_assoc_t assoc_id, + uint8_t *buffer, + uint32_t buffer_length, + uint16_t stream); void ngap_gNB_itti_send_nas_downlink_ind(instance_t instance, uint32_t gNB_ue_ngap_id, uint8_t *nas_pdu, uint32_t nas_pdu_length); -void ngap_gNB_itti_send_sctp_close_association(instance_t instance, - int32_t assoc_id); - +void ngap_gNB_itti_send_sctp_close_association(instance_t instance, sctp_assoc_t assoc_id); #endif /* NGAP_GNB_ITTI_MESSAGING_H_ */ diff --git a/openair3/NGAP/ngap_gNB_management_procedures.c b/openair3/NGAP/ngap_gNB_management_procedures.c index 85167ed7f0..6ed06d9324 100644 --- a/openair3/NGAP/ngap_gNB_management_procedures.c +++ b/openair3/NGAP/ngap_gNB_management_procedures.c @@ -89,9 +89,7 @@ void ngap_gNB_insert_new_instance(ngap_gNB_instance_t *new_instance_p) new_instance_p, ngap_gNB_entries); } -struct ngap_gNB_amf_data_s *ngap_gNB_get_AMF( - ngap_gNB_instance_t *instance_p, - int32_t assoc_id, uint16_t cnx_id) +struct ngap_gNB_amf_data_s *ngap_gNB_get_AMF(ngap_gNB_instance_t *instance_p, sctp_assoc_t assoc_id, uint16_t cnx_id) { struct ngap_gNB_amf_data_s temp; struct ngap_gNB_amf_data_s *found; diff --git a/openair3/NGAP/ngap_gNB_management_procedures.h b/openair3/NGAP/ngap_gNB_management_procedures.h index e192f71be9..fa62f53382 100644 --- a/openair3/NGAP/ngap_gNB_management_procedures.h +++ b/openair3/NGAP/ngap_gNB_management_procedures.h @@ -31,9 +31,7 @@ #ifndef NGAP_GNB_MANAGEMENT_PROCEDURES_H_ #define NGAP_GNB_MANAGEMENT_PROCEDURES_H_ -struct ngap_gNB_amf_data_s *ngap_gNB_get_AMF( - ngap_gNB_instance_t *instance_p, - int32_t assoc_id, uint16_t cnx_id); +struct ngap_gNB_amf_data_s *ngap_gNB_get_AMF(ngap_gNB_instance_t *instance_p, sctp_assoc_t assoc_id, uint16_t cnx_id); struct ngap_gNB_amf_data_s *ngap_gNB_get_AMF_from_instance(ngap_gNB_instance_t *instance_p); diff --git a/openair3/NGAP/ngap_gNB_nas_procedures.c b/openair3/NGAP/ngap_gNB_nas_procedures.c index f9c7041006..690e603042 100644 --- a/openair3/NGAP/ngap_gNB_nas_procedures.c +++ b/openair3/NGAP/ngap_gNB_nas_procedures.c @@ -292,9 +292,7 @@ int ngap_gNB_handle_nas_first_req(instance_t instance, ngap_nas_first_req_t *UEf } //------------------------------------------------------------------------------ -int ngap_gNB_handle_nas_downlink(uint32_t assoc_id, - uint32_t stream, - NGAP_NGAP_PDU_t *pdu) +int ngap_gNB_handle_nas_downlink(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) //------------------------------------------------------------------------------ { diff --git a/openair3/NGAP/ngap_gNB_nas_procedures.h b/openair3/NGAP/ngap_gNB_nas_procedures.h index e7552cd47e..da55a349ed 100644 --- a/openair3/NGAP/ngap_gNB_nas_procedures.h +++ b/openair3/NGAP/ngap_gNB_nas_procedures.h @@ -31,10 +31,7 @@ #ifndef NGAP_GNB_NAS_PROCEDURES_H_ #define NGAP_GNB_NAS_PROCEDURES_H_ -int ngap_gNB_handle_nas_downlink( - uint32_t assoc_id, - uint32_t stream, - NGAP_NGAP_PDU_t *pdu); +int ngap_gNB_handle_nas_downlink(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu); int ngap_gNB_nas_uplink(instance_t instance, ngap_uplink_nas_t *ngap_uplink_nas_p); diff --git a/openair3/NGAP/ngap_gNB_overload.c b/openair3/NGAP/ngap_gNB_overload.c index 318a2124bd..d8512c0695 100644 --- a/openair3/NGAP/ngap_gNB_overload.c +++ b/openair3/NGAP/ngap_gNB_overload.c @@ -45,17 +45,13 @@ #include "assertions.h" -int ngap_gNB_handle_overload_start(uint32_t assoc_id, - uint32_t stream, - NGAP_NGAP_PDU_t *pdu) +int ngap_gNB_handle_overload_start(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) { //TODO return 0; } -int ngap_gNB_handle_overload_stop(uint32_t assoc_id, - uint32_t stream, - NGAP_NGAP_PDU_t *pdu) +int ngap_gNB_handle_overload_stop(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) { /* We received Overload stop message, meaning that the AMF is no more * overloaded. This is an empty message, with only message header and no diff --git a/openair3/NGAP/ngap_gNB_overload.h b/openair3/NGAP/ngap_gNB_overload.h index 0b7ab52c26..b893194a4b 100644 --- a/openair3/NGAP/ngap_gNB_overload.h +++ b/openair3/NGAP/ngap_gNB_overload.h @@ -36,9 +36,7 @@ // int ngap_gNB_handle_overload_start(gNB_amf_desc_t *gNB_desc_p, // sctp_queue_item_t *packet_p, // struct ngap_message_s *message_p); -int ngap_gNB_handle_overload_start(uint32_t assoc_id, - uint32_t stream, - NGAP_NGAP_PDU_t *pdu); +int ngap_gNB_handle_overload_start(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu); /** * \brief Handle an overload stop message @@ -46,8 +44,6 @@ int ngap_gNB_handle_overload_start(uint32_t assoc_id, // int ngap_gNB_handle_overload_stop(gNB_amf_desc_t *gNB_desc_p, // sctp_queue_item_t *packet_p, // struct ngap_message_s *message_p); -int ngap_gNB_handle_overload_stop(uint32_t assoc_id, - uint32_t stream, - NGAP_NGAP_PDU_t *pdu); +int ngap_gNB_handle_overload_stop(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu); #endif /* NGAP_GNB_OVERLOAD_H_ */ diff --git a/openair3/NGAP/ngap_gNB_trace.c b/openair3/NGAP/ngap_gNB_trace.c index f3e216988c..8fc0968ccd 100644 --- a/openair3/NGAP/ngap_gNB_trace.c +++ b/openair3/NGAP/ngap_gNB_trace.c @@ -45,18 +45,13 @@ #include "ngap_gNB_itti_messaging.h" #include "ngap_gNB_management_procedures.h" - -int ngap_gNB_handle_trace_start(uint32_t assoc_id, - uint32_t stream, - NGAP_NGAP_PDU_t *pdu) +int ngap_gNB_handle_trace_start(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) { //TODO return 0; } -int ngap_gNB_handle_deactivate_trace(uint32_t assoc_id, - uint32_t stream, - NGAP_NGAP_PDU_t *message_p) +int ngap_gNB_handle_deactivate_trace(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *message_p) { // NGAP_DeactivateTraceIEs_t *deactivate_trace_p; // diff --git a/openair3/NGAP/ngap_gNB_trace.h b/openair3/NGAP/ngap_gNB_trace.h index 70863e3737..b35354a16f 100644 --- a/openair3/NGAP/ngap_gNB_trace.h +++ b/openair3/NGAP/ngap_gNB_trace.h @@ -30,12 +30,8 @@ #ifndef NGAP_GNB_TRACE_H_ #define NGAP_GNB_TRACE_H_ -int ngap_gNB_handle_trace_start(uint32_t assoc_id, - uint32_t stream, - NGAP_NGAP_PDU_t *pdu); +int ngap_gNB_handle_trace_start(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu); -int ngap_gNB_handle_deactivate_trace(uint32_t assoc_id, - uint32_t stream, - NGAP_NGAP_PDU_t *pdu); +int ngap_gNB_handle_deactivate_trace(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu); #endif /* NGAP_GNB_TRACE_H_ */ diff --git a/openair3/S1AP/s1ap_common.h b/openair3/S1AP/s1ap_common.h index 65baea44c6..a452d284e5 100644 --- a/openair3/S1AP/s1ap_common.h +++ b/openair3/S1AP/s1ap_common.h @@ -28,6 +28,8 @@ #include "common/utils/LOG/log.h" #include "oai_asn1.h" +#include "netinet/in.h" +#include "netinet/sctp.h" #include "S1AP_ProtocolIE-Field.h" #include "S1AP_S1AP-PDU.h" @@ -85,11 +87,7 @@ extern int asn1_xer_print; } while(0) /** \brief Function callback prototype. **/ -typedef int (*s1ap_message_decoded_callback)( - uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu -); +typedef int (*s1ap_message_decoded_callback)(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu); /** \brief Handle criticality \param criticality Criticality of the IE diff --git a/openair3/S1AP/s1ap_eNB_defs.h b/openair3/S1AP/s1ap_eNB_defs.h index ed0909d66e..89f31f6486 100644 --- a/openair3/S1AP/s1ap_eNB_defs.h +++ b/openair3/S1AP/s1ap_eNB_defs.h @@ -156,7 +156,7 @@ typedef struct s1ap_eNB_mme_data_s { uint16_t cnx_id; /* SCTP association id */ - int32_t assoc_id; + sctp_assoc_t assoc_id; /* This is served PLMN IDs communicated to the MME via an index over the * MCC/MNC array in s1ap_eNB_instance */ diff --git a/openair3/S1AP/s1ap_eNB_handlers.c b/openair3/S1AP/s1ap_eNB_handlers.c index 6bad1ce455..241abc459f 100644 --- a/openair3/S1AP/s1ap_eNB_handlers.c +++ b/openair3/S1AP/s1ap_eNB_handlers.c @@ -50,64 +50,28 @@ #include "assertions.h" #include "conversions.h" -static -int s1ap_eNB_handle_s1_setup_response(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu); -static -int s1ap_eNB_handle_s1_setup_failure(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu); +static int s1ap_eNB_handle_s1_setup_response(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu); +static int s1ap_eNB_handle_s1_setup_failure(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu); -static -int s1ap_eNB_handle_error_indication(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu); +static int s1ap_eNB_handle_error_indication(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu); -static -int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu); +static int s1ap_eNB_handle_initial_context_request(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu); -static -int s1ap_eNB_handle_ue_context_release_command(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu); +static int s1ap_eNB_handle_ue_context_release_command(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu); -static -int s1ap_eNB_handle_e_rab_setup_request(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu); +static int s1ap_eNB_handle_e_rab_setup_request(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu); -static -int s1ap_eNB_handle_paging(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu); +static int s1ap_eNB_handle_paging(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu); -static -int s1ap_eNB_handle_e_rab_modify_request(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu); +static int s1ap_eNB_handle_e_rab_modify_request(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu); -static -int s1ap_eNB_handle_e_rab_release_command(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu); +static int s1ap_eNB_handle_e_rab_release_command(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu); -static -int s1ap_eNB_handle_s1_path_switch_request_ack(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu); +static int s1ap_eNB_handle_s1_path_switch_request_ack(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu); -static -int s1ap_eNB_handle_s1_path_switch_request_failure(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu); +static int s1ap_eNB_handle_s1_path_switch_request_failure(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu); -static -int s1ap_eNB_handle_s1_ENDC_e_rab_modification_confirm(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu); +static int s1ap_eNB_handle_s1_ENDC_e_rab_modification_confirm(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu); static int s1ap_eNB_snd_s1_setup_request( s1ap_eNB_instance_t *instance_p, @@ -228,8 +192,8 @@ void s1ap_handle_s1_setup_message(s1ap_eNB_mme_data_t *mme_desc_p, int sctp_shut } } -int s1ap_eNB_handle_message(uint32_t assoc_id, int32_t stream, - const uint8_t *const data, const uint32_t data_length) { +int s1ap_eNB_handle_message(sctp_assoc_t assoc_id, int32_t stream, const uint8_t *const data, const uint32_t data_length) +{ S1AP_S1AP_PDU_t pdu; int ret; DevAssert(data != NULL); @@ -268,10 +232,8 @@ int s1ap_eNB_handle_message(uint32_t assoc_id, int32_t stream, return ret; } -static -int s1ap_eNB_handle_s1_setup_failure(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu) { +static int s1ap_eNB_handle_s1_setup_failure(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu) +{ S1AP_S1SetupFailure_t *container; S1AP_S1SetupFailureIEs_t *ie; s1ap_eNB_mme_data_t *mme_desc_p; @@ -361,10 +323,8 @@ int s1ap_eNB_handle_s1_setup_failure(uint32_t assoc_id, return 0; } -static -int s1ap_eNB_handle_s1_setup_response(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu) { +static int s1ap_eNB_handle_s1_setup_response(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu) +{ S1AP_S1SetupResponse_t *container; S1AP_S1SetupResponseIEs_t *ie; s1ap_eNB_mme_data_t *mme_desc_p; @@ -478,11 +438,8 @@ int s1ap_eNB_handle_s1_setup_response(uint32_t assoc_id, return 0; } - -static -int s1ap_eNB_handle_error_indication(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu) { +static int s1ap_eNB_handle_error_indication(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu) +{ S1AP_ErrorIndication_t *container; S1AP_ErrorIndicationIEs_t *ie; s1ap_eNB_mme_data_t *mme_desc_p; @@ -817,11 +774,8 @@ int s1ap_eNB_handle_error_indication(uint32_t assoc_id, return 0; } - -static -int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu) { +static int s1ap_eNB_handle_initial_context_request(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu) +{ int i; s1ap_eNB_mme_data_t *mme_desc_p = NULL; s1ap_eNB_ue_context_t *ue_desc_p = NULL; @@ -987,11 +941,8 @@ int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id, return 0; } - -static -int s1ap_eNB_handle_ue_context_release_command(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu) { +static int s1ap_eNB_handle_ue_context_release_command(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu) +{ s1ap_eNB_mme_data_t *mme_desc_p = NULL; s1ap_eNB_ue_context_t *ue_desc_p = NULL; MessageDef *message_p = NULL; @@ -1078,13 +1029,10 @@ int s1ap_eNB_handle_ue_context_release_command(uint32_t assoc_id, S1AP_ERROR( "Mandatory Element Nothing : UEContextReleaseCommand(UE_S1AP_IDs)\n" ); return -1; } - } -static -int s1ap_eNB_handle_e_rab_setup_request(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu) { +static int s1ap_eNB_handle_e_rab_setup_request(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu) +{ int i; S1AP_MME_UE_S1AP_ID_t mme_ue_s1ap_id; S1AP_ENB_UE_S1AP_ID_t enb_ue_s1ap_id; @@ -1204,10 +1152,8 @@ int s1ap_eNB_handle_e_rab_setup_request(uint32_t assoc_id, return 0; } -static -int s1ap_eNB_handle_paging(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu) { +static int s1ap_eNB_handle_paging(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu) +{ s1ap_eNB_mme_data_t *mme_desc_p = NULL; s1ap_eNB_instance_t *s1ap_eNB_instance = NULL; MessageDef *message_p = NULL; @@ -1374,10 +1320,8 @@ int s1ap_eNB_handle_paging(uint32_t assoc_id, return 0; } -static -int s1ap_eNB_handle_e_rab_modify_request(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu) { +static int s1ap_eNB_handle_e_rab_modify_request(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu) +{ int i, nb_of_e_rabs_failed; s1ap_eNB_mme_data_t *mme_desc_p = NULL; s1ap_eNB_ue_context_t *ue_desc_p = NULL; @@ -1510,10 +1454,8 @@ int s1ap_eNB_handle_e_rab_modify_request(uint32_t assoc_id, return 0; } // handle e-rab release command and send it to rrc_end -static -int s1ap_eNB_handle_e_rab_release_command(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu) { +static int s1ap_eNB_handle_e_rab_release_command(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu) +{ int i; s1ap_eNB_mme_data_t *mme_desc_p = NULL; s1ap_eNB_ue_context_t *ue_desc_p = NULL; @@ -1614,10 +1556,8 @@ int s1ap_eNB_handle_e_rab_release_command(uint32_t assoc_id, return 0; } -static -int s1ap_eNB_handle_s1_path_switch_request_ack(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu) { +static int s1ap_eNB_handle_s1_path_switch_request_ack(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu) +{ s1ap_eNB_mme_data_t *mme_desc_p = NULL; s1ap_eNB_ue_context_t *ue_desc_p = NULL; MessageDef *message_p = NULL; @@ -1776,10 +1716,8 @@ int s1ap_eNB_handle_s1_path_switch_request_ack(uint32_t assoc_id, return 0; } -static -int s1ap_eNB_handle_s1_path_switch_request_failure(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu) { +static int s1ap_eNB_handle_s1_path_switch_request_failure(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu) +{ s1ap_eNB_mme_data_t *mme_desc_p = NULL; S1AP_PathSwitchRequestFailure_t *pathSwitchRequestFailure; S1AP_PathSwitchRequestFailureIEs_t *ie; @@ -1843,12 +1781,9 @@ int s1ap_eNB_handle_s1_path_switch_request_failure(uint32_t assoc_ return 0; } -static -int s1ap_eNB_handle_s1_ENDC_e_rab_modification_confirm(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu){ - - LOG_I(S1AP, "Received S1AP E-RAB Modification confirm message \n"); +static int s1ap_eNB_handle_s1_ENDC_e_rab_modification_confirm(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu) +{ + LOG_I(S1AP, "Received S1AP E-RAB Modification confirm message \n"); return 0; } diff --git a/openair3/S1AP/s1ap_eNB_handlers.h b/openair3/S1AP/s1ap_eNB_handlers.h index d0e93faa4d..ea9873679d 100644 --- a/openair3/S1AP/s1ap_eNB_handlers.h +++ b/openair3/S1AP/s1ap_eNB_handlers.h @@ -24,7 +24,6 @@ void s1ap_handle_s1_setup_message(s1ap_eNB_mme_data_t *mme_desc_p, int sctp_shutdown); -int s1ap_eNB_handle_message(uint32_t assoc_id, int32_t stream, - const uint8_t * const data, const uint32_t data_length); +int s1ap_eNB_handle_message(sctp_assoc_t assoc_id, int32_t stream, const uint8_t *const data, const uint32_t data_length); #endif /* S1AP_ENB_HANDLERS_H_ */ diff --git a/openair3/S1AP/s1ap_eNB_itti_messaging.c b/openair3/S1AP/s1ap_eNB_itti_messaging.c index 8a6539a118..ffaed8d5fb 100644 --- a/openair3/S1AP/s1ap_eNB_itti_messaging.c +++ b/openair3/S1AP/s1ap_eNB_itti_messaging.c @@ -23,8 +23,11 @@ #include "s1ap_eNB_itti_messaging.h" -void s1ap_eNB_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer, - uint32_t buffer_length, uint16_t stream) +void s1ap_eNB_itti_send_sctp_data_req(instance_t instance, + sctp_assoc_t assoc_id, + uint8_t *buffer, + uint32_t buffer_length, + uint16_t stream) { MessageDef *message_p; sctp_data_req_t *sctp_data_req; @@ -63,7 +66,7 @@ void s1ap_eNB_itti_send_nas_downlink_ind(instance_t instance, itti_send_msg_to_task(TASK_RRC_ENB, instance, message_p); } -void s1ap_eNB_itti_send_sctp_close_association(instance_t instance, int32_t assoc_id) +void s1ap_eNB_itti_send_sctp_close_association(instance_t instance, sctp_assoc_t assoc_id) { MessageDef *message_p = NULL; sctp_close_association_t *sctp_close_association_p = NULL; diff --git a/openair3/S1AP/s1ap_eNB_itti_messaging.h b/openair3/S1AP/s1ap_eNB_itti_messaging.h index cd6b3cebcc..ac4ad8ffae 100644 --- a/openair3/S1AP/s1ap_eNB_itti_messaging.h +++ b/openair3/S1AP/s1ap_eNB_itti_messaging.h @@ -22,8 +22,14 @@ #ifndef S1AP_ENB_ITTI_MESSAGING_H_ #define S1AP_ENB_ITTI_MESSAGING_H_ -void s1ap_eNB_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer, - uint32_t buffer_length, uint16_t stream); +#include +#include + +void s1ap_eNB_itti_send_sctp_data_req(instance_t instance, + sctp_assoc_t assoc_id, + uint8_t *buffer, + uint32_t buffer_length, + uint16_t stream); void s1ap_eNB_itti_send_nas_downlink_ind(instance_t instance, uint16_t ue_initial_id, @@ -31,8 +37,6 @@ void s1ap_eNB_itti_send_nas_downlink_ind(instance_t instance, uint8_t *nas_pdu, uint32_t nas_pdu_length); -void s1ap_eNB_itti_send_sctp_close_association(instance_t instance, - int32_t assoc_id); - +void s1ap_eNB_itti_send_sctp_close_association(instance_t instance, sctp_assoc_t assoc_id); #endif /* S1AP_ENB_ITTI_MESSAGING_H_ */ diff --git a/openair3/S1AP/s1ap_eNB_management_procedures.c b/openair3/S1AP/s1ap_eNB_management_procedures.c index a870e975a2..e9effa7824 100644 --- a/openair3/S1AP/s1ap_eNB_management_procedures.c +++ b/openair3/S1AP/s1ap_eNB_management_procedures.c @@ -89,9 +89,7 @@ void s1ap_eNB_insert_new_instance(s1ap_eNB_instance_t *new_instance_p) new_instance_p, s1ap_eNB_entries); } -struct s1ap_eNB_mme_data_s *s1ap_eNB_get_MME( - s1ap_eNB_instance_t *instance_p, - int32_t assoc_id, uint16_t cnx_id) +struct s1ap_eNB_mme_data_s *s1ap_eNB_get_MME(s1ap_eNB_instance_t *instance_p, sctp_assoc_t assoc_id, uint16_t cnx_id) { struct s1ap_eNB_mme_data_s temp; struct s1ap_eNB_mme_data_s *found; diff --git a/openair3/S1AP/s1ap_eNB_management_procedures.h b/openair3/S1AP/s1ap_eNB_management_procedures.h index 83df7f8919..4ec8fba2f4 100644 --- a/openair3/S1AP/s1ap_eNB_management_procedures.h +++ b/openair3/S1AP/s1ap_eNB_management_procedures.h @@ -22,9 +22,7 @@ #ifndef S1AP_ENB_MANAGEMENT_PROCEDURES_H_ #define S1AP_ENB_MANAGEMENT_PROCEDURES_H_ -struct s1ap_eNB_mme_data_s *s1ap_eNB_get_MME( - s1ap_eNB_instance_t *instance_p, - int32_t assoc_id, uint16_t cnx_id); +struct s1ap_eNB_mme_data_s *s1ap_eNB_get_MME(s1ap_eNB_instance_t *instance_p, sctp_assoc_t assoc_id, uint16_t cnx_id); struct s1ap_eNB_mme_data_s *s1ap_eNB_get_MME_from_instance(s1ap_eNB_instance_t *instance_p); diff --git a/openair3/S1AP/s1ap_eNB_nas_procedures.c b/openair3/S1AP/s1ap_eNB_nas_procedures.c index d1eefc8b21..c8c844ac56 100644 --- a/openair3/S1AP/s1ap_eNB_nas_procedures.c +++ b/openair3/S1AP/s1ap_eNB_nas_procedures.c @@ -316,9 +316,7 @@ int s1ap_eNB_handle_nas_first_req( } //------------------------------------------------------------------------------ -int s1ap_eNB_handle_nas_downlink(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu) +int s1ap_eNB_handle_nas_downlink(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu) //------------------------------------------------------------------------------ { s1ap_eNB_mme_data_t *mme_desc_p = NULL; diff --git a/openair3/S1AP/s1ap_eNB_nas_procedures.h b/openair3/S1AP/s1ap_eNB_nas_procedures.h index 47f71cc795..35eaa94f89 100644 --- a/openair3/S1AP/s1ap_eNB_nas_procedures.h +++ b/openair3/S1AP/s1ap_eNB_nas_procedures.h @@ -22,10 +22,7 @@ #ifndef S1AP_ENB_NAS_PROCEDURES_H_ #define S1AP_ENB_NAS_PROCEDURES_H_ -int s1ap_eNB_handle_nas_downlink( - uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu); +int s1ap_eNB_handle_nas_downlink(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu); int s1ap_eNB_nas_uplink(instance_t instance, s1ap_uplink_nas_t *s1ap_uplink_nas_p); diff --git a/openair3/S1AP/s1ap_eNB_overload.c b/openair3/S1AP/s1ap_eNB_overload.c index 4266a7090c..15092c19f8 100644 --- a/openair3/S1AP/s1ap_eNB_overload.c +++ b/openair3/S1AP/s1ap_eNB_overload.c @@ -43,9 +43,7 @@ #include "assertions.h" -int s1ap_eNB_handle_overload_start(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu) +int s1ap_eNB_handle_overload_start(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu) { s1ap_eNB_mme_data_t *mme_desc_p; S1AP_OverloadStart_t *container; @@ -88,9 +86,7 @@ int s1ap_eNB_handle_overload_start(uint32_t assoc_id, return 0; } -int s1ap_eNB_handle_overload_stop(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu) +int s1ap_eNB_handle_overload_stop(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu) { /* We received Overload stop message, meaning that the MME is no more * overloaded. This is an empty message, with only message header and no diff --git a/openair3/S1AP/s1ap_eNB_overload.h b/openair3/S1AP/s1ap_eNB_overload.h index 8133345dee..bf6f95ac9d 100644 --- a/openair3/S1AP/s1ap_eNB_overload.h +++ b/openair3/S1AP/s1ap_eNB_overload.h @@ -28,9 +28,7 @@ // int s1ap_eNB_handle_overload_start(eNB_mme_desc_t *eNB_desc_p, // sctp_queue_item_t *packet_p, // struct s1ap_message_s *message_p); -int s1ap_eNB_handle_overload_start(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu); +int s1ap_eNB_handle_overload_start(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu); /** * \brief Handle an overload stop message @@ -38,8 +36,6 @@ int s1ap_eNB_handle_overload_start(uint32_t assoc_id, // int s1ap_eNB_handle_overload_stop(eNB_mme_desc_t *eNB_desc_p, // sctp_queue_item_t *packet_p, // struct s1ap_message_s *message_p); -int s1ap_eNB_handle_overload_stop(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu); +int s1ap_eNB_handle_overload_stop(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu); #endif /* S1AP_ENB_OVERLOAD_H_ */ diff --git a/openair3/S1AP/s1ap_eNB_trace.c b/openair3/S1AP/s1ap_eNB_trace.c index 38787a6999..1eb7abe704 100644 --- a/openair3/S1AP/s1ap_eNB_trace.c +++ b/openair3/S1AP/s1ap_eNB_trace.c @@ -101,9 +101,7 @@ void s1ap_eNB_generate_trace_failure(struct s1ap_eNB_ue_context_s *ue_desc_p, length, ue_desc_p->tx_stream); } -int s1ap_eNB_handle_trace_start(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu) +int s1ap_eNB_handle_trace_start(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu) { S1AP_TraceStart_t *container; S1AP_TraceStartIEs_t *ie; @@ -142,9 +140,7 @@ int s1ap_eNB_handle_trace_start(uint32_t assoc_id, return 0; } -int s1ap_eNB_handle_deactivate_trace(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *message_p) +int s1ap_eNB_handle_deactivate_trace(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *message_p) { // S1AP_DeactivateTraceIEs_t *deactivate_trace_p; // diff --git a/openair3/S1AP/s1ap_eNB_trace.h b/openair3/S1AP/s1ap_eNB_trace.h index 75f7a59dc4..b933221098 100644 --- a/openair3/S1AP/s1ap_eNB_trace.h +++ b/openair3/S1AP/s1ap_eNB_trace.h @@ -32,15 +32,11 @@ // int s1ap_eNB_handle_trace_start(eNB_mme_desc_t *eNB_desc_p, // sctp_queue_item_t *packet_p, // struct s1ap_message_s *message_p); -int s1ap_eNB_handle_trace_start(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu); +int s1ap_eNB_handle_trace_start(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu); // int s1ap_eNB_handle_deactivate_trace(eNB_mme_desc_t *eNB_desc_p, // sctp_queue_item_t *packet_p, // struct s1ap_message_s *message_p); -int s1ap_eNB_handle_deactivate_trace(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu); +int s1ap_eNB_handle_deactivate_trace(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu); #endif /* S1AP_ENB_TRACE_H_ */ diff --git a/openair3/SCTP/sctp_eNB_defs.h b/openair3/SCTP/sctp_eNB_defs.h index 9d3b4119b5..6f4551cd83 100644 --- a/openair3/SCTP/sctp_eNB_defs.h +++ b/openair3/SCTP/sctp_eNB_defs.h @@ -19,11 +19,13 @@ * contact@openairinterface.org */ -#include "queue.h" - #ifndef SCTP_ENB_DEFS_H_ #define SCTP_ENB_DEFS_H_ +#include "queue.h" +#include +#include + typedef struct sctp_queue_item_s { /* Pair of stream on which we received this packet */ uint16_t local_stream; @@ -32,7 +34,7 @@ typedef struct sctp_queue_item_s { uint16_t remote_port; /* Remote address */ uint32_t remote_addr; - uint32_t assoc_id; + sctp_assoc_t assoc_id; /* PPID used for the packet */ uint32_t ppid; @@ -52,7 +54,7 @@ typedef struct { /* Unique SCTP association ID (Local to host), used to distinguish * associations between MME and eNB. */ - int32_t assoc_id; + sctp_assoc_t assoc_id; /* Current remote port used for transmission */ uint16_t remote_port; diff --git a/openair3/SCTP/sctp_eNB_itti_messaging.c b/openair3/SCTP/sctp_eNB_itti_messaging.c index c31d4ba9ed..40472ed923 100644 --- a/openair3/SCTP/sctp_eNB_itti_messaging.c +++ b/openair3/SCTP/sctp_eNB_itti_messaging.c @@ -38,9 +38,12 @@ int sctp_itti_send_init_msg_multi_cnf(task_id_t task_id, instance_t instance, in return itti_send_msg_to_task(task_id, instance, message_p); } -int sctp_itti_send_new_message_ind(task_id_t task_id, instance_t instance, - uint32_t assoc_id, uint8_t *buffer, - uint32_t buffer_length, uint16_t stream) +int sctp_itti_send_new_message_ind(task_id_t task_id, + instance_t instance, + sctp_assoc_t assoc_id, + uint8_t *buffer, + uint32_t buffer_length, + uint16_t stream) { MessageDef *message_p; sctp_data_ind_t *sctp_data_ind_p; @@ -61,10 +64,13 @@ int sctp_itti_send_new_message_ind(task_id_t task_id, instance_t instance, return itti_send_msg_to_task(task_id, instance, message_p); } -int sctp_itti_send_association_resp(task_id_t task_id, instance_t instance, - int32_t assoc_id, - uint16_t cnx_id, enum sctp_state_e state, - uint16_t out_streams, uint16_t in_streams) +int sctp_itti_send_association_resp(task_id_t task_id, + instance_t instance, + sctp_assoc_t assoc_id, + uint16_t cnx_id, + enum sctp_state_e state, + uint16_t out_streams, + uint16_t in_streams) { MessageDef *message_p; sctp_new_association_resp_t *sctp_new_association_resp_p; @@ -82,9 +88,12 @@ int sctp_itti_send_association_resp(task_id_t task_id, instance_t instance, return itti_send_msg_to_task(task_id, instance, message_p); } -int sctp_itti_send_association_ind(task_id_t task_id, instance_t instance, - int32_t assoc_id, uint16_t port, - uint16_t out_streams, uint16_t in_streams) +int sctp_itti_send_association_ind(task_id_t task_id, + instance_t instance, + sctp_assoc_t assoc_id, + uint16_t port, + uint16_t out_streams, + uint16_t in_streams) { MessageDef *message_p; sctp_new_association_ind_t *sctp_new_association_ind_p; diff --git a/openair3/SCTP/sctp_eNB_itti_messaging.h b/openair3/SCTP/sctp_eNB_itti_messaging.h index a35dc2219a..a91e95493c 100644 --- a/openair3/SCTP/sctp_eNB_itti_messaging.h +++ b/openair3/SCTP/sctp_eNB_itti_messaging.h @@ -24,18 +24,26 @@ int sctp_itti_send_init_msg_multi_cnf(task_id_t task_id, instance_t instance, int multi_sd); -int sctp_itti_send_new_message_ind(task_id_t task_id, instance_t instance, - uint32_t assoc_id, uint8_t *buffer, - uint32_t buffer_length, uint16_t stream); +int sctp_itti_send_new_message_ind(task_id_t task_id, + instance_t instance, + sctp_assoc_t assoc_id, + uint8_t *buffer, + uint32_t buffer_length, + uint16_t stream); -int sctp_itti_send_association_resp(task_id_t task_id, instance_t instance, - int32_t assoc_id, - uint16_t cnx_id, enum sctp_state_e state, - uint16_t out_streams, uint16_t in_streams); - -int sctp_itti_send_association_ind(task_id_t task_id, instance_t instance, - int32_t assoc_id, uint16_t port, - uint16_t out_streams, uint16_t in_streams); +int sctp_itti_send_association_resp(task_id_t task_id, + instance_t instance, + sctp_assoc_t assoc_id, + uint16_t cnx_id, + enum sctp_state_e state, + uint16_t out_streams, + uint16_t in_streams); +int sctp_itti_send_association_ind(task_id_t task_id, + instance_t instance, + sctp_assoc_t assoc_id, + uint16_t port, + uint16_t out_streams, + uint16_t in_streams); #endif /* SCTP_ITTI_MESSAGING_H_ */ diff --git a/openair3/SCTP/sctp_eNB_task.c b/openair3/SCTP/sctp_eNB_task.c index 35a2692bd4..6701521b8c 100644 --- a/openair3/SCTP/sctp_eNB_task.c +++ b/openair3/SCTP/sctp_eNB_task.c @@ -77,7 +77,7 @@ typedef struct sctp_cnx_list_elm_s { uint16_t in_streams; ///< Number of input streams negociated for this connection uint16_t out_streams; ///< Number of output streams negotiated for this connection uint16_t ppid; ///< Payload protocol Identifier - int32_t assoc_id; ///< SCTP association id for the connection (note4debug host byte order) + sctp_assoc_t assoc_id; ///< SCTP association id for the connection (note4debug host byte order) uint32_t messages_recv; ///< Number of messages received on this connection uint32_t messages_sent; ///< Number of messages sent on this connection task_id_t task_id; ///< Task id of the task who asked for this connection @@ -93,7 +93,7 @@ static STAILQ_HEAD(sctp_cnx_list_head, sctp_cnx_list_elm_s) sctp_cnx_list; static uint16_t sctp_nb_cnx = 0; //------------------------------------------------------------------------------ -struct sctp_cnx_list_elm_s *sctp_get_cnx(int32_t assoc_id, int sd) +struct sctp_cnx_list_elm_s *sctp_get_cnx(sctp_assoc_t assoc_id, int sd) { struct sctp_cnx_list_elm_s *elm; @@ -225,7 +225,7 @@ sctp_handle_new_association_req_multi( int ns; int sd; - int32_t assoc_id = 0; + sctp_assoc_t assoc_id = 0; struct sctp_cnx_list_elm_s *sctp_cnx = NULL; enum sctp_connection_type_e connection_type = SCTP_TYPE_CLIENT; @@ -362,7 +362,7 @@ sctp_handle_new_association_req( const sctp_new_association_req_t * const sctp_new_association_req_p) { int sd = 0; - int32_t assoc_id = 0; + sctp_assoc_t assoc_id = 0; struct sctp_event_subscribe events={0}; diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/cu_gnb.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/cu_gnb.conf index 88742a5ffa..493680900c 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/cu_gnb.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/cu_gnb.conf @@ -18,7 +18,6 @@ gNBs = plmn_list = ({ mcc = 208; mnc = 99; mnc_length = 2; snssaiList = ({ sst = 1 }) }); nr_cellid = 12345678L; - force_256qam_off = 1; tr_s_preference = "f1"; @@ -29,135 +28,7 @@ gNBs = local_s_portd = 2152; remote_s_portc = 500; remote_s_portd = 2152; - min_rxtxtime = 6; - servingCellConfigCommon = ( - { - #spCellConfigCommon - - physCellId = 0; - -# downlinkConfigCommon - #frequencyInfoDL - # this is 3600 MHz + 43 PRBs@30kHz SCS (same as initial BWP) - absoluteFrequencySSB = 641280; - dl_frequencyBand = 78; - # this is 3600 MHz - dl_absoluteFrequencyPointA = 640008; - #scs-SpecificCarrierList - dl_offstToCarrier = 0; -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - dl_subcarrierSpacing = 1; - dl_carrierBandwidth = 106; - #initialDownlinkBWP - #genericParameters - # this is RBstart=27,L=48 (275*(L-1))+RBstart - initialDLBWPlocationAndBandwidth = 28875; # 6366 12925 12956 28875 12952 -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - initialDLBWPsubcarrierSpacing = 1; - #pdcch-ConfigCommon - initialDLBWPcontrolResourceSetZero = 12; - initialDLBWPsearchSpaceZero = 0; - - #uplinkConfigCommon - #frequencyInfoUL - ul_frequencyBand = 78; - #scs-SpecificCarrierList - ul_offstToCarrier = 0; -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - ul_subcarrierSpacing = 1; - ul_carrierBandwidth = 106; - pMax = 20; - #initialUplinkBWP - #genericParameters - initialULBWPlocationAndBandwidth = 28875; -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - initialULBWPsubcarrierSpacing = 1; - #rach-ConfigCommon - #rach-ConfigGeneric - prach_ConfigurationIndex = 98; -#prach_msg1_FDM -#0 = one, 1=two, 2=four, 3=eight - prach_msg1_FDM = 0; - prach_msg1_FrequencyStart = 0; - zeroCorrelationZoneConfig = 13; - preambleReceivedTargetPower = -96; -#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) - preambleTransMax = 6; -#powerRampingStep -# 0=dB0,1=dB2,2=dB4,3=dB6 - powerRampingStep = 1; -#ra_ReponseWindow -#1,2,4,8,10,20,40,80 - ra_ResponseWindow = 4; -#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR -#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen - ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4; -#oneHalf (0..15) 4,8,12,16,...60,64 - ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 14; -#ra_ContentionResolutionTimer -#(0..7) 8,16,24,32,40,48,56,64 - ra_ContentionResolutionTimer = 7; - rsrp_ThresholdSSB = 19; -#prach-RootSequenceIndex_PR -#1 = 839, 2 = 139 - prach_RootSequenceIndex_PR = 2; - prach_RootSequenceIndex = 1; - # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex - # - msg1_SubcarrierSpacing = 1, -# restrictedSetConfig -# 0=unrestricted, 1=restricted type A, 2=restricted type B - restrictedSetConfig = 0, - - msg3_DeltaPreamble = 1; - p0_NominalWithGrant =-90; - -# pucch-ConfigCommon setup : -# pucchGroupHopping -# 0 = neither, 1= group hopping, 2=sequence hopping - pucchGroupHopping = 0; - hoppingId = 40; - p0_nominal = -90; -# ssb_PositionsInBurs_BitmapPR -# 1=short, 2=medium, 3=long - ssb_PositionsInBurst_PR = 2; - ssb_PositionsInBurst_Bitmap = 1; - -# ssb_periodicityServingCell -# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 - ssb_periodicityServingCell = 2; - -# dmrs_TypeA_position -# 0 = pos2, 1 = pos3 - dmrs_TypeA_Position = 0; - -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - subcarrierSpacing = 1; - - - #tdd-UL-DL-ConfigurationCommon -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - referenceSubcarrierSpacing = 1; - # pattern1 - # dl_UL_TransmissionPeriodicity - # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10 - dl_UL_TransmissionPeriodicity = 6; - nrofDownlinkSlots = 7; - nrofDownlinkSymbols = 6; - nrofUplinkSlots = 2; - nrofUplinkSymbols = 4; - - ssPBCH_BlockPower = -25; - } - - ); # ------- SCTP definitions SCTP : {