From fa356620445b2aee53377c5d30873c193704a1c4 Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Tue, 17 Nov 2020 14:10:10 +0100 Subject: [PATCH 001/231] 10 MHz config file --- .../CONF/testing_gnb_24PRB.conf | 297 ++++++++++++++++++ 1 file changed, 297 insertions(+) create mode 100644 targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_24PRB.conf diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_24PRB.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_24PRB.conf new file mode 100644 index 0000000000..df1aa852e4 --- /dev/null +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_24PRB.conf @@ -0,0 +1,297 @@ +Active_gNBs = ( "gNB-Eurecom-5GNRBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +gNBs = +( + { + ////////// Identification parameters: + gNB_ID = 0xe00; + + cell_type = "CELL_MACRO_GNB"; + + gNB_name = "gNB-Eurecom-5GNRBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 1; + + plmn_list = ({mcc = 222; mnc = 01; mnc_length = 2;}); + + tr_s_preference = "local_mac" + + ////////// Physical parameters: + + ssb_SubcarrierOffset = 31; //0; + pdsch_AntennaPorts = 1; + pusch_TargetSNRx10 = 200; + pucch_TargetSNRx10 = 200; + + servingCellConfigCommon = ( + { + #spCellConfigCommon + + physCellId = 0; + +# downlinkConfigCommon + #frequencyInfoDL + # this is 3600 MHz + 12 PRBs@30kHz SCS + absoluteFrequencySSB = 640288; + dl_frequencyBand = 78; + # this is 3600 MHz + dl_absoluteFrequencyPointA = 640000; + #scs-SpecificCarrierList + dl_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + dl_subcarrierSpacing = 1; + dl_carrierBandwidth = 24; + #initialDownlinkBWP + #genericParameters + # this is RBstart=0,L=24 (275*(L-1))+RBstart + initialDLBWPlocationAndBandwidth = 6325; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialDLBWPsubcarrierSpacing = 1; + #pdcch-ConfigCommon + initialDLBWPcontrolResourceSetZero = 0; + initialDLBWPsearchSpaceZero = 0; + #pdsch-ConfigCommon + #pdschTimeDomainAllocationList (up to 16 entries) + initialDLBWPk0_0 = 0; + #initialULBWPmappingType + #0=typeA,1=typeB + initialDLBWPmappingType_0 = 0; + #this is SS=1,L=13 + initialDLBWPstartSymbolAndLength_0 = 40; + + initialDLBWPk0_1 = 0; + initialDLBWPmappingType_1 = 0; + #this is SS=2,L=12 + initialDLBWPstartSymbolAndLength_1 = 53; + + initialDLBWPk0_2 = 0; + initialDLBWPmappingType_2 = 0; + #this is SS=1,L=12 + initialDLBWPstartSymbolAndLength_2 = 54; + + initialDLBWPk0_3 = 0; + initialDLBWPmappingType_3 = 0; + #this is SS=1,L=4 //5 (4 is for 43, 5 is for 57) + initialDLBWPstartSymbolAndLength_3 = 57; //43; //57; + #uplinkConfigCommon + #frequencyInfoUL + ul_frequencyBand = 78; + #scs-SpecificCarrierList + ul_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + ul_subcarrierSpacing = 1; + ul_carrierBandwidth = 24; + pMax = 20; + #initialUplinkBWP + #genericParameters + initialULBWPlocationAndBandwidth = 6325; +# 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 = -100; +#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 = 5; +#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; //15; +#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, + # pusch-ConfigCommon (up to 16 elements) + initialULBWPk2_0 = 2; + initialULBWPmappingType_0 = 1 + # this is SS=0 L=12 + initialULBWPstartSymbolAndLength_0 = 55; + + initialULBWPk2_1 = 2; + initialULBWPmappingType_1 = 1; + # this is SS=0 L=11 + initialULBWPstartSymbolAndLength_1 = 69; + + initialULBWPk2_2 = 7; + initialULBWPmappingType_2 = 1; + # this is SS=10 L=4 + initialULBWPstartSymbolAndLength_2 = 52; + + 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; #0x80; + +# 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; //8; //7; + nrofDownlinkSymbols = 6; //0; //6; + nrofUplinkSlots = 2; + nrofUplinkSymbols = 4; //0; //4; + + ssPBCH_BlockPower = -25; + } + + ); + + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "192.168.18.99"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + ///X2 + enable_x2 = "yes"; + t_reloc_prep = 1000; /* unit: millisecond */ + tx2_reloc_overall = 2000; /* unit: millisecond */ + t_dc_prep = 1000; /* unit: millisecond */ + t_dc_overall = 2000; /* unit: millisecond */ + target_enb_x2_ip_address = ( + { ipv4 = "192.168.18.199"; + ipv6 = "192:168:30::17"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + + GNB_INTERFACE_NAME_FOR_S1_MME = "eth0"; + GNB_IPV4_ADDRESS_FOR_S1_MME = "192.168.18.198/24"; + GNB_INTERFACE_NAME_FOR_S1U = "eth0"; + GNB_IPV4_ADDRESS_FOR_S1U = "192.168.18.198/24"; + GNB_PORT_FOR_S1U = 2152; # Spec 2152 + GNB_IPV4_ADDRESS_FOR_X2C = "192.168.18.198/24"; + GNB_PORT_FOR_X2C = 36422; # Spec 36422 + }; + } +); + +MACRLCs = ( + { + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + } +); + +L1s = ( + { + num_cc = 1; + tr_n_preference = "local_mac"; + } +); + +RUs = ( + { + local_rf = "yes" + nb_tx = 1 + nb_rx = 1 + att_tx = 0 + att_rx = 0; + bands = [7]; + max_pdschReferenceSignalPower = -27; + max_rxgain = 114; + eNB_instances = [0]; + clock_src = "external"; + } +); + +THREAD_STRUCT = ( + { + #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" + parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; + //parallel_config = "PARALLEL_SINGLE_THREAD"; + #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" + worker_config = "WORKER_ENABLE"; + } +); + + log_config : + { + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + }; + From 450f98228ab1cd27fe5fbe570d794bd8af404e6c Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Wed, 18 Nov 2020 17:21:30 +0100 Subject: [PATCH 002/231] 10 MHz USRP n300 config file --- .../CONF/gnb.band78.tm1.24PRB.usrpn300.conf | 283 ++++++++++++++++++ 1 file changed, 283 insertions(+) create mode 100644 targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpn300.conf diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpn300.conf new file mode 100644 index 0000000000..75b2b6c27d --- /dev/null +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpn300.conf @@ -0,0 +1,283 @@ +Active_gNBs = ( "gNB-Eurecom-5GNRBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +gNBs = +( + { + ////////// Identification parameters: + gNB_ID = 0xe00; + + cell_type = "CELL_MACRO_GNB"; + + gNB_name = "gNB-Eurecom-5GNRBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 1; + + plmn_list = ({mcc = 208; mnc = 93; mnc_length = 2;}); + + tr_s_preference = "local_mac" + + ////////// Physical parameters: + + ssb_SubcarrierOffset = 0; + pdsch_AntennaPorts = 1; + + servingCellConfigCommon = ( + { + #spCellConfigCommon + + physCellId = 0; + +# downlinkConfigCommon + #frequencyInfoDL + # this is 3600 MHz + 43 PRBs@30kHz SCS (same as initial BWP) + absoluteFrequencySSB = 640288; + dl_frequencyBand = 78; + # this is 3600 MHz + dl_absoluteFrequencyPointA = 640000; + #scs-SpecificCarrierList + dl_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + dl_subcarrierSpacing = 1; + dl_carrierBandwidth = 24; + #initialDownlinkBWP + #genericParameters + # this is RBstart=41,L=24 (275*(L-1))+RBstart + initialDLBWPlocationAndBandwidth = 6325; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialDLBWPsubcarrierSpacing = 1; + #pdcch-ConfigCommon + initialDLBWPcontrolResourceSetZero = 0; + initialDLBWPsearchSpaceZero = 0; + #pdsch-ConfigCommon + #pdschTimeDomainAllocationList (up to 16 entries) + initialDLBWPk0_0 = 0; + #initialULBWPmappingType + #0=typeA,1=typeB + initialDLBWPmappingType_0 = 0; + #this is SS=1,L=13 + initialDLBWPstartSymbolAndLength_0 = 40; + + initialDLBWPk0_1 = 0; + initialDLBWPmappingType_1 = 0; + #this is SS=2,L=12 + initialDLBWPstartSymbolAndLength_1 = 53; + + initialDLBWPk0_2 = 0; + initialDLBWPmappingType_2 = 0; + #this is SS=1,L=12 + initialDLBWPstartSymbolAndLength_2 = 54; + + initialDLBWPk0_3 = 0; + initialDLBWPmappingType_3 = 0; + #this is SS=1,L=5 + initialDLBWPstartSymbolAndLength_3 = 57; + + #uplinkConfigCommon + #frequencyInfoUL + ul_frequencyBand = 78; + #scs-SpecificCarrierList + ul_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + ul_subcarrierSpacing = 1; + ul_carrierBandwidth = 24; + pMax = 20; + #initialUplinkBWP + #genericParameters + initialULBWPlocationAndBandwidth = 6325; +# 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 = -118; +#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 = 15; +#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, + + # pusch-ConfigCommon (up to 16 elements) + initialULBWPk2_0 = 6; + initialULBWPmappingType_0 = 1 + # this is SS=0 L=11 + initialULBWPstartSymbolAndLength_0 = 55; + + initialULBWPk2_1 = 6; + initialULBWPmappingType_1 = 1; + # this is SS=0 L=12 + initialULBWPstartSymbolAndLength_1 = 69; + + initialULBWPk2_2 = 7; + initialULBWPmappingType_2 = 1; + # this is SS=10 L=4 + initialULBWPstartSymbolAndLength_2 = 52; + + 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 = 10; + } + + ); + + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "192.168.12.26"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + + GNB_INTERFACE_NAME_FOR_S1_MME = "eth0"; + GNB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.111/24"; + GNB_INTERFACE_NAME_FOR_S1U = "eth0"; + GNB_IPV4_ADDRESS_FOR_S1U = "192.168.12.111/24"; + GNB_PORT_FOR_S1U = 2152; # Spec 2152 + }; + } +); + +MACRLCs = ( + { + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + } +); + +L1s = ( + { + num_cc = 1; + tr_n_preference = "local_mac"; + } +); + +RUs = ( + { + local_rf = "yes" + nb_tx = 1 + nb_rx = 1 + att_tx = 0 + att_rx = 0; + bands = [7]; + max_pdschReferenceSignalPower = -27; + max_rxgain = 75; + eNB_instances = [0]; + #beamforming 1x4 matrix: + bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000]; + sdr_addrs = "addr=192.168.10.2,mgmt_addr=192.168.10.2,second_addr=192.168.20.2"; + clock_src = "external"; + } +); + +THREAD_STRUCT = ( + { + #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" + parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; + #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" + worker_config = "WORKER_ENABLE"; + } +); + + log_config : + { + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + }; + From 6a0ec688c9fd3f4ad89e7fd82ff27a17c23efed7 Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Wed, 18 Nov 2020 17:29:24 +0100 Subject: [PATCH 003/231] modifications in RRC for lower number of RBs --- openair2/RRC/NR/rrc_gNB_reconfig.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index a9e27da95d..68710ed2bc 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -412,12 +412,21 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->controlResourceSetZero=NULL; bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonControlResourceSet=calloc(1,sizeof(*bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonControlResourceSet)); + int curr_bwp = NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth,275); + NR_ControlResourceSet_t *coreset = calloc(1,sizeof(*coreset)); coreset->controlResourceSetId=1; - // frequencyDomainResources '11111111 11111111 00000000 00000000 00000000 00000'B, + // frequency domain resources depends on BWP size + // options are 24, 48 or 96 coreset->frequencyDomainResources.buf = calloc(1,6); - coreset->frequencyDomainResources.buf[0] = 0xff; - coreset->frequencyDomainResources.buf[1] = 0xff; + if (curr_bwp < 48) + coreset->frequencyDomainResources.buf[0] = 0xf0; + else + coreset->frequencyDomainResources.buf[0] = 0xff; + if (curr_bwp < 96) + coreset->frequencyDomainResources.buf[1] = 0; + else + coreset->frequencyDomainResources.buf[1] = 0xff; coreset->frequencyDomainResources.buf[2] = 0; coreset->frequencyDomainResources.buf[3] = 0; coreset->frequencyDomainResources.buf[4] = 0; @@ -531,7 +540,12 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco ss2->nrofCandidates=calloc(1,sizeof(*ss2->nrofCandidates)); ss2->nrofCandidates->aggregationLevel1 = NR_SearchSpace__nrofCandidates__aggregationLevel1_n0; ss2->nrofCandidates->aggregationLevel2 = NR_SearchSpace__nrofCandidates__aggregationLevel2_n0; - ss2->nrofCandidates->aggregationLevel4 = NR_SearchSpace__nrofCandidates__aggregationLevel4_n4; + if (curr_bwp < 48) + ss2->nrofCandidates->aggregationLevel4 = NR_SearchSpace__nrofCandidates__aggregationLevel4_n1; + else if (curr_bwp < 96) + ss2->nrofCandidates->aggregationLevel4 = NR_SearchSpace__nrofCandidates__aggregationLevel4_n2; + else + ss2->nrofCandidates->aggregationLevel4 = NR_SearchSpace__nrofCandidates__aggregationLevel4_n4; ss2->nrofCandidates->aggregationLevel8 = NR_SearchSpace__nrofCandidates__aggregationLevel8_n0; ss2->nrofCandidates->aggregationLevel16 = NR_SearchSpace__nrofCandidates__aggregationLevel16_n0; ss2->searchSpaceType=calloc(1,sizeof(*ss2->searchSpaceType)); @@ -915,7 +929,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco NR_PUCCH_Resource_t *pucchres2=calloc(1,sizeof(*pucchres2)); NR_PUCCH_Resource_t *pucchres3=calloc(1,sizeof(*pucchres3)); pucchres0->pucch_ResourceId=1; - pucchres0->startingPRB=48; + pucchres0->startingPRB=8; pucchres0->intraSlotFrequencyHopping=NULL; pucchres0->secondHopPRB=NULL; pucchres0->format.present= NR_PUCCH_Resource__format_PR_format0; @@ -926,7 +940,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco ASN_SEQUENCE_ADD(&pucch_Config->resourceToAddModList->list,pucchres0); pucchres1->pucch_ResourceId=2; - pucchres1->startingPRB=48; + pucchres1->startingPRB=8; pucchres1->intraSlotFrequencyHopping=NULL; pucchres1->secondHopPRB=NULL; pucchres1->format.present= NR_PUCCH_Resource__format_PR_format0; @@ -937,7 +951,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco ASN_SEQUENCE_ADD(&pucch_Config->resourceToAddModList->list,pucchres1); pucchres2->pucch_ResourceId=3; - pucchres2->startingPRB=40; + pucchres2->startingPRB=0; pucchres2->intraSlotFrequencyHopping=NULL; pucchres2->secondHopPRB=NULL; pucchres2->format.present= NR_PUCCH_Resource__format_PR_format2; @@ -948,7 +962,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco ASN_SEQUENCE_ADD(&pucch_Config->resourceToAddModList->list,pucchres2); pucchres3->pucch_ResourceId=4; - pucchres3->startingPRB=40; + pucchres3->startingPRB=0; pucchres3->intraSlotFrequencyHopping=NULL; pucchres3->secondHopPRB=NULL; pucchres3->format.present= NR_PUCCH_Resource__format_PR_format2; From 78e0af5893b0596ef449fe00e407d706d7b8b5a2 Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Wed, 18 Nov 2020 17:45:05 +0100 Subject: [PATCH 004/231] adding 10MHz option (values to be verified) --- executables/nr-ru.c | 9 +++++++++ openair1/PHY/INIT/nr_parms.c | 8 +++++++- openair1/SCHED_NR/phy_procedures_nr_gNB.c | 1 + 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/executables/nr-ru.c b/executables/nr-ru.c index feff0c29c2..7d4e3607df 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -1113,6 +1113,15 @@ void fill_rf_config(RU_t *ru, char *rf_config_file) { cfg->tx_bw = 40e6; cfg->rx_bw = 40e6; } + } else if(N_RB == 24) { + if (fp->threequarter_fs) { + AssertFatal(0 == 1,"three quarter sampling not supported for N_RB 24\n"); + } else { + cfg->sample_rate=15.36e6; + cfg->samples_per_frame = 153600; + cfg->tx_bw = 10e6; + cfg->rx_bw = 10e6; + } } else { AssertFatal(0==1,"N_RB %d not yet supported for numerology %d\n",N_RB,mu); } diff --git a/openair1/PHY/INIT/nr_parms.c b/openair1/PHY/INIT/nr_parms.c index 92d8c2a1c6..db7a30183b 100644 --- a/openair1/PHY/INIT/nr_parms.c +++ b/openair1/PHY/INIT/nr_parms.c @@ -108,6 +108,12 @@ void set_scs_parameters (NR_DL_FRAME_PARMS *fp, int mu, uint16_t bw) switch(bw){ case 5: + case 10: + fp->ofdm_symbol_size = 512; + fp->first_carrier_offset = 368; //512 - ( (24*12) / 2 ) + fp->nb_prefix_samples0 = 44; + fp->nb_prefix_samples = 36; + break; case 15: case 20: case 25: @@ -200,7 +206,7 @@ void set_scs_parameters (NR_DL_FRAME_PARMS *fp, int mu, uint16_t bw) break; case 50: fp->ofdm_symbol_size = 512; - fp->first_carrier_offset = 320; //1024 - ( (66*12) / 2 ) + fp->first_carrier_offset = 320; //512 - ( (32*12) / 2 ) fp->nb_prefix_samples0 = 68; fp->nb_prefix_samples = 36; break; diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index 9ad0afba85..3ab58c35a7 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -379,6 +379,7 @@ void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id, // scale the 16 factor in N_TA calculation in 38.213 section 4.2 according to the used FFT size switch (gNB->frame_parms.N_RB_DL) { + case 24: timing_advance_update /= 4; break; case 106: timing_advance_update /= 16; break; case 217: timing_advance_update /= 32; break; case 245: timing_advance_update /= 32; break; From 8ac98d553f573272a5eaa08953021f8bf9892702 Mon Sep 17 00:00:00 2001 From: Florian Kaltenberger Date: Mon, 2 Nov 2020 14:19:14 +0100 Subject: [PATCH 005/231] first version of PRACH for FR2. to be tested --- openair1/PHY/INIT/nr_init.c | 17 +- openair1/PHY/NR_TRANSPORT/nr_prach.c | 259 +++++++++++++----------- openair1/PHY/NR_UE_TRANSPORT/nr_prach.c | 224 ++++++++++++++++---- openair1/SIMULATION/NR_PHY/prachsim.c | 25 ++- 4 files changed, 352 insertions(+), 173 deletions(-) diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index 80469f3e81..49ec60c94b 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -431,11 +431,18 @@ void nr_phy_config_request_sim(PHY_VARS_gNB *gNB, //gNB_config->subframe_config.dl_cyclic_prefix_type.value = (fp->Ncp == NORMAL) ? NFAPI_CP_NORMAL : NFAPI_CP_EXTENDED; gNB->mac_enabled = 1; - fp->dl_CarrierFreq = 3500000000;//from_nrarfcn(gNB_config->nfapi_config.rf_bands.rf_band[0],gNB_config->nfapi_config.nrarfcn.value); - fp->ul_CarrierFreq = 3500000000;//fp->dl_CarrierFreq - (get_uldl_offset(gNB_config->nfapi_config.rf_bands.rf_band[0])*100000); - fp->nr_band = 78; -// fp->threequarter_fs= 0; - + if (mu==1) { + fp->dl_CarrierFreq = 3500000000;//from_nrarfcn(gNB_config->nfapi_config.rf_bands.rf_band[0],gNB_config->nfapi_config.nrarfcn.value); + fp->ul_CarrierFreq = 3500000000;//fp->dl_CarrierFreq - (get_uldl_offset(gNB_config->nfapi_config.rf_bands.rf_band[0])*100000); + fp->nr_band = 78; + // fp->threequarter_fs= 0; + } else if (mu==3) { + fp->dl_CarrierFreq = 27524520000;//from_nrarfcn(gNB_config->nfapi_config.rf_bands.rf_band[0],gNB_config->nfapi_config.nrarfcn.value); + fp->ul_CarrierFreq = 27524520000;//fp->dl_CarrierFreq - (get_uldl_offset(gNB_config->nfapi_config.rf_bands.rf_band[0])*100000); + fp->nr_band = 261; + // fp->threequarter_fs= 0; + } + gNB_config->carrier_config.dl_bandwidth.value = config_bandwidth(mu, N_RB_DL, fp->nr_band); nr_init_frame_parms(gNB_config, fp); diff --git a/openair1/PHY/NR_TRANSPORT/nr_prach.c b/openair1/PHY/NR_TRANSPORT/nr_prach.c index ba0705cde7..3c4a1a41ff 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_prach.c +++ b/openair1/PHY/NR_TRANSPORT/nr_prach.c @@ -188,7 +188,7 @@ void rx_nr_prach_ru(RU_t *ru, prach[aa] = (int16_t*)&ru->common.rxdata[aa][(slot2*fp->get_samples_per_slot(slot,fp))+sample_offset_slot-ru->N_TA_offset]; } - + idft_size_idx_t dftsize; int dftlen=0; int mu = fp->numerology_index; int Ncp = 0; @@ -269,7 +269,8 @@ void rx_nr_prach_ru(RU_t *ru, if (LOG_DEBUGFLAG(PRACH)) { LOG_D(PHY,"rx_prach: Doing PRACH FFT for nb_rx:%d Ncp:%d\n",ru->nb_rx, Ncp); } - AssertFatal(mu==1,"only 30 kHz SCS handled for now\n"); + + // Note: Assumes PUSCH SCS @ 30 kHz, take values for formats 0-2 and adjust for others below int kbar = 1; @@ -299,6 +300,7 @@ void rx_nr_prach_ru(RU_t *ru, AssertFatal(prach[aa]!=NULL,"prach[%d] is null\n",aa); // do DFT + if (mu==1) { if (fp->N_RB_UL <= 100) AssertFatal(1==0,"N_RB_UL %d not support for NR PRACH yet\n",fp->N_RB_UL); else if (fp->N_RB_UL < 137) { @@ -327,36 +329,29 @@ void rx_nr_prach_ru(RU_t *ru, } }// 839 sequence else { - if ((mu==0 && - (prachStartSymbol == 0 || prachStartSymbol == 7)) || - (mu==1 && prachStartSymbol == 0)) prach2+=64; // 32 samples @ 61.44 Ms/s in first symbol of each half subframe (15/30 kHz only) + if (prachStartSymbol == 0) + prach2+=64; // 32 samples @ 61.44 Ms/s in first symbol of each half subframe (15/30 kHz only) - if (mu==0) AssertFatal(1==0,"Shouldn't get here\n"); - else if (mu==1) { - dftlen=2048; - dft(DFT_2048,prach2,rxsigF[aa],1); - if (prachFormat != 9/*C0*/) { - dft(DFT_2048,prach2+4096,rxsigF[aa]+4096,1); - reps++; - } - if (prachFormat == 5/*A2*/ || prachFormat == 6/*A3*/|| prachFormat == 8/*B4*/ || prachFormat == 10/*C2*/) { - dft(DFT_2048,prach2+4096*2,rxsigF[aa]+4096*2,1); - dft(DFT_2048,prach2+4096*3,rxsigF[aa]+4096*3,1); - reps+=2; - } - if (prachFormat == 6/*A3*/ || prachFormat == 8/*B4*/) { - dft(DFT_2048,prach2+4096*4,rxsigF[aa]+4096*4,1); - dft(DFT_2048,prach2+4096*5,rxsigF[aa]+4096*5,1); - reps+=2; - } - if (prachFormat == 8/*B4*/) { - for (int i=6;i<12;i++) dft(DFT_2048,prach2+(4096*i),rxsigF[aa]+(4096*i),1); - reps+=6; - } + dftlen=2048; + dft(DFT_2048,prach2,rxsigF[aa],1); + if (prachFormat != 9/*C0*/) { + dft(DFT_2048,prach2+4096,rxsigF[aa]+4096,1); + reps++; + } + if (prachFormat == 5/*A2*/ || prachFormat == 6/*A3*/|| prachFormat == 8/*B4*/ || prachFormat == 10/*C2*/) { + dft(DFT_2048,prach2+4096*2,rxsigF[aa]+4096*2,1); + dft(DFT_2048,prach2+4096*3,rxsigF[aa]+4096*3,1); + reps+=2; + } + if (prachFormat == 6/*A3*/ || prachFormat == 8/*B4*/) { + dft(DFT_2048,prach2+4096*4,rxsigF[aa]+4096*4,1); + dft(DFT_2048,prach2+4096*5,rxsigF[aa]+4096*5,1); + reps+=2; + } + if (prachFormat == 8/*B4*/) { + for (int i=6;i<12;i++) dft(DFT_2048,prach2+(4096*i),rxsigF[aa]+(4096*i),1); + reps+=6; } - else if (mu==2) AssertFatal(1==0,"Shouldn't get here\n"); - else if (mu==3) AssertFatal(1==0,"Shouldn't get here\n"); - else if (mu==4) AssertFatal(1==0,"Shouldn't get here\n"); } } else { // threequarter sampling // 40 MHz @ 46.08 Ms/s @@ -383,36 +378,28 @@ void rx_nr_prach_ru(RU_t *ru, reps=4; } } else { - if ((mu==0 && - (prachStartSymbol == 0 || prachStartSymbol == 7)) || - (mu==1 && prachStartSymbol == 0)) prach2+=48; // 24 samples @ 46.08 Ms/s in first symbol of each half subframe (15/30 kHz only) - if (mu==0) AssertFatal(1==0,"Shouldn't get here\n"); - else if (mu==1) { - dftlen=1536; - dft(DFT_1536,prach2,rxsigF[aa],1); - if (prachFormat != 9/*C0*/) { - dft(DFT_1536,prach2+3072,rxsigF[aa]+3072,1); - reps++; - } - - if (prachFormat == 5/*A2*/ || prachFormat == 6/*A3*/|| prachFormat == 8/*B4*/ || prachFormat == 10/*C2*/) { - dft(DFT_1536,prach2+3072*2,rxsigF[aa]+3072*2,1); - dft(DFT_1536,prach2+3072*3,rxsigF[aa]+3072*3,1); - reps+=2; - } - if (prachFormat == 6/*A3*/ || prachFormat == 8/*B4*/) { - dft(DFT_1536,prach2+3072*4,rxsigF[aa]+3072*4,1); - dft(DFT_1536,prach2+3072*5,rxsigF[aa]+3072*5,1); - reps+=2; - } - if (prachFormat == 8/*B4*/) { - for (int i=6;i<12;i++) dft(DFT_1536,prach2+(3072*i),rxsigF[aa]+(3072*i),1); - reps+=6; - } - }// mu==1 - else if (mu==2) AssertFatal(1==0,"Shouldn't get here\n"); - else if (mu==3) AssertFatal(1==0,"Shouldn't get here\n"); - else if (mu==4) AssertFatal(1==0,"Shouldn't get here\n"); + if (prachStartSymbol == 0) prach2+=48; // 24 samples @ 46.08 Ms/s in first symbol of each half subframe (15/30 kHz only) + dftlen=1536; + dft(DFT_1536,prach2,rxsigF[aa],1); + if (prachFormat != 9/*C0*/) { + dft(DFT_1536,prach2+3072,rxsigF[aa]+3072,1); + reps++; + } + + if (prachFormat == 5/*A2*/ || prachFormat == 6/*A3*/|| prachFormat == 8/*B4*/ || prachFormat == 10/*C2*/) { + dft(DFT_1536,prach2+3072*2,rxsigF[aa]+3072*2,1); + dft(DFT_1536,prach2+3072*3,rxsigF[aa]+3072*3,1); + reps+=2; + } + if (prachFormat == 6/*A3*/ || prachFormat == 8/*B4*/) { + dft(DFT_1536,prach2+3072*4,rxsigF[aa]+3072*4,1); + dft(DFT_1536,prach2+3072*5,rxsigF[aa]+3072*5,1); + reps+=2; + } + if (prachFormat == 8/*B4*/) { + for (int i=6;i<12;i++) dft(DFT_1536,prach2+(3072*i),rxsigF[aa]+(3072*i),1); + reps+=6; + } } // short format } // 3/4 sampling } // <=50 MHz BW @@ -442,37 +429,29 @@ void rx_nr_prach_ru(RU_t *ru, } } else { - if ((mu==0 && - (prachStartSymbol == 0 || prachStartSymbol == 7)) || - (mu==1 && prachStartSymbol == 0)) prach2+=128; // 64 samples @ 122.88 Ms/s in first symbol of each half subframe (15/30 kHz only) + if (prachStartSymbol == 0) prach2+=128; // 64 samples @ 122.88 Ms/s in first symbol of each half subframe (15/30 kHz only) - if (mu==0) AssertFatal(1==0,"Shouldn't get here\n"); - else if (mu==1) { - dftlen=4096; - dft(DFT_4096,prach2,rxsigF[aa],1); - if (prachFormat != 9/*C0*/) { - dft(DFT_4096,prach2+8192,rxsigF[aa]+8192,1); - reps++; - } - - if (prachFormat == 5/*A2*/ || prachFormat == 6/*A3*/|| prachFormat == 8/*B4*/ || prachFormat == 10/*C2*/) { - dft(DFT_4096,prach2+8192*2,rxsigF[aa]+8192*2,1); - dft(DFT_4096,prach2+8192*3,rxsigF[aa]+8192*3,1); - reps+=2; - } - if (prachFormat == 6/*A3*/ || prachFormat == 8/*B4*/) { - dft(DFT_4096,prach2+8192*4,rxsigF[aa]+8192*4,1); - dft(DFT_4096,prach2+8192*5,rxsigF[aa]+8192*5,1); - reps+=2; - } - if (prachFormat == 8/*B4*/) { - for (int i=6;i<12;i++) dft(DFT_4096,prach2+(8192*i),rxsigF[aa]+(8192*i),1); - reps+=6; - } + dftlen=4096; + dft(DFT_4096,prach2,rxsigF[aa],1); + if (prachFormat != 9/*C0*/) { + dft(DFT_4096,prach2+8192,rxsigF[aa]+8192,1); + reps++; + } + + if (prachFormat == 5/*A2*/ || prachFormat == 6/*A3*/|| prachFormat == 8/*B4*/ || prachFormat == 10/*C2*/) { + dft(DFT_4096,prach2+8192*2,rxsigF[aa]+8192*2,1); + dft(DFT_4096,prach2+8192*3,rxsigF[aa]+8192*3,1); + reps+=2; + } + if (prachFormat == 6/*A3*/ || prachFormat == 8/*B4*/) { + dft(DFT_4096,prach2+8192*4,rxsigF[aa]+8192*4,1); + dft(DFT_4096,prach2+8192*5,rxsigF[aa]+8192*5,1); + reps+=2; + } + if (prachFormat == 8/*B4*/) { + for (int i=6;i<12;i++) dft(DFT_4096,prach2+(8192*i),rxsigF[aa]+(8192*i),1); + reps+=6; } - else if (mu==2) AssertFatal(1==0,"Shouldn't get here\n"); - else if (mu==3) AssertFatal(1==0,"Shouldn't get here\n"); - else if (mu==4) AssertFatal(1==0,"Shouldn't get here\n"); } } else { AssertFatal(fp->N_RB_UL <= 217,"cannot do more than 217 PRBs with 3/4 sampling\n"); @@ -494,40 +473,84 @@ void rx_nr_prach_ru(RU_t *ru, reps=4; } } else { - if ((mu==0 && - (prachStartSymbol == 0 || prachStartSymbol == 7)) || - (mu==1 && prachStartSymbol == 0)) prach2+=96; // 64 samples @ 122.88 Ms/s in first symbol of each half subframe (15/30 kHz only) + if (prachStartSymbol == 0) prach2+=96; // 64 samples @ 122.88 Ms/s in first symbol of each half subframe (15/30 kHz only) - if (mu==0) AssertFatal(1==0,"Shouldn't get here\n"); - else if (mu==1) { - dftlen=3072; - dft(DFT_3072,prach2,rxsigF[aa],1); - if (prachFormat != 9/*C0*/) { - dft(DFT_3072,prach2+6144,rxsigF[aa]+6144,1); - reps++; - } - - if (prachFormat == 5/*A2*/ || prachFormat == 6/*A3*/|| prachFormat == 8/*B4*/ || prachFormat == 10/*C2*/) { - dft(DFT_3072,prach2+6144*2,rxsigF[aa]+6144*2,1); - dft(DFT_3072,prach2+6144*3,rxsigF[aa]+6144*3,1); - reps+=2; - } - if (prachFormat == 6/*A3*/ || prachFormat == 8/*B4*/) { - dft(DFT_3072,prach2+6144*4,rxsigF[aa]+6144*4,1); - dft(DFT_3072,prach2+6144*5,rxsigF[aa]+6144*5,1); - reps+=2; - } - if (prachFormat == 8/*B4*/) { - for (int i=6;i<12;i++) dft(DFT_3072,prach2+(6144*i),rxsigF[aa]+(6144*i),1); - reps+=6; - } + dftlen=3072; + dft(DFT_3072,prach2,rxsigF[aa],1); + if (prachFormat != 9/*C0*/) { + dft(DFT_3072,prach2+6144,rxsigF[aa]+6144,1); + reps++; + } + + if (prachFormat == 5/*A2*/ || prachFormat == 6/*A3*/|| prachFormat == 8/*B4*/ || prachFormat == 10/*C2*/) { + dft(DFT_3072,prach2+6144*2,rxsigF[aa]+6144*2,1); + dft(DFT_3072,prach2+6144*3,rxsigF[aa]+6144*3,1); + reps+=2; + } + if (prachFormat == 6/*A3*/ || prachFormat == 8/*B4*/) { + dft(DFT_3072,prach2+6144*4,rxsigF[aa]+6144*4,1); + dft(DFT_3072,prach2+6144*5,rxsigF[aa]+6144*5,1); + reps+=2; + } + if (prachFormat == 8/*B4*/) { + for (int i=6;i<12;i++) dft(DFT_3072,prach2+(6144*i),rxsigF[aa]+(6144*i),1); + reps+=6; } - else if (mu==2) AssertFatal(1==0,"Shouldn't get here\n"); - else if (mu==3) AssertFatal(1==0,"Shouldn't get here\n"); - else if (mu==4) AssertFatal(1==0,"Shouldn't get here\n"); } } } + } + else if (mu==3) { + if (fp->threequarter_fs) { + AssertFatal(1==0,"3/4 sampling not supported for numerology %d\n",mu); + } + if (prach_sequence_length == 0) { + AssertFatal(1==0,"long prach not supported for numerology %d\n",mu); + } + if (fp->N_RB_UL == 32) { + prach2 = prach[aa] + (Ncp<<2); // Ncp is for 30.72 Ms/s, so multiply by 2 for I/Q, and 2 for 61.44Msps + if (slot%(fp->slots_per_subframe/2)==0 && prachStartSymbol == 0) + prach2+=64; // 32 samples @ 61.44 Ms/s in first symbol of each half subframe + dftlen=512; + dftsize = IDFT_512; + } + else if (fp->N_RB_UL == 66) { + prach2 = prach[aa] + (Ncp<<3); // Ncp is for 30.72 Ms/s, so multiply by 4 for I/Q, and 2 for 122.88Msps + if (slot%(fp->slots_per_subframe/2)==0 && prachStartSymbol == 0) + prach2+=128; // 64 samples @ 122.88 Ms/s in first symbol of each half subframe + dftlen=1024; + dftsize = IDFT_1024; + } + else { + AssertFatal(1==0,"N_RB_UL %d not support for numerology %d\n",fp->N_RB_UL,mu); + } + + dft(dftsize,prach2,rxsigF[aa],1); + if (prachFormat != 9/*C0*/) { + dft(dftsize,prach2+dftlen*2,rxsigF[aa]+dftlen*2,1); + reps++; + } + + if (prachFormat == 5/*A2*/ || prachFormat == 6/*A3*/|| prachFormat == 8/*B4*/ || prachFormat == 10/*C2*/) { + dft(dftsize,prach2+dftlen*4,rxsigF[aa]+dftlen*4,1); + dft(dftsize,prach2+dftlen*6,rxsigF[aa]+dftlen*6,1); + reps+=2; + } + if (prachFormat == 6/*A3*/ || prachFormat == 8/*B4*/) { + dft(dftsize,prach2+dftlen*8,rxsigF[aa]+dftlen*8,1); + dft(dftsize,prach2+dftlen*10,rxsigF[aa]+dftlen*10,1); + reps+=2; + } + if (prachFormat == 8/*B4*/) { + for (int i=6;i<12;i++) + dft(dftsize,prach2+(dftlen*2*i),rxsigF[aa]+(dftlen*2*i),1); + reps+=6; + } + } + else { + AssertFatal(1==0,"Numerology not supported\n"); + } + //Coherent combining of PRACH repetitions (assumes channel does not change, to be revisted for "long" PRACH) LOG_D(PHY,"Doing PRACH combining of %d reptitions N_ZC %d\n",reps,N_ZC); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c b/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c index 465598d468..181abca69e 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c @@ -241,6 +241,7 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ * *********************************************************/ + if (mu==1) { if (fp->N_RB_UL <= 100) AssertFatal(1 == 0, "N_RB_UL %d not support for NR PRACH yet\n", fp->N_RB_UL); else if (fp->N_RB_UL < 137) { @@ -321,6 +322,22 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ } } } + } + else if (mu==3) { + if (fp->threequarter_fs) + AssertFatal(1==0,"3/4 sampling not supported for numerology %d\n",mu); + + if (prach_sequence_length == 0) + AssertFatal(1==0,"long prach not supported for numerology %d\n",mu); + + if (fp->N_RB_UL == 32) + dftlen=512; + else if (fp->N_RB_UL == 66) + dftlen=1024; + else + AssertFatal(1==0,"N_RB_UL %d not support for numerology %d\n",fp->N_RB_UL,mu); + } + for (offset=0,offset2=0; offsetN_RB_UL <= 100) - AssertFatal(1==0,"N_RB_UL %d not supported for NR PRACH yet\n",fp->N_RB_UL); + //actually what we should be checking here is how often the current prach crosses a 0.5ms boundary. I am not quite sure for which paramter set this would be the case, so I will ignore it for now and just check if the prach starts on a 0.5ms boundary + uint8_t use_extended_prach_prefix = 0; + if(fp->numerology_index == 0) { + if (prachStartSymbol == 0 || prachStartSymbol == 7) + use_extended_prach_prefix = 1; + } + else { + if (slot%(fp->slots_per_subframe/2)==0 && prachStartSymbol == 0) + use_extended_prach_prefix = 1; + } + + if (fp->N_RB_UL <= 34) { //32 PRB case 61.44Msps + if (fp->threequarter_fs == 0) { + Ncp<<=1; //to account for 61.44Mbps + // This is after cyclic prefix + prach2 = prach+(Ncp<<1); //times 2 for complex samples + if (prach_sequence_length == 0) + AssertFatal(1==0,"no long PRACH for this PRACH size %d\n",fp->N_RB_UL); + else { + if (use_extended_prach_prefix) + Ncp+=32; // 16*kappa, kappa=2 for 61.44Msps + prach2 = prach+(Ncp<<1); //times 2 for complex samples + if (prach_fmt_id == 4 || prach_fmt_id == 7 || prach_fmt_id == 9) { + idft(IDFT_512,prachF,prach2,1); + // here we have |empty | Prach512 | + if (prach_fmt_id != 9) { + memmove(prach2+(512<<1),prach2,(512<<2)); + prach_len = (512*2)+Ncp; + } + else prach_len = (512*1)+Ncp; + memmove(prach,prach+(512<<1),(Ncp<<2)); + // here we have |Prefix | Prach512 | Prach512 (if ! 0xc0) | + } else if (prach_fmt_id == 5) { // 6x512 + idft(IDFT_512,prachF,prach2,1); + // here we have |empty | Prach512 | + memmove(prach2+(512<<1),prach2,(512<<2)); + // here we have |empty | Prach512 | Prach512| empty512 | empty512 | + memmove(prach2+(512<<2),prach2,(512<<3)); + // here we have |empty | Prach512 | Prach512| Prach512 | Prach512 | + memmove(prach,prach+(512<<1),(Ncp<<2)); + // here we have |Prefix | Prach512 | + prach_len = (512*4)+Ncp; + } else if (prach_fmt_id == 6) { // 6x512 + idft(IDFT_512,prachF,prach2,1); + // here we have |empty | Prach512 | + memmove(prach2+(512<<1),prach2,(512<<2)); + // here we have |empty | Prach512 | Prach512| empty512 | empty512 | empty512 | empty512 + memmove(prach2+(512<<2),prach2,(512<<3)); + // here we have |empty | Prach512 | Prach512| Prach512 | Prach512 | empty512 | empty512 + memmove(prach2+(512<<3),prach2,(512<<3)); + // here we have |empty | Prach512 | Prach512| Prach512 | Prach512 | Prach512 | Prach512 + memmove(prach,prach+(512<<1),(Ncp<<2)); + // here we have |Prefix | Prach512 | + prach_len = (512*6)+Ncp; + } else if (prach_fmt_id == 8) { // 12x512 + idft(IDFT_512,prachF,prach2,1); + // here we have |empty | Prach512 | + memmove(prach2+(512<<1),prach2,(512<<2)); + // here we have |empty | Prach512 | Prach512| empty512 | empty512 | empty512 | empty512 + memmove(prach2+(512<<2),prach2,(512<<3)); + // here we have |empty | Prach512 | Prach512| Prach512 | Prach512 | empty512 | empty512 + memmove(prach2+(512<<3),prach2,(512<<3)); + // here we have |empty | Prach512 | Prach512| Prach512 | Prach512 | Prach512 | Prach512 + memmove(prach2+(512<<1)*6,prach2,(512<<2)*6); + // here we have |empty | Prach512 | Prach512| Prach512 | Prach512 | Prach512 | Prach512 | Prach512 | Prach512| Prach512 | Prach512 | Prach512 | Prach512| + memmove(prach,prach+(512<<1),(Ncp<<2)); + // here we have |Prefix | Prach512 | Prach512| Prach512 | Prach512 | Prach512 | Prach512 | Prach512 | Prach512| Prach512 | Prach512 | Prach512 | Prach512| + prach_len = (512*12)+Ncp; + } + } + } + else + AssertFatal(1==0,"3/4 sampling not supported for this PRACH size %d\n",fp->N_RB_UL); + + } + else if (fp->N_RB_UL <= 68) {//66 PRB case, 122.88 Msps + if (fp->threequarter_fs == 0) { + Ncp<<=2; //to account for 122.88Mbps + // This is after cyclic prefix + prach2 = prach+(Ncp<<1); //times 2 for complex samples + if (prach_sequence_length == 0) + AssertFatal(1==0,"no long PRACH for this PRACH size %d\n",fp->N_RB_UL); + else { + if (use_extended_prach_prefix) + Ncp+=64; // 16*kappa, kappa=4 for 122.88Msps + prach2 = prach+(Ncp<<1); //times 2 for complex samples + if (prach_fmt_id == 4 || prach_fmt_id == 7 || prach_fmt_id == 9) { + idft(IDFT_1024,prachF,prach2,1); + // here we have |empty | Prach1024 | + if (prach_fmt_id != 9) { + memmove(prach2+(1024<<1),prach2,(1024<<2)); + prach_len = (1024*2)+Ncp; + } + else prach_len = (1024*1)+Ncp; + memmove(prach,prach+(1024<<1),(Ncp<<2)); + // here we have |Prefix | Prach1024 | Prach1024 (if ! 0xc0) | + } else if (prach_fmt_id == 5) { // 6x1024 + idft(IDFT_1024,prachF,prach2,1); + // here we have |empty | Prach1024 | + memmove(prach2+(1024<<1),prach2,(1024<<2)); + // here we have |empty | Prach1024 | Prach1024| empty1024 | empty1024 | + memmove(prach2+(1024<<2),prach2,(1024<<3)); + // here we have |empty | Prach1024 | Prach1024| Prach1024 | Prach1024 | + memmove(prach,prach+(1024<<1),(Ncp<<2)); + // here we have |Prefix | Prach1024 | + prach_len = (1024*4)+Ncp; + } else if (prach_fmt_id == 6) { // 6x1024 + idft(IDFT_1024,prachF,prach2,1); + // here we have |empty | Prach1024 | + memmove(prach2+(1024<<1),prach2,(1024<<2)); + // here we have |empty | Prach1024 | Prach1024| empty1024 | empty1024 | empty1024 | empty1024 + memmove(prach2+(1024<<2),prach2,(1024<<3)); + // here we have |empty | Prach1024 | Prach1024| Prach1024 | Prach1024 | empty1024 | empty1024 + memmove(prach2+(1024<<3),prach2,(1024<<3)); + // here we have |empty | Prach1024 | Prach1024| Prach1024 | Prach1024 | Prach1024 | Prach1024 + memmove(prach,prach+(1024<<1),(Ncp<<2)); + // here we have |Prefix | Prach1024 | + prach_len = (1024*6)+Ncp; + } else if (prach_fmt_id == 8) { // 12x1024 + idft(IDFT_1024,prachF,prach2,1); + // here we have |empty | Prach1024 | + memmove(prach2+(1024<<1),prach2,(1024<<2)); + // here we have |empty | Prach1024 | Prach1024| empty1024 | empty1024 | empty1024 | empty1024 + memmove(prach2+(1024<<2),prach2,(1024<<3)); + // here we have |empty | Prach1024 | Prach1024| Prach1024 | Prach1024 | empty1024 | empty1024 + memmove(prach2+(1024<<3),prach2,(1024<<3)); + // here we have |empty | Prach1024 | Prach1024| Prach1024 | Prach1024 | Prach1024 | Prach1024 + memmove(prach2+(1024<<1)*6,prach2,(1024<<2)*6); + // here we have |empty | Prach1024 | Prach1024| Prach1024 | Prach1024 | Prach1024 | Prach1024 | Prach1024 | Prach1024| Prach1024 | Prach1024 | Prach1024 | Prach1024| + memmove(prach,prach+(1024<<1),(Ncp<<2)); + // here we have |Prefix | Prach1024 | Prach1024| Prach1024 | Prach1024 | Prach1024 | Prach1024 | Prach1024 | Prach1024| Prach1024 | Prach1024 | Prach1024 | Prach1024| + prach_len = (1024*12)+Ncp; + } + } + } + else + AssertFatal(1==0,"3/4 sampling not supported for this PRACH size %d\n",fp->N_RB_UL); + } else if (fp->N_RB_UL < 137) { // 46.08 or 61.44 Ms/s if (fp->threequarter_fs == 0) { // full sampling @ 61.44 Ms/s - Ncp<<=1; - // This is after cyclic prefix (Ncp<<1 samples for 30.72 Ms/s, Ncp<<2 samples for 61.44 Ms/s - prach2 = prach+(Ncp<<1); + Ncp<<=1; //to account for 61.44Mbps + // This is after cyclic prefix + prach2 = prach+(Ncp<<1); //times 2 for complex samples if (prach_sequence_length == 0){ if (prach_fmt_id == 0) { //24576 samples @ 30.72 Ms/s, 49152 samples @ 61.44 Ms/s idft(IDFT_49152,prachF,prach2,1); @@ -442,9 +596,10 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ prach_len = (12288*4)+Ncp; } } else { // short PRACH sequence + if (use_extended_prach_prefix) + Ncp+=32; // 16*kappa, kappa=2 for 61.44Msps + prach2 = prach+(Ncp<<1); //times 2 for complex samples if (prach_fmt_id == 4 || prach_fmt_id == 7 || prach_fmt_id == 9) { - Ncp+=32; // This assumes we are transmitting starting in symbol 0 of a PRACH slot, 30 kHz, full sampling - prach2 = prach+(Ncp<<1); idft(IDFT_2048,prachF,prach2,1); // here we have |empty | Prach2048 | if (prach_fmt_id != 9) { @@ -455,8 +610,6 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ memmove(prach,prach+(2048<<1),(Ncp<<2)); // here we have |Prefix | Prach2048 | Prach2048 (if ! 0xc0) | } else if (prach_fmt_id == 5) { // 6x2048 - Ncp+=32; // This assumes we are transmitting starting in symbol 0 of a PRACH slot, 30 kHz, full sampling - prach2 = prach+(Ncp<<1); idft(IDFT_2048,prachF,prach2,1); // here we have |empty | Prach2048 | memmove(prach2+(2048<<1),prach2,(2048<<2)); @@ -467,8 +620,6 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ // here we have |Prefix | Prach2048 | prach_len = (2048*4)+Ncp; } else if (prach_fmt_id == 6) { // 6x2048 - Ncp+=32; - prach2 = prach+(Ncp<<1); idft(IDFT_2048,prachF,prach2,1); // here we have |empty | Prach2048 | memmove(prach2+(2048<<1),prach2,(2048<<2)); @@ -481,8 +632,6 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ // here we have |Prefix | Prach2048 | prach_len = (2048*6)+Ncp; } else if (prach_fmt_id == 8) { // 12x2048 - Ncp+=32; // This assumes we are transmitting starting in symbol 0 of a PRACH slot, 30 kHz, full sampling - prach2 = prach+(Ncp<<1); idft(IDFT_2048,prachF,prach2,1); // here we have |empty | Prach2048 | memmove(prach2+(2048<<1),prach2,(2048<<2)); @@ -535,9 +684,10 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ prach_len = (9216*4)+Ncp; } } else { // short sequence + if (use_extended_prach_prefix) + Ncp+=24; // 16*kappa, kappa=1.5 for 46.08Msps + prach2 = prach+(Ncp<<1); //times 2 for complex samples if (prach_fmt_id == 4 || prach_fmt_id == 7 || prach_fmt_id == 9) { - Ncp+=24; // This assumes we are transmitting starting in symbol 0 of a PRACH slot, 30 kHz, full sampling - prach2 = prach+(Ncp<<1); idft(IDFT_1536,prachF,prach2,1); // here we have |empty | Prach1536 | if (prach_fmt_id != 9) { @@ -549,9 +699,6 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ // here we have |Prefix | Prach1536 | Prach1536 (if ! 0xc0) | } else if (prach_fmt_id == 5) { // 6x1536 - - Ncp+=24; // This assumes we are transmitting starting in symbol 0 of a PRACH slot, 30 kHz, full sampling - prach2 = prach+(Ncp<<1); idft(IDFT_1536,prachF,prach2,1); // here we have |empty | Prach1536 | memmove(prach2+(1536<<1),prach2,(1536<<2)); @@ -562,8 +709,6 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ // here we have |Prefix | Prach1536 | prach_len = (1536*4)+Ncp; } else if (prach_fmt_id == 6) { // 6x1536 - Ncp+=24; // This assumes we are transmitting starting in symbol 0 of a PRACH slot, 30 kHz, full sampling - prach2 = prach+(Ncp<<1); idft(IDFT_1536,prachF,prach2,1); // here we have |empty | Prach1536 | memmove(prach2+(1536<<1),prach2,(1536<<2)); @@ -576,8 +721,6 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ // here we have |Prefix | Prach1536 | prach_len = (1536*6)+Ncp; } else if (prach_fmt_id == 8) { // 12x1536 - Ncp+=24; // This assumes we are transmitting starting in symbol 0 of a PRACH slot, 30 kHz, full sampling - prach2 = prach+(Ncp<<1); idft(IDFT_1536,prachF,prach2,1); // here we have |empty | Prach1536 | memmove(prach2+(1536<<1),prach2,(1536<<2)); @@ -596,8 +739,9 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ } } else if (fp->N_RB_UL <= 273) {// 92.16 or 122.88 Ms/s if (fp->threequarter_fs == 0) { // full sampling @ 122.88 Ms/s - Ncp<<=2; - prach2 = prach+(Ncp<<1); + Ncp<<=2; //to account for 122.88Mbps + // This is after cyclic prefix + prach2 = prach+(Ncp<<1); //times 2 for complex samples if (prach_sequence_length == 0){ if (prach_fmt_id == 0) { //24576 samples @ 30.72 Ms/s, 98304 samples @ 122.88 Ms/s idft(IDFT_98304,prachF,prach2,1); @@ -632,9 +776,10 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ prach_len = (24576*4)+Ncp; } } else { // short sequence + if (use_extended_prach_prefix) + Ncp+=64; // 16*kappa, kappa=4 for 122.88Msps + prach2 = prach+(Ncp<<1); //times 2 for complex samples if (prach_fmt_id == 4 || prach_fmt_id == 7 || prach_fmt_id == 9) { - Ncp+=64; // This assumes we are transmitting starting in symbol 0 of a PRACH slot, 30 kHz, full sampling - prach2 = prach+(Ncp<<1); idft(IDFT_4096,prachF,prach2,1); // here we have |empty | Prach4096 | if (prach_fmt_id != 9) { @@ -644,8 +789,6 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ memmove(prach,prach+(4096<<1),(Ncp<<2)); // here we have |Prefix | Prach4096 | Prach4096 (if ! 0xc0) | } else if (prach_fmt_id == 5) { // 4x4096 - Ncp+=64; // This assumes we are transmitting starting in symbol 0 of a PRACH slot, 30 kHz, full sampling - prach2 = prach+(Ncp<<1); idft(IDFT_4096,prachF,prach2,1); // here we have |empty | Prach4096 | memmove(prach2+(4096<<1),prach2,(4096<<2)); @@ -656,8 +799,6 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ // here we have |Prefix | Prach4096 | prach_len = (4096*4)+Ncp; } else if (prach_fmt_id == 6) { // 6x4096 - Ncp+=64; // This assumes we are transmitting starting in symbol 0 of a PRACH slot, 30 kHz, full sampling - prach2 = prach+(Ncp<<1); idft(IDFT_4096,prachF,prach2,1); // here we have |empty | Prach4096 | memmove(prach2+(4096<<1),prach2,(4096<<2)); @@ -670,8 +811,6 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ // here we have |Prefix | Prach4096 | prach_len = (4096*6)+Ncp; } else if (prach_fmt_id == 8) { // 12x4096 - Ncp+=64; // This assumes we are transmitting starting in symbol 0 of a PRACH slot, 30 kHz, full sampling - prach2 = prach+(Ncp<<1); idft(IDFT_4096,prachF,prach2,1); // here we have |empty | Prach4096 | memmove(prach2+(4096<<1),prach2,(4096<<2)); @@ -688,8 +827,8 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ } } } else { // three quarter sampling @ 92.16 Ms/s - Ncp = (Ncp*3); - prach2 = prach+(Ncp<<1); + Ncp = (Ncp*3); //to account for 92.16 Msps + prach2 = prach+(Ncp<<1); //times 2 for complex samples if (prach_sequence_length == 0){ if (prach_fmt_id == 0) { idft(IDFT_73728,prachF,prach2,1); @@ -724,20 +863,19 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ prach_len = (18432*4)+Ncp; } } else { // short sequence - if (prach_fmt_id == 4 || prach_fmt_id == 7 || prach_fmt_id == 9) { - Ncp+=48; // This assumes we are transmitting starting in symbol 0 of a PRACH slot, 30 kHz, full sampling - prach2 = prach+(Ncp<<1); + if (use_extended_prach_prefix) + Ncp+=48; // 16*kappa, kappa=3 for 92.16Msps + prach2 = prach+(Ncp<<1); //times 2 for complex samples + if (prach_fmt_id == 4 || prach_fmt_id == 7 || prach_fmt_id == 9) { idft(IDFT_3072,prachF,prach2,1); // here we have |empty | Prach3072 | if (prach_fmt_id != 9) { memmove(prach2+(3072<<1),prach2,(3072<<2)); prach_len = (3072*2)+Ncp; } else prach_len = (3072*1)+Ncp; - memmove(prach,prach+(3072<<1),(Ncp<<2)); - // here we have |Prefix | Prach3072 | Prach3072 (if ! 0xc0) | + memmove(prach,prach+(3072<<1),(Ncp<<2)); + // here we have |Prefix | Prach3072 | Prach3072 (if ! 0xc0) | } else if (prach_fmt_id == 6) { // 6x3072 - Ncp+=48; // This assumes we are transmitting starting in symbol 0 of a PRACH slot, 30 kHz, full sampling - prach2 = prach+(Ncp<<1); idft(IDFT_3072,prachF,prach2,1); // here we have |empty | Prach3072 | memmove(prach2+(3072<<1),prach2,(3072<<2)); @@ -750,8 +888,6 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ // here we have |Prefix | Prach3072 | prach_len = (3072*6)+Ncp; } else if (prach_fmt_id == 5) { // 4x3072 - Ncp+=48; // This assumes we are transmitting starting in symbol 0 of a PRACH slot, 30 kHz, full sampling - prach2 = prach+(Ncp<<1); idft(IDFT_3072,prachF,prach2,1); // here we have |empty | Prach3072 | memmove(prach2+(3072<<1),prach2,(3072<<2)); @@ -762,8 +898,6 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ // here we have |Prefix | Prach3072 | prach_len = (3072*4)+Ncp; } else if (prach_fmt_id == 6) { // 12x3072 - Ncp+=48; // This assumes we are transmitting starting in symbol 0 of a PRACH slot, 30 kHz, full sampling - prach2 = prach+(Ncp<<1); idft(IDFT_3072,prachF,prach2,1); // here we have |empty | Prach3072 | memmove(prach2+(3072<<1),prach2,(3072<<2)); diff --git a/openair1/SIMULATION/NR_PHY/prachsim.c b/openair1/SIMULATION/NR_PHY/prachsim.c index fc02cf5ece..6e75150bd2 100644 --- a/openair1/SIMULATION/NR_PHY/prachsim.c +++ b/openair1/SIMULATION/NR_PHY/prachsim.c @@ -153,7 +153,7 @@ int main(int argc, char **argv){ randominit(0); - while ((c = getopt (argc, argv, "hHaA:Cc:r:p:g:n:s:S:t:x:y:v:V:z:N:F:d:Z:L:R:E")) != -1) { + while ((c = getopt (argc, argv, "hHaA:Cc:r:p:g:m:n:s:S:t:x:y:v:V:z:N:F:d:Z:L:R:E")) != -1) { switch (c) { case 'a': printf("Running AWGN simulation\n"); @@ -243,6 +243,10 @@ int main(int argc, char **argv){ threequarter_fs=1; break; + case 'm': + mu = atoi(optarg); + break; + case 'n': n_frames = atoi(optarg); break; @@ -371,9 +375,8 @@ int main(int argc, char **argv){ } - if (config_index<67) { prach_sequence_length=0; slot = subframe*2; slot_gNB = 1+(subframe*2); } - uint16_t N_ZC; - N_ZC = prach_sequence_length == 0 ? 839 : 139; + if (config_index<67 && mu==1) { prach_sequence_length=0; slot = subframe*2; slot_gNB = 1+(subframe*2); } + uint16_t N_ZC = prach_sequence_length == 0 ? 839 : 139; printf("Config_index %d, prach_sequence_length %d\n",config_index,prach_sequence_length); @@ -416,6 +419,11 @@ int main(int argc, char **argv){ nr_phy_config_request_sim(gNB, N_RB_UL, N_RB_UL, mu, Nid_cell, SSB_positions); + absoluteFrequencyPointA = to_nrarfcn(frame_parms->nr_band, + frame_parms->dl_CarrierFreq, + frame_parms->numerology_index, + frame_parms->N_RB_UL*(180e3)*(1 << frame_parms->numerology_index)); + //nsymb = (frame_parms->Ncp == 0) ? 14 : 12; printf("FFT Size %d, Extended Prefix %d, Samples per subframe %d, Frame type %s, Frequency Range %s\n", @@ -432,7 +440,14 @@ int main(int argc, char **argv){ gNB->gNB_config.carrier_config.num_tx_ant.value = 1; gNB->gNB_config.carrier_config.num_rx_ant.value = 1; - gNB->gNB_config.tdd_table.tdd_period.value = 6; + if (mu==1) + gNB->gNB_config.tdd_table.tdd_period.value = 6; + else if (mu==3) + gNB->gNB_config.tdd_table.tdd_period.value = 3; + else { + printf("unsupported numerology %d\n",mu); + exit(-1); + } gNB->gNB_config.prach_config.num_prach_fd_occasions.value = num_prach_fd_occasions; gNB->gNB_config.prach_config.num_prach_fd_occasions_list = (nfapi_nr_num_prach_fd_occasions_t *) malloc(num_prach_fd_occasions*sizeof(nfapi_nr_num_prach_fd_occasions_t)); From bba103dc2d1bc092be33fb96d3d57249d66d06bb Mon Sep 17 00:00:00 2001 From: Florian Kaltenberger Date: Tue, 3 Nov 2020 10:49:12 +0100 Subject: [PATCH 006/231] some fixes - prachsim working now for FR2 - added testcases --- cmake_targets/autotests/test_case_list.xml | 14 +++++++++----- openair1/PHY/NR_TRANSPORT/nr_prach.c | 7 ++++--- openair1/PHY/NR_UE_TRANSPORT/nr_prach.c | 2 ++ openair1/SIMULATION/NR_PHY/prachsim.c | 16 ++++++++-------- 4 files changed, 23 insertions(+), 16 deletions(-) diff --git a/cmake_targets/autotests/test_case_list.xml b/cmake_targets/autotests/test_case_list.xml index 7e43a9d01c..8ce35c355e 100644 --- a/cmake_targets/autotests/test_case_list.xml +++ b/cmake_targets/autotests/test_case_list.xml @@ -1302,10 +1302,12 @@ execution - nr_prachsim Test cases. (Test1: 106 PRBs - Prach format A2), - (Test2: 217 PRBs - Prach format A2), - (Test3: 273 PRBs - Prach format A2), - (Test4: 106 PRBs - Prach format 0) + nr_prachsim Test cases. (Test1: 30kHz SCS, 106 PRBs, Prach format A2), + (Test2: 30kHz SCS, 217 PRBs, Prach format A2), + (Test3: 30kHz SCS, 273 PRBs, Prach format A2), + (Test4: 30kHz SCS, 106 PRBs, Prach format 0) + (Test5: 120kHz SCS, 32 PRBs, Prach format A2) + (Test5: 120kHz SCS, 66 PRBs, Prach format A2) $OPENAIR_DIR/cmake_targets/build_oai --phy_simulators -c @@ -1315,7 +1317,9 @@ -a -s -30 -n 100 -p 63 -R 106 -a -s -30 -n 100 -p 63 -R 217 -a -s -30 -n 100 -p 63 -R 273 - -a -s -30 -n 100 -p 63 -R 106 -c 4 + -a -s -30 -n 100 -p 63 -R 106 -c 4 + -a -s -30 -n 100 -p 32 -R 32 -m 3 -c52 + -a -s -30 -n 100 -p 32 -R 66 -m 3 -c52 nr_prachsim.test1 nr_prachsim.test2 nr_prachsim.test3 nr_prachsim.test4 PRACH test OK segmentation fault|assertion|exiting|fatal diff --git a/openair1/PHY/NR_TRANSPORT/nr_prach.c b/openair1/PHY/NR_TRANSPORT/nr_prach.c index 3c4a1a41ff..b5a3c061e9 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_prach.c +++ b/openair1/PHY/NR_TRANSPORT/nr_prach.c @@ -185,7 +185,7 @@ void rx_nr_prach_ru(RU_t *ru, for (int aa=0; aanb_rx; aa++){ if (prach_sequence_length == 0) slot2=(slot/fp->slots_per_subframe)*fp->slots_per_subframe; - prach[aa] = (int16_t*)&ru->common.rxdata[aa][(slot2*fp->get_samples_per_slot(slot,fp))+sample_offset_slot-ru->N_TA_offset]; + prach[aa] = (int16_t*)&ru->common.rxdata[aa][fp->get_samples_slot_timestamp(slot2,fp,0)+sample_offset_slot-ru->N_TA_offset]; } idft_size_idx_t dftsize; @@ -512,14 +512,14 @@ void rx_nr_prach_ru(RU_t *ru, if (slot%(fp->slots_per_subframe/2)==0 && prachStartSymbol == 0) prach2+=64; // 32 samples @ 61.44 Ms/s in first symbol of each half subframe dftlen=512; - dftsize = IDFT_512; + dftsize = DFT_512; } else if (fp->N_RB_UL == 66) { prach2 = prach[aa] + (Ncp<<3); // Ncp is for 30.72 Ms/s, so multiply by 4 for I/Q, and 2 for 122.88Msps if (slot%(fp->slots_per_subframe/2)==0 && prachStartSymbol == 0) prach2+=128; // 64 samples @ 122.88 Ms/s in first symbol of each half subframe dftlen=1024; - dftsize = IDFT_1024; + dftsize = DFT_1024; } else { AssertFatal(1==0,"N_RB_UL %d not support for numerology %d\n",fp->N_RB_UL,mu); @@ -551,6 +551,7 @@ void rx_nr_prach_ru(RU_t *ru, AssertFatal(1==0,"Numerology not supported\n"); } + //LOG_M("ru_rxsigF_tmp.m","rxsFtmp", rxsigF[aa], dftlen*2*reps, 1, 1); //Coherent combining of PRACH repetitions (assumes channel does not change, to be revisted for "long" PRACH) LOG_D(PHY,"Doing PRACH combining of %d reptitions N_ZC %d\n",reps,N_ZC); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c b/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c index 181abca69e..0ae271c2db 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c @@ -105,6 +105,8 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ sample_offset_slot = (prachStartSymbol==0?0:fp->ofdm_symbol_size*prachStartSymbol+fp->nb_prefix_samples0+fp->nb_prefix_samples*(prachStartSymbol-1)); prach_start = fp->get_samples_slot_timestamp(slot, fp, 0) + sample_offset_slot; + //printf("prachstartsymbold %d, sample_offset_slot %d, prach_start %d\n",prachStartSymbol, sample_offset_slot, prach_start); + // First compute physical root sequence /************************************************************************ * 4G and NR NCS tables are slightly different and depend on prach format diff --git a/openair1/SIMULATION/NR_PHY/prachsim.c b/openair1/SIMULATION/NR_PHY/prachsim.c index 6e75150bd2..e91c0425ae 100644 --- a/openair1/SIMULATION/NR_PHY/prachsim.c +++ b/openair1/SIMULATION/NR_PHY/prachsim.c @@ -374,12 +374,6 @@ int main(int argc, char **argv){ } } - - if (config_index<67 && mu==1) { prach_sequence_length=0; slot = subframe*2; slot_gNB = 1+(subframe*2); } - uint16_t N_ZC = prach_sequence_length == 0 ? 839 : 139; - - printf("Config_index %d, prach_sequence_length %d\n",config_index,prach_sequence_length); - // Configure log logInit(); set_glog(loglvl); @@ -424,7 +418,13 @@ int main(int argc, char **argv){ frame_parms->numerology_index, frame_parms->N_RB_UL*(180e3)*(1 << frame_parms->numerology_index)); - //nsymb = (frame_parms->Ncp == 0) ? 14 : 12; + subframe = slot/frame_parms->slots_per_subframe; + + if (config_index<67 && mu==1) { prach_sequence_length=0; slot = subframe*2; slot_gNB = 1+(subframe*2); } + uint16_t N_ZC = prach_sequence_length == 0 ? 839 : 139; + + printf("Config_index %d, prach_sequence_length %d\n",config_index,prach_sequence_length); + printf("FFT Size %d, Extended Prefix %d, Samples per subframe %d, Frame type %s, Frequency Range %s\n", NUMBER_OF_OFDM_CARRIERS, @@ -767,7 +767,7 @@ int main(int argc, char **argv){ LOG_M("prachF0.m","prachF0", &gNB->prach_vars.prachF[0], N_ZC, 1, 1); LOG_M("rxsig0.m","rxs0", &gNB->common_vars.rxdata[0][subframe*frame_parms->samples_per_subframe], frame_parms->samples_per_subframe, 1, 1); LOG_M("ru_rxsig0.m","rxs0", &ru->common.rxdata[0][subframe*frame_parms->samples_per_subframe], frame_parms->samples_per_subframe, 1, 1); - LOG_M("rxsigF0.m","rxsF0", gNB->prach_vars.rxsigF[0], N_ZC, 1, 1); + LOG_M("ru_rxsigF0.m","rxsF0", ru->prach_rxsigF[0][0], N_ZC, 1, 1); LOG_M("prach_preamble.m","prachp", &gNB->X_u[0], N_ZC, 1, 1); LOG_M("ue_prach_preamble.m","prachp", &UE->X_u[0], N_ZC, 1, 1); #endif From 6213307061ff7715cf2b814031e089312dd1bcde Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Thu, 19 Nov 2020 17:11:54 +0100 Subject: [PATCH 007/231] fix indentation in nr_prach --- openair1/PHY/NR_TRANSPORT/nr_prach.c | 382 +++++++++++++-------------- 1 file changed, 190 insertions(+), 192 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/nr_prach.c b/openair1/PHY/NR_TRANSPORT/nr_prach.c index b5a3c061e9..aae310d45a 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_prach.c +++ b/openair1/PHY/NR_TRANSPORT/nr_prach.c @@ -301,205 +301,203 @@ void rx_nr_prach_ru(RU_t *ru, // do DFT if (mu==1) { - if (fp->N_RB_UL <= 100) - AssertFatal(1==0,"N_RB_UL %d not support for NR PRACH yet\n",fp->N_RB_UL); - else if (fp->N_RB_UL < 137) { - if (fp->threequarter_fs==0) { - //40 MHz @ 61.44 Ms/s - //50 MHz @ 61.44 Ms/s - prach2 = prach[aa] + (Ncp<<2); // Ncp is for 30.72 Ms/s, so multiply by 2 for I/Q, and 2 to bring to 61.44 Ms/s - if (prach_sequence_length == 0) { - if (prachFormat == 0 || prachFormat == 1 || prachFormat == 2) { - dftlen=49152; - dft(DFT_49152,prach2,rxsigF[aa],1); + if (fp->N_RB_UL <= 100) + AssertFatal(1==0,"N_RB_UL %d not support for NR PRACH yet\n",fp->N_RB_UL); + else if (fp->N_RB_UL < 137) { + if (fp->threequarter_fs==0) { + //40 MHz @ 61.44 Ms/s + //50 MHz @ 61.44 Ms/s + prach2 = prach[aa] + (Ncp<<2); // Ncp is for 30.72 Ms/s, so multiply by 2 for I/Q, and 2 to bring to 61.44 Ms/s + if (prach_sequence_length == 0) { + if (prachFormat == 0 || prachFormat == 1 || prachFormat == 2) { + dftlen=49152; + dft(DFT_49152,prach2,rxsigF[aa],1); + } + if (prachFormat == 1 || prachFormat == 2) { + dft(DFT_49152,prach2+98304,rxsigF[aa]+98304,1); + reps++; + } + if (prachFormat == 2) { + dft(DFT_49152,prach2+(98304*2),rxsigF[aa]+(98304*2),1); + dft(DFT_49152,prach2+(98304*3),rxsigF[aa]+(98304*3),1); + reps+=2; + } + if (prachFormat == 3) { + dftlen=12288; + for (int i=0;i<4;i++) dft(DFT_12288,prach2+(i*12288*2),rxsigF[aa]+(i*12288*2),1); + reps=4; + } + }// 839 sequence + else { + if (prachStartSymbol == 0) + prach2+=64; // 32 samples @ 61.44 Ms/s in first symbol of each half subframe (15/30 kHz only) + dftlen=2048; + dft(DFT_2048,prach2,rxsigF[aa],1); + if (prachFormat != 9/*C0*/) { + dft(DFT_2048,prach2+4096,rxsigF[aa]+4096,1); + reps++; + } + if (prachFormat == 5/*A2*/ || prachFormat == 6/*A3*/|| prachFormat == 8/*B4*/ || prachFormat == 10/*C2*/) { + dft(DFT_2048,prach2+4096*2,rxsigF[aa]+4096*2,1); + dft(DFT_2048,prach2+4096*3,rxsigF[aa]+4096*3,1); + reps+=2; + } + if (prachFormat == 6/*A3*/ || prachFormat == 8/*B4*/) { + dft(DFT_2048,prach2+4096*4,rxsigF[aa]+4096*4,1); + dft(DFT_2048,prach2+4096*5,rxsigF[aa]+4096*5,1); + reps+=2; + } + if (prachFormat == 8/*B4*/) { + for (int i=6;i<12;i++) dft(DFT_2048,prach2+(4096*i),rxsigF[aa]+(4096*i),1); + reps+=6; + } } - if (prachFormat == 1 || prachFormat == 2) { - dft(DFT_49152,prach2+98304,rxsigF[aa]+98304,1); - reps++; - } - if (prachFormat == 2) { - dft(DFT_49152,prach2+(98304*2),rxsigF[aa]+(98304*2),1); - dft(DFT_49152,prach2+(98304*3),rxsigF[aa]+(98304*3),1); - reps+=2; - } - if (prachFormat == 3) { - dftlen=12288; - for (int i=0;i<4;i++) dft(DFT_12288,prach2+(i*12288*2),rxsigF[aa]+(i*12288*2),1); - reps=4; - } - }// 839 sequence - else { - if (prachStartSymbol == 0) - prach2+=64; // 32 samples @ 61.44 Ms/s in first symbol of each half subframe (15/30 kHz only) + } else { // threequarter sampling + // 40 MHz @ 46.08 Ms/s + prach2 = prach[aa] + (3*Ncp); // 46.08 is 1.5 * 30.72, times 2 for I/Q + if (prach_sequence_length == 0) { + AssertFatal(fp->N_RB_UL <= 107,"cannot do 108..136 PRBs with 3/4 sampling\n"); + if (prachFormat == 0 || prachFormat == 1 || prachFormat == 2) { + dftlen=36864; + dft(DFT_36864,prach2,rxsigF[aa],1); + reps++; + } + if (prachFormat == 1 || prachFormat == 2) { + dft(DFT_36864,prach2+73728,rxsigF[aa]+73728,1); + reps++; + } + if (prachFormat == 2) { + dft(DFT_36864,prach2+(73728*2),rxsigF[aa]+(73728*2),1); + dft(DFT_36864,prach2+(73728*3),rxsigF[aa]+(73728*3),1); + reps+=2; + } + if (prachFormat == 3) { + dftlen=9216; + for (int i=0;i<4;i++) dft(DFT_9216,prach2+(i*9216*2),rxsigF[aa]+(i*9216*2),1); + reps=4; + } + } else { + if (prachStartSymbol == 0) prach2+=48; // 24 samples @ 46.08 Ms/s in first symbol of each half subframe (15/30 kHz only) + dftlen=1536; + dft(DFT_1536,prach2,rxsigF[aa],1); + if (prachFormat != 9/*C0*/) { + dft(DFT_1536,prach2+3072,rxsigF[aa]+3072,1); + reps++; + } + if (prachFormat == 5/*A2*/ || prachFormat == 6/*A3*/|| prachFormat == 8/*B4*/ || prachFormat == 10/*C2*/) { + dft(DFT_1536,prach2+3072*2,rxsigF[aa]+3072*2,1); + dft(DFT_1536,prach2+3072*3,rxsigF[aa]+3072*3,1); + reps+=2; + } + if (prachFormat == 6/*A3*/ || prachFormat == 8/*B4*/) { + dft(DFT_1536,prach2+3072*4,rxsigF[aa]+3072*4,1); + dft(DFT_1536,prach2+3072*5,rxsigF[aa]+3072*5,1); + reps+=2; + } + if (prachFormat == 8/*B4*/) { + for (int i=6;i<12;i++) dft(DFT_1536,prach2+(3072*i),rxsigF[aa]+(3072*i),1); + reps+=6; + } + } // short format + } // 3/4 sampling + } // <=50 MHz BW + else if (fp->N_RB_UL <= 273) { + if (fp->threequarter_fs==0) { + prach2 = prach[aa] + (Ncp<<3); + //80,90,100 MHz @ 122.88 Ms/s - dftlen=2048; - dft(DFT_2048,prach2,rxsigF[aa],1); - if (prachFormat != 9/*C0*/) { - dft(DFT_2048,prach2+4096,rxsigF[aa]+4096,1); - reps++; - } - if (prachFormat == 5/*A2*/ || prachFormat == 6/*A3*/|| prachFormat == 8/*B4*/ || prachFormat == 10/*C2*/) { - dft(DFT_2048,prach2+4096*2,rxsigF[aa]+4096*2,1); - dft(DFT_2048,prach2+4096*3,rxsigF[aa]+4096*3,1); - reps+=2; - } - if (prachFormat == 6/*A3*/ || prachFormat == 8/*B4*/) { - dft(DFT_2048,prach2+4096*4,rxsigF[aa]+4096*4,1); - dft(DFT_2048,prach2+4096*5,rxsigF[aa]+4096*5,1); - reps+=2; - } - if (prachFormat == 8/*B4*/) { - for (int i=6;i<12;i++) dft(DFT_2048,prach2+(4096*i),rxsigF[aa]+(4096*i),1); - reps+=6; - } - } - } else { // threequarter sampling - // 40 MHz @ 46.08 Ms/s - prach2 = prach[aa] + (3*Ncp); // 46.08 is 1.5 * 30.72, times 2 for I/Q - if (prach_sequence_length == 0) { - AssertFatal(fp->N_RB_UL <= 107,"cannot do 108..136 PRBs with 3/4 sampling\n"); - if (prachFormat == 0 || prachFormat == 1 || prachFormat == 2) { - dftlen=36864; - dft(DFT_36864,prach2,rxsigF[aa],1); - reps++; - } - if (prachFormat == 1 || prachFormat == 2) { - dft(DFT_36864,prach2+73728,rxsigF[aa]+73728,1); - reps++; - } - if (prachFormat == 2) { - dft(DFT_36864,prach2+(73728*2),rxsigF[aa]+(73728*2),1); - dft(DFT_36864,prach2+(73728*3),rxsigF[aa]+(73728*3),1); - reps+=2; - } - if (prachFormat == 3) { - dftlen=9216; - for (int i=0;i<4;i++) dft(DFT_9216,prach2+(i*9216*2),rxsigF[aa]+(i*9216*2),1); - reps=4; - } - } else { - if (prachStartSymbol == 0) prach2+=48; // 24 samples @ 46.08 Ms/s in first symbol of each half subframe (15/30 kHz only) - dftlen=1536; - dft(DFT_1536,prach2,rxsigF[aa],1); - if (prachFormat != 9/*C0*/) { - dft(DFT_1536,prach2+3072,rxsigF[aa]+3072,1); - reps++; - } - - if (prachFormat == 5/*A2*/ || prachFormat == 6/*A3*/|| prachFormat == 8/*B4*/ || prachFormat == 10/*C2*/) { - dft(DFT_1536,prach2+3072*2,rxsigF[aa]+3072*2,1); - dft(DFT_1536,prach2+3072*3,rxsigF[aa]+3072*3,1); - reps+=2; - } - if (prachFormat == 6/*A3*/ || prachFormat == 8/*B4*/) { - dft(DFT_1536,prach2+3072*4,rxsigF[aa]+3072*4,1); - dft(DFT_1536,prach2+3072*5,rxsigF[aa]+3072*5,1); - reps+=2; - } - if (prachFormat == 8/*B4*/) { - for (int i=6;i<12;i++) dft(DFT_1536,prach2+(3072*i),rxsigF[aa]+(3072*i),1); - reps+=6; - } - } // short format - } // 3/4 sampling - } // <=50 MHz BW - else if (fp->N_RB_UL <= 273) { - if (fp->threequarter_fs==0) { - prach2 = prach[aa] + (Ncp<<3); - //80,90,100 MHz @ 122.88 Ms/s - - if (prach_sequence_length == 0) { - if (prachFormat == 0 || prachFormat == 1 || prachFormat == 2) { - dftlen=98304; - dft(DFT_98304,prach2,rxsigF[aa],1); + if (prach_sequence_length == 0) { + if (prachFormat == 0 || prachFormat == 1 || prachFormat == 2) { + dftlen=98304; + dft(DFT_98304,prach2,rxsigF[aa],1); + } + if (prachFormat == 1 || prachFormat == 2) { + dft(DFT_98304,prach2+196608,rxsigF[aa]+196608,1); + reps++; + } + if (prachFormat == 2) { + dft(DFT_98304,prach2+(196608*2),rxsigF[aa]+(196608*2),1); + dft(DFT_98304,prach2+(196608*3),rxsigF[aa]+(196608*3),1); + reps+=2; + } + if (prachFormat == 3) { + dftlen=24576; + for (int i=0;i<4;i++) dft(DFT_24576,prach2+(i*2*24576),rxsigF[aa]+(i*2*24576),1); + reps=4; + } } - if (prachFormat == 1 || prachFormat == 2) { - dft(DFT_98304,prach2+196608,rxsigF[aa]+196608,1); - reps++; - } - if (prachFormat == 2) { - dft(DFT_98304,prach2+(196608*2),rxsigF[aa]+(196608*2),1); - dft(DFT_98304,prach2+(196608*3),rxsigF[aa]+(196608*3),1); - reps+=2; - } - if (prachFormat == 3) { - dftlen=24576; - for (int i=0;i<4;i++) dft(DFT_24576,prach2+(i*2*24576),rxsigF[aa]+(i*2*24576),1); - reps=4; - } - } - else { - if (prachStartSymbol == 0) prach2+=128; // 64 samples @ 122.88 Ms/s in first symbol of each half subframe (15/30 kHz only) + else { + if (prachStartSymbol == 0) prach2+=128; // 64 samples @ 122.88 Ms/s in first symbol of each half subframe (15/30 kHz only) - dftlen=4096; - dft(DFT_4096,prach2,rxsigF[aa],1); - if (prachFormat != 9/*C0*/) { - dft(DFT_4096,prach2+8192,rxsigF[aa]+8192,1); - reps++; - } - - if (prachFormat == 5/*A2*/ || prachFormat == 6/*A3*/|| prachFormat == 8/*B4*/ || prachFormat == 10/*C2*/) { - dft(DFT_4096,prach2+8192*2,rxsigF[aa]+8192*2,1); - dft(DFT_4096,prach2+8192*3,rxsigF[aa]+8192*3,1); - reps+=2; - } - if (prachFormat == 6/*A3*/ || prachFormat == 8/*B4*/) { - dft(DFT_4096,prach2+8192*4,rxsigF[aa]+8192*4,1); - dft(DFT_4096,prach2+8192*5,rxsigF[aa]+8192*5,1); - reps+=2; - } - if (prachFormat == 8/*B4*/) { - for (int i=6;i<12;i++) dft(DFT_4096,prach2+(8192*i),rxsigF[aa]+(8192*i),1); - reps+=6; - } - } - } else { - AssertFatal(fp->N_RB_UL <= 217,"cannot do more than 217 PRBs with 3/4 sampling\n"); - prach2 = prach[aa] + (6*Ncp); - // 80 MHz @ 92.16 Ms/s - if (prach_sequence_length == 0) { - if (prachFormat == 0 || prachFormat == 1 || prachFormat == 2) { - dftlen=73728; - dft(DFT_73728,prach2,rxsigF[aa],1); - reps++; - } - if (prachFormat == 1 || prachFormat == 2) { - dft(DFT_73728,prach2+(2*73728),rxsigF[aa]+(2*73728),1); - reps++; - } - if (prachFormat == 3) { - dftlen=18432; - for (int i=0;i<4;i++) dft(DFT_18432,prach2+(i*2*18432),rxsigF[aa]+(i*2*18432),1); - reps=4; - } - } else { - if (prachStartSymbol == 0) prach2+=96; // 64 samples @ 122.88 Ms/s in first symbol of each half subframe (15/30 kHz only) + dftlen=4096; + dft(DFT_4096,prach2,rxsigF[aa],1); + if (prachFormat != 9/*C0*/) { + dft(DFT_4096,prach2+8192,rxsigF[aa]+8192,1); + reps++; + } - dftlen=3072; - dft(DFT_3072,prach2,rxsigF[aa],1); - if (prachFormat != 9/*C0*/) { - dft(DFT_3072,prach2+6144,rxsigF[aa]+6144,1); - reps++; - } - - if (prachFormat == 5/*A2*/ || prachFormat == 6/*A3*/|| prachFormat == 8/*B4*/ || prachFormat == 10/*C2*/) { - dft(DFT_3072,prach2+6144*2,rxsigF[aa]+6144*2,1); - dft(DFT_3072,prach2+6144*3,rxsigF[aa]+6144*3,1); - reps+=2; - } - if (prachFormat == 6/*A3*/ || prachFormat == 8/*B4*/) { - dft(DFT_3072,prach2+6144*4,rxsigF[aa]+6144*4,1); - dft(DFT_3072,prach2+6144*5,rxsigF[aa]+6144*5,1); - reps+=2; - } - if (prachFormat == 8/*B4*/) { - for (int i=6;i<12;i++) dft(DFT_3072,prach2+(6144*i),rxsigF[aa]+(6144*i),1); - reps+=6; - } - } + if (prachFormat == 5/*A2*/ || prachFormat == 6/*A3*/|| prachFormat == 8/*B4*/ || prachFormat == 10/*C2*/) { + dft(DFT_4096,prach2+8192*2,rxsigF[aa]+8192*2,1); + dft(DFT_4096,prach2+8192*3,rxsigF[aa]+8192*3,1); + reps+=2; + } + if (prachFormat == 6/*A3*/ || prachFormat == 8/*B4*/) { + dft(DFT_4096,prach2+8192*4,rxsigF[aa]+8192*4,1); + dft(DFT_4096,prach2+8192*5,rxsigF[aa]+8192*5,1); + reps+=2; + } + if (prachFormat == 8/*B4*/) { + for (int i=6;i<12;i++) dft(DFT_4096,prach2+(8192*i),rxsigF[aa]+(8192*i),1); + reps+=6; + } + } + } else { + AssertFatal(fp->N_RB_UL <= 217,"cannot do more than 217 PRBs with 3/4 sampling\n"); + prach2 = prach[aa] + (6*Ncp); + // 80 MHz @ 92.16 Ms/s + if (prach_sequence_length == 0) { + if (prachFormat == 0 || prachFormat == 1 || prachFormat == 2) { + dftlen=73728; + dft(DFT_73728,prach2,rxsigF[aa],1); + reps++; + } + if (prachFormat == 1 || prachFormat == 2) { + dft(DFT_73728,prach2+(2*73728),rxsigF[aa]+(2*73728),1); + reps++; + } + if (prachFormat == 3) { + dftlen=18432; + for (int i=0;i<4;i++) dft(DFT_18432,prach2+(i*2*18432),rxsigF[aa]+(i*2*18432),1); + reps=4; + } + } else { + if (prachStartSymbol == 0) prach2+=96; // 64 samples @ 122.88 Ms/s in first symbol of each half subframe (15/30 kHz only) + + dftlen=3072; + dft(DFT_3072,prach2,rxsigF[aa],1); + if (prachFormat != 9/*C0*/) { + dft(DFT_3072,prach2+6144,rxsigF[aa]+6144,1); + reps++; + } + + if (prachFormat == 5/*A2*/ || prachFormat == 6/*A3*/|| prachFormat == 8/*B4*/ || prachFormat == 10/*C2*/) { + dft(DFT_3072,prach2+6144*2,rxsigF[aa]+6144*2,1); + dft(DFT_3072,prach2+6144*3,rxsigF[aa]+6144*3,1); + reps+=2; + } + if (prachFormat == 6/*A3*/ || prachFormat == 8/*B4*/) { + dft(DFT_3072,prach2+6144*4,rxsigF[aa]+6144*4,1); + dft(DFT_3072,prach2+6144*5,rxsigF[aa]+6144*5,1); + reps+=2; + } + if (prachFormat == 8/*B4*/) { + for (int i=6;i<12;i++) dft(DFT_3072,prach2+(6144*i),rxsigF[aa]+(6144*i),1); + reps+=6; + } + } + } } } - } else if (mu==3) { if (fp->threequarter_fs) { AssertFatal(1==0,"3/4 sampling not supported for numerology %d\n",mu); From 3efb07735763dfd025316b95e78506f70f439e36 Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Sat, 21 Nov 2020 11:11:28 +0100 Subject: [PATCH 008/231] 24 RB option in uesoftmodem --- executables/nr-uesoftmodem.c | 44 +++++++++++++++++------------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 08834ed740..ea3f6b64b5 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -337,23 +337,30 @@ void init_openair0(void) { openair0_cfg[card].configFilename = NULL; openair0_cfg[card].threequarter_fs = frame_parms->threequarter_fs; numerology = frame_parms->numerology_index; - - if(frame_parms->N_RB_DL == 66) { + if(frame_parms->N_RB_DL == 24) { + if (numerology==1) { + openair0_cfg[card].sample_rate=15.36e6; + openair0_cfg[card].samples_per_frame = 153600; + } else { + LOG_E(PHY,"Unsupported numerology!\n"); + exit(-1); + } + }else if(frame_parms->N_RB_DL == 66) { if (numerology==3) { - openair0_cfg[card].sample_rate=122.88e6; - openair0_cfg[card].samples_per_frame = 1228800; - } else { - LOG_E(PHY,"Unsupported numerology! FR2 supports only 120KHz SCS for now.\n"); - exit(-1); - } + openair0_cfg[card].sample_rate=122.88e6; + openair0_cfg[card].samples_per_frame = 1228800; + } else { + LOG_E(PHY,"Unsupported numerology! FR2 supports only 120KHz SCS for now.\n"); + exit(-1); + } }else if(frame_parms->N_RB_DL == 32) { if (numerology==3) { - openair0_cfg[card].sample_rate=61.44e6; - openair0_cfg[card].samples_per_frame = 614400; - } else { - LOG_E(PHY,"Unsupported numerology! FR2 supports only 120KHz SCS for now.\n"); - exit(-1); - } + openair0_cfg[card].sample_rate=61.44e6; + openair0_cfg[card].samples_per_frame = 614400; + } else { + LOG_E(PHY,"Unsupported numerology! FR2 supports only 120KHz SCS for now.\n"); + exit(-1); + } }else if(frame_parms->N_RB_DL == 217) { if (numerology==1) { if (frame_parms->threequarter_fs) { @@ -406,15 +413,6 @@ void init_openair0(void) { LOG_E(PHY,"Unsupported numerology!\n"); exit(-1); } - } else if(frame_parms->N_RB_DL == 50) { - openair0_cfg[card].sample_rate=15.36e6; - openair0_cfg[card].samples_per_frame = 153600; - } else if (frame_parms->N_RB_DL == 25) { - openair0_cfg[card].sample_rate=7.68e6; - openair0_cfg[card].samples_per_frame = 76800; - } else if (frame_parms->N_RB_DL == 6) { - openair0_cfg[card].sample_rate=1.92e6; - openair0_cfg[card].samples_per_frame = 19200; } else { LOG_E(PHY,"Unknown NB_RB %d!\n",frame_parms->N_RB_DL); From fbdcba9fa40ea822acade80376f1ec895665aef7 Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Sat, 21 Nov 2020 11:12:11 +0100 Subject: [PATCH 009/231] bugfix in dci_nr --- openair1/PHY/NR_UE_TRANSPORT/dci_nr.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c index 53456bb691..9d51bc0e21 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c @@ -372,8 +372,12 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF, c_rb = n_BWP_start; for (int rb=0;rb>3] & (1<<(c_rb_by6&7))) == 0) c_rb+=6; + while ((coreset_freq_dom[c_rb_by6>>3] & (1<<(7-(c_rb_by6&7)))) == 0){ + c_rb+=6; + c_rb_by6 = c_rb/6; + } LOG_DDD("c_rb=%d\n",c_rb); rxF=NULL; From 66f957fb486bbe062f76bd997fbbd5161ee1b360 Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Thu, 26 Nov 2020 17:17:27 +0100 Subject: [PATCH 010/231] fix TA scaling at ue --- openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index b0d765b746..878fe37a21 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -138,13 +138,14 @@ uint16_t get_bw_scaling(uint16_t bwp_ul_NB_RB){ uint16_t bw_scaling; // scale the 16 factor in N_TA calculation in 38.213 section 4.2 according to the used FFT size switch (bwp_ul_NB_RB) { + case 24: bw_scaling = 4; break; case 32: bw_scaling = 4; break; case 66: bw_scaling = 8; break; case 106: bw_scaling = 16; break; case 217: bw_scaling = 32; break; case 245: bw_scaling = 32; break; case 273: bw_scaling = 32; break; - default: abort(); + default: AssertFatal(1==0,"N_RB_UL %d not supported\n",bwp_ul_NB_RB); } return bw_scaling; } @@ -1243,13 +1244,14 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, // scale the 16 factor in N_TA calculation in 38.213 section 4.2 according to the used FFT size switch (ue->frame_parms.N_RB_DL) { + case 24: bw_scaling = 4; break; case 32: bw_scaling = 4; break; case 66: bw_scaling = 8; break; case 106: bw_scaling = 16; break; case 217: bw_scaling = 32; break; case 245: bw_scaling = 32; break; case 273: bw_scaling = 32; break; - default: abort(); + default: AssertFatal(1==0,"N_RB_DL %d not supported\n",ue->frame_parms.N_RB_DL); } /* Time Alignment procedure From 784f4de1596c85372b356f0d23e78d5d21c5ed7b Mon Sep 17 00:00:00 2001 From: Shweta Shrivastava Date: Sat, 5 Dec 2020 12:48:12 -0600 Subject: [PATCH 011/231] Read dedicated servingCellConfig, PTRS params from config file --- .../gnb.band78.tm1.106PRB.usrpn300.conf | 51 +++++++++ openair2/GNB_APP/RRC_nr_paramsvalues.h | 38 +++++++ openair2/GNB_APP/gnb_config.c | 103 ++++++++++++++++++ 3 files changed, 192 insertions(+) diff --git a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf index aeba400cad..f304f583c0 100644 --- a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf +++ b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf @@ -191,6 +191,57 @@ gNBs = ); + # Dedicated Serving Cell Configuration + servingCellConfigDedicated = ( + { + # DL PTRS related parameters. + # 3GPP TS 38.331 PTRS-DownlinkConfig + + # frequencyDensity value range: 1-276 + dl_ptrsFreqDensity0_0 = 25; + dl_ptrsFreqDensity1_0 = 75; + + # timeDensity value range: 0-29 + dl_ptrsTimeDensity0_0 = 2; + dl_ptrsTimeDensity1_0 = 4; + dl_ptrsTimeDensity2_0 = 10; + + # epre_Ratio + # 0 = "00", 1 = "01" in TS 38.214, table 4.1-2 + dl_ptrsEpreRatio_0 = 0; + + # resourceElementOffset + # 0 = offset01 1 = offset02, 2 = offset02 + # 3GPP TS 38.331 PTRS-DownlinkConfig; TS 38.211 sec. 7.4.1.2.2 + dl_ptrsReOffset_0 = 0; + + # UL PTRS related parameters. + # 3GPP TS 38.331 PTRS-UplinkConfig + + # frequencyDensity value range: 1-276 + ul_ptrsFreqDensity0_0 = 25; + ul_ptrsFreqDensity1_0 = 75; + + # timeDensity value range: 0-29 + ul_ptrsTimeDensity0_0 = 2; + ul_ptrsTimeDensity1_0 = 4; + ul_ptrsTimeDensity2_0 = 10; + + # resourceElementOffset + # 0 = offset01 1 = offset02, 2 = offset02 + # TS 38.331 PTRS-UplinkConfig; TS 38.211 sec. 6.4.1.2.2.1 + ul_ptrsReOffset_0 = 0; + + # maxNrofPorts + # 0 = n1, 1 = n2 + ul_ptrsMaxPorts_0 = 0; + + # ptrs-Power + # 0 = p00, 1 = p01, 2 = p10, 3 = p11 + #ul_ptrsPower_0 = 0; + } + ); + # ------- SCTP definitions SCTP : diff --git a/openair2/GNB_APP/RRC_nr_paramsvalues.h b/openair2/GNB_APP/RRC_nr_paramsvalues.h index 231aeb34f4..2fa9af1bd3 100644 --- a/openair2/GNB_APP/RRC_nr_paramsvalues.h +++ b/openair2/GNB_APP/RRC_nr_paramsvalues.h @@ -210,6 +210,24 @@ #define CARRIERBANDWIDTH_OKVALUES {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} +/* Serving Cell Config Dedicated */ +#define GNB_CONFIG_STRING_SERVINGCELLCONFIGDEDICATED "servingCellConfigDedicated" +#define GNB_CONFIG_STRING_DLPTRSFREQDENSITY0_0 "dl_ptrsFreqDensity0_0" +#define GNB_CONFIG_STRING_DLPTRSFREQDENSITY1_0 "dl_ptrsFreqDensity1_0" +#define GNB_CONFIG_STRING_DLPTRSTIMEDENSITY0_0 "dl_ptrsTimeDensity0_0" +#define GNB_CONFIG_STRING_DLPTRSTIMEDENSITY1_0 "dl_ptrsTimeDensity1_0" +#define GNB_CONFIG_STRING_DLPTRSTIMEDENSITY2_0 "dl_ptrsTimeDensity2_0" +#define GNB_CONFIG_STRING_DLPTRSEPRERATIO_0 "dl_ptrsEpreRatio_0" +#define GNB_CONFIG_STRING_DLPTRSREOFFSET_0 "dl_ptrsReOffset_0" +#define GNB_CONFIG_STRING_ULPTRSFREQDENSITY0_0 "ul_ptrsFreqDensity0_0" +#define GNB_CONFIG_STRING_ULPTRSFREQDENSITY1_0 "ul_ptrsFreqDensity1_0" +#define GNB_CONFIG_STRING_ULPTRSTIMEDENSITY0_0 "ul_ptrsTimeDensity0_0" +#define GNB_CONFIG_STRING_ULPTRSTIMEDENSITY1_0 "ul_ptrsTimeDensity1_0" +#define GNB_CONFIG_STRING_ULPTRSTIMEDENSITY2_0 "ul_ptrsTimeDensity2_0" +#define GNB_CONFIG_STRING_ULPTRSREOFFSET_0 "ul_ptrsReOffset_0" +#define GNB_CONFIG_STRING_ULPTRSMAXPORTS_0 "ul_ptrsMaxPorts_0" +#define GNB_CONFIG_STRING_ULPTRSPOWER_0 "ul_ptrsPower_0" + /*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ /* Serving Cell Config Common configuration parameters */ /* optname helpstr paramflags XXXptr defXXXval type numelt */ @@ -379,6 +397,26 @@ {GNB_CONFIG_STRING_SSPBCHBLOCKPOWER,NULL,0,i64ptr:&scc->ss_PBCH_BlockPower,defint64val:20,TYPE_INT64,0}, \ {GNB_CONFIG_STRING_MSG1SUBCARRIERSPACING,NULL,0,i64ptr:scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg1_SubcarrierSpacing,defintval:-1,TYPE_INT64,0}} +/*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ +/* Serving Cell Config Dedicated configuration parameters */ +/*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ + +#define SCDPARAMS_DESC(scd) { \ +{GNB_CONFIG_STRING_DLPTRSFREQDENSITY0_0,NULL,0,i64ptr:scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->frequencyDensity->list.array[0],defint64val:1,TYPE_INT64,0}, \ +{GNB_CONFIG_STRING_DLPTRSFREQDENSITY1_0,NULL,0,i64ptr:scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->frequencyDensity->list.array[1],defint64val:1,TYPE_INT64,0}, \ +{GNB_CONFIG_STRING_DLPTRSTIMEDENSITY0_0,NULL,0,i64ptr:scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->timeDensity->list.array[0],defint64val:0,TYPE_INT64,0}, \ +{GNB_CONFIG_STRING_DLPTRSTIMEDENSITY1_0,NULL,0,i64ptr:scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->timeDensity->list.array[1],defint64val:0,TYPE_INT64,0}, \ +{GNB_CONFIG_STRING_DLPTRSTIMEDENSITY2_0,NULL,0,i64ptr:scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->timeDensity->list.array[2],defint64val:0,TYPE_INT64,0}, \ +{GNB_CONFIG_STRING_DLPTRSEPRERATIO_0,NULL,0,i64ptr:scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->epre_Ratio,defint64val:-1,TYPE_INT64,0}, \ +{GNB_CONFIG_STRING_DLPTRSREOFFSET_0,NULL,0,i64ptr:scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->resourceElementOffset,defint64val:-1,TYPE_INT64,0}, \ +{GNB_CONFIG_STRING_ULPTRSFREQDENSITY0_0,NULL,0,i64ptr: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],defint64val:1,TYPE_INT64,0}, \ +{GNB_CONFIG_STRING_ULPTRSFREQDENSITY1_0,NULL,0,i64ptr: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],defint64val:1,TYPE_INT64,0}, \ +{GNB_CONFIG_STRING_ULPTRSTIMEDENSITY0_0,NULL,0,i64ptr: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],defint64val:0,TYPE_INT64,0}, \ +{GNB_CONFIG_STRING_ULPTRSTIMEDENSITY1_0,NULL,0,i64ptr: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],defint64val:0,TYPE_INT64,0}, \ +{GNB_CONFIG_STRING_ULPTRSTIMEDENSITY2_0,NULL,0,i64ptr: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],defint64val:0,TYPE_INT64,0}, \ +{GNB_CONFIG_STRING_ULPTRSREOFFSET_0,NULL,0,i64ptr:scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->resourceElementOffset,defint64val:-1,TYPE_INT64,0}, \ +{GNB_CONFIG_STRING_ULPTRSMAXPORTS_0,NULL,0,i64ptr:&scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->maxNrofPorts,defint64val:0,TYPE_INT64,0}, \ +{GNB_CONFIG_STRING_ULPTRSPOWER_0,NULL,0,i64ptr:&scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->ptrs_Power,defint64val:0,TYPE_INT64,0}} diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 5f74d6121f..8bae2805ad 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -290,6 +290,87 @@ void fix_scc(NR_ServingCellConfigCommon_t *scc,uint64_t ssbmap) { } } +void prepare_scd(NR_ServingCellConfig_t *scd) { + scd->downlinkBWP_ToAddModList = CALLOC(1,sizeof(scd->downlinkBWP_ToAddModList)); + NR_BWP_Downlink_t *bwp=calloc(1,sizeof(*bwp)); + bwp->bwp_Id=1; + bwp->bwp_Dedicated=calloc(1,sizeof(*bwp->bwp_Dedicated)); + bwp->bwp_Dedicated->pdsch_Config = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config)); + bwp->bwp_Dedicated->pdsch_Config->present = NR_SetupRelease_PDSCH_Config_PR_setup; + bwp->bwp_Dedicated->pdsch_Config->choice.setup = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup)); + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA)); + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->present= NR_SetupRelease_DMRS_DownlinkConfig_PR_setup; + + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup)); + NR_DMRS_DownlinkConfig_t *NR_DMRS_DownlinkCfg = bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup; + NR_DMRS_DownlinkCfg->phaseTrackingRS=CALLOC(1,sizeof(*NR_DMRS_DownlinkCfg->phaseTrackingRS)); + NR_DMRS_DownlinkCfg->phaseTrackingRS->present = NR_SetupRelease_PTRS_DownlinkConfig_PR_setup; + NR_DMRS_DownlinkCfg->phaseTrackingRS->choice.setup = CALLOC(1,sizeof(*NR_DMRS_DownlinkCfg->phaseTrackingRS->choice.setup)); + NR_PTRS_DownlinkConfig_t *NR_PTRS_DownlinkCfg = NR_DMRS_DownlinkCfg->phaseTrackingRS->choice.setup; + NR_PTRS_DownlinkCfg->frequencyDensity = CALLOC(1, sizeof(NR_PTRS_DownlinkCfg->frequencyDensity)); + int *dl_rbs[2]; + for (int i=0;i<2;i++) { + dl_rbs[i] = CALLOC(1,sizeof(*dl_rbs[i])); + *dl_rbs[i] = 0; + ASN_SEQUENCE_ADD(&NR_PTRS_DownlinkCfg->frequencyDensity->list, dl_rbs[i]); + } + NR_PTRS_DownlinkCfg->timeDensity = CALLOC(1, sizeof(NR_PTRS_DownlinkCfg->timeDensity)); + int *dl_mcs[3]; + for (int i=0;i<3;i++) { + dl_mcs[i] = CALLOC(1,sizeof(*dl_mcs[i])); + *dl_mcs[i] = 0; + ASN_SEQUENCE_ADD(&NR_PTRS_DownlinkCfg->timeDensity->list, dl_mcs[i]); + } + NR_PTRS_DownlinkCfg->epre_Ratio = CALLOC(1, sizeof(NR_PTRS_DownlinkCfg->epre_Ratio)); + NR_PTRS_DownlinkCfg->resourceElementOffset = CALLOC(1, sizeof(NR_PTRS_DownlinkCfg->resourceElementOffset)); + *NR_PTRS_DownlinkCfg->resourceElementOffset = 0; + ASN_SEQUENCE_ADD(&scd->downlinkBWP_ToAddModList->list,bwp); + + scd->uplinkConfig = CALLOC(1, sizeof(NR_UplinkConfig_t)); + scd->uplinkConfig->uplinkBWP_ToAddModList = CALLOC(1,sizeof(scd->uplinkConfig->uplinkBWP_ToAddModList)); + + NR_PUSCH_Config_t *pusch_Config = CALLOC(1,sizeof(*pusch_Config)); + //pusch_Config->dmrs_UplinkForPUSCH_MappingTypeA = NULL; + pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB = CALLOC(1,sizeof(*pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB)); + pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->present = NR_SetupRelease_DMRS_UplinkConfig_PR_setup; + pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup = CALLOC(1,sizeof(*pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup)); + NR_DMRS_UplinkConfig_t *NR_DMRS_UplinkConfig = pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup; + //NR_DMRS_UplinkConfig->dmrs_Type = NULL; + //NR_DMRS_UplinkConfig->dmrs_AdditionalPosition = calloc(1,sizeof(*NR_DMRS_UplinkConfig->dmrs_AdditionalPosition)); + //*NR_DMRS_UplinkConfig->dmrs_AdditionalPosition = NR_DMRS_UplinkConfig__dmrs_AdditionalPosition_pos0; + ////NR_DMRS_UplinkConfig->phaseTrackingRS=NULL; + NR_DMRS_UplinkConfig->phaseTrackingRS = CALLOC(1,sizeof(*NR_DMRS_UplinkConfig->phaseTrackingRS)); + NR_DMRS_UplinkConfig->phaseTrackingRS->present = NR_SetupRelease_PTRS_UplinkConfig_PR_setup; + NR_DMRS_UplinkConfig->phaseTrackingRS->choice.setup = CALLOC(1,sizeof(*NR_DMRS_UplinkConfig->phaseTrackingRS->choice.setup)); + NR_PTRS_UplinkConfig_t *NR_PTRS_UplinkConfig = NR_DMRS_UplinkConfig->phaseTrackingRS->choice.setup; + NR_PTRS_UplinkConfig->transformPrecoderDisabled = CALLOC(1,sizeof(*NR_PTRS_UplinkConfig->transformPrecoderDisabled)); + NR_PTRS_UplinkConfig->transformPrecoderDisabled->frequencyDensity = CALLOC(1,sizeof(*NR_PTRS_UplinkConfig->transformPrecoderDisabled->frequencyDensity)); + int *n_rbs[2]; + for (int i=0;i<2;i++) { + n_rbs[i] = CALLOC(1,sizeof(*n_rbs[i])); + *n_rbs[i] = 0; + ASN_SEQUENCE_ADD(&NR_PTRS_UplinkConfig->transformPrecoderDisabled->frequencyDensity->list, n_rbs[i]); + } + NR_PTRS_UplinkConfig->transformPrecoderDisabled->timeDensity = CALLOC(1,sizeof(*NR_PTRS_UplinkConfig->transformPrecoderDisabled->timeDensity)); + int *ptrs_mcs[3]; + for (int i = 0; i < 3; i++) { + ptrs_mcs[i] = CALLOC(1,sizeof(*ptrs_mcs[i])); + *ptrs_mcs[i] = 0; + ASN_SEQUENCE_ADD(&NR_PTRS_UplinkConfig->transformPrecoderDisabled->timeDensity->list, ptrs_mcs[i]); + } + NR_PTRS_UplinkConfig->transformPrecoderDisabled->resourceElementOffset = CALLOC(1, sizeof(NR_PTRS_UplinkConfig->transformPrecoderDisabled->resourceElementOffset)); + *NR_PTRS_UplinkConfig->transformPrecoderDisabled->resourceElementOffset = 0; + NR_BWP_Uplink_t *ubwp = CALLOC(1,sizeof(*ubwp)); + ubwp->bwp_Id=1; + ubwp->bwp_Dedicated = CALLOC(1,sizeof(*ubwp->bwp_Dedicated)); + + ubwp->bwp_Dedicated->pusch_Config = CALLOC(1,sizeof(*ubwp->bwp_Dedicated->pusch_Config)); + ubwp->bwp_Dedicated->pusch_Config->present = NR_SetupRelease_PUSCH_Config_PR_setup; + ubwp->bwp_Dedicated->pusch_Config->choice.setup = pusch_Config; + + ASN_SEQUENCE_ADD(&scd->uplinkConfig->uplinkBWP_ToAddModList->list,ubwp); +} + void RCconfig_nr_flexran() { uint16_t i; @@ -527,6 +608,12 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { prepare_scc(scc); paramdef_t SCCsParams[] = SCCPARAMS_DESC(scc); paramlist_def_t SCCsParamList = {GNB_CONFIG_STRING_SERVINGCELLCONFIGCOMMON, NULL, 0}; + + 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 @@ -589,6 +676,22 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { (int)scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.preambleReceivedTargetPower); 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 \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); + } + printf("NRRRC %d: Southbound Transport %s\n",i,*(GNBParamList.paramarray[i][GNB_TRANSPORT_S_PREFERENCE_IDX].strptr)); if (strcmp(*(GNBParamList.paramarray[i][GNB_TRANSPORT_S_PREFERENCE_IDX].strptr), "local_mac") == 0) { From fba68e9a5f939482c7b14a8ed8f464bfe98f0537 Mon Sep 17 00:00:00 2001 From: Shweta Shrivastava Date: Sat, 5 Dec 2020 13:00:51 -0600 Subject: [PATCH 012/231] Fix dedicated configuration after reading config file --- openair2/GNB_APP/gnb_config.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 8bae2805ad..a52056b2ef 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -371,6 +371,27 @@ void prepare_scd(NR_ServingCellConfig_t *scd) { ASN_SEQUENCE_ADD(&scd->uplinkConfig->uplinkBWP_ToAddModList->list,ubwp); } +void fix_scd(NR_ServingCellConfig_t *scd) { + // Check for DL PTRS parameters validity + if (*scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->resourceElementOffset > 2) { + LOG_I(RRC, "Freeing DL PTRS resourceElementOffset \n"); + free(scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->resourceElementOffset); + scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->resourceElementOffset = NULL; + } + if (*scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->epre_Ratio > 1) { + LOG_I(RRC, "Freeing DL PTRS epre_Ratio \n"); + free(scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->epre_Ratio); + scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->epre_Ratio = NULL; + } + + // Check for UL PTRS parameters validity + if (*scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->resourceElementOffset > 2) { + LOG_I(RRC, "Freeing UL PTRS resourceElementOffset \n"); + free(scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->resourceElementOffset); + scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->resourceElementOffset = NULL; + } +} + void RCconfig_nr_flexran() { uint16_t i; @@ -690,6 +711,7 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { (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); + fix_scd(scd); } printf("NRRRC %d: Southbound Transport %s\n",i,*(GNBParamList.paramarray[i][GNB_TRANSPORT_S_PREFERENCE_IDX].strptr)); From f9b87d84ab9d41615d15c563dcd29e616e62854c Mon Sep 17 00:00:00 2001 From: Shweta Shrivastava Date: Sat, 5 Dec 2020 13:45:38 -0600 Subject: [PATCH 013/231] Add dedicated config to RRC config request from GNB APP -> RRC --- openair2/COMMON/rrc_messages_types.h | 2 ++ openair2/GNB_APP/gnb_config.c | 1 + 2 files changed, 3 insertions(+) diff --git a/openair2/COMMON/rrc_messages_types.h b/openair2/COMMON/rrc_messages_types.h index 6f37c8be1c..28c96afd0f 100644 --- a/openair2/COMMON/rrc_messages_types.h +++ b/openair2/COMMON/rrc_messages_types.h @@ -42,6 +42,7 @@ #include "LTE_SL-DiscResourcePool-r12.h" #include "NR_RACH-ConfigCommon.h" #include "NR_ServingCellConfigCommon.h" +#include "NR_ServingCellConfig.h" //-------------------------------------------------------------------------------------------// // Messages for RRC logging #if defined(DISABLE_ITTI_XER_PRINT) @@ -405,6 +406,7 @@ typedef struct NRRrcConfigurationReq_s { uint16_t mnc[PLMN_LIST_MAX_SIZE]; uint8_t mnc_digit_length[PLMN_LIST_MAX_SIZE]; NR_ServingCellConfigCommon_t *scc; + NR_ServingCellConfig_t *scd; int ssb_SubcarrierOffset; int pdsch_AntennaPorts; int pusch_TargetSNRx10; diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index a52056b2ef..e2f1c3a5bb 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -784,6 +784,7 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { printf("pucch_TargetSNRx10 %d\n",*GNBParamList.paramarray[i][GNB_PUCCH_TARGETPOW_X10_IDX].iptr); NRRRC_CONFIGURATION_REQ (msg_p).pucch_TargetSNRx10 = *GNBParamList.paramarray[i][GNB_PUCCH_TARGETPOW_X10_IDX].iptr; NRRRC_CONFIGURATION_REQ (msg_p).scc = scc; + NRRRC_CONFIGURATION_REQ (msg_p).scd = scd; }// From c71e136aa04931f28806f26008c4774eba0334c3 Mon Sep 17 00:00:00 2001 From: Shweta Shrivastava Date: Sat, 5 Dec 2020 14:04:27 -0600 Subject: [PATCH 014/231] Code cleanup and comments --- openair2/GNB_APP/gnb_config.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index e2f1c3a5bb..1b78546d0c 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -290,10 +290,17 @@ void fix_scc(NR_ServingCellConfigCommon_t *scc,uint64_t ssbmap) { } } +/* Function to allocate dedicated serving cell config strutures */ void prepare_scd(NR_ServingCellConfig_t *scd) { + // Allocate downlink structures + scd->downlinkBWP_ToAddModList = CALLOC(1,sizeof(scd->downlinkBWP_ToAddModList)); + + // Downlink bandwidth part NR_BWP_Downlink_t *bwp=calloc(1,sizeof(*bwp)); bwp->bwp_Id=1; + + // Allocate downlink dedicated bandwidth part and PDSCH structures bwp->bwp_Dedicated=calloc(1,sizeof(*bwp->bwp_Dedicated)); bwp->bwp_Dedicated->pdsch_Config = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config)); bwp->bwp_Dedicated->pdsch_Config->present = NR_SetupRelease_PDSCH_Config_PR_setup; @@ -301,6 +308,7 @@ void prepare_scd(NR_ServingCellConfig_t *scd) { bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA)); bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->present= NR_SetupRelease_DMRS_DownlinkConfig_PR_setup; + // Allocate DL DMRS and PTRS configuration bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup)); NR_DMRS_DownlinkConfig_t *NR_DMRS_DownlinkCfg = bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup; NR_DMRS_DownlinkCfg->phaseTrackingRS=CALLOC(1,sizeof(*NR_DMRS_DownlinkCfg->phaseTrackingRS)); @@ -326,19 +334,18 @@ void prepare_scd(NR_ServingCellConfig_t *scd) { *NR_PTRS_DownlinkCfg->resourceElementOffset = 0; ASN_SEQUENCE_ADD(&scd->downlinkBWP_ToAddModList->list,bwp); + // Allocate uplink structures + scd->uplinkConfig = CALLOC(1, sizeof(NR_UplinkConfig_t)); scd->uplinkConfig->uplinkBWP_ToAddModList = CALLOC(1,sizeof(scd->uplinkConfig->uplinkBWP_ToAddModList)); NR_PUSCH_Config_t *pusch_Config = CALLOC(1,sizeof(*pusch_Config)); - //pusch_Config->dmrs_UplinkForPUSCH_MappingTypeA = NULL; + + // Allocate UL DMRS and PTRS structures pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB = CALLOC(1,sizeof(*pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB)); pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->present = NR_SetupRelease_DMRS_UplinkConfig_PR_setup; pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup = CALLOC(1,sizeof(*pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup)); NR_DMRS_UplinkConfig_t *NR_DMRS_UplinkConfig = pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup; - //NR_DMRS_UplinkConfig->dmrs_Type = NULL; - //NR_DMRS_UplinkConfig->dmrs_AdditionalPosition = calloc(1,sizeof(*NR_DMRS_UplinkConfig->dmrs_AdditionalPosition)); - //*NR_DMRS_UplinkConfig->dmrs_AdditionalPosition = NR_DMRS_UplinkConfig__dmrs_AdditionalPosition_pos0; - ////NR_DMRS_UplinkConfig->phaseTrackingRS=NULL; NR_DMRS_UplinkConfig->phaseTrackingRS = CALLOC(1,sizeof(*NR_DMRS_UplinkConfig->phaseTrackingRS)); NR_DMRS_UplinkConfig->phaseTrackingRS->present = NR_SetupRelease_PTRS_UplinkConfig_PR_setup; NR_DMRS_UplinkConfig->phaseTrackingRS->choice.setup = CALLOC(1,sizeof(*NR_DMRS_UplinkConfig->phaseTrackingRS->choice.setup)); @@ -360,6 +367,8 @@ void prepare_scd(NR_ServingCellConfig_t *scd) { } NR_PTRS_UplinkConfig->transformPrecoderDisabled->resourceElementOffset = CALLOC(1, sizeof(NR_PTRS_UplinkConfig->transformPrecoderDisabled->resourceElementOffset)); *NR_PTRS_UplinkConfig->transformPrecoderDisabled->resourceElementOffset = 0; + + // UL bandwidth part NR_BWP_Uplink_t *ubwp = CALLOC(1,sizeof(*ubwp)); ubwp->bwp_Id=1; ubwp->bwp_Dedicated = CALLOC(1,sizeof(*ubwp->bwp_Dedicated)); @@ -371,6 +380,7 @@ void prepare_scd(NR_ServingCellConfig_t *scd) { ASN_SEQUENCE_ADD(&scd->uplinkConfig->uplinkBWP_ToAddModList->list,ubwp); } +/* This function checks dedicated serving cell configuration and performs fixes as needed */ void fix_scd(NR_ServingCellConfig_t *scd) { // Check for DL PTRS parameters validity if (*scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->resourceElementOffset > 2) { @@ -630,6 +640,7 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { 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); From a0306a92a0c1769c328f6447fe68d57c6ff84dd9 Mon Sep 17 00:00:00 2001 From: Shweta Shrivastava Date: Sat, 5 Dec 2020 15:15:58 -0600 Subject: [PATCH 015/231] Use dedicated serving cell config from config file to fill secondaryCellGroup --- openair2/RRC/NR/nr_rrc_proto.h | 2 ++ openair2/RRC/NR/rrc_gNB.c | 2 ++ openair2/RRC/NR/rrc_gNB_nsa.c | 1 + openair2/RRC/NR/rrc_gNB_reconfig.c | 44 ++++++------------------------ 4 files changed, 14 insertions(+), 35 deletions(-) diff --git a/openair2/RRC/NR/nr_rrc_proto.h b/openair2/RRC/NR/nr_rrc_proto.h index 130c6a0e34..259a95d6b5 100644 --- a/openair2/RRC/NR/nr_rrc_proto.h +++ b/openair2/RRC/NR/nr_rrc_proto.h @@ -72,6 +72,7 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_ void rrc_remove_nsa_user(gNB_RRC_INST *rrc, int rnti); void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellconfigcommon, + NR_ServingCellConfig_t *servingcellconfigdedicated, NR_CellGroupConfig_t *secondaryCellGroup, int scg_id, int servCellIndex, @@ -79,6 +80,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco int initial_csi_index); void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon, + NR_ServingCellConfig_t *servingcellconfigdedicated, NR_RRCReconfiguration_IEs_t *reconfig, NR_CellGroupConfig_t *secondaryCellGroup, int n_physical_antenna_ports, diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 71e0bd13ad..0c5c422efb 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -270,6 +270,8 @@ static void init_NR_SI(gNB_RRC_INST *rrc, gNB_RrcConfigurationReq *configuration parse_CG_ConfigInfo(rrc,CG_ConfigInfo,NULL); } else { struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_allocate_new_UE_context(rrc); + ue_context_p->ue_context.spCellConfig = calloc(1, sizeof(struct NR_SpCellConfig)); + ue_context_p->ue_context.spCellConfig->spCellConfigDedicated = configuration->scd; LOG_I(NR_RRC,"Adding new user (%p)\n",ue_context_p); rrc_add_nsa_user(rrc,ue_context_p,NULL); } diff --git a/openair2/RRC/NR/rrc_gNB_nsa.c b/openair2/RRC/NR/rrc_gNB_nsa.c index 7b7647a746..30f56597b5 100644 --- a/openair2/RRC/NR/rrc_gNB_nsa.c +++ b/openair2/RRC/NR/rrc_gNB_nsa.c @@ -167,6 +167,7 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_ fill_default_rbconfig(ue_context_p->ue_context.rb_config); } fill_default_reconfig(carrier->servingcellconfigcommon, + ue_context_p->ue_context.spCellConfig->spCellConfigDedicated, reconfig_ies, ue_context_p->ue_context.secondaryCellGroup, carrier->pdsch_AntennaPorts, diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index b5bcf09d47..58fa37cc32 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -31,6 +31,7 @@ #define RRC_GNB_NSA_C #include "NR_ServingCellConfigCommon.h" +#include "NR_ServingCellConfig.h" #include "NR_RRCReconfiguration.h" #include "NR_RRCReconfiguration-IEs.h" #include "NR_CellGroupConfig.h" @@ -49,6 +50,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellconfigcommon, + NR_ServingCellConfig_t *servingcellconfigdedicated, NR_CellGroupConfig_t *secondaryCellGroup, int scg_id, int servCellIndex, @@ -224,7 +226,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup->ext1 = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup->ext1)); secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup->ext1->t311 = NR_RLF_TimersAndConstants__ext1__t311_ms30000; secondaryCellGroup->spCellConfig->rlmInSyncOutOfSyncThreshold = NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated)); + secondaryCellGroup->spCellConfig->spCellConfigDedicated = servingcellconfigdedicated; secondaryCellGroup->spCellConfig->spCellConfigDedicated->tdd_UL_DL_ConfigurationDedicated = NULL; secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP)); secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdcch_Config=NULL; @@ -394,9 +396,8 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco #endif secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToReleaseList= NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList)); - - NR_BWP_Downlink_t *bwp=calloc(1,sizeof(*bwp)); + + NR_BWP_Downlink_t *bwp=servingcellconfigdedicated->downlinkBWP_ToAddModList->list.array[0]; bwp->bwp_Id=1; bwp->bwp_Common=calloc(1,sizeof(*bwp->bwp_Common)); // copy common BWP size from initial BWP except for bandwdith @@ -501,8 +502,6 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco ASN_SEQUENCE_ADD(&bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list,pdschi); } - bwp->bwp_Dedicated=calloc(1,sizeof(*bwp->bwp_Dedicated)); - bwp->bwp_Dedicated->pdcch_Config=calloc(1,sizeof(*bwp->bwp_Dedicated->pdcch_Config)); bwp->bwp_Dedicated->pdcch_Config->present = NR_SetupRelease_PDCCH_Config_PR_setup; bwp->bwp_Dedicated->pdcch_Config->choice.setup = calloc(1,sizeof(*bwp->bwp_Dedicated->pdcch_Config->choice.setup)); @@ -545,22 +544,12 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToReleaseList = NULL; - bwp->bwp_Dedicated->pdsch_Config = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config)); - - bwp->bwp_Dedicated->pdsch_Config->present = NR_SetupRelease_PDSCH_Config_PR_setup; - bwp->bwp_Dedicated->pdsch_Config->choice.setup = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup)); bwp->bwp_Dedicated->pdsch_Config->choice.setup->dataScramblingIdentityPDSCH = NULL; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA)); - bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->present= NR_SetupRelease_DMRS_DownlinkConfig_PR_setup; - - bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup)); bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type=NULL; bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->maxLength=NULL; bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->scramblingID0=NULL; bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->scramblingID1=NULL; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS=NULL; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition)); *bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0; @@ -737,8 +726,6 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco *bwp->bwp_Dedicated->radioLinkMonitoringConfig->choice.setup->beamFailureDetectionTimer = NR_RadioLinkMonitoringConfig__beamFailureDetectionTimer_pbfd2; #endif - ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list,bwp); - secondaryCellGroup->spCellConfig->spCellConfigDedicated->firstActiveDownlinkBWP_Id=calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->firstActiveDownlinkBWP_Id)); *secondaryCellGroup->spCellConfig->spCellConfigDedicated->firstActiveDownlinkBWP_Id=1; @@ -746,26 +733,21 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco secondaryCellGroup->spCellConfig->spCellConfigDedicated->defaultDownlinkBWP_Id = NULL; secondaryCellGroup->spCellConfig->spCellConfigDedicated->defaultDownlinkBWP_Id = calloc(1, sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->defaultDownlinkBWP_Id)); *secondaryCellGroup->spCellConfig->spCellConfigDedicated->defaultDownlinkBWP_Id = 1; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig=calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig)); NR_BWP_UplinkDedicated_t *initialUplinkBWP = calloc(1,sizeof(*initialUplinkBWP)); secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP = initialUplinkBWP; initialUplinkBWP->pucch_Config = NULL; initialUplinkBWP->pusch_Config = calloc(1,sizeof(*initialUplinkBWP->pusch_Config)); initialUplinkBWP->pusch_Config->present = NR_SetupRelease_PUSCH_Config_PR_setup; - NR_PUSCH_Config_t *pusch_Config = calloc(1,sizeof(*pusch_Config)); + NR_PUSCH_Config_t *pusch_Config = servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup; initialUplinkBWP->pusch_Config->choice.setup = pusch_Config; pusch_Config->txConfig=calloc(1,sizeof(*pusch_Config->txConfig)); *pusch_Config->txConfig= NR_PUSCH_Config__txConfig_codebook; pusch_Config->dmrs_UplinkForPUSCH_MappingTypeA = NULL; - pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB = calloc(1,sizeof(*pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB)); - pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->present = NR_SetupRelease_DMRS_UplinkConfig_PR_setup; - pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup = calloc(1,sizeof(*pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup)); NR_DMRS_UplinkConfig_t *NR_DMRS_UplinkConfig = pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup; NR_DMRS_UplinkConfig->dmrs_Type = NULL; NR_DMRS_UplinkConfig->dmrs_AdditionalPosition = calloc(1,sizeof(*NR_DMRS_UplinkConfig->dmrs_AdditionalPosition)); *NR_DMRS_UplinkConfig->dmrs_AdditionalPosition = NR_DMRS_UplinkConfig__dmrs_AdditionalPosition_pos0; - NR_DMRS_UplinkConfig->phaseTrackingRS=NULL; NR_DMRS_UplinkConfig->maxLength=NULL; NR_DMRS_UplinkConfig->transformPrecodingDisabled = calloc(1,sizeof(*NR_DMRS_UplinkConfig->transformPrecodingDisabled)); NR_DMRS_UplinkConfig->transformPrecodingDisabled->scramblingID0 = NULL; @@ -864,8 +846,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco ASN_SEQUENCE_ADD(&srs_Config->srs_ResourceToAddModList->list,srs_res0); secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToReleaseList = NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList)); - NR_BWP_Uplink_t *ubwp = calloc(1,sizeof(*ubwp)); + NR_BWP_Uplink_t *ubwp = servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]; ubwp->bwp_Id=1; ubwp->bwp_Common = calloc(1,sizeof(*ubwp->bwp_Common)); // copy bwp_Common from Initial UL BWP except for bandwidth @@ -878,7 +859,6 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco ubwp->bwp_Common->pusch_ConfigCommon = servingcellconfigcommon->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon; ubwp->bwp_Common->pucch_ConfigCommon = servingcellconfigcommon->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon; - ubwp->bwp_Dedicated = calloc(1,sizeof(*ubwp->bwp_Dedicated)); ubwp->bwp_Dedicated->pucch_Config = calloc(1,sizeof(*ubwp->bwp_Dedicated->pucch_Config)); ubwp->bwp_Dedicated->pucch_Config->present = NR_SetupRelease_PUCCH_Config_PR_setup; NR_PUCCH_Config_t *pucch_Config = calloc(1,sizeof(*pucch_Config)); @@ -1008,11 +988,6 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco ASN_SEQUENCE_ADD(&pucch_Config->pucch_PowerControl->p0_Set->list,p00); pucch_Config->pucch_PowerControl->pathlossReferenceRSs = NULL; - // copy pusch_Config from dedicated initialBWP - ubwp->bwp_Dedicated->pusch_Config = calloc(1,sizeof(*ubwp->bwp_Dedicated->pusch_Config)); - ubwp->bwp_Dedicated->pusch_Config->present = NR_SetupRelease_PUSCH_Config_PR_setup; - ubwp->bwp_Dedicated->pusch_Config->choice.setup = pusch_Config; - ubwp->bwp_Dedicated->configuredGrantConfig = NULL; ubwp->bwp_Dedicated->srs_Config = calloc(1,sizeof(*ubwp->bwp_Dedicated->srs_Config)); ubwp->bwp_Dedicated->srs_Config->present = NR_SetupRelease_SRS_Config_PR_setup; @@ -1020,8 +995,6 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco ubwp->bwp_Dedicated->beamFailureRecoveryConfig = NULL; - ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list,ubwp); - secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->firstActiveUplinkBWP_Id = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->firstActiveUplinkBWP_Id)); *secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->firstActiveUplinkBWP_Id = 1; @@ -1203,6 +1176,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco } void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon, + NR_ServingCellConfig_t *servingcellconfigdedicated, NR_RRCReconfiguration_IEs_t *reconfig, NR_CellGroupConfig_t *secondaryCellGroup, int n_physical_antenna_ports, @@ -1213,7 +1187,7 @@ void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon // radioBearerConfig reconfig->radioBearerConfig=NULL; // secondaryCellGroup - fill_default_secondaryCellGroup(servingcellconfigcommon,secondaryCellGroup,1,1,n_physical_antenna_ports,initial_csi_index); + fill_default_secondaryCellGroup(servingcellconfigcommon,servingcellconfigdedicated,secondaryCellGroup,1,1,n_physical_antenna_ports,initial_csi_index); xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void*)secondaryCellGroup); char scg_buffer[1024]; From 61d3f3465a2b31a47b4a958e89ef258a2a971d90 Mon Sep 17 00:00:00 2001 From: Shweta Shrivastava Date: Tue, 8 Dec 2020 22:57:50 -0600 Subject: [PATCH 016/231] Make PTRS configuration optional --- .../gnb.band78.tm1.106PRB.usrpn300.conf | 4 + openair2/GNB_APP/RRC_nr_paramsvalues.h | 20 ++--- openair2/GNB_APP/gnb_config.c | 81 +++++++++++++++---- 3 files changed, 81 insertions(+), 24 deletions(-) diff --git a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf index f304f583c0..b148107234 100644 --- a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf +++ b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf @@ -194,6 +194,10 @@ gNBs = # Dedicated Serving Cell Configuration servingCellConfigDedicated = ( { + # PTRS-related config is optional. If any of the frequencyDensity or + # timeDensity parameters are skipped below or if the values are out- + # of-bounds, PTRS will be assumed to be not present. + # DL PTRS related parameters. # 3GPP TS 38.331 PTRS-DownlinkConfig diff --git a/openair2/GNB_APP/RRC_nr_paramsvalues.h b/openair2/GNB_APP/RRC_nr_paramsvalues.h index 2fa9af1bd3..ad0551408f 100644 --- a/openair2/GNB_APP/RRC_nr_paramsvalues.h +++ b/openair2/GNB_APP/RRC_nr_paramsvalues.h @@ -402,18 +402,18 @@ /*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ #define SCDPARAMS_DESC(scd) { \ -{GNB_CONFIG_STRING_DLPTRSFREQDENSITY0_0,NULL,0,i64ptr:scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->frequencyDensity->list.array[0],defint64val:1,TYPE_INT64,0}, \ -{GNB_CONFIG_STRING_DLPTRSFREQDENSITY1_0,NULL,0,i64ptr:scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->frequencyDensity->list.array[1],defint64val:1,TYPE_INT64,0}, \ -{GNB_CONFIG_STRING_DLPTRSTIMEDENSITY0_0,NULL,0,i64ptr:scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->timeDensity->list.array[0],defint64val:0,TYPE_INT64,0}, \ -{GNB_CONFIG_STRING_DLPTRSTIMEDENSITY1_0,NULL,0,i64ptr:scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->timeDensity->list.array[1],defint64val:0,TYPE_INT64,0}, \ -{GNB_CONFIG_STRING_DLPTRSTIMEDENSITY2_0,NULL,0,i64ptr:scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->timeDensity->list.array[2],defint64val:0,TYPE_INT64,0}, \ +{GNB_CONFIG_STRING_DLPTRSFREQDENSITY0_0,NULL,0,i64ptr:scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->frequencyDensity->list.array[0],defint64val:-1,TYPE_INT64,0}, \ +{GNB_CONFIG_STRING_DLPTRSFREQDENSITY1_0,NULL,0,i64ptr:scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->frequencyDensity->list.array[1],defint64val:-1,TYPE_INT64,0}, \ +{GNB_CONFIG_STRING_DLPTRSTIMEDENSITY0_0,NULL,0,i64ptr:scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->timeDensity->list.array[0],defint64val:-1,TYPE_INT64,0}, \ +{GNB_CONFIG_STRING_DLPTRSTIMEDENSITY1_0,NULL,0,i64ptr:scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->timeDensity->list.array[1],defint64val:-1,TYPE_INT64,0}, \ +{GNB_CONFIG_STRING_DLPTRSTIMEDENSITY2_0,NULL,0,i64ptr:scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->timeDensity->list.array[2],defint64val:-1,TYPE_INT64,0}, \ {GNB_CONFIG_STRING_DLPTRSEPRERATIO_0,NULL,0,i64ptr:scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->epre_Ratio,defint64val:-1,TYPE_INT64,0}, \ {GNB_CONFIG_STRING_DLPTRSREOFFSET_0,NULL,0,i64ptr:scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->resourceElementOffset,defint64val:-1,TYPE_INT64,0}, \ -{GNB_CONFIG_STRING_ULPTRSFREQDENSITY0_0,NULL,0,i64ptr: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],defint64val:1,TYPE_INT64,0}, \ -{GNB_CONFIG_STRING_ULPTRSFREQDENSITY1_0,NULL,0,i64ptr: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],defint64val:1,TYPE_INT64,0}, \ -{GNB_CONFIG_STRING_ULPTRSTIMEDENSITY0_0,NULL,0,i64ptr: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],defint64val:0,TYPE_INT64,0}, \ -{GNB_CONFIG_STRING_ULPTRSTIMEDENSITY1_0,NULL,0,i64ptr: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],defint64val:0,TYPE_INT64,0}, \ -{GNB_CONFIG_STRING_ULPTRSTIMEDENSITY2_0,NULL,0,i64ptr: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],defint64val:0,TYPE_INT64,0}, \ +{GNB_CONFIG_STRING_ULPTRSFREQDENSITY0_0,NULL,0,i64ptr: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],defint64val:-1,TYPE_INT64,0}, \ +{GNB_CONFIG_STRING_ULPTRSFREQDENSITY1_0,NULL,0,i64ptr: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],defint64val:-1,TYPE_INT64,0}, \ +{GNB_CONFIG_STRING_ULPTRSTIMEDENSITY0_0,NULL,0,i64ptr: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],defint64val:-1,TYPE_INT64,0}, \ +{GNB_CONFIG_STRING_ULPTRSTIMEDENSITY1_0,NULL,0,i64ptr: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],defint64val:-1,TYPE_INT64,0}, \ +{GNB_CONFIG_STRING_ULPTRSTIMEDENSITY2_0,NULL,0,i64ptr: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],defint64val:-1,TYPE_INT64,0}, \ {GNB_CONFIG_STRING_ULPTRSREOFFSET_0,NULL,0,i64ptr:scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->resourceElementOffset,defint64val:-1,TYPE_INT64,0}, \ {GNB_CONFIG_STRING_ULPTRSMAXPORTS_0,NULL,0,i64ptr:&scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->maxNrofPorts,defint64val:0,TYPE_INT64,0}, \ {GNB_CONFIG_STRING_ULPTRSPOWER_0,NULL,0,i64ptr:&scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->ptrs_Power,defint64val:0,TYPE_INT64,0}} diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 1b78546d0c..2ef6607ebc 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -383,22 +383,75 @@ void prepare_scd(NR_ServingCellConfig_t *scd) { /* This function checks dedicated serving cell configuration and performs fixes as needed */ void fix_scd(NR_ServingCellConfig_t *scd) { // Check for DL PTRS parameters validity - if (*scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->resourceElementOffset > 2) { - LOG_I(RRC, "Freeing DL PTRS resourceElementOffset \n"); - free(scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->resourceElementOffset); - scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->resourceElementOffset = NULL; + if (scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS) { + // If any of the frequencyDensity values are not set or are out of bounds, PTRS is assumed to be not present + for (int i = scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->frequencyDensity->list.count-1; i >= 0; i--) { + if ((*scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->frequencyDensity->list.array[i] < 1) + || (*scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->frequencyDensity->list.array[i] > 276)) { + LOG_I(RRC, "DL PTRS frequencyDensity %d not set. Assuming PTRS not present! \n", i); + free(scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS); + scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS = NULL; + break; + } + } } - if (*scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->epre_Ratio > 1) { - LOG_I(RRC, "Freeing DL PTRS epre_Ratio \n"); - free(scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->epre_Ratio); - scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->epre_Ratio = NULL; + if (scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS) { + // If any of the timeDensity values are not set or are out of bounds, PTRS is assumed to be not present + for (int i = scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->timeDensity->list.count-1; i >= 0; i--) { + if ((*scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->timeDensity->list.array[i] < 0) + || (*scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->timeDensity->list.array[i] > 29)) { + LOG_I(RRC, "DL PTRS timeDensity %d not set. Assuming PTRS not present! \n", i); + free(scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS); + scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS = NULL; + break; + } + } + } + if (scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS) { + if (*scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->resourceElementOffset > 2) { + LOG_I(RRC, "Freeing DL PTRS resourceElementOffset \n"); + free(scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->resourceElementOffset); + scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->resourceElementOffset = NULL; + } + if (*scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->epre_Ratio > 1) { + LOG_I(RRC, "Freeing DL PTRS epre_Ratio \n"); + free(scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->epre_Ratio); + scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->epre_Ratio = NULL; + } } - // Check for UL PTRS parameters validity - if (*scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->resourceElementOffset > 2) { - LOG_I(RRC, "Freeing UL PTRS resourceElementOffset \n"); - free(scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->resourceElementOffset); - scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->resourceElementOffset = NULL; + if (scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS) { + // If any of the frequencyDensity values are not set or are out of bounds, PTRS is assumed to be not present + for (int i = scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->frequencyDensity->list.count-1; i >= 0; i--) { + if ((*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[i] < 1) + || (*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[i] > 276)) { + LOG_I(RRC, "UL PTRS frequencyDensity %d not set. Assuming PTRS not present! \n", i); + free(scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS); + scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS = NULL; + break; + } + } + } + + if (scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS) { + // If any of the timeDensity values are not set or are out of bounds, PTRS is assumed to be not present + for (int i = scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->timeDensity->list.count-1; i >= 0; i--) { + if ((*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[i] < 0) + || (*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[i] > 29)) { + LOG_I(RRC, "UL PTRS timeDensity %d not set. Assuming PTRS not present! \n", i); + free(scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS); + scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS = NULL; + break; + } + } + } + if (scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS) { + // Check for UL PTRS parameters validity + if (*scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->resourceElementOffset > 2) { + LOG_I(RRC, "Freeing UL PTRS resourceElementOffset \n"); + free(scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->resourceElementOffset); + scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->resourceElementOffset = NULL; + } } } @@ -722,8 +775,8 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { (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); - fix_scd(scd); } + fix_scd(scd); printf("NRRRC %d: Southbound Transport %s\n",i,*(GNBParamList.paramarray[i][GNB_TRANSPORT_S_PREFERENCE_IDX].strptr)); if (strcmp(*(GNBParamList.paramarray[i][GNB_TRANSPORT_S_PREFERENCE_IDX].strptr), "local_mac") == 0) { From 63a5c693b436783bf35328aba30888bb2fe13f85 Mon Sep 17 00:00:00 2001 From: He Shanyun Date: Thu, 28 Nov 2019 10:25:13 +0900 Subject: [PATCH 017/231] modify decode error about supportedCodecList in NAS message --- openair3/NAS/COMMON/IES/SupportedCodecList.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/openair3/NAS/COMMON/IES/SupportedCodecList.c b/openair3/NAS/COMMON/IES/SupportedCodecList.c index 3a69eee366..15a2fecaa0 100644 --- a/openair3/NAS/COMMON/IES/SupportedCodecList.c +++ b/openair3/NAS/COMMON/IES/SupportedCodecList.c @@ -43,13 +43,17 @@ int decode_supported_codec_list(SupportedCodecList *supportedcodeclist, uint8_t CHECK_LENGTH_DECODER(len - decoded, ielen); supportedcodeclist->systemidentification = *(buffer + decoded); decoded++; + ielen--; supportedcodeclist->lengthofbitmap = *(buffer + decoded); decoded++; + ielen--; //IES_DECODE_U16(supportedcodeclist->codecbitmap, *(buffer + decoded)); IES_DECODE_U16(buffer, decoded, supportedcodeclist->codecbitmap); + ielen=ielen -2; #if defined (NAS_DEBUG) dump_supported_codec_list_xml(supportedcodeclist, iei); #endif + decoded = decoded + ielen; return decoded; } int encode_supported_codec_list(SupportedCodecList *supportedcodeclist, uint8_t iei, uint8_t *buffer, uint32_t len) From df17a8dd4f220aa9ba4c0ea0b5162939fdb1cbfb Mon Sep 17 00:00:00 2001 From: Wu Jing Date: Wed, 8 Jan 2020 16:50:16 +0900 Subject: [PATCH 018/231] merge NNSF feature based on v1.0.2 (cherry picked from commit b9e93a16379cf261502d9451b60bd787c07da64e) --- openair2/RRC/LTE/rrc_eNB_S1AP.c | 32 ++++++++--- openair3/S1AP/s1ap_eNB_defs.h | 2 + openair3/S1AP/s1ap_eNB_nas_procedures.c | 17 +++--- openair3/S1AP/s1ap_eNB_nnsf.c | 70 ++++++++++++++++++++++--- openair3/S1AP/s1ap_eNB_nnsf.h | 3 +- 5 files changed, 101 insertions(+), 23 deletions(-) diff --git a/openair2/RRC/LTE/rrc_eNB_S1AP.c b/openair2/RRC/LTE/rrc_eNB_S1AP.c index 4be9a50b32..b319491207 100644 --- a/openair2/RRC/LTE/rrc_eNB_S1AP.c +++ b/openair2/RRC/LTE/rrc_eNB_S1AP.c @@ -782,21 +782,37 @@ rrc_eNB_send_S1AP_NAS_FIRST_REQ( S1AP_NAS_FIRST_REQ (message_p).ue_identity.presenceMask |= UE_IDENTITIES_gummei; if (r_mme->plmn_Identity != NULL) { - if ((r_mme->plmn_Identity->mcc != NULL) && (r_mme->plmn_Identity->mcc->list.count > 0)) { - /* Use first indicated PLMN MCC if it is defined */ - S1AP_NAS_FIRST_REQ (message_p).ue_identity.gummei.mcc = *r_mme->plmn_Identity->mcc->list.array[selected_plmn_identity]; + if ((r_mme->plmn_Identity->mcc != NULL) && (r_mme->plmn_Identity->mcc->list.count == 3)) + { + S1AP_NAS_FIRST_REQ (message_p).ue_identity.gummei.mcc = (*r_mme->plmn_Identity->mcc->list.array[0] & 0xf) * 100 + + (*r_mme->plmn_Identity->mcc->list.array[1] & 0xf) * 10 + + (*r_mme->plmn_Identity->mcc->list.array[2] & 0xf); LOG_I(S1AP, "[eNB %d] Build S1AP_NAS_FIRST_REQ adding in s_TMSI: GUMMEI MCC %u ue %x\n", ctxt_pP->module_id, S1AP_NAS_FIRST_REQ (message_p).ue_identity.gummei.mcc, ue_context_pP->ue_context.rnti); } - - if (r_mme->plmn_Identity->mnc.list.count > 0) { - /* Use first indicated PLMN MNC if it is defined */ - S1AP_NAS_FIRST_REQ (message_p).ue_identity.gummei.mnc = *r_mme->plmn_Identity->mnc.list.array[selected_plmn_identity]; - LOG_I(S1AP, "[eNB %d] Build S1AP_NAS_FIRST_REQ adding in s_TMSI: GUMMEI MNC %u ue %x\n", + if(r_mme->plmn_Identity->mnc.list.count == 3) + { + S1AP_NAS_FIRST_REQ (message_p).ue_identity.gummei.mnc = (*r_mme->plmn_Identity->mnc.list.array[0] & 0xf) * 100 + + (*r_mme->plmn_Identity->mnc.list.array[1] & 0xf) * 10 + + (*r_mme->plmn_Identity->mnc.list.array[2] & 0xf); + S1AP_NAS_FIRST_REQ (message_p).ue_identity.gummei.mnc_len = 3; + LOG_I(S1AP, "[eNB %d] Build S1AP_NAS_FIRST_REQ adding in s_TMSI: GUMMEI MNC %u %udigit ue %x\n", ctxt_pP->module_id, S1AP_NAS_FIRST_REQ (message_p).ue_identity.gummei.mnc, + S1AP_NAS_FIRST_REQ (message_p).ue_identity.gummei.mnc_len, + ue_context_pP->ue_context.rnti); + } + else if(r_mme->plmn_Identity->mnc.list.count == 2) + { + S1AP_NAS_FIRST_REQ (message_p).ue_identity.gummei.mnc = (*r_mme->plmn_Identity->mnc.list.array[0] & 0xf) * 10 + + (*r_mme->plmn_Identity->mnc.list.array[1] & 0xf); + S1AP_NAS_FIRST_REQ (message_p).ue_identity.gummei.mnc_len = 2; + LOG_I(S1AP, "[eNB %d] Build S1AP_NAS_FIRST_REQ adding in s_TMSI: GUMMEI MNC %u %udigit ue %x\n", + ctxt_pP->module_id, + S1AP_NAS_FIRST_REQ (message_p).ue_identity.gummei.mnc, + S1AP_NAS_FIRST_REQ (message_p).ue_identity.gummei.mnc_len, ue_context_pP->ue_context.rnti); } } else { // end if plmn_Identity != NULL diff --git a/openair3/S1AP/s1ap_eNB_defs.h b/openair3/S1AP/s1ap_eNB_defs.h index d4bc6cfc0f..c6f44cdb18 100644 --- a/openair3/S1AP/s1ap_eNB_defs.h +++ b/openair3/S1AP/s1ap_eNB_defs.h @@ -164,6 +164,8 @@ typedef struct s1ap_eNB_mme_data_s { /* Only meaningfull in virtual mode */ struct s1ap_eNB_instance_s *s1ap_eNB_instance; + + uint32_t nb_calls; } s1ap_eNB_mme_data_t; typedef struct s1ap_eNB_instance_s { diff --git a/openair3/S1AP/s1ap_eNB_nas_procedures.c b/openair3/S1AP/s1ap_eNB_nas_procedures.c index d931e76bb6..4744ff4e43 100644 --- a/openair3/S1AP/s1ap_eNB_nas_procedures.c +++ b/openair3/S1AP/s1ap_eNB_nas_procedures.c @@ -138,8 +138,9 @@ int s1ap_eNB_handle_nas_first_req( * identity, selects the MME with the highest capacity. */ mme_desc_p = s1ap_eNB_nnsf_select_mme( - instance_p, - s1ap_nas_first_req_p->establishment_cause); + instance_p, + s1ap_nas_first_req_p->establishment_cause, + s1ap_nas_first_req_p->selected_plmn_identity); if (mme_desc_p) { S1AP_INFO("[eNB %d] Chose MME '%s' (assoc_id %d) through highest relative capacity\n", @@ -232,9 +233,9 @@ int s1ap_eNB_handle_nas_first_req( MACRO_ENB_ID_TO_CELL_IDENTITY(instance_p->eNB_id, 0, // Cell ID &ie->value.choice.EUTRAN_CGI.cell_ID); - MCC_MNC_TO_TBCD(instance_p->mcc[ue_desc_p->selected_plmn_identity], - instance_p->mnc[ue_desc_p->selected_plmn_identity], - instance_p->mnc_digit_length[ue_desc_p->selected_plmn_identity], + MCC_MNC_TO_TBCD(instance_p->mcc[mme_desc_p->broadcast_plmn_index[0]], + instance_p->mnc[mme_desc_p->broadcast_plmn_index[0]], + instance_p->mnc_digit_length[mme_desc_p->broadcast_plmn_index[0]], &ie->value.choice.EUTRAN_CGI.pLMNidentity); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* Set the establishment cause according to those provided by RRC */ @@ -494,9 +495,9 @@ int s1ap_eNB_nas_uplink(instance_t instance, s1ap_uplink_nas_t *s1ap_uplink_nas_ ie->criticality = S1AP_Criticality_ignore; ie->value.present = S1AP_UplinkNASTransport_IEs__value_PR_EUTRAN_CGI; MCC_MNC_TO_PLMNID( - s1ap_eNB_instance_p->mcc[ue_context_p->selected_plmn_identity], - s1ap_eNB_instance_p->mnc[ue_context_p->selected_plmn_identity], - s1ap_eNB_instance_p->mnc_digit_length[ue_context_p->selected_plmn_identity], + s1ap_eNB_instance_p->mcc[ue_context_p->mme_ref->broadcast_plmn_index[0]], + s1ap_eNB_instance_p->mnc[ue_context_p->mme_ref->broadcast_plmn_index[0]], + s1ap_eNB_instance_p->mnc_digit_length[ue_context_p->mme_ref->broadcast_plmn_index[0]], &ie->value.choice.EUTRAN_CGI.pLMNidentity); //#warning "TODO get cell id from RRC" MACRO_ENB_ID_TO_CELL_IDENTITY(s1ap_eNB_instance_p->eNB_id, diff --git a/openair3/S1AP/s1ap_eNB_nnsf.c b/openair3/S1AP/s1ap_eNB_nnsf.c index 6319f6e054..6577b8f10b 100644 --- a/openair3/S1AP/s1ap_eNB_nnsf.c +++ b/openair3/S1AP/s1ap_eNB_nnsf.c @@ -38,13 +38,27 @@ struct s1ap_eNB_mme_data_s * s1ap_eNB_nnsf_select_mme(s1ap_eNB_instance_t *instance_p, - rrc_establishment_cause_t cause) + rrc_establishment_cause_t cause, + uint32_t plmn_id) { struct s1ap_eNB_mme_data_s *mme_data_p = NULL; struct s1ap_eNB_mme_data_s *mme_highest_capacity_p = NULL; - uint8_t current_capacity = 0; + typedef struct MME_nnsf_inf { + struct s1ap_eNB_mme_data_s *mme_p; + uint64_t weight; + } MME_nnsf_inf_t; + + uint16_t capacity_sum = 0; + MME_nnsf_inf_t mme_inf[10]; + int cnt; + int nb_mme = 0; + uint64_t weight = 0; + + memset(mme_inf, 0, sizeof(mme_inf)); RB_FOREACH(mme_data_p, s1ap_mme_map, &instance_p->s1ap_mme_head) { + struct served_gummei_s *gummei_p = NULL; + capacity_sum = capacity_sum + mme_data_p->relative_mme_capacity; if (mme_data_p->state != S1AP_ENB_STATE_CONNECTED) { /* The association between MME and eNB is not ready for the moment, * go to the next known MME. @@ -79,12 +93,56 @@ s1ap_eNB_nnsf_select_mme(s1ap_eNB_instance_t *instance_p, } } - if (current_capacity < mme_data_p->relative_mme_capacity) { - /* We find a better MME, keep a reference to it */ - current_capacity = mme_data_p->relative_mme_capacity; - mme_highest_capacity_p = mme_data_p; + gummei_p = mme_data_p->served_gummei.stqh_first; + if( gummei_p != NULL ) + { + struct plmn_identity_s *served_plmns_p = NULL; + + served_plmns_p = gummei_p->served_plmns.stqh_first; + if( served_plmns_p != 0 ) + for( cnt = 0 ; cnt < 8 ; cnt++) + { + if ( (served_plmns_p->mcc == instance_p->mcc[plmn_id]) && + (served_plmns_p->mnc == instance_p->mnc[plmn_id]) ) + { + mme_inf[nb_mme].mme_p = mme_data_p; + nb_mme++; + break; + } + if( served_plmns_p->next.stqe_next == 0 ) + { + break; + } + served_plmns_p = served_plmns_p->next.stqe_next; + } } } + if( nb_mme != 0 ) + { + for( cnt = 0 ; cnt < nb_mme ; cnt++ ) + { + mme_inf[cnt].weight = (capacity_sum*10)/mme_inf[cnt].mme_p->relative_mme_capacity; + mme_inf[cnt].weight = (mme_inf[cnt].weight)*(mme_inf[cnt].mme_p->nb_calls + 1); + } + mme_highest_capacity_p = mme_inf[0].mme_p; + weight = mme_inf[0].weight; + for( cnt = 1 ; cnt < nb_mme ; cnt++ ) + { + if( weight > mme_inf[cnt].weight ) + { + mme_highest_capacity_p = mme_inf[cnt].mme_p; + weight = mme_inf[cnt].weight; + } + } + } + else + { + mme_highest_capacity_p = NULL; + } + if( mme_highest_capacity_p != NULL ) + { + mme_highest_capacity_p->nb_calls++; + } return mme_highest_capacity_p; } diff --git a/openair3/S1AP/s1ap_eNB_nnsf.h b/openair3/S1AP/s1ap_eNB_nnsf.h index d5f080649b..de039b7d30 100644 --- a/openair3/S1AP/s1ap_eNB_nnsf.h +++ b/openair3/S1AP/s1ap_eNB_nnsf.h @@ -24,7 +24,8 @@ struct s1ap_eNB_mme_data_s * s1ap_eNB_nnsf_select_mme(s1ap_eNB_instance_t *instance_p, - rrc_establishment_cause_t cause); + rrc_establishment_cause_t cause, + uint32_t plmn_id); struct s1ap_eNB_mme_data_s * s1ap_eNB_nnsf_select_mme_by_plmn_id(s1ap_eNB_instance_t *instance_p, From f006866c74a74554ac694a216f21a30e767bc07d Mon Sep 17 00:00:00 2001 From: Haruki NAOI Date: Thu, 12 Mar 2020 14:55:26 +0900 Subject: [PATCH 019/231] Fix: Drop paging message on sctp stream zero. (cherry picked from commit 2d45f940be267e013781d6baba5b2ab665e64c88) --- openair3/S1AP/s1ap_eNB_handlers.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/openair3/S1AP/s1ap_eNB_handlers.c b/openair3/S1AP/s1ap_eNB_handlers.c index 79501a1a09..7a3715f61b 100644 --- a/openair3/S1AP/s1ap_eNB_handlers.c +++ b/openair3/S1AP/s1ap_eNB_handlers.c @@ -1105,13 +1105,6 @@ int s1ap_eNB_handle_paging(uint32_t assoc_id, // received Paging Message from MME S1AP_DEBUG("[SCTP %d] Received Paging Message From MME\n",assoc_id); - /* Paging procedure -> stream != 0 */ - if (stream == 0) { - LOG_W(S1AP,"[SCTP %d] Received Paging procedure on stream (%d)\n", - assoc_id, stream); - return -1; - } - if ((mme_desc_p = s1ap_eNB_get_MME(NULL, assoc_id, 0)) == NULL) { S1AP_ERROR("[SCTP %d] Received Paging for non " "existing MME context\n", assoc_id); From cead17f2d8efa326392d31cbbf9b79a6ccdcb793 Mon Sep 17 00:00:00 2001 From: Wu Jing Date: Thu, 2 Apr 2020 10:09:02 +0900 Subject: [PATCH 020/231] Fix openair3/NAS/UE cppcheck error --- openair3/NAS/UE/EMM/SAP/emm_as.c | 4 ++-- openair3/NAS/UE/EMM/SecurityModeControl.c | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/openair3/NAS/UE/EMM/SAP/emm_as.c b/openair3/NAS/UE/EMM/SAP/emm_as.c index 99a3763dea..10b118eac0 100644 --- a/openair3/NAS/UE/EMM/SAP/emm_as.c +++ b/openair3/NAS/UE/EMM/SAP/emm_as.c @@ -443,14 +443,14 @@ static int _emm_as_data_ind(nas_user_t *user, const emm_as_data_t *msg, int *emm EPS_MOBILITY_MANAGEMENT_MESSAGE) { /* Process EMM data */ rc = _emm_as_recv(user, plain_msg, bytes, emm_cause); + free(plain_msg); } else if (header.protocol_discriminator == EPS_SESSION_MANAGEMENT_MESSAGE) { const OctetString data = {bytes, (uint8_t *)plain_msg}; /* Foward ESM data to EPS session management */ rc = lowerlayer_data_ind(user, &data); + free(plain_msg); } - - free(plain_msg); } } else { /* Process successfull lower layer transfer indication */ diff --git a/openair3/NAS/UE/EMM/SecurityModeControl.c b/openair3/NAS/UE/EMM/SecurityModeControl.c index 67bfaf784e..b27270fadc 100644 --- a/openair3/NAS/UE/EMM/SecurityModeControl.c +++ b/openair3/NAS/UE/EMM/SecurityModeControl.c @@ -296,16 +296,16 @@ int emm_proc_security_mode_command(nas_user_t *user, int native_ksi, int ksi, else { /* Setup EMM cause code */ emm_cause = EMM_CAUSE_SECURITY_MODE_REJECTED; - - /* Release security mode control internal data */ - if (security_data->kenb.value) { - free(security_data->kenb.value); - security_data->kenb.value = NULL; - security_data->kenb.length = 0; - } } } + /* Release security mode control internal data */ + if (security_data->kenb.value) { + free(security_data->kenb.value); + security_data->kenb.value = NULL; + security_data->kenb.length = 0; + } + /* Setup EMM procedure handler to be executed upon receiving * lower layer notification */ rc = emm_proc_lowerlayer_initialize(user->lowerlayer_data, NULL, NULL, NULL, NULL); From 7631a1dc1df843f328fcb299fd6d39533be84162 Mon Sep 17 00:00:00 2001 From: Ding Yumei Date: Sun, 20 Dec 2020 18:32:40 +0100 Subject: [PATCH 021/231] fix s1ap StreamID issue --- openair3/S1AP/s1ap_eNB_handlers.c | 4 +--- openair3/S1AP/s1ap_eNB_overload.c | 12 ++++++++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/openair3/S1AP/s1ap_eNB_handlers.c b/openair3/S1AP/s1ap_eNB_handlers.c index 7a3715f61b..0895494837 100644 --- a/openair3/S1AP/s1ap_eNB_handlers.c +++ b/openair3/S1AP/s1ap_eNB_handlers.c @@ -1512,7 +1512,6 @@ int s1ap_eNB_handle_s1_path_switch_request_ack(uint32_t assoc_id, if (stream == 0) { S1AP_ERROR("[SCTP %d] Received s1 path switch request ack on stream (%d)\n", assoc_id, stream); - //return -1; } if ((mme_desc_p = s1ap_eNB_get_MME(NULL, assoc_id, 0)) == NULL) { @@ -1667,9 +1666,8 @@ int s1ap_eNB_handle_s1_path_switch_request_failure(uint32_t assoc_ pathSwitchRequestFailure = &pdu->choice.unsuccessfulOutcome.value.choice.PathSwitchRequestFailure; if (stream != 0) { - S1AP_ERROR("[SCTP %d] Received s1 path switch request failure on stream != 0 (%d)\n", + S1AP_WARN("[SCTP %d] Received s1 path switch request failure on stream != 0 (%d)\n", assoc_id, stream); - return -1; } if ((mme_desc_p = s1ap_eNB_get_MME(NULL, assoc_id, 0)) == NULL) { diff --git a/openair3/S1AP/s1ap_eNB_overload.c b/openair3/S1AP/s1ap_eNB_overload.c index 9358ae62bd..e331d03b4a 100644 --- a/openair3/S1AP/s1ap_eNB_overload.c +++ b/openair3/S1AP/s1ap_eNB_overload.c @@ -63,7 +63,11 @@ int s1ap_eNB_handle_overload_start(uint32_t assoc_id, S1AP_OverloadResponse_PR_overloadAction, 0, 0); } /* Non UE-associated signalling -> stream 0 */ - DevCheck(stream == 0, stream, 0, 0); + if (stream != 0) { + S1AP_ERROR("[SCTP %d] Received s1 overload start on stream != 0 (%d)\n", + assoc_id, stream); + return -1; + } if ((mme_desc_p = s1ap_eNB_get_MME(NULL, assoc_id, 0)) == NULL) { /* No MME context associated */ @@ -93,7 +97,11 @@ int s1ap_eNB_handle_overload_stop(uint32_t assoc_id, s1ap_eNB_mme_data_t *mme_desc_p; /* Non UE-associated signalling -> stream 0 */ - DevCheck(stream == 0, stream, 0, 0); + if (stream != 0) { + S1AP_ERROR("[SCTP %d] Received s1 overload stop on stream != 0 (%d)\n", + assoc_id, stream); + return -1; + } if ((mme_desc_p = s1ap_eNB_get_MME(NULL, assoc_id, 0)) == NULL) { /* No MME context associated */ From 46407ca42b51404e0251a2d27bd42ed63ae88b8e Mon Sep 17 00:00:00 2001 From: Haruki NAOI Date: Wed, 8 Apr 2020 11:50:58 +0900 Subject: [PATCH 022/231] Add S1down auto recovery. (cherry picked from commit 2339972ceaeb75fe18c0b2ae9ea69216dd919668) --- cmake_targets/CMakeLists.txt | 1 + openair2/COMMON/s1ap_messages_types.h | 5 + openair2/COMMON/tasks_def.h | 3 +- openair2/ENB_APP/enb_config.c | 59 +++ openair2/ENB_APP/enb_paramdef.h | 15 + openair2/X2AP/x2ap_common.h | 2 +- openair2/X2AP/x2ap_eNB_handler.c | 35 +- openair3/S1AP/s1ap_common.h | 7 +- openair3/S1AP/s1ap_eNB.c | 398 +++++++++++++++-- openair3/S1AP/s1ap_eNB_defs.h | 12 + openair3/S1AP/s1ap_eNB_handlers.c | 409 +++++++++++++++--- .../S1AP/s1ap_eNB_management_procedures.c | 47 +- openair3/S1AP/s1ap_eNB_nas_procedures.c | 12 + openair3/S1AP/s1ap_eNB_overload.c | 4 + openair3/S1AP/s1ap_eNB_timer.c | 300 +++++++++++++ openair3/S1AP/s1ap_eNB_timer.h | 86 ++++ openair3/S1AP/s1ap_eNB_trace.c | 4 + openair3/SCTP/sctp_default_values.h | 4 +- openair3/SCTP/sctp_eNB_task.c | 4 +- 19 files changed, 1289 insertions(+), 118 deletions(-) create mode 100644 openair3/S1AP/s1ap_eNB_timer.c create mode 100644 openair3/S1AP/s1ap_eNB_timer.h diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 0b9d925017..a85dc7e5ea 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -540,6 +540,7 @@ add_library(S1AP_ENB ${S1AP_DIR}/s1ap_eNB_overload.c ${S1AP_DIR}/s1ap_eNB_trace.c ${S1AP_DIR}/s1ap_eNB_ue_context.c + ${S1AP_DIR}/s1ap_eNB_timer.c ) add_dependencies(S1AP_ENB rrc_flag s1ap_flag) diff --git a/openair2/COMMON/s1ap_messages_types.h b/openair2/COMMON/s1ap_messages_types.h index f6b4f3c4e2..38214fc71f 100644 --- a/openair2/COMMON/s1ap_messages_types.h +++ b/openair2/COMMON/s1ap_messages_types.h @@ -393,6 +393,11 @@ typedef struct s1ap_register_enb_req_s { /* Number of SCTP streams used for a mme association */ uint16_t sctp_in_streams; uint16_t sctp_out_streams; + uint16_t s1_setuprsp_wait_timer; + uint16_t s1_setupreq_wait_timer; + uint16_t s1_setupreq_count; + uint16_t sctp_req_timer; + uint16_t sctp_req_count; } s1ap_register_enb_req_t; //-------------------------------------------------------------------------------------------// diff --git a/openair2/COMMON/tasks_def.h b/openair2/COMMON/tasks_def.h index 33b6d5f9d4..f84195d5d7 100644 --- a/openair2/COMMON/tasks_def.h +++ b/openair2/COMMON/tasks_def.h @@ -47,7 +47,8 @@ TASK_DEF(TASK_RAL_ENB, TASK_PRIORITY_MED, 200) TASK_DEF(TASK_UDP, TASK_PRIORITY_MED, 1000) // GTP_V1U task TASK_DEF(TASK_GTPV1_U, TASK_PRIORITY_MED, 1000) -TASK_DEF(TASK_S1AP, TASK_PRIORITY_MED, 200) +//TASK_DEF(TASK_S1AP, TASK_PRIORITY_MED, 200) +TASK_DEF(TASK_S1AP, TASK_PRIORITY_MED, 2000) TASK_DEF(TASK_CU_F1, TASK_PRIORITY_MED, 200) TASK_DEF(TASK_DU_F1, TASK_PRIORITY_MED, 200) /// M3ap task, acts as both source and target diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index de77d783c7..31d0efb0aa 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -2426,6 +2426,65 @@ int RCconfig_S1( "to\n" " tracking_area_code = 1; // no string!!\n" " plmn_list = ( { mcc = 208; mnc = 93; mnc_length = 2; } )\n"); + if(*ENBParamList.paramarray[k][ENB_S1SETUP_RSP_TIMER_IDX].uptr <= 0xffff) + { + S1AP_REGISTER_ENB_REQ(msg_p).s1_setuprsp_wait_timer = *ENBParamList.paramarray[k][ENB_S1SETUP_RSP_TIMER_IDX].uptr; + } + else + { + LOG_E(S1AP, + "s1setup_rsp_timer value in conf file is invalid (%d). Default value is set.\n", + *ENBParamList.paramarray[k][ENB_S1SETUP_RSP_TIMER_IDX].uptr); + S1AP_REGISTER_ENB_REQ(msg_p).s1_setuprsp_wait_timer = 5; + } + + if(*ENBParamList.paramarray[k][ENB_S1SETUP_REQ_TIMER_IDX].uptr <= 0xffff) + { + S1AP_REGISTER_ENB_REQ(msg_p).s1_setupreq_wait_timer = *ENBParamList.paramarray[k][ENB_S1SETUP_REQ_TIMER_IDX].uptr; + } + else + { + LOG_E(S1AP, + "s1setup_req_timer value in conf file is invalid (%d). Default value is set.\n", + *ENBParamList.paramarray[k][ENB_S1SETUP_REQ_TIMER_IDX].uptr); + S1AP_REGISTER_ENB_REQ(msg_p).s1_setupreq_wait_timer = 5; + } + + if(*ENBParamList.paramarray[k][ENB_S1SETUP_REQ_COUNT_IDX].uptr <= 0xffff) + { + S1AP_REGISTER_ENB_REQ(msg_p).s1_setupreq_count = *ENBParamList.paramarray[k][ENB_S1SETUP_REQ_COUNT_IDX].uptr; + } + else + { + LOG_E(S1AP, + "s1setup_req_count value in conf file is invalid (%d). Default value is set.\n", + *ENBParamList.paramarray[k][ENB_S1SETUP_REQ_COUNT_IDX].uptr); + S1AP_REGISTER_ENB_REQ(msg_p).s1_setupreq_count = 0xffff; + } + + if(*ENBParamList.paramarray[k][ENB_SCTP_REQ_TIMER_IDX].uptr <= 0xffff) + { + S1AP_REGISTER_ENB_REQ(msg_p).sctp_req_timer = *ENBParamList.paramarray[k][ENB_SCTP_REQ_TIMER_IDX].uptr; + } + else + { + LOG_E(S1AP, + "sctp_req_timer value in conf file is invalid (%d). Default value is set.\n", + *ENBParamList.paramarray[k][ENB_SCTP_REQ_TIMER_IDX].uptr); + S1AP_REGISTER_ENB_REQ(msg_p).sctp_req_timer = 180; + } + + if(*ENBParamList.paramarray[k][ENB_SCTP_REQ_COUNT_IDX].uptr <= 0xffff) + { + S1AP_REGISTER_ENB_REQ(msg_p).sctp_req_count = *ENBParamList.paramarray[k][ENB_SCTP_REQ_COUNT_IDX].uptr; + } + else + { + LOG_E(S1AP, + "sctp_req_count value in conf file is invalid (%d). Default value is set.\n", + *ENBParamList.paramarray[k][ENB_SCTP_REQ_COUNT_IDX].uptr); + S1AP_REGISTER_ENB_REQ(msg_p).sctp_req_count = 0xffff; + } config_getlist(&PLMNParamList, PLMNParams, sizeof(PLMNParams)/sizeof(paramdef_t), aprefix); if (PLMNParamList.numelt < 1 || PLMNParamList.numelt > 6) { diff --git a/openair2/ENB_APP/enb_paramdef.h b/openair2/ENB_APP/enb_paramdef.h index de7e0bbdad..f26863414c 100644 --- a/openair2/ENB_APP/enb_paramdef.h +++ b/openair2/ENB_APP/enb_paramdef.h @@ -214,6 +214,11 @@ typedef enum { #define ENB_CONFIG_STRING_X2 "enable_x2" #define ENB_CONFIG_STRING_ENB_M2 "enable_enb_m2" #define ENB_CONFIG_STRING_MCE_M2 "enable_mce_m2" +#define ENB_CONFIG_STRING_S1SETUP_RSP_TIMER "s1setup_rsp_timer" +#define ENB_CONFIG_STRING_S1SETUP_REQ_TIMER "s1setup_req_timer" +#define ENB_CONFIG_STRING_S1SETUP_REQ_COUNT "s1setup_req_count" +#define ENB_CONFIG_STRING_SCTP_REQ_TIMER "sctp_req_timer" +#define ENB_CONFIG_STRING_SCTP_REQ_COUNT "sctp_req_count" /*-----------------------------------------------------------------------------------------------------------------------------------------*/ /* cell configuration parameters */ /* optname helpstr paramflags XXXptr defXXXval type numelt */ @@ -239,6 +244,11 @@ typedef enum { {ENB_CONFIG_STRING_X2, NULL, 0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \ {ENB_CONFIG_STRING_ENB_M2, NULL, 0, strptr:NULL, defstrval:"no", TYPE_STRING, 0}, \ {ENB_CONFIG_STRING_MCE_M2, NULL, 0, strptr:NULL, defstrval:"no", TYPE_STRING, 0}, \ + {ENB_CONFIG_STRING_S1SETUP_RSP_TIMER, NULL, 0, uptr:NULL, defuintval:5, TYPE_UINT, 0}, \ + {ENB_CONFIG_STRING_S1SETUP_REQ_TIMER, NULL, 0, uptr:NULL, defuintval:5, TYPE_UINT, 0}, \ + {ENB_CONFIG_STRING_S1SETUP_REQ_COUNT, NULL, 0, uptr:NULL, defuintval:65535, TYPE_UINT, 0}, \ + {ENB_CONFIG_STRING_SCTP_REQ_TIMER, NULL, 0, uptr:NULL, defuintval:180, TYPE_UINT, 0}, \ + {ENB_CONFIG_STRING_SCTP_REQ_COUNT, NULL, 0, uptr:NULL, defuintval:65535, TYPE_UINT, 0}, \ } #define ENB_ENB_ID_IDX 0 @@ -261,6 +271,11 @@ typedef enum { #define ENB_ENABLE_X2 17 #define ENB_ENABLE_ENB_M2 18 #define ENB_ENABLE_MCE_M2 19 +#define ENB_S1SETUP_RSP_TIMER_IDX 20 +#define ENB_S1SETUP_REQ_TIMER_IDX 21 +#define ENB_S1SETUP_REQ_COUNT_IDX 22 +#define ENB_SCTP_REQ_TIMER_IDX 23 +#define ENB_SCTP_REQ_COUNT_IDX 24 #define TRACKING_AREA_CODE_OKRANGE {0x0001,0xFFFD} #define ENBPARAMS_CHECK { \ diff --git a/openair2/X2AP/x2ap_common.h b/openair2/X2AP/x2ap_common.h index a2f903a737..470a023c31 100644 --- a/openair2/X2AP/x2ap_common.h +++ b/openair2/X2AP/x2ap_common.h @@ -84,7 +84,7 @@ extern int asn1_xer_print; break; \ } \ } \ - if (mandatory) DevAssert(ie != NULL); \ +/* if (mandatory) DevAssert(ie != NULL); \*/ \ } while(0) /** \brief Function callback prototype. diff --git a/openair2/X2AP/x2ap_eNB_handler.c b/openair2/X2AP/x2ap_eNB_handler.c index bbdeaf0ac8..db03507539 100644 --- a/openair2/X2AP/x2ap_eNB_handler.c +++ b/openair2/X2AP/x2ap_eNB_handler.c @@ -536,6 +536,14 @@ int x2ap_eNB_handle_x2_setup_response(instance_t instance, return -1; } + if((x2ap_eNB_data->state == X2AP_ENB_STATE_CONNECTED) || + (x2ap_eNB_data->state == X2AP_ENB_STATE_READY)) + + { + X2AP_ERROR("Received Unexpexted X2 Setup Response Message\n"); + return -1; + } + X2AP_DEBUG("Received a new X2 setup response\n"); X2AP_FIND_PROTOCOLIE_BY_ID(X2AP_X2SetupResponse_IEs_t, ie, x2SetupResponse, @@ -662,6 +670,14 @@ int x2ap_eNB_handle_x2_setup_failure(instance_t instance, return -1; } + if((x2ap_eNB_data->state == X2AP_ENB_STATE_CONNECTED) || + (x2ap_eNB_data->state == X2AP_ENB_STATE_READY)) + + { + X2AP_ERROR("Received Unexpexted X2 Setup Failure Message\n"); + return -1; + } + X2AP_DEBUG("Received a new X2 setup failure\n"); X2AP_FIND_PROTOCOLIE_BY_ID(X2AP_X2SetupFailure_IEs_t, ie, x2SetupFailure, @@ -730,6 +746,7 @@ int x2ap_eNB_handle_handover_preparation (instance_t instance, X2AP_ProtocolIE_ID_id_Old_eNB_UE_X2AP_ID, true); if (ie == NULL ) { X2AP_ERROR("%s %d: ie is a NULL pointer \n",__FILE__,__LINE__); + itti_free(ITTI_MSG_ORIGIN_ID(msg), msg); return -1; } @@ -750,7 +767,11 @@ int x2ap_eNB_handle_handover_preparation (instance_t instance, //measResultListEUTRA.list.array[ncell_index]->physCellId; X2AP_FIND_PROTOCOLIE_BY_ID(X2AP_HandoverRequest_IEs_t, ie, x2HandoverRequest, X2AP_ProtocolIE_ID_id_GUMMEI_ID, true); - + if (ie == NULL ) { + X2AP_ERROR("%s %d: ie is a NULL pointer \n",__FILE__,__LINE__); + itti_free(ITTI_MSG_ORIGIN_ID(msg), msg); + return -1; + } TBCD_TO_MCC_MNC(&ie->value.choice.ECGI.pLMN_Identity, X2AP_HANDOVER_REQ(msg).ue_gummei.mcc, X2AP_HANDOVER_REQ(msg).ue_gummei.mnc, X2AP_HANDOVER_REQ(msg).ue_gummei.mnc_len); OCTET_STRING_TO_INT8(&ie->value.choice.GUMMEI.mME_Code, X2AP_HANDOVER_REQ(msg).ue_gummei.mme_code); @@ -761,6 +782,7 @@ int x2ap_eNB_handle_handover_preparation (instance_t instance, if (ie == NULL ) { X2AP_ERROR("%s %d: ie is a NULL pointer \n",__FILE__,__LINE__); + itti_free(ITTI_MSG_ORIGIN_ID(msg), msg); return -1; } @@ -872,6 +894,7 @@ int x2ap_eNB_handle_handover_response (instance_t instance, if (ie == NULL ) { X2AP_ERROR("%s %d: ie is a NULL pointer \n",__FILE__,__LINE__); + itti_free(ITTI_MSG_ORIGIN_ID(msg), msg); return -1; } @@ -882,6 +905,7 @@ int x2ap_eNB_handle_handover_response (instance_t instance, if (ie == NULL ) { X2AP_ERROR("%s %d: ie is a NULL pointer \n",__FILE__,__LINE__); + itti_free(ITTI_MSG_ORIGIN_ID(msg), msg); return -1; } @@ -912,6 +936,7 @@ int x2ap_eNB_handle_handover_response (instance_t instance, if (ie == NULL ) { X2AP_ERROR("%s %d: ie is a NULL pointer \n", __FILE__, __LINE__); + itti_free(ITTI_MSG_ORIGIN_ID(msg), msg); return -1; }else{ if (ie->value.choice.E_RABs_Admitted_List.list.count > 0) { @@ -959,6 +984,12 @@ int x2ap_eNB_handle_handover_response (instance_t instance, X2AP_FIND_PROTOCOLIE_BY_ID(X2AP_HandoverRequestAcknowledge_IEs_t, ie, x2HandoverRequestAck, X2AP_ProtocolIE_ID_id_TargeteNBtoSource_eNBTransparentContainer, true); + if (ie == NULL ) { + X2AP_ERROR("%s %d: ie is a NULL pointer \n",__FILE__,__LINE__); + itti_free(ITTI_MSG_ORIGIN_ID(msg), msg); + return -1; + } + X2AP_TargeteNBtoSource_eNBTransparentContainer_t *c = &ie->value.choice.TargeteNBtoSource_eNBTransparentContainer; if (c->size > 1024 /* TODO: this is the size of rrc_buffer in struct x2ap_handover_req_ack_s */) @@ -1012,6 +1043,7 @@ int x2ap_eNB_handle_ue_context_release (instance_t instance, if (ie == NULL ) { X2AP_ERROR("%s %d: ie is a NULL pointer \n",__FILE__,__LINE__); + itti_free(ITTI_MSG_ORIGIN_ID(msg), msg); return -1; } @@ -1022,6 +1054,7 @@ int x2ap_eNB_handle_ue_context_release (instance_t instance, if (ie == NULL ) { X2AP_ERROR("%s %d: ie is a NULL pointer \n",__FILE__,__LINE__); + itti_free(ITTI_MSG_ORIGIN_ID(msg), msg); return -1; } diff --git a/openair3/S1AP/s1ap_common.h b/openair3/S1AP/s1ap_common.h index 77d03f4ae4..efac0201a3 100644 --- a/openair3/S1AP/s1ap_common.h +++ b/openair3/S1AP/s1ap_common.h @@ -106,7 +106,12 @@ extern int asn1_xer_print; if (ie == NULL ) { \ S1AP_ERROR("S1AP_FIND_PROTOCOLIE_BY_ID: %s %d: ie is NULL\n",__FILE__,__LINE__);\ } \ - if (mandatory) DevAssert(ie != NULL); \ + if (mandatory) { \ + if (ie == NULL) { \ + S1AP_ERROR("S1AP_FIND_PROTOCOLIE_BY_ID: %s %d: ie is NULL\n",__FILE__,__LINE__);\ + return -1; \ + } \ + } \ } while(0) /** \brief Function callback prototype. **/ diff --git a/openair3/S1AP/s1ap_eNB.c b/openair3/S1AP/s1ap_eNB.c index 2a153acaa2..8452d9e563 100644 --- a/openair3/S1AP/s1ap_eNB.c +++ b/openair3/S1AP/s1ap_eNB.c @@ -58,6 +58,8 @@ #include "s1ap_eNB_ue_context.h" // test, to be removed #include "msc.h" +#include "s1ap_eNB_timer.h" + #include "assertions.h" #include "conversions.h" #if defined(TEST_S1C_MME) @@ -73,6 +75,11 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t * void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp); +static int s1ap_sctp_req(s1ap_eNB_instance_t *instance_p, + s1ap_eNB_mme_data_t *s1ap_mme_data_p); +void s1ap_eNB_timer_expired(instance_t instance, + s1ap_timer_has_expired_t *msg_p); + uint32_t s1ap_generate_eNB_id(void) { char *out; char hostname[50]; @@ -114,9 +121,9 @@ static void s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p, local_ip_addr, sizeof(*local_ip_addr)); S1AP_INFO("[eNB %d] check the mme registration state\n",instance_p->instance); - mme = NULL; - - if ( mme == NULL ) { +// mme = NULL; +// +// if ( mme == NULL ) { /* Create new MME descriptor */ s1ap_mme_data_p = calloc(1, sizeof(*s1ap_mme_data_p)); DevAssert(s1ap_mme_data_p != NULL); @@ -136,28 +143,33 @@ static void s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p, * but not yet associated. */ RB_INSERT(s1ap_mme_map, &instance_p->s1ap_mme_head, s1ap_mme_data_p); - s1ap_mme_data_p->state = S1AP_ENB_STATE_WAITING; - instance_p->s1ap_mme_nb ++; +// s1ap_mme_data_p->state = S1AP_ENB_STATE_WAITING; + s1ap_mme_data_p->state = S1AP_ENB_STATE_DISCONNECTED; + memcpy( &(s1ap_mme_data_p->mme_ip_address), mme_ip_address, sizeof(net_ip_address_t) ); + s1ap_mme_data_p->overload_state = S1AP_NO_OVERLOAD; + s1ap_mme_data_p->sctp_req_cnt++; + s1ap_mme_data_p->timer_id = S1AP_TIMERID_INIT; +// instance_p->s1ap_mme_nb ++; instance_p->s1ap_mme_pending_nb ++; - } else if (mme->state == S1AP_ENB_STATE_WAITING) { - instance_p->s1ap_mme_pending_nb ++; - sctp_new_association_req_p->ulp_cnx_id = mme->cnx_id; - S1AP_INFO("[eNB %d] MME already registered, retrive the data (state %d, cnx %d, mme_nb %d, mme_pending_nb %d)\n", - instance_p->instance, - mme->state, mme->cnx_id, - instance_p->s1ap_mme_nb, instance_p->s1ap_mme_pending_nb); - /*s1ap_mme_data_p->cnx_id = mme->cnx_id; - sctp_new_association_req_p->ulp_cnx_id = mme->cnx_id; - - s1ap_mme_data_p->assoc_id = -1; - s1ap_mme_data_p->s1ap_eNB_instance = instance_p; - */ - } else { - S1AP_WARN("[eNB %d] MME already registered but not in the waiting state, retrive the data (state %d, cnx %d, mme_nb %d, mme_pending_nb %d)\n", - instance_p->instance, - mme->state, mme->cnx_id, - instance_p->s1ap_mme_nb, instance_p->s1ap_mme_pending_nb); - } +// } else if (mme->state == S1AP_ENB_STATE_WAITING) { +// instance_p->s1ap_mme_pending_nb ++; +// sctp_new_association_req_p->ulp_cnx_id = mme->cnx_id; +// S1AP_INFO("[eNB %d] MME already registered, retrive the data (state %d, cnx %d, mme_nb %d, mme_pending_nb %d)\n", +// instance_p->instance, +// mme->state, mme->cnx_id, +// instance_p->s1ap_mme_nb, instance_p->s1ap_mme_pending_nb); +// /*s1ap_mme_data_p->cnx_id = mme->cnx_id; +// sctp_new_association_req_p->ulp_cnx_id = mme->cnx_id; +// +// s1ap_mme_data_p->assoc_id = -1; +// s1ap_mme_data_p->s1ap_eNB_instance = instance_p; +// */ +// } else { +// S1AP_WARN("[eNB %d] MME already registered but not in the waiting state, retrive the data (state %d, cnx %d, mme_nb %d, mme_pending_nb %d)\n", +// instance_p->instance, +// mme->state, mme->cnx_id, +// instance_p->s1ap_mme_nb, instance_p->s1ap_mme_pending_nb); +// } itti_send_msg_to_task(TASK_SCTP, instance_p->instance, message_p); } @@ -168,6 +180,7 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t * uint8_t index; DevAssert(s1ap_register_eNB != NULL); /* Look if the provided instance already exists */ + s1ap_timer_init(); new_instance = s1ap_eNB_get_instance(instance); if (new_instance != NULL) { @@ -195,7 +208,7 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t * new_instance->eNB_id = s1ap_register_eNB->eNB_id; new_instance->cell_type = s1ap_register_eNB->cell_type; new_instance->tac = s1ap_register_eNB->tac; - + memcpy(&new_instance->eNB_s1_ip, &s1ap_register_eNB->enb_ip_address, sizeof(s1ap_register_eNB->enb_ip_address)); @@ -206,6 +219,15 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t * new_instance->mnc_digit_length[i] = s1ap_register_eNB->mnc_digit_length[i]; } + memcpy( &(new_instance->enb_ip_address), &(s1ap_register_eNB->enb_ip_address), sizeof(net_ip_address_t) ); + new_instance->s1_setuprsp_wait_timer = s1ap_register_eNB->s1_setuprsp_wait_timer; + new_instance->s1_setupreq_wait_timer = s1ap_register_eNB->s1_setupreq_wait_timer; + new_instance->s1_setupreq_count = s1ap_register_eNB->s1_setupreq_count; + new_instance->sctp_req_timer = s1ap_register_eNB->sctp_req_timer; + new_instance->sctp_req_count = s1ap_register_eNB->sctp_req_count; + new_instance->sctp_in_streams = s1ap_register_eNB->sctp_in_streams; + new_instance->sctp_out_streams = s1ap_register_eNB->sctp_out_streams; + new_instance->num_plmn = s1ap_register_eNB->num_plmn; new_instance->default_drx = s1ap_register_eNB->default_drx; /* Add the new instance to the list of eNB (meaningfull in virtual mode) */ @@ -216,8 +238,14 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t * s1ap_register_eNB->eNB_id); } - DevCheck(s1ap_register_eNB->nb_mme <= S1AP_MAX_NB_MME_IP_ADDRESS, - S1AP_MAX_NB_MME_IP_ADDRESS, s1ap_register_eNB->nb_mme, 0); +// DevCheck(s1ap_register_eNB->nb_mme <= S1AP_MAX_NB_MME_IP_ADDRESS, +// S1AP_MAX_NB_MME_IP_ADDRESS, s1ap_register_eNB->nb_mme, 0); + if( s1ap_register_eNB->nb_mme > S1AP_MAX_NB_MME_IP_ADDRESS ) + { + S1AP_ERROR("Invalid MME number = %d\n ", s1ap_register_eNB->nb_mme); + s1ap_register_eNB->nb_mme = S1AP_MAX_NB_MME_IP_ADDRESS; + } + new_instance->s1ap_mme_nb = s1ap_register_eNB->nb_mme; /* Trying to connect to provided list of MME ip address */ for (index = 0; index < s1ap_register_eNB->nb_mme; index++) { @@ -249,28 +277,153 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t * void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp) { s1ap_eNB_instance_t *instance_p; s1ap_eNB_mme_data_t *s1ap_mme_data_p; + s1ap_eNB_ue_context_t *ue_p = NULL; + MessageDef *message_p = NULL; + uint32_t timer_kind = 0; + struct plmn_identity_s* plmnInfo; + struct served_group_id_s* groupInfo; + struct served_gummei_s* gummeiInfo; + struct mme_code_s* mmeCode; + int8_t cnt = 0; + unsigned enb_s1ap_id[20]; DevAssert(sctp_new_association_resp != NULL); instance_p = s1ap_eNB_get_instance(instance); DevAssert(instance_p != NULL); s1ap_mme_data_p = s1ap_eNB_get_MME(instance_p, -1, sctp_new_association_resp->ulp_cnx_id); DevAssert(s1ap_mme_data_p != NULL); - - if (sctp_new_association_resp->sctp_state != SCTP_STATE_ESTABLISHED) { - S1AP_WARN("Received unsuccessful result for SCTP association (%u), instance %d, cnx_id %u\n", - sctp_new_association_resp->sctp_state, - instance, - sctp_new_association_resp->ulp_cnx_id); - s1ap_handle_s1_setup_message(s1ap_mme_data_p, sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN); - return; + memset(enb_s1ap_id, 0, sizeof(enb_s1ap_id) ); + if( s1ap_mme_data_p->timer_id != S1AP_TIMERID_INIT ) + { + s1ap_timer_remove( s1ap_mme_data_p->timer_id ); + s1ap_mme_data_p->timer_id = S1AP_TIMERID_INIT; } + + if( sctp_new_association_resp->sctp_state != SCTP_STATE_ESTABLISHED ) + { + RB_FOREACH(ue_p, s1ap_ue_map, &instance_p->s1ap_ue_head) + { + if( ue_p->mme_ref == s1ap_mme_data_p ) + { + enb_s1ap_id[cnt] = ue_p->eNB_ue_s1ap_id; + cnt++; + + message_p = NULL; + message_p = itti_alloc_new_message(TASK_S1AP, S1AP_UE_CONTEXT_RELEASE_COMMAND); + + if( message_p != NULL ) + { + S1AP_UE_CONTEXT_RELEASE_COMMAND(message_p).eNB_ue_s1ap_id = ue_p->eNB_ue_s1ap_id; + + if( itti_send_msg_to_task(TASK_RRC_ENB, ue_p->eNB_instance->instance, message_p) < 0 ) + { + S1AP_ERROR("UE Context Release Command Transmission Failure: eNB_ue_s1ap_id=%d\n", ue_p->eNB_ue_s1ap_id); + } + } + else + { + S1AP_ERROR("Invalid message_p : eNB_ue_s1ap_id=%d\n", ue_p->eNB_ue_s1ap_id); + } + } + } + for( ; cnt > 0 ; ) + { + cnt--; + s1ap_ue_context_release( instance, (uint32_t)enb_s1ap_id[cnt] ); + } + s1ap_mme_data_p->mme_name = 0; + s1ap_mme_data_p->overload_state = S1AP_NO_OVERLOAD; + s1ap_mme_data_p->nextstream = 0; + s1ap_mme_data_p->in_streams = 0; + s1ap_mme_data_p->out_streams = 0; + s1ap_mme_data_p->assoc_id = -1; + + while (!STAILQ_EMPTY(&s1ap_mme_data_p->served_gummei)) + { + gummeiInfo = STAILQ_FIRST(&s1ap_mme_data_p->served_gummei); + STAILQ_REMOVE_HEAD(&s1ap_mme_data_p->served_gummei, next); + while (!STAILQ_EMPTY(&gummeiInfo->served_plmns)) + { + plmnInfo = STAILQ_FIRST(&gummeiInfo->served_plmns); + STAILQ_REMOVE_HEAD(&gummeiInfo->served_plmns, next); + free(plmnInfo); + } + while (!STAILQ_EMPTY(&gummeiInfo->served_group_ids)) + { + groupInfo = STAILQ_FIRST(&gummeiInfo->served_group_ids); + STAILQ_REMOVE_HEAD(&gummeiInfo->served_group_ids, next); + free(groupInfo); + } + while (!STAILQ_EMPTY(&gummeiInfo->mme_codes)) + { + mmeCode = STAILQ_FIRST(&gummeiInfo->mme_codes); + STAILQ_REMOVE_HEAD(&gummeiInfo->mme_codes, next); + free(mmeCode); + } + free(gummeiInfo); + } + + STAILQ_INIT(&s1ap_mme_data_p->served_gummei); + + if( s1ap_mme_data_p->state == S1AP_ENB_STATE_DISCONNECTED ) + { + if( (s1ap_mme_data_p->sctp_req_cnt <= instance_p->sctp_req_count) || + (instance_p->sctp_req_count == 0xffff) ) + { + timer_kind = s1ap_mme_data_p->cnx_id; + timer_kind = timer_kind | S1AP_MMEIND; + timer_kind = timer_kind | SCTP_REQ_WAIT; + + if( s1ap_timer_setup( instance_p->sctp_req_timer, 0, TASK_S1AP, instance_p->instance, + timer_kind, S1AP_TIMER_ONE_SHOT, NULL, &s1ap_mme_data_p->timer_id) < 0 ) + { + S1AP_ERROR("Timer Start NG(SCTP retransmission wait timer) : MME=%d\n",s1ap_mme_data_p->cnx_id); + s1ap_sctp_req( instance_p, s1ap_mme_data_p ); + } + } + else + { + S1AP_ERROR("Retransmission count exceeded of SCTP : MME=%d\n",s1ap_mme_data_p->cnx_id); + } + } + else + { + S1AP_ERROR("SCTP disconnection reception : MME = %d\n",s1ap_mme_data_p->cnx_id); + + if( (s1ap_mme_data_p->sctp_req_cnt <= instance_p->sctp_req_count) || + (instance_p->sctp_req_count == 0xffff) ) + { + s1ap_sctp_req( instance_p, s1ap_mme_data_p ); + } + else + { + S1AP_ERROR("Retransmission count exceeded of SCTP : MME=%d\n",s1ap_mme_data_p->cnx_id); + } + s1ap_mme_data_p->state = S1AP_ENB_STATE_DISCONNECTED; + } + } +// if (sctp_new_association_resp->sctp_state != SCTP_STATE_ESTABLISHED) { +// S1AP_WARN("Received unsuccessful result for SCTP association (%u), instance %d, cnx_id %u\n", +// sctp_new_association_resp->sctp_state, +// instance, +// sctp_new_association_resp->ulp_cnx_id); +// s1ap_handle_s1_setup_message(s1ap_mme_data_p, sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN); +// return; +// } + else + { /* Update parameters */ s1ap_mme_data_p->assoc_id = sctp_new_association_resp->assoc_id; s1ap_mme_data_p->in_streams = sctp_new_association_resp->in_streams; s1ap_mme_data_p->out_streams = sctp_new_association_resp->out_streams; /* Prepare new S1 Setup Request */ - s1ap_eNB_generate_s1_setup_request(instance_p, s1ap_mme_data_p); + s1ap_mme_data_p->s1_setupreq_cnt = 0; + s1ap_mme_data_p->sctp_req_cnt = 0; + if (s1ap_eNB_generate_s1_setup_request(instance_p, s1ap_mme_data_p) == -1) { + S1AP_ERROR("s1ap eNB generate s1 setup request failed\n"); + return; + } } static @@ -288,9 +441,102 @@ void s1ap_eNB_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind) { AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); } +void s1ap_eNB_timer_expired( + instance_t instance, + s1ap_timer_has_expired_t *msg_p) +{ + uint32_t timer_kind = 0; + int16_t line_ind = 0; + s1ap_eNB_mme_data_t *mme_desc_p = NULL; + uint32_t timer_ind = 0; + s1ap_eNB_instance_t *instance_p = NULL; + long timer_id = S1AP_TIMERID_INIT; + + instance_p = s1ap_eNB_get_instance(instance); + timer_kind = msg_p->timer_kind; + line_ind = (int16_t)(timer_kind & S1AP_LINEIND); + timer_id = msg_p->timer_id; + + if( (timer_kind & S1AP_MMEIND) == S1AP_MMEIND ) + { + mme_desc_p = s1ap_eNB_get_MME(instance_p, -1, line_ind); + if(mme_desc_p != NULL) + { + if( timer_id == mme_desc_p->timer_id ) + { + mme_desc_p->timer_id = S1AP_TIMERID_INIT; + timer_ind = timer_kind & S1AP_TIMERIND; + + switch(timer_ind) + { + case S1_SETRSP_WAIT: + { + if( (instance_p->s1_setupreq_count >= mme_desc_p->s1_setupreq_cnt) || + (instance_p->s1_setupreq_count == 0xffff) ) + { + s1ap_eNB_generate_s1_setup_request( instance_p, mme_desc_p ); + } + else + { + S1AP_ERROR("Retransmission count exceeded of S1 SETUP REQUEST : MME=%d\n",line_ind); + } + break; + } + case S1_SETREQ_WAIT: + { + if( (instance_p->s1_setupreq_count >= mme_desc_p->s1_setupreq_cnt) || + (instance_p->s1_setupreq_count == 0xffff) ) + { + s1ap_eNB_generate_s1_setup_request( instance_p, mme_desc_p ); + } + else + { + S1AP_ERROR("Retransmission count exceeded of S1 SETUP REQUEST : MME=%d\n",line_ind); + } + break; + } + case SCTP_REQ_WAIT: + { + if( (instance_p->sctp_req_count >= mme_desc_p->sctp_req_cnt) || + (instance_p->sctp_req_count == 0xffff) ) + { + s1ap_sctp_req( instance_p, mme_desc_p ); + } + else + { + S1AP_ERROR("Retransmission count exceeded of SCTP : MME=%d\n",line_ind); + } + break; + } + default: + { + S1AP_WARN("Invalid Timer indication\n"); + break; + } + } + } + else + { + S1AP_DEBUG("Unmatch timer id\n"); + return; + } + } + else + { + S1AP_WARN("Not applicable MME detected : connection id = %d\n", line_ind); + return; + } + } + else + { + } + return; +} + void s1ap_eNB_init(void) { S1AP_DEBUG("Starting S1AP layer\n"); s1ap_eNB_prepare_internal_data(); + s1ap_timer_init(); itti_mark_task_ready(TASK_S1AP); MSC_START_USE(); } @@ -411,6 +657,13 @@ void *s1ap_eNB_process_itti_msg(void *notUsed) { } break; + case TIMER_HAS_EXPIRED: + { + s1ap_eNB_timer_expired(ITTI_MESSAGE_GET_INSTANCE(received_msg), + &TIMER_HAS_EXPIRED(received_msg)); + } + break; + default: S1AP_ERROR("Received unhandled message: %d:%s\n", ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg)); @@ -451,6 +704,7 @@ static int s1ap_eNB_generate_s1_setup_request( uint8_t *buffer = NULL; uint32_t len = 0; int ret = 0; + uint32_t timer_kind = 0; DevAssert(instance_p != NULL); DevAssert(s1ap_mme_data_p != NULL); s1ap_mme_data_p->state = S1AP_ENB_STATE_WAITING; @@ -525,6 +779,17 @@ static int s1ap_eNB_generate_s1_setup_request( return -1; } + timer_kind = s1ap_mme_data_p->cnx_id; + timer_kind = timer_kind | S1AP_MMEIND; + timer_kind = timer_kind | S1_SETRSP_WAIT; + + if( s1ap_timer_setup(instance_p->s1_setuprsp_wait_timer, 0, TASK_S1AP, instance_p->instance, timer_kind, S1AP_TIMER_ONE_SHOT, + NULL, &s1ap_mme_data_p->timer_id) < 0 ) + { + S1AP_ERROR("Timer Start NG(S1 Setup Response) : MME=%d\n",s1ap_mme_data_p->cnx_id); + } + s1ap_mme_data_p->s1_setupreq_cnt++; + /* Non UE-Associated signalling -> stream = 0 */ s1ap_eNB_itti_send_sctp_data_req(instance_p->instance, s1ap_mme_data_p->assoc_id, buffer, len, 0); return ret; @@ -533,3 +798,64 @@ static int s1ap_eNB_generate_s1_setup_request( +static int s1ap_sctp_req(s1ap_eNB_instance_t *instance_p, + s1ap_eNB_mme_data_t *s1ap_mme_data_p) +{ + MessageDef *message_p = NULL; + sctp_new_association_req_t *sctp_new_association_req_p = NULL; + + if( instance_p == NULL ) + { + S1AP_ERROR("Invalid instance_p\n"); + return -1; + } + + message_p = itti_alloc_new_message(TASK_S1AP, SCTP_NEW_ASSOCIATION_REQ); + sctp_new_association_req_p = &message_p->ittiMsg.sctp_new_association_req; + sctp_new_association_req_p->port = S1AP_PORT_NUMBER; + sctp_new_association_req_p->ppid = S1AP_SCTP_PPID; + sctp_new_association_req_p->in_streams = instance_p->sctp_in_streams; + sctp_new_association_req_p->out_streams = instance_p->sctp_out_streams; + sctp_new_association_req_p->ulp_cnx_id = s1ap_mme_data_p->cnx_id; + + if( s1ap_mme_data_p->mme_ip_address.ipv4 != 0 ) + { + memcpy(&sctp_new_association_req_p->remote_address, + &s1ap_mme_data_p->mme_ip_address, + sizeof(net_ip_address_t)); + if( instance_p->enb_ip_address.ipv4 != 0 ) + { + memcpy(&sctp_new_association_req_p->local_address, + &instance_p->enb_ip_address, + sizeof(net_ip_address_t)); + } + else + { + S1AP_ERROR("Invalid IP Address Format V4(MME):V6\n"); + return -1; + } + } + else + { + memcpy(&sctp_new_association_req_p->remote_address, + &s1ap_mme_data_p->mme_ip_address, + sizeof(net_ip_address_t)); + if( instance_p->enb_ip_address.ipv6 != 0 ) + { + memcpy(&sctp_new_association_req_p->local_address, + &instance_p->enb_ip_address, + sizeof(net_ip_address_t)); + } + else + { + S1AP_ERROR("Invalid IP Address Format V6(MME):V4\n"); + return -1; + } + } + + itti_send_msg_to_task(TASK_SCTP, instance_p->instance, message_p); + + s1ap_mme_data_p->sctp_req_cnt++; + + return 0; +} diff --git a/openair3/S1AP/s1ap_eNB_defs.h b/openair3/S1AP/s1ap_eNB_defs.h index c6f44cdb18..78a8866e01 100644 --- a/openair3/S1AP/s1ap_eNB_defs.h +++ b/openair3/S1AP/s1ap_eNB_defs.h @@ -166,6 +166,10 @@ typedef struct s1ap_eNB_mme_data_s { struct s1ap_eNB_instance_s *s1ap_eNB_instance; uint32_t nb_calls; + net_ip_address_t mme_ip_address; + long timer_id; + uint16_t s1_setupreq_cnt; + uint16_t sctp_req_cnt; } s1ap_eNB_mme_data_t; typedef struct s1ap_eNB_instance_s { @@ -218,6 +222,14 @@ typedef struct s1ap_eNB_instance_s { /* Default Paging DRX of the eNB as defined in TS 36.304 */ paging_drx_t default_drx; + net_ip_address_t enb_ip_address; + uint16_t s1_setuprsp_wait_timer; + uint16_t s1_setupreq_wait_timer; + uint16_t s1_setupreq_count; + uint16_t sctp_req_timer; + uint16_t sctp_req_count; + uint16_t sctp_in_streams; + uint16_t sctp_out_streams; } s1ap_eNB_instance_t; typedef struct { diff --git a/openair3/S1AP/s1ap_eNB_handlers.c b/openair3/S1AP/s1ap_eNB_handlers.c index 0895494837..5d43c5b3fa 100644 --- a/openair3/S1AP/s1ap_eNB_handlers.c +++ b/openair3/S1AP/s1ap_eNB_handlers.c @@ -49,6 +49,7 @@ #include "assertions.h" #include "conversions.h" #include "msc.h" +#include "s1ap_eNB_timer.h" static int s1ap_eNB_handle_s1_setup_response(uint32_t assoc_id, @@ -109,6 +110,10 @@ int s1ap_eNB_handle_s1_ENDC_e_rab_modification_confirm(uint32_t as uint32_t stream, S1AP_S1AP_PDU_t *pdu); +static int s1ap_eNB_snd_s1_setup_request( + s1ap_eNB_instance_t *instance_p, + s1ap_eNB_mme_data_t *s1ap_mme_data_p); + /* Handlers matrix. Only eNB related procedure present here */ s1ap_message_decoded_callback messages_callback[][3] = { { 0, 0, 0 }, /* HandoverPreparation */ @@ -260,6 +265,10 @@ int s1ap_eNB_handle_s1_setup_failure(uint32_t assoc_id, S1AP_S1SetupFailure_t *container; S1AP_S1SetupFailureIEs_t *ie; s1ap_eNB_mme_data_t *mme_desc_p; + uint32_t interval_sec = 0; + uint32_t timer_kind = 0; + s1ap_eNB_instance_t *instance_p; + DevAssert(pdu != NULL); container = &pdu->choice.unsuccessfulOutcome.value.choice.S1SetupFailure; @@ -270,7 +279,7 @@ int s1ap_eNB_handle_s1_setup_failure(uint32_t assoc_id, } if ((mme_desc_p = s1ap_eNB_get_MME(NULL, assoc_id, 0)) == NULL) { - S1AP_ERROR("[SCTP %d] Received S1 setup response for non existing " + S1AP_ERROR("[SCTP %d] Received S1 setup failure for non existing " "MME context\n", assoc_id); return -1; } @@ -278,6 +287,11 @@ int s1ap_eNB_handle_s1_setup_failure(uint32_t assoc_id, S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_S1SetupFailureIEs_t, ie, container, S1AP_ProtocolIE_ID_id_Cause,true); + if(ie == NULL) + { + return -1; + } + if ((ie->value.choice.Cause.present == S1AP_Cause_PR_misc) && (ie->value.choice.Cause.choice.misc == S1AP_CauseMisc_unspecified)) { S1AP_WARN("Received s1 setup failure for MME... MME is not ready\n"); @@ -285,8 +299,65 @@ int s1ap_eNB_handle_s1_setup_failure(uint32_t assoc_id, S1AP_ERROR("Received s1 setup failure for MME... please check your parameters\n"); } - mme_desc_p->state = S1AP_ENB_STATE_WAITING; - s1ap_handle_s1_setup_message(mme_desc_p, 0); + if( mme_desc_p->timer_id != S1AP_TIMERID_INIT ) + { + s1ap_timer_remove( mme_desc_p->timer_id ); + mme_desc_p->timer_id = S1AP_TIMERID_INIT; + } + instance_p = mme_desc_p->s1ap_eNB_instance; + if( ( instance_p->s1_setupreq_count >= mme_desc_p->s1_setupreq_cnt) || + ( instance_p->s1_setupreq_count == 0xffff) ) + { + S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_S1SetupFailureIEs_t, ie, container, + S1AP_ProtocolIE_ID_id_TimeToWait, false); + if( ie != NULL ) + { + switch(ie->value.choice.TimeToWait) + { + case S1AP_TimeToWait_v1s: + interval_sec = 1; + break; + case S1AP_TimeToWait_v2s: + interval_sec = 2; + break; + case S1AP_TimeToWait_v5s: + interval_sec = 5; + break; + case S1AP_TimeToWait_v10s: + interval_sec = 10; + break; + case S1AP_TimeToWait_v20s: + interval_sec = 20; + break; + case S1AP_TimeToWait_v60s: + interval_sec = 60; + break; + default: + interval_sec = instance_p->s1_setupreq_wait_timer; + break; + } + } + else + { + interval_sec = instance_p->s1_setupreq_wait_timer; + } + + timer_kind = mme_desc_p->cnx_id; + timer_kind = timer_kind | S1AP_MMEIND; + timer_kind = timer_kind | S1_SETREQ_WAIT; + + if( s1ap_timer_setup(interval_sec, 0, TASK_S1AP, instance_p->instance, timer_kind, S1AP_TIMER_ONE_SHOT, + NULL, &mme_desc_p->timer_id) < 0 ) + { + S1AP_ERROR("Timer Start NG(S1 Setup Request) : MME=%d\n",mme_desc_p->cnx_id); + + s1ap_eNB_snd_s1_setup_request( instance_p, mme_desc_p ); + } + } + else + { + S1AP_ERROR("Retransmission count exceeded of S1 SETUP REQUEST : MME=%d\n",mme_desc_p->cnx_id); + } return 0; } @@ -314,9 +385,29 @@ int s1ap_eNB_handle_s1_setup_response(uint32_t assoc_id, return -1; } + /* Set the capacity of this MME */ + S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_S1SetupResponseIEs_t, ie, container, + S1AP_ProtocolIE_ID_id_RelativeMMECapacity, true); + if(ie == NULL) + { + return -1; + } + mme_desc_p->relative_mme_capacity = ie->value.choice.RelativeMMECapacity; + S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_S1SetupResponseIEs_t, ie, container, S1AP_ProtocolIE_ID_id_ServedGUMMEIs, true); + if(ie == NULL) + { + return -1; + } + if( mme_desc_p->timer_id != S1AP_TIMERID_INIT ) + { + s1ap_timer_remove( mme_desc_p->timer_id ); + mme_desc_p->timer_id = S1AP_TIMERID_INIT; + } + mme_desc_p->s1_setupreq_cnt = 0; + mme_desc_p->sctp_req_cnt = 0; /* The list of served gummei can contain at most 8 elements. * LTE related gummei is the first element in the list, i.e with an id of 0. */ @@ -370,11 +461,11 @@ int s1ap_eNB_handle_s1_setup_response(uint32_t assoc_id, } /* Set the capacity of this MME */ - S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_S1SetupResponseIEs_t, ie, container, - S1AP_ProtocolIE_ID_id_RelativeMMECapacity, true); - - mme_desc_p->relative_mme_capacity = ie->value.choice.RelativeMMECapacity; - +// S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_S1SetupResponseIEs_t, ie, container, +// S1AP_ProtocolIE_ID_id_RelativeMMECapacity, true); +// +// mme_desc_p->relative_mme_capacity = ie->value.choice.RelativeMMECapacity; +// /* Optionaly set the mme name */ S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_S1SetupResponseIEs_t, ie, container, S1AP_ProtocolIE_ID_id_MMEname, false); @@ -392,7 +483,7 @@ int s1ap_eNB_handle_s1_setup_response(uint32_t assoc_id, */ mme_desc_p->state = S1AP_ENB_STATE_CONNECTED; mme_desc_p->s1ap_eNB_instance->s1ap_mme_associated_nb ++; - s1ap_handle_s1_setup_message(mme_desc_p, 0); +// s1ap_handle_s1_setup_message(mme_desc_p, 0); return 0; } @@ -725,6 +816,10 @@ int s1ap_eNB_handle_error_indication(uint32_t assoc_id, S1AP_ProtocolIE_ID_id_CriticalityDiagnostics, false); if (ie) { + if( ie->value.choice.CriticalityDiagnostics.procedureCode ) + { + S1AP_WARN("Received S1 Error indication CriticalityDiagnostics procedureCode = %d\n", *ie->value.choice.CriticalityDiagnostics.procedureCode); + } // TODO continue } @@ -807,6 +902,33 @@ int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id, &(S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).ue_ambr.br_dl)); /* id-E-RABToBeSetupListCtxtSUReq */ } else { + itti_free(ITTI_MSG_ORIGIN_ID(message_p), message_p); + return -1; + } + + /* id-UESecurityCapabilities */ + S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_InitialContextSetupRequestIEs_t, ie, container, + S1AP_ProtocolIE_ID_id_UESecurityCapabilities, true); + + if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */ + S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).security_capabilities.encryption_algorithms = + BIT_STRING_to_uint16(&ie->value.choice.UESecurityCapabilities.encryptionAlgorithms); + S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).security_capabilities.integrity_algorithms = + BIT_STRING_to_uint16(&ie->value.choice.UESecurityCapabilities.integrityProtectionAlgorithms); + /* id-SecurityKey : Copy the security key */ + } else {/* ie != NULL */ + itti_free(ITTI_MSG_ORIGIN_ID(message_p), message_p); + return -1; + } + + S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_InitialContextSetupRequestIEs_t, ie, container, + S1AP_ProtocolIE_ID_id_SecurityKey, true); + + if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */ + memcpy(&S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).security_key, + ie->value.choice.SecurityKey.buf, ie->value.choice.SecurityKey.size); + } else {/* ie != NULL */ + itti_free(ITTI_MSG_ORIGIN_ID(message_p), message_p); return -1; } @@ -852,34 +974,11 @@ int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id, item_p->e_RABlevelQoSParameters.allocationRetentionPriority.pre_emptionVulnerability; } /* for i... */ } else {/* ie != NULL */ + itti_free(ITTI_MSG_ORIGIN_ID(message_p), message_p); return -1; } - /* id-UESecurityCapabilities */ - S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_InitialContextSetupRequestIEs_t, ie, container, - S1AP_ProtocolIE_ID_id_UESecurityCapabilities, true); - - if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */ - S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).security_capabilities.encryption_algorithms = - BIT_STRING_to_uint16(&ie->value.choice.UESecurityCapabilities.encryptionAlgorithms); - S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).security_capabilities.integrity_algorithms = - BIT_STRING_to_uint16(&ie->value.choice.UESecurityCapabilities.integrityProtectionAlgorithms); - /* id-SecurityKey : Copy the security key */ - } else {/* ie != NULL */ - return -1; - } - - S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_InitialContextSetupRequestIEs_t, ie, container, - S1AP_ProtocolIE_ID_id_SecurityKey, true); - - if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */ - memcpy(&S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).security_key, - ie->value.choice.SecurityKey.buf, ie->value.choice.SecurityKey.size); itti_send_msg_to_task(TASK_RRC_ENB, ue_desc_p->eNB_instance->instance, message_p); - } else {/* ie != NULL */ - return -1; - } - return 0; } @@ -904,6 +1003,14 @@ int s1ap_eNB_handle_ue_context_release_command(uint32_t assoc_id, return -1; } + S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_UEContextReleaseCommand_IEs_t, ie, container, + S1AP_ProtocolIE_ID_id_Cause, true); + if( ie == NULL ) + { + S1AP_ERROR( "Mandatory Element Nothing : UEContextReleaseCommand(Cause)\n" ); + return -1; + } + S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_UEContextReleaseCommand_IEs_t, ie, container, S1AP_ProtocolIE_ID_id_UE_S1AP_IDs, true); @@ -951,9 +1058,29 @@ int s1ap_eNB_handle_ue_context_release_command(uint32_t assoc_id, //#warning "TODO mapping mme_ue_s1ap_id enb_ue_s1ap_id?" case S1AP_UE_S1AP_IDs_PR_mME_UE_S1AP_ID: - mme_ue_s1ap_id = ie->value.choice.UE_S1AP_IDs.choice.uE_S1AP_ID_pair.mME_UE_S1AP_ID; - S1AP_ERROR("TO DO mapping mme_ue_s1ap_id enb_ue_s1ap_id"); - (void)mme_ue_s1ap_id; /* TODO: remove - it's to remove gcc warning about unused var */ +// mme_ue_s1ap_id = ie->value.choice.UE_S1AP_IDs.choice.uE_S1AP_ID_pair.mME_UE_S1AP_ID; +// S1AP_ERROR("TO DO mapping mme_ue_s1ap_id enb_ue_s1ap_id"); +// (void)mme_ue_s1ap_id; /* TODO: remove - it's to remove gcc warning about unused var */ + mme_ue_s1ap_id = ie->value.choice.UE_S1AP_IDs.choice.mME_UE_S1AP_ID; + + RB_FOREACH(ue_desc_p, s1ap_ue_map, &mme_desc_p->s1ap_eNB_instance->s1ap_ue_head) + { + if( ue_desc_p->mme_ue_s1ap_id == mme_ue_s1ap_id ) + { + enb_ue_s1ap_id = ue_desc_p->eNB_ue_s1ap_id; + + message_p = itti_alloc_new_message(TASK_S1AP, S1AP_UE_CONTEXT_RELEASE_COMMAND); + S1AP_UE_CONTEXT_RELEASE_COMMAND(message_p).eNB_ue_s1ap_id = enb_ue_s1ap_id; + itti_send_msg_to_task(TASK_RRC_ENB, ue_desc_p->eNB_instance->instance, message_p); + + return 0; + } + } + S1AP_ERROR("[SCTP %d] Received UE context release command(mME_UE_S1AP_ID) for non " + "existing UE context 0x%06lx\n", + assoc_id, + mme_ue_s1ap_id); + return -1; case S1AP_UE_S1AP_IDs_PR_NOTHING: default: @@ -961,12 +1088,10 @@ int s1ap_eNB_handle_ue_context_release_command(uint32_t assoc_id, return -1; } } else { + S1AP_ERROR( "Mandatory Element Nothing : UEContextReleaseCommand(UE_S1AP_IDs)\n" ); return -1; } - S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_UEContextReleaseCommand_IEs_t, ie, container, - S1AP_ProtocolIE_ID_id_Cause, true); - /* TBD */ } static @@ -985,7 +1110,7 @@ int s1ap_eNB_handle_e_rab_setup_request(uint32_t assoc_id, container = &pdu->choice.initiatingMessage.value.choice.E_RABSetupRequest; if ((mme_desc_p = s1ap_eNB_get_MME(NULL, assoc_id, 0)) == NULL) { - S1AP_ERROR("[SCTP %d] Received initial context setup request for non " + S1AP_ERROR("[SCTP %d] Received E-RAB setup request for non " "existing MME context\n", assoc_id); return -1; } @@ -1012,7 +1137,7 @@ int s1ap_eNB_handle_e_rab_setup_request(uint32_t assoc_id, if ((ue_desc_p = s1ap_eNB_get_ue_context(mme_desc_p->s1ap_eNB_instance, enb_ue_s1ap_id)) == NULL) { - S1AP_ERROR("[SCTP %d] Received initial context setup request for non " + S1AP_ERROR("[SCTP %d] Received E-RAB setup request for non " "existing UE context 0x%06lx\n", assoc_id, enb_ue_s1ap_id); return -1; @@ -1085,6 +1210,7 @@ int s1ap_eNB_handle_e_rab_setup_request(uint32_t assoc_id, itti_send_msg_to_task(TASK_RRC_ENB, ue_desc_p->eNB_instance->instance, message_p); } else { + itti_free(ITTI_MSG_ORIGIN_ID(message_p), message_p); return -1; } @@ -1132,6 +1258,7 @@ int s1ap_eNB_handle_paging(uint32_t assoc_id, S1AP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.mme_code = 0; S1AP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.m_tmsi = 0; } else { + itti_free(ITTI_MSG_ORIGIN_ID(message_p), message_p); return -1; } @@ -1159,6 +1286,7 @@ int s1ap_eNB_handle_paging(uint32_t assoc_id, if(i != ie->value.choice.UEPagingID.choice.iMSI.size - 1) { /* invalid paging_p->uePagingID.choise.iMSI.buffer */ S1AP_ERROR("[SCTP %d] Received Paging : uePagingID.choise.iMSI error(i %d 0x0F)\n", assoc_id,i); + itti_free(ITTI_MSG_ORIGIN_ID(message_p), message_p); return -1; } } else { @@ -1169,14 +1297,17 @@ int s1ap_eNB_handle_paging(uint32_t assoc_id, if (S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.length >= S1AP_IMSI_LENGTH) { /* invalid paging_p->uePagingID.choise.iMSI.size */ S1AP_ERROR("[SCTP %d] Received Paging : uePagingID.choise.iMSI.size(%d) is over IMSI length(%d)\n", assoc_id, S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.length, S1AP_IMSI_LENGTH); + itti_free(ITTI_MSG_ORIGIN_ID(message_p), message_p); return -1; } } else { /* of if (ie->value.choice.UEPagingID.present == S1AP_UEPagingID_PR_iMSI) */ /* invalid paging_p->uePagingID.present */ S1AP_ERROR("[SCTP %d] Received Paging : uePagingID.present(%d) is unknown\n", assoc_id, ie->value.choice.UEPagingID.present); + itti_free(ITTI_MSG_ORIGIN_ID(message_p), message_p); return -1; } } else { /* of ie != NULL */ + itti_free(ITTI_MSG_ORIGIN_ID(message_p), message_p); return -1; } @@ -1209,6 +1340,7 @@ int s1ap_eNB_handle_paging(uint32_t assoc_id, return -1; } } else { + itti_free(ITTI_MSG_ORIGIN_ID(message_p), message_p); return -1; } @@ -1236,6 +1368,7 @@ int s1ap_eNB_handle_paging(uint32_t assoc_id, S1AP_PAGING_IND(message_p).tac[i]); } } else { + itti_free(ITTI_MSG_ORIGIN_ID(message_p), message_p); return -1; } @@ -1330,6 +1463,7 @@ int s1ap_eNB_handle_e_rab_modify_request(uint32_t assoc_id, S1AP_E_RAB_MODIFY_RESP(message_p).e_rabs_failed[nb_of_e_rabs_failed].cause_value = S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id; } } else { + itti_free(ITTI_MSG_ORIGIN_ID(message_p), message_p); return -1; } @@ -1382,6 +1516,7 @@ int s1ap_eNB_handle_e_rab_modify_request(uint32_t assoc_id, itti_send_msg_to_task(TASK_RRC_ENB, ue_desc_p->eNB_instance->instance, message_p); } else { /* of if (ie != NULL)*/ + itti_free(ITTI_MSG_ORIGIN_ID(message_p), message_p); return -1; } @@ -1455,6 +1590,24 @@ int s1ap_eNB_handle_e_rab_release_command(uint32_t assoc_id, message_p = itti_alloc_new_message(TASK_S1AP, S1AP_E_RAB_RELEASE_COMMAND); S1AP_E_RAB_RELEASE_COMMAND(message_p).eNB_ue_s1ap_id = enb_ue_s1ap_id; S1AP_E_RAB_RELEASE_COMMAND(message_p).mme_ue_s1ap_id = mme_ue_s1ap_id; + /* id-E-RABToBeReleasedList */ + S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_E_RABReleaseCommandIEs_t, ie, container, + S1AP_ProtocolIE_ID_id_E_RABToBeReleasedList, true); + + if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */ + S1AP_E_RAB_RELEASE_COMMAND(message_p).nb_e_rabs_torelease = ie->value.choice.E_RABList.list.count; + + for (i = 0; i < ie->value.choice.E_RABList.list.count; i++) { + S1AP_E_RABItem_t *item_p; + item_p = &(((S1AP_E_RABItemIEs_t *)ie->value.choice.E_RABList.list.array[i])->value.choice.E_RABItem); + S1AP_E_RAB_RELEASE_COMMAND(message_p).e_rab_release_params[i].e_rab_id = item_p->e_RAB_ID; + S1AP_DEBUG("[SCTP] Received E-RAB release command for e-rab id %ld\n", item_p->e_RAB_ID); + } + } else { + itti_free(ITTI_MSG_ORIGIN_ID(message_p), message_p); + return -1; + } + /* id-NAS-PDU */ S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_E_RABReleaseCommandIEs_t, ie, container, S1AP_ProtocolIE_ID_id_NAS_PDU, false); @@ -1470,24 +1623,6 @@ int s1ap_eNB_handle_e_rab_release_command(uint32_t assoc_id, S1AP_E_RAB_RELEASE_COMMAND(message_p).nas_pdu.length = 0; S1AP_E_RAB_RELEASE_COMMAND(message_p).nas_pdu.buffer = NULL; } - - /* id-E-RABToBeReleasedList */ - S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_E_RABReleaseCommandIEs_t, ie, container, - S1AP_ProtocolIE_ID_id_E_RABToBeReleasedList, true); - - if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */ - S1AP_E_RAB_RELEASE_COMMAND(message_p).nb_e_rabs_torelease = ie->value.choice.E_RABList.list.count; - - for (i = 0; i < ie->value.choice.E_RABList.list.count; i++) { - S1AP_E_RABItem_t *item_p; - item_p = &(((S1AP_E_RABItemIEs_t *)ie->value.choice.E_RABList.list.array[i])->value.choice.E_RABItem); - S1AP_E_RAB_RELEASE_COMMAND(message_p).e_rab_release_params[i].e_rab_id = item_p->e_RAB_ID; - S1AP_DEBUG("[SCTP] Received E-RAB release command for e-rab id %ld\n", item_p->e_RAB_ID); - } - } else { - return -1; - } - itti_send_msg_to_task(TASK_RRC_ENB, ue_desc_p->eNB_instance->instance, message_p); return 0; } @@ -1528,6 +1663,7 @@ int s1ap_eNB_handle_s1_path_switch_request_ack(uint32_t assoc_id, if (ie == NULL) { S1AP_ERROR("[SCTP %d] Received path switch request ack for non " "ie context is NULL\n", assoc_id); + itti_free(ITTI_MSG_ORIGIN_ID(message_p), message_p); return -1; } @@ -1550,6 +1686,7 @@ int s1ap_eNB_handle_s1_path_switch_request_ack(uint32_t assoc_id, if (ie == NULL) { S1AP_ERROR("[SCTP %d] Received path switch request ack for non " "ie context is NULL\n", assoc_id); + itti_free(ITTI_MSG_ORIGIN_ID(message_p), message_p); return -1; } @@ -1567,6 +1704,7 @@ int s1ap_eNB_handle_s1_path_switch_request_ack(uint32_t assoc_id, if (ie == NULL) { S1AP_ERROR("[SCTP %d] Received path switch request ack for non " "ie context is NULL\n", assoc_id); + itti_free(ITTI_MSG_ORIGIN_ID(message_p), message_p); return -1; } @@ -1580,14 +1718,10 @@ int s1ap_eNB_handle_s1_path_switch_request_ack(uint32_t assoc_id, S1AP_ProtocolIE_ID_id_uEaggregateMaximumBitrate, false); if (ie) { - OCTET_STRING_TO_INT32 ( - &ie->value.choice.UEAggregateMaximumBitrate.uEaggregateMaximumBitRateUL, - S1AP_PATH_SWITCH_REQ_ACK(message_p).ue_ambr.br_ul - ); - OCTET_STRING_TO_INT32 ( - &ie->value.choice.UEAggregateMaximumBitrate.uEaggregateMaximumBitRateDL, - S1AP_PATH_SWITCH_REQ_ACK(message_p).ue_ambr.br_dl - ); + asn_INTEGER2ulong(&ie->value.choice.UEAggregateMaximumBitrate.uEaggregateMaximumBitRateUL, + &S1AP_PATH_SWITCH_REQ_ACK(message_p).ue_ambr.br_ul); + asn_INTEGER2ulong(&ie->value.choice.UEAggregateMaximumBitrate.uEaggregateMaximumBitRateDL, + &S1AP_PATH_SWITCH_REQ_ACK(message_p).ue_ambr.br_dl); } else { S1AP_WARN("UEAggregateMaximumBitrate not supported\n"); S1AP_PATH_SWITCH_REQ_ACK(message_p).ue_ambr.br_ul = 0; @@ -1731,3 +1865,144 @@ int s1ap_eNB_handle_s1_ENDC_e_rab_modification_confirm(uint32_t as return 0; } +//----------------------------------------------------------------------------- +/* +* eNB generate a S1 setup request towards MME +*/ +static int s1ap_eNB_snd_s1_setup_request( + s1ap_eNB_instance_t *instance_p, + s1ap_eNB_mme_data_t *s1ap_mme_data_p) +//----------------------------------------------------------------------------- +{ + S1AP_S1AP_PDU_t pdu; + S1AP_S1SetupRequest_t *out = NULL; + S1AP_S1SetupRequestIEs_t *ie = NULL; + S1AP_SupportedTAs_Item_t *ta = NULL; + S1AP_PLMNidentity_t *plmn = NULL; + uint8_t *buffer = NULL; + uint32_t len = 0; + int ret = 0; + uint32_t timer_kind = 0; + + DevAssert(instance_p != NULL); + DevAssert(s1ap_mme_data_p != NULL); + s1ap_mme_data_p->state = S1AP_ENB_STATE_WAITING; + /* Prepare the S1AP message to encode */ + memset(&pdu, 0, sizeof(pdu)); + pdu.present = S1AP_S1AP_PDU_PR_initiatingMessage; + pdu.choice.initiatingMessage.procedureCode = S1AP_ProcedureCode_id_S1Setup; + pdu.choice.initiatingMessage.criticality = S1AP_Criticality_reject; + pdu.choice.initiatingMessage.value.present = S1AP_InitiatingMessage__value_PR_S1SetupRequest; + out = &pdu.choice.initiatingMessage.value.choice.S1SetupRequest; + /* mandatory */ + ie = (S1AP_S1SetupRequestIEs_t *)calloc(1, sizeof(S1AP_S1SetupRequestIEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_Global_ENB_ID; + ie->criticality = S1AP_Criticality_reject; + ie->value.present = S1AP_S1SetupRequestIEs__value_PR_Global_ENB_ID; + MCC_MNC_TO_PLMNID(instance_p->mcc[s1ap_mme_data_p->broadcast_plmn_index[0]], + instance_p->mnc[s1ap_mme_data_p->broadcast_plmn_index[0]], + instance_p->mnc_digit_length[s1ap_mme_data_p->broadcast_plmn_index[0]], + &ie->value.choice.Global_ENB_ID.pLMNidentity); + ie->value.choice.Global_ENB_ID.eNB_ID.present = S1AP_ENB_ID_PR_macroENB_ID; + MACRO_ENB_ID_TO_BIT_STRING(instance_p->eNB_id, + &ie->value.choice.Global_ENB_ID.eNB_ID.choice.macroENB_ID); + S1AP_INFO("%d -> %02x%02x%02x\n", instance_p->eNB_id, + ie->value.choice.Global_ENB_ID.eNB_ID.choice.macroENB_ID.buf[0], + ie->value.choice.Global_ENB_ID.eNB_ID.choice.macroENB_ID.buf[1], + ie->value.choice.Global_ENB_ID.eNB_ID.choice.macroENB_ID.buf[2]); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* optional */ + if (instance_p->eNB_name) { + ie = (S1AP_S1SetupRequestIEs_t *)calloc(1, sizeof(S1AP_S1SetupRequestIEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_eNBname; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_S1SetupRequestIEs__value_PR_ENBname; + OCTET_STRING_fromBuf(&ie->value.choice.ENBname, instance_p->eNB_name, + strlen(instance_p->eNB_name)); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* mandatory */ + ie = (S1AP_S1SetupRequestIEs_t *)calloc(1, sizeof(S1AP_S1SetupRequestIEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_SupportedTAs; + ie->criticality = S1AP_Criticality_reject; + ie->value.present = S1AP_S1SetupRequestIEs__value_PR_SupportedTAs; + { + ta = (S1AP_SupportedTAs_Item_t *)calloc(1, sizeof(S1AP_SupportedTAs_Item_t)); + INT16_TO_OCTET_STRING(instance_p->tac, &ta->tAC); + { + for (int i = 0; i < s1ap_mme_data_p->broadcast_plmn_num; ++i) { + plmn = (S1AP_PLMNidentity_t *)calloc(1, sizeof(S1AP_PLMNidentity_t)); + MCC_MNC_TO_TBCD(instance_p->mcc[s1ap_mme_data_p->broadcast_plmn_index[i]], + instance_p->mnc[s1ap_mme_data_p->broadcast_plmn_index[i]], + instance_p->mnc_digit_length[s1ap_mme_data_p->broadcast_plmn_index[i]], + plmn); + ASN_SEQUENCE_ADD(&ta->broadcastPLMNs.list, plmn); + } + } + ASN_SEQUENCE_ADD(&ie->value.choice.SupportedTAs.list, ta); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + /* mandatory */ + ie = (S1AP_S1SetupRequestIEs_t *)calloc(1, sizeof(S1AP_S1SetupRequestIEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_DefaultPagingDRX; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_S1SetupRequestIEs__value_PR_PagingDRX; + ie->value.choice.PagingDRX = instance_p->default_drx; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* optional */ + if (0) { + ie = (S1AP_S1SetupRequestIEs_t *)calloc(1, sizeof(S1AP_S1SetupRequestIEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_CSG_IdList; + ie->criticality = S1AP_Criticality_reject; + ie->value.present = S1AP_S1SetupRequestIEs__value_PR_CSG_IdList; + // ie->value.choice.CSG_IdList = ; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* optional */ +#if (S1AP_VERSION >= MAKE_VERSION(13, 0, 0)) + + if (0) { + ie = (S1AP_S1SetupRequestIEs_t *)calloc(1, sizeof(S1AP_S1SetupRequestIEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_UE_RetentionInformation; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_S1SetupRequestIEs__value_PR_UE_RetentionInformation; + // ie->value.choice.UE_RetentionInformation = ; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* optional */ + if (0) { + ie = (S1AP_S1SetupRequestIEs_t *)calloc(1, sizeof(S1AP_S1SetupRequestIEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_NB_IoT_DefaultPagingDRX; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_S1SetupRequestIEs__value_PR_NB_IoT_DefaultPagingDRX; + // ie->value.choice.NB_IoT_DefaultPagingDRX = ; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + +#endif /* #if (S1AP_VERSION >= MAKE_VERSION(14, 0, 0)) */ + + if (s1ap_eNB_encode_pdu(&pdu, &buffer, &len) < 0) { + S1AP_ERROR("Failed to encode S1 setup request\n"); + return -1; + } + + timer_kind = s1ap_mme_data_p->cnx_id; + timer_kind = timer_kind | S1AP_MMEIND; + timer_kind = timer_kind | S1_SETRSP_WAIT; + + if( s1ap_timer_setup(instance_p->s1_setuprsp_wait_timer, 0, TASK_S1AP, instance_p->instance, timer_kind, S1AP_TIMER_ONE_SHOT, + NULL, &s1ap_mme_data_p->timer_id) < 0 ) + { + S1AP_ERROR("Timer Start NG(S1 Setup Response) : MME=%d\n",s1ap_mme_data_p->cnx_id); + } + s1ap_mme_data_p->s1_setupreq_cnt++; + + /* Non UE-Associated signalling -> stream = 0 */ + s1ap_eNB_itti_send_sctp_data_req(instance_p->instance, s1ap_mme_data_p->assoc_id, buffer, len, 0); + return ret; +} diff --git a/openair3/S1AP/s1ap_eNB_management_procedures.c b/openair3/S1AP/s1ap_eNB_management_procedures.c index fc7ae70e49..1fdc09664b 100644 --- a/openair3/S1AP/s1ap_eNB_management_procedures.c +++ b/openair3/S1AP/s1ap_eNB_management_procedures.c @@ -95,23 +95,54 @@ struct s1ap_eNB_mme_data_s *s1ap_eNB_get_MME( { struct s1ap_eNB_mme_data_s temp; struct s1ap_eNB_mme_data_s *found; + struct s1ap_eNB_mme_data_s *mme_p; memset(&temp, 0, sizeof(struct s1ap_eNB_mme_data_s)); temp.assoc_id = assoc_id; temp.cnx_id = cnx_id; - if (instance_p == NULL) { - STAILQ_FOREACH(instance_p, &s1ap_eNB_internal_data.s1ap_eNB_instances_head, - s1ap_eNB_entries) { - found = RB_FIND(s1ap_mme_map, &instance_p->s1ap_mme_head, &temp); + if( cnx_id != 0 ) + { + if (instance_p == NULL) { + STAILQ_FOREACH(instance_p, &s1ap_eNB_internal_data.s1ap_eNB_instances_head, + s1ap_eNB_entries) { + found = RB_FIND(s1ap_mme_map, &instance_p->s1ap_mme_head, &temp); - if (found != NULL) { - return found; + if (found != NULL) { + return found; + } + } + } else { + return RB_FIND(s1ap_mme_map, &instance_p->s1ap_mme_head, &temp); + } + } + else + { + if (instance_p == NULL) + { + STAILQ_FOREACH(instance_p, &s1ap_eNB_internal_data.s1ap_eNB_instances_head, + s1ap_eNB_entries) + { + RB_FOREACH(mme_p, s1ap_mme_map, &instance_p->s1ap_mme_head) + { + if( mme_p->assoc_id == assoc_id ) + { + return mme_p; + } + } + } + } + else + { + RB_FOREACH(mme_p, s1ap_mme_map, &instance_p->s1ap_mme_head) + { + if( mme_p->assoc_id == assoc_id ) + { + return mme_p; + } } } - } else { - return RB_FIND(s1ap_mme_map, &instance_p->s1ap_mme_head, &temp); } return NULL; diff --git a/openair3/S1AP/s1ap_eNB_nas_procedures.c b/openair3/S1AP/s1ap_eNB_nas_procedures.c index 4744ff4e43..c617dc399d 100644 --- a/openair3/S1AP/s1ap_eNB_nas_procedures.c +++ b/openair3/S1AP/s1ap_eNB_nas_procedures.c @@ -359,10 +359,18 @@ int s1ap_eNB_handle_nas_downlink(uint32_t assoc_id, container = &pdu->choice.initiatingMessage.value.choice.DownlinkNASTransport; S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_DownlinkNASTransport_IEs_t, ie, container, S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID, true); + if(ie == NULL) + { + return -1; + } mme_ue_s1ap_id = ie->value.choice.MME_UE_S1AP_ID; S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_DownlinkNASTransport_IEs_t, ie, container, S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID, true); + if(ie == NULL) + { + return -1; + } enb_ue_s1ap_id = ie->value.choice.ENB_UE_S1AP_ID; if ((ue_desc_p = s1ap_eNB_get_ue_context(s1ap_eNB_instance, @@ -417,6 +425,10 @@ int s1ap_eNB_handle_nas_downlink(uint32_t assoc_id, S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_DownlinkNASTransport_IEs_t, ie, container, S1AP_ProtocolIE_ID_id_NAS_PDU, true); + if(ie == NULL) + { + return -1; + } /* Forward the NAS PDU to RRC */ s1ap_eNB_itti_send_nas_downlink_ind(s1ap_eNB_instance->instance, ue_desc_p->ue_initial_id, diff --git a/openair3/S1AP/s1ap_eNB_overload.c b/openair3/S1AP/s1ap_eNB_overload.c index e331d03b4a..64d3fcdf65 100644 --- a/openair3/S1AP/s1ap_eNB_overload.c +++ b/openair3/S1AP/s1ap_eNB_overload.c @@ -62,6 +62,10 @@ int s1ap_eNB_handle_overload_start(uint32_t assoc_id, S1AP_OverloadResponse_PR_overloadAction, S1AP_OverloadResponse_PR_overloadAction, 0, 0); } + else + { + return -1; + } /* Non UE-associated signalling -> stream 0 */ if (stream != 0) { S1AP_ERROR("[SCTP %d] Received s1 overload start on stream != 0 (%d)\n", diff --git a/openair3/S1AP/s1ap_eNB_timer.c b/openair3/S1AP/s1ap_eNB_timer.c new file mode 100644 index 0000000000..d4b5bdbd14 --- /dev/null +++ b/openair3/S1AP/s1ap_eNB_timer.c @@ -0,0 +1,300 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "assertions.h" +#include "intertask_interface.h" +#include "s1ap_eNB_timer.h" +#include "common/utils/LOG/log.h" +#include "queue.h" +#include "s1ap_common.h" + +struct s1ap_timer_elm_s { + task_id_t task_id; ///< Task ID which has requested the timer + int32_t instance; ///< Instance of the task which has requested the timer + uint32_t timer_kind; ///< Instance of the task which has requested the timer + timer_t timer; ///< Unique timer id + timer_type_t type; ///< Timer type + void *timer_arg; ///< Optional argument that will be passed when timer expires + STAILQ_ENTRY(s1ap_timer_elm_s) entries; ///< Pointer to next element +}; + +typedef struct timer_desc_s { + STAILQ_HEAD(timer_list_head, s1ap_timer_elm_s) timer_queue; + pthread_mutex_t timer_list_mutex; + struct timespec timeout; +} timer_desc_t; + +static timer_desc_t timer_desc; + +#define TIMER_SEARCH(vAR, tIMERfIELD, tIMERvALUE, tIMERqUEUE) \ +do { \ + STAILQ_FOREACH(vAR, tIMERqUEUE, entries) { \ + if (((vAR)->tIMERfIELD == tIMERvALUE)) \ + break; \ + } \ +} while(0) + +int s1ap_timer_timeout(sigval_t info) +{ + struct s1ap_timer_elm_s *timer_p; + MessageDef *message_p; + s1ap_timer_has_expired_t *timer_expired_p; + task_id_t task_id; + int32_t instance; + uint32_t timer_kind; + + timer_kind = info.sival_int; + if( pthread_mutex_lock(&timer_desc.timer_list_mutex) != 0 ) + { + S1AP_ERROR("Failed to mutex lock timeout=%x\n", timer_kind); + + return -1; + } + TIMER_SEARCH(timer_p, timer_kind, timer_kind, &timer_desc.timer_queue); + + if( pthread_mutex_unlock(&timer_desc.timer_list_mutex) != 0 ) + { + S1AP_ERROR("Failed to mutex unlock timeout=%x\n", timer_kind); + } + if (timer_p == NULL) + { + S1AP_ERROR("Didn't find timer 0x%lx in list\n", timer_kind); + + return -1; + } + S1AP_DEBUG("Timer kind 0x%x has expired\n", timer_kind); + + task_id = timer_p->task_id; + instance = timer_p->instance; + message_p = itti_alloc_new_message(TASK_UNKNOWN, TIMER_HAS_EXPIRED); + + timer_expired_p = &message_p->ittiMsg.timer_has_expired; + + timer_expired_p->timer_id = (long)timer_p->timer; + timer_expired_p->timer_kind = timer_p->timer_kind; + timer_expired_p->arg = timer_p->timer_arg; + + /* Timer is a one shot timer, remove it */ + if( timer_p->type == S1AP_TIMER_ONE_SHOT ) + { + if( s1ap_timer_remove((long)timer_p->timer) != 0 ) + { + S1AP_DEBUG("Failed to delete timer 0x%lx\n", (long)timer_p->timer); + } + } + + /* Notify task of timer expiry */ + if( itti_send_msg_to_task(task_id, instance, message_p) < 0 ) + { + S1AP_ERROR("Failed to send msg TIMER_HAS_EXPIRED to task %u\n", task_id); + free(message_p); + return -1; + } + + return 0; +} + +int s1ap_timer_setup( + uint32_t interval_sec, + uint32_t interval_us, + task_id_t task_id, + int32_t instance, + uint32_t timer_kind, + timer_type_t type, + void *timer_arg, + long *timer_id) +{ + struct sigevent evp; + struct itimerspec its; + struct s1ap_timer_elm_s *timer_p; + timer_t timer; + + if( timer_id == NULL ) + { + S1AP_ERROR("Invalid timer_id\n"); + return -1; + } + + if( type >= S1AP_TIMER_TYPE_MAX ) + { + S1AP_ERROR("Invalid timer type (%d/%d)!\n", type, TIMER_TYPE_MAX); + return -1; + } + + if( *timer_id != S1AP_TIMERID_INIT ) + { + if( s1ap_timer_remove(*timer_id) != 0 ) + { + S1AP_ERROR("Failed to delete timer when the timer start 0x%lx\n", *timer_id); + } + } + + /* Allocate new timer list element */ + timer_p = malloc(sizeof(struct s1ap_timer_elm_s)); + + if( timer_p == NULL ) + { + S1AP_ERROR("Failed to create new timer element\n"); + return -1; + } + + memset(&timer, 0, sizeof(timer_t)); + memset(&evp, 0, sizeof(evp)); + + timer_p->task_id = task_id; + timer_p->instance = instance; + timer_p->timer_kind = timer_kind; + timer_p->type = type; + timer_p->timer_arg = timer_arg; + + evp.sigev_notify = (int)SIGEV_THREAD; + evp.sigev_notify_function = (void *)s1ap_timer_timeout; + evp.sigev_signo = SIGRTMIN; + evp.sigev_notify_attributes = NULL; + evp.sigev_value.sival_int = timer_kind; + + /* At the timer creation, the timer structure will be filled in with timer_id, + * which is unique for this process. This id is allocated by kernel and the + * value might be used to distinguish timers. + */ + if( timer_create(CLOCK_REALTIME, &evp, &timer) < 0 ) + { + S1AP_ERROR("Failed to create timer: (%s:%d)\n", strerror(errno), errno); + free(timer_p); + return -1; + } + + /* Fill in the first expiration value. */ + its.it_value.tv_sec = interval_sec; + its.it_value.tv_nsec = interval_us * 1000; + + if( type == S1AP_TIMER_PERIODIC ) + { + /* Asked for periodic timer. We set the interval time */ + its.it_interval.tv_sec = interval_sec; + its.it_interval.tv_nsec = interval_us * 1000; + } + else + { + /* Asked for one-shot timer. Do not set the interval field */ + its.it_interval.tv_sec = 0; + its.it_interval.tv_nsec = 0; + } + + if( timer_settime(timer, 0, &its, NULL) ) + { + S1AP_ERROR("Failed to Settimer: (%s:%d)\n", strerror(errno), errno); + free(timer_p); + return -1; + } + + /* Simply set the timer_id argument. so it can be used by caller */ + *timer_id = (long)timer; + + timer_p->timer = timer; + + /* Lock the queue and insert the timer at the tail */ + if( pthread_mutex_lock(&timer_desc.timer_list_mutex) != 0 ) + { + S1AP_ERROR("Failed to mutex lock\n"); + if( timer_delete(timer_p->timer) < 0 ) + { + S1AP_ERROR("Failed to delete timer 0x%lx\n", (long)timer_p->timer); + } + free(timer_p); + timer_p = NULL; + + return -1; + } + + STAILQ_INSERT_TAIL(&timer_desc.timer_queue, timer_p, entries); + if( pthread_mutex_unlock(&timer_desc.timer_list_mutex) != 0 ) + { + S1AP_ERROR("Failed to mutex unlock\n"); + } + + return 0; +} + +int s1ap_timer_remove(long timer_id) +{ + int rc = 0; + struct s1ap_timer_elm_s *timer_p; + + + if( pthread_mutex_lock(&timer_desc.timer_list_mutex) != 0 ) + { + S1AP_ERROR("Failed to mutex lock\n"); + if( timer_delete(timer_id) < 0 ) + { + S1AP_ERROR("Failed to delete timer 0x%lx\n", (long)timer_id); + } + + return -1; + } + + TIMER_SEARCH(timer_p, timer, ((timer_t)timer_id), &timer_desc.timer_queue); + + /* We didn't find the timer in list */ + if (timer_p == NULL) + { + S1AP_ERROR("Didn't find timer 0x%lx in list\n", timer_id); + if( pthread_mutex_unlock(&timer_desc.timer_list_mutex) != 0 ) + { + S1AP_ERROR("Failed to mutex unlock\n"); + } + + return -1; + } + + timer_delete(timer_p->timer); + + STAILQ_REMOVE(&timer_desc.timer_queue, timer_p, s1ap_timer_elm_s, entries); + + if( pthread_mutex_unlock(&timer_desc.timer_list_mutex) != 0 ) + { + S1AP_ERROR("Failed to mutex unlock\n"); + } + + free(timer_p); + timer_p = NULL; + return rc; +} + +int s1ap_timer_init(void) +{ + memset(&timer_desc, 0, sizeof(timer_desc_t)); + + STAILQ_INIT(&timer_desc.timer_queue); + pthread_mutex_init(&timer_desc.timer_list_mutex, NULL); + + return 0; +} diff --git a/openair3/S1AP/s1ap_eNB_timer.h b/openair3/S1AP/s1ap_eNB_timer.h new file mode 100644 index 0000000000..7af80eb806 --- /dev/null +++ b/openair3/S1AP/s1ap_eNB_timer.h @@ -0,0 +1,86 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +#ifndef TIMER_H_ +#define TIMER_H_ + +#include + +#define SIGTIMER SIGRTMIN + +typedef enum s1ap_timer_type_s { + S1AP_TIMER_PERIODIC, + S1AP_TIMER_ONE_SHOT, + S1AP_TIMER_TYPE_MAX, +} s1ap_timer_type_t; + +typedef struct { + void *arg; + long timer_id; + int32_t timer_kind; +} s1ap_timer_has_expired_t; + + +int s1ap_timer_timeout(sigval_t info); + +/** \brief Request a new timer + * \param interval_sec timer interval in seconds + * \param interval_us timer interval in micro seconds + * \param task_id task id of the task requesting the timer + * \param instance instance of the task requesting the timer + * \param type timer type + * \param timer_id unique timer identifier + * @returns -1 on failure, 0 otherwise + **/ +int s1ap_timer_setup( + uint32_t interval_sec, + uint32_t interval_us, + task_id_t task_id, + int32_t instance, + uint32_t timer_kind, + timer_type_t type, + void *timer_arg, + long *timer_id); + +/** \brief Remove the timer from list + * \param timer_id unique timer id + * @returns -1 on failure, 0 otherwise + **/ + +int s1ap_timer_remove(long timer_id); + +/** \brief Initialize timer task and its API + * \param mme_config MME common configuration + * @returns -1 on failure, 0 otherwise + **/ +int s1ap_timer_init(void); + +#define S1AP_MMEIND 0x80000000 +#define S1AP_UEIND 0x00000000 +#define S1_SETRSP_WAIT 0x00010000 +#define S1_SETREQ_WAIT 0x00020000 +#define SCTP_REQ_WAIT 0x00030000 +#define S1AP_LINEIND 0x0000ffff +#define S1AP_TIMERIND 0x00ff0000 + +#define S1AP_TIMERID_INIT 0xffffffffffffffff + +#endif diff --git a/openair3/S1AP/s1ap_eNB_trace.c b/openair3/S1AP/s1ap_eNB_trace.c index 19f5059238..695eeb4ef8 100644 --- a/openair3/S1AP/s1ap_eNB_trace.c +++ b/openair3/S1AP/s1ap_eNB_trace.c @@ -121,6 +121,10 @@ int s1ap_eNB_handle_trace_start(uint32_t assoc_id, if (ie != NULL) { ue_desc_p = s1ap_eNB_get_ue_context(mme_ref_p->s1ap_eNB_instance, ie->value.choice.ENB_UE_S1AP_ID); + } + else + { + return -1; } if (ue_desc_p == NULL) { /* Could not find context associated with this eNB_ue_s1ap_id -> generate diff --git a/openair3/SCTP/sctp_default_values.h b/openair3/SCTP/sctp_default_values.h index 528ffb5a05..0f8f94dca9 100644 --- a/openair3/SCTP/sctp_default_values.h +++ b/openair3/SCTP/sctp_default_values.h @@ -24,8 +24,8 @@ #define SCTP_OUT_STREAMS (16) #define SCTP_IN_STREAMS (16) -#define SCTP_MAX_ATTEMPTS (2) -#define SCTP_TIMEOUT (5) +#define SCTP_MAX_ATTEMPTS (8) +#define SCTP_TIMEOUT (60000) #define SCTP_RECV_BUFFER_SIZE (8192) #endif /* SCTP_DEFAULT_VALUES_H_ */ diff --git a/openair3/SCTP/sctp_eNB_task.c b/openair3/SCTP/sctp_eNB_task.c index ee006338c5..ec9e62bb3f 100644 --- a/openair3/SCTP/sctp_eNB_task.c +++ b/openair3/SCTP/sctp_eNB_task.c @@ -943,10 +943,12 @@ sctp_eNB_read_from_socket( &sinfo, &flags); if (n < 0) { - if (errno == ENOTCONN) { + if( (errno == ENOTCONN) || (errno == ECONNRESET) || (errno == ETIMEDOUT) || (errno == ECONNREFUSED) ) + { itti_unsubscribe_event_fd(TASK_SCTP, sctp_cnx->sd); SCTP_DEBUG("Received not connected for sd %d\n", sctp_cnx->sd); + SCTP_ERROR("sctp_recvmsg (fd %d, len %d ): %s:%d\n", sctp_cnx->sd, n, strerror(errno), errno); sctp_itti_send_association_resp( sctp_cnx->task_id, sctp_cnx->instance, -1, From 8c607fe85bcae0baea227a783674403459ff85f5 Mon Sep 17 00:00:00 2001 From: "Wu.Jing" Date: Thu, 9 Apr 2020 11:39:57 +0800 Subject: [PATCH 023/231] Fix build error in --UE because of s1ap_eNB.c (cherry picked from commit 519e6628d572c9b6cf8031632d4e22e2f8dc5b93) --- openair3/S1AP/s1ap_eNB.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/openair3/S1AP/s1ap_eNB.c b/openair3/S1AP/s1ap_eNB.c index 8452d9e563..b3ceb7ff2c 100644 --- a/openair3/S1AP/s1ap_eNB.c +++ b/openair3/S1AP/s1ap_eNB.c @@ -329,7 +329,13 @@ void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa for( ; cnt > 0 ; ) { cnt--; - s1ap_ue_context_release( instance, (uint32_t)enb_s1ap_id[cnt] ); + struct s1ap_eNB_ue_context_s *ue_context_p = NULL; + struct s1ap_eNB_ue_context_s *s1ap_ue_context_p = NULL; + ue_context_p = s1ap_eNB_get_ue_context(instance_p, (uint32_t)enb_s1ap_id[cnt]); + if (ue_context_p != NULL) { + s1ap_ue_context_p = RB_REMOVE(s1ap_ue_map, &instance_p->s1ap_ue_head, ue_context_p); + s1ap_eNB_free_ue_context(s1ap_ue_context_p); + } } s1ap_mme_data_p->mme_name = 0; s1ap_mme_data_p->overload_state = S1AP_NO_OVERLOAD; From 4c75866a549bd70ae39b33c853f3ad9643387ecf Mon Sep 17 00:00:00 2001 From: "Wu.Jing" Date: Thu, 9 Apr 2020 12:34:02 +0800 Subject: [PATCH 024/231] Fix cppcheck warning (cherry picked from commit aaa4d390fdefc4e8071b80edc90a580907c9dec3) --- openair3/S1AP/s1ap_eNB.c | 4 ++-- openair3/S1AP/s1ap_eNB_timer.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/openair3/S1AP/s1ap_eNB.c b/openair3/S1AP/s1ap_eNB.c index b3ceb7ff2c..9eebb68fe7 100644 --- a/openair3/S1AP/s1ap_eNB.c +++ b/openair3/S1AP/s1ap_eNB.c @@ -317,12 +317,12 @@ void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa if( itti_send_msg_to_task(TASK_RRC_ENB, ue_p->eNB_instance->instance, message_p) < 0 ) { - S1AP_ERROR("UE Context Release Command Transmission Failure: eNB_ue_s1ap_id=%d\n", ue_p->eNB_ue_s1ap_id); + S1AP_ERROR("UE Context Release Command Transmission Failure: eNB_ue_s1ap_id=%u\n", ue_p->eNB_ue_s1ap_id); } } else { - S1AP_ERROR("Invalid message_p : eNB_ue_s1ap_id=%d\n", ue_p->eNB_ue_s1ap_id); + S1AP_ERROR("Invalid message_p : eNB_ue_s1ap_id=%u\n", ue_p->eNB_ue_s1ap_id); } } } diff --git a/openair3/S1AP/s1ap_eNB_timer.c b/openair3/S1AP/s1ap_eNB_timer.c index d4b5bdbd14..4e9fb166d3 100644 --- a/openair3/S1AP/s1ap_eNB_timer.c +++ b/openair3/S1AP/s1ap_eNB_timer.c @@ -82,11 +82,11 @@ int s1ap_timer_timeout(sigval_t info) if( pthread_mutex_unlock(&timer_desc.timer_list_mutex) != 0 ) { - S1AP_ERROR("Failed to mutex unlock timeout=%x\n", timer_kind); + S1AP_ERROR("Failed to mutex unlock timeout=0x%x\n", timer_kind); } if (timer_p == NULL) { - S1AP_ERROR("Didn't find timer 0x%lx in list\n", timer_kind); + S1AP_ERROR("Didn't find timer 0x%x in list\n", timer_kind); return -1; } From 52acfc75de38e86f3c3396dec30e428b9600c20e Mon Sep 17 00:00:00 2001 From: Cai Yang Date: Thu, 9 Apr 2020 15:28:55 +0900 Subject: [PATCH 025/231] Fix s1ap_eNB_timer.c warnings (cherry picked from commit 39850dcfadb37e24ccfe41e0a85a9f2136eeff4a) --- openair3/S1AP/s1ap_eNB_timer.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/openair3/S1AP/s1ap_eNB_timer.c b/openair3/S1AP/s1ap_eNB_timer.c index 4e9fb166d3..ccb294cb54 100644 --- a/openair3/S1AP/s1ap_eNB_timer.c +++ b/openair3/S1AP/s1ap_eNB_timer.c @@ -96,14 +96,14 @@ int s1ap_timer_timeout(sigval_t info) instance = timer_p->instance; message_p = itti_alloc_new_message(TASK_UNKNOWN, TIMER_HAS_EXPIRED); - timer_expired_p = &message_p->ittiMsg.timer_has_expired; + timer_expired_p = (s1ap_timer_has_expired_t *)(&message_p->ittiMsg.timer_has_expired); timer_expired_p->timer_id = (long)timer_p->timer; timer_expired_p->timer_kind = timer_p->timer_kind; timer_expired_p->arg = timer_p->timer_arg; /* Timer is a one shot timer, remove it */ - if( timer_p->type == S1AP_TIMER_ONE_SHOT ) + if( (int)timer_p->type == (int)S1AP_TIMER_ONE_SHOT ) { if( s1ap_timer_remove((long)timer_p->timer) != 0 ) { @@ -143,7 +143,7 @@ int s1ap_timer_setup( return -1; } - if( type >= S1AP_TIMER_TYPE_MAX ) + if( (int)type >= (int)S1AP_TIMER_TYPE_MAX ) { S1AP_ERROR("Invalid timer type (%d/%d)!\n", type, TIMER_TYPE_MAX); return -1; @@ -196,7 +196,7 @@ int s1ap_timer_setup( its.it_value.tv_sec = interval_sec; its.it_value.tv_nsec = interval_us * 1000; - if( type == S1AP_TIMER_PERIODIC ) + if( (int)type == (int)S1AP_TIMER_PERIODIC ) { /* Asked for periodic timer. We set the interval time */ its.it_interval.tv_sec = interval_sec; @@ -253,7 +253,7 @@ int s1ap_timer_remove(long timer_id) if( pthread_mutex_lock(&timer_desc.timer_list_mutex) != 0 ) { S1AP_ERROR("Failed to mutex lock\n"); - if( timer_delete(timer_id) < 0 ) + if( timer_delete((timer_t)timer_id) < 0 ) { S1AP_ERROR("Failed to delete timer 0x%lx\n", (long)timer_id); } From 4a14c4c706400311326adab8e2a8dad73bdf79a4 Mon Sep 17 00:00:00 2001 From: Wu Jing Date: Mon, 13 Apr 2020 14:37:50 +0900 Subject: [PATCH 026/231] fix build waning (cherry picked from commit 624fe21f52117959940066a6cfc5f8beac70e462) # Conflicts: # openair2/LAYER2/MAC/eNB_scheduler_RA.c # openair2/LAYER2/MAC/eNB_scheduler_dlsch.c # openair2/LAYER2/MAC/eNB_scheduler_fairRR.c # openair3/S1AP/s1ap_eNB.c # Conflicts: # openair3/S1AP/s1ap_eNB.c --- openair3/S1AP/s1ap_eNB.c | 4 ++-- openair3/S1AP/s1ap_eNB_handlers.c | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/openair3/S1AP/s1ap_eNB.c b/openair3/S1AP/s1ap_eNB.c index 9eebb68fe7..742766909b 100644 --- a/openair3/S1AP/s1ap_eNB.c +++ b/openair3/S1AP/s1ap_eNB.c @@ -105,7 +105,7 @@ static void s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p, MessageDef *message_p = NULL; sctp_new_association_req_t *sctp_new_association_req_p = NULL; s1ap_eNB_mme_data_t *s1ap_mme_data_p = NULL; - struct s1ap_eNB_mme_data_s *mme = NULL; +// struct s1ap_eNB_mme_data_s *mme = NULL; DevAssert(instance_p != NULL); DevAssert(mme_ip_address != NULL); message_p = itti_alloc_new_message(TASK_S1AP, SCTP_NEW_ASSOCIATION_REQ); @@ -666,7 +666,7 @@ void *s1ap_eNB_process_itti_msg(void *notUsed) { case TIMER_HAS_EXPIRED: { s1ap_eNB_timer_expired(ITTI_MESSAGE_GET_INSTANCE(received_msg), - &TIMER_HAS_EXPIRED(received_msg)); + (s1ap_timer_has_expired_t *) &TIMER_HAS_EXPIRED(received_msg)); } break; diff --git a/openair3/S1AP/s1ap_eNB_handlers.c b/openair3/S1AP/s1ap_eNB_handlers.c index 5d43c5b3fa..89f82fa485 100644 --- a/openair3/S1AP/s1ap_eNB_handlers.c +++ b/openair3/S1AP/s1ap_eNB_handlers.c @@ -38,6 +38,9 @@ #include "s1ap_eNB_defs.h" #include "s1ap_eNB_handlers.h" #include "s1ap_eNB_decoder.h" +#include "s1ap_eNB_encoder.h" + +#include "s1ap_eNB_itti_messaging.h" #include "s1ap_eNB_ue_context.h" #include "s1ap_eNB_trace.h" @@ -818,7 +821,7 @@ int s1ap_eNB_handle_error_indication(uint32_t assoc_id, if (ie) { if( ie->value.choice.CriticalityDiagnostics.procedureCode ) { - S1AP_WARN("Received S1 Error indication CriticalityDiagnostics procedureCode = %d\n", *ie->value.choice.CriticalityDiagnostics.procedureCode); + S1AP_WARN("Received S1 Error indication CriticalityDiagnostics procedureCode = %ld\n", *ie->value.choice.CriticalityDiagnostics.procedureCode); } // TODO continue } From cf41c788d682c301e6cb0f981add5681e3dff626 Mon Sep 17 00:00:00 2001 From: Haruki NAOI Date: Mon, 27 Jul 2020 12:34:14 +0900 Subject: [PATCH 027/231] fix s1ap stack overflow. (cherry picked from commit f6b51079021347c19d528200f04d7cdba1dde0e5) # Conflicts: # openair3/S1AP/s1ap_eNB.c --- openair3/S1AP/s1ap_eNB.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/openair3/S1AP/s1ap_eNB.c b/openair3/S1AP/s1ap_eNB.c index 742766909b..2501fe334c 100644 --- a/openair3/S1AP/s1ap_eNB.c +++ b/openair3/S1AP/s1ap_eNB.c @@ -285,7 +285,7 @@ void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa struct served_gummei_s* gummeiInfo; struct mme_code_s* mmeCode; int8_t cnt = 0; - unsigned enb_s1ap_id[20]; + unsigned enb_s1ap_id[NUMBER_OF_UE_MAX]; DevAssert(sctp_new_association_resp != NULL); instance_p = s1ap_eNB_get_instance(instance); DevAssert(instance_p != NULL); @@ -305,6 +305,7 @@ void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa { if( ue_p->mme_ref == s1ap_mme_data_p ) { + if(cnt < NUMBER_OF_UE_MAX){ enb_s1ap_id[cnt] = ue_p->eNB_ue_s1ap_id; cnt++; @@ -324,6 +325,9 @@ void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa { S1AP_ERROR("Invalid message_p : eNB_ue_s1ap_id=%u\n", ue_p->eNB_ue_s1ap_id); } + }else{ + S1AP_ERROR("s1ap_eNB_handle_sctp_association_resp: cnt %d > max\n", cnt); + } } } for( ; cnt > 0 ; ) @@ -419,18 +423,18 @@ void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa // } else { - /* Update parameters */ - s1ap_mme_data_p->assoc_id = sctp_new_association_resp->assoc_id; - s1ap_mme_data_p->in_streams = sctp_new_association_resp->in_streams; - s1ap_mme_data_p->out_streams = sctp_new_association_resp->out_streams; - /* Prepare new S1 Setup Request */ - s1ap_mme_data_p->s1_setupreq_cnt = 0; - s1ap_mme_data_p->sctp_req_cnt = 0; - if (s1ap_eNB_generate_s1_setup_request(instance_p, s1ap_mme_data_p) == -1) { - S1AP_ERROR("s1ap eNB generate s1 setup request failed\n"); - return; + /* Update parameters */ + s1ap_mme_data_p->assoc_id = sctp_new_association_resp->assoc_id; + s1ap_mme_data_p->in_streams = sctp_new_association_resp->in_streams; + s1ap_mme_data_p->out_streams = sctp_new_association_resp->out_streams; + /* Prepare new S1 Setup Request */ + s1ap_mme_data_p->s1_setupreq_cnt = 0; + s1ap_mme_data_p->sctp_req_cnt = 0; + if (s1ap_eNB_generate_s1_setup_request(instance_p, s1ap_mme_data_p) == -1) { + S1AP_ERROR("s1ap eNB generate s1 setup request failed\n"); + return; + } } -} static void s1ap_eNB_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind) { From 27413fc4fc58347f18abe8aaab4de4d39119a768 Mon Sep 17 00:00:00 2001 From: "masayuki.harada" Date: Fri, 20 Nov 2020 22:13:27 +0900 Subject: [PATCH 028/231] Fix merge miss. --- openair2/COMMON/tasks_def.h | 3 +- openair2/X2AP/x2ap_common.h | 2 +- openair3/S1AP/s1ap_eNB.c | 123 +++++++++++++----------------------- 3 files changed, 47 insertions(+), 81 deletions(-) diff --git a/openair2/COMMON/tasks_def.h b/openair2/COMMON/tasks_def.h index f84195d5d7..33b6d5f9d4 100644 --- a/openair2/COMMON/tasks_def.h +++ b/openair2/COMMON/tasks_def.h @@ -47,8 +47,7 @@ TASK_DEF(TASK_RAL_ENB, TASK_PRIORITY_MED, 200) TASK_DEF(TASK_UDP, TASK_PRIORITY_MED, 1000) // GTP_V1U task TASK_DEF(TASK_GTPV1_U, TASK_PRIORITY_MED, 1000) -//TASK_DEF(TASK_S1AP, TASK_PRIORITY_MED, 200) -TASK_DEF(TASK_S1AP, TASK_PRIORITY_MED, 2000) +TASK_DEF(TASK_S1AP, TASK_PRIORITY_MED, 200) TASK_DEF(TASK_CU_F1, TASK_PRIORITY_MED, 200) TASK_DEF(TASK_DU_F1, TASK_PRIORITY_MED, 200) /// M3ap task, acts as both source and target diff --git a/openair2/X2AP/x2ap_common.h b/openair2/X2AP/x2ap_common.h index 470a023c31..a2f903a737 100644 --- a/openair2/X2AP/x2ap_common.h +++ b/openair2/X2AP/x2ap_common.h @@ -84,7 +84,7 @@ extern int asn1_xer_print; break; \ } \ } \ -/* if (mandatory) DevAssert(ie != NULL); \*/ \ + if (mandatory) DevAssert(ie != NULL); \ } while(0) /** \brief Function callback prototype. diff --git a/openair3/S1AP/s1ap_eNB.c b/openair3/S1AP/s1ap_eNB.c index 2501fe334c..c011653f76 100644 --- a/openair3/S1AP/s1ap_eNB.c +++ b/openair3/S1AP/s1ap_eNB.c @@ -121,55 +121,31 @@ static void s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p, local_ip_addr, sizeof(*local_ip_addr)); S1AP_INFO("[eNB %d] check the mme registration state\n",instance_p->instance); -// mme = NULL; -// -// if ( mme == NULL ) { - /* Create new MME descriptor */ - s1ap_mme_data_p = calloc(1, sizeof(*s1ap_mme_data_p)); - DevAssert(s1ap_mme_data_p != NULL); - s1ap_mme_data_p->cnx_id = s1ap_eNB_fetch_add_global_cnx_id(); - sctp_new_association_req_p->ulp_cnx_id = s1ap_mme_data_p->cnx_id; - s1ap_mme_data_p->assoc_id = -1; - s1ap_mme_data_p->broadcast_plmn_num = broadcast_plmn_num; - memcpy(&s1ap_mme_data_p->mme_s1_ip, - mme_ip_address, - sizeof(*mme_ip_address)); - for (int i = 0; i < broadcast_plmn_num; ++i) - s1ap_mme_data_p->broadcast_plmn_index[i] = broadcast_plmn_index[i]; + /* Create new MME descriptor */ + s1ap_mme_data_p = calloc(1, sizeof(*s1ap_mme_data_p)); + DevAssert(s1ap_mme_data_p != NULL); + s1ap_mme_data_p->cnx_id = s1ap_eNB_fetch_add_global_cnx_id(); + sctp_new_association_req_p->ulp_cnx_id = s1ap_mme_data_p->cnx_id; + s1ap_mme_data_p->assoc_id = -1; + s1ap_mme_data_p->broadcast_plmn_num = broadcast_plmn_num; + memcpy(&s1ap_mme_data_p->mme_s1_ip, + mme_ip_address, + sizeof(*mme_ip_address)); + for (int i = 0; i < broadcast_plmn_num; ++i) + s1ap_mme_data_p->broadcast_plmn_index[i] = broadcast_plmn_index[i]; - s1ap_mme_data_p->s1ap_eNB_instance = instance_p; - STAILQ_INIT(&s1ap_mme_data_p->served_gummei); - /* Insert the new descriptor in list of known MME - * but not yet associated. - */ - RB_INSERT(s1ap_mme_map, &instance_p->s1ap_mme_head, s1ap_mme_data_p); -// s1ap_mme_data_p->state = S1AP_ENB_STATE_WAITING; - s1ap_mme_data_p->state = S1AP_ENB_STATE_DISCONNECTED; - memcpy( &(s1ap_mme_data_p->mme_ip_address), mme_ip_address, sizeof(net_ip_address_t) ); - s1ap_mme_data_p->overload_state = S1AP_NO_OVERLOAD; - s1ap_mme_data_p->sctp_req_cnt++; - s1ap_mme_data_p->timer_id = S1AP_TIMERID_INIT; -// instance_p->s1ap_mme_nb ++; - instance_p->s1ap_mme_pending_nb ++; -// } else if (mme->state == S1AP_ENB_STATE_WAITING) { -// instance_p->s1ap_mme_pending_nb ++; -// sctp_new_association_req_p->ulp_cnx_id = mme->cnx_id; -// S1AP_INFO("[eNB %d] MME already registered, retrive the data (state %d, cnx %d, mme_nb %d, mme_pending_nb %d)\n", -// instance_p->instance, -// mme->state, mme->cnx_id, -// instance_p->s1ap_mme_nb, instance_p->s1ap_mme_pending_nb); -// /*s1ap_mme_data_p->cnx_id = mme->cnx_id; -// sctp_new_association_req_p->ulp_cnx_id = mme->cnx_id; -// -// s1ap_mme_data_p->assoc_id = -1; -// s1ap_mme_data_p->s1ap_eNB_instance = instance_p; -// */ -// } else { -// S1AP_WARN("[eNB %d] MME already registered but not in the waiting state, retrive the data (state %d, cnx %d, mme_nb %d, mme_pending_nb %d)\n", -// instance_p->instance, -// mme->state, mme->cnx_id, -// instance_p->s1ap_mme_nb, instance_p->s1ap_mme_pending_nb); -// } + s1ap_mme_data_p->s1ap_eNB_instance = instance_p; + STAILQ_INIT(&s1ap_mme_data_p->served_gummei); + /* Insert the new descriptor in list of known MME + * but not yet associated. + */ + RB_INSERT(s1ap_mme_map, &instance_p->s1ap_mme_head, s1ap_mme_data_p); + s1ap_mme_data_p->state = S1AP_ENB_STATE_DISCONNECTED; + memcpy( &(s1ap_mme_data_p->mme_ip_address), mme_ip_address, sizeof(net_ip_address_t) ); + s1ap_mme_data_p->overload_state = S1AP_NO_OVERLOAD; + s1ap_mme_data_p->sctp_req_cnt++; + s1ap_mme_data_p->timer_id = S1AP_TIMERID_INIT; + instance_p->s1ap_mme_pending_nb ++; itti_send_msg_to_task(TASK_SCTP, instance_p->instance, message_p); } @@ -210,8 +186,8 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t * new_instance->tac = s1ap_register_eNB->tac; memcpy(&new_instance->eNB_s1_ip, - &s1ap_register_eNB->enb_ip_address, - sizeof(s1ap_register_eNB->enb_ip_address)); + &s1ap_register_eNB->enb_ip_address, + sizeof(s1ap_register_eNB->enb_ip_address)); for (int i = 0; i < s1ap_register_eNB->num_plmn; i++) { new_instance->mcc[i] = s1ap_register_eNB->mcc[i]; @@ -238,8 +214,6 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t * s1ap_register_eNB->eNB_id); } -// DevCheck(s1ap_register_eNB->nb_mme <= S1AP_MAX_NB_MME_IP_ADDRESS, -// S1AP_MAX_NB_MME_IP_ADDRESS, s1ap_register_eNB->nb_mme, 0); if( s1ap_register_eNB->nb_mme > S1AP_MAX_NB_MME_IP_ADDRESS ) { S1AP_ERROR("Invalid MME number = %d\n ", s1ap_register_eNB->nb_mme); @@ -306,27 +280,27 @@ void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa if( ue_p->mme_ref == s1ap_mme_data_p ) { if(cnt < NUMBER_OF_UE_MAX){ - enb_s1ap_id[cnt] = ue_p->eNB_ue_s1ap_id; - cnt++; - - message_p = NULL; - message_p = itti_alloc_new_message(TASK_S1AP, S1AP_UE_CONTEXT_RELEASE_COMMAND); - - if( message_p != NULL ) - { - S1AP_UE_CONTEXT_RELEASE_COMMAND(message_p).eNB_ue_s1ap_id = ue_p->eNB_ue_s1ap_id; + enb_s1ap_id[cnt] = ue_p->eNB_ue_s1ap_id; + cnt++; - if( itti_send_msg_to_task(TASK_RRC_ENB, ue_p->eNB_instance->instance, message_p) < 0 ) + message_p = NULL; + message_p = itti_alloc_new_message(TASK_S1AP, S1AP_UE_CONTEXT_RELEASE_COMMAND); + + if( message_p != NULL ) { - S1AP_ERROR("UE Context Release Command Transmission Failure: eNB_ue_s1ap_id=%u\n", ue_p->eNB_ue_s1ap_id); + S1AP_UE_CONTEXT_RELEASE_COMMAND(message_p).eNB_ue_s1ap_id = ue_p->eNB_ue_s1ap_id; + + if( itti_send_msg_to_task(TASK_RRC_ENB, ue_p->eNB_instance->instance, message_p) < 0 ) + { + S1AP_ERROR("UE Context Release Command Transmission Failure: eNB_ue_s1ap_id=%u\n", ue_p->eNB_ue_s1ap_id); + } + } + else + { + S1AP_ERROR("Invalid message_p : eNB_ue_s1ap_id=%u\n", ue_p->eNB_ue_s1ap_id); } - } - else - { - S1AP_ERROR("Invalid message_p : eNB_ue_s1ap_id=%u\n", ue_p->eNB_ue_s1ap_id); - } }else{ - S1AP_ERROR("s1ap_eNB_handle_sctp_association_resp: cnt %d > max\n", cnt); + S1AP_ERROR("s1ap_eNB_handle_sctp_association_resp: cnt %d > max\n", cnt); } } } @@ -396,7 +370,7 @@ void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa { S1AP_ERROR("Retransmission count exceeded of SCTP : MME=%d\n",s1ap_mme_data_p->cnx_id); } - } + } else { S1AP_ERROR("SCTP disconnection reception : MME = %d\n",s1ap_mme_data_p->cnx_id); @@ -413,14 +387,6 @@ void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa s1ap_mme_data_p->state = S1AP_ENB_STATE_DISCONNECTED; } } -// if (sctp_new_association_resp->sctp_state != SCTP_STATE_ESTABLISHED) { -// S1AP_WARN("Received unsuccessful result for SCTP association (%u), instance %d, cnx_id %u\n", -// sctp_new_association_resp->sctp_state, -// instance, -// sctp_new_association_resp->ulp_cnx_id); -// s1ap_handle_s1_setup_message(s1ap_mme_data_p, sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN); -// return; -// } else { /* Update parameters */ @@ -435,6 +401,7 @@ void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa return; } } +} static void s1ap_eNB_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind) { From 674339237fd94c7c79dc8c1af49f90b9a31da1f7 Mon Sep 17 00:00:00 2001 From: "masayuki.harada" Date: Tue, 24 Nov 2020 11:11:54 +0900 Subject: [PATCH 029/231] Add handling of error case. --- openair3/GTPV1-U/gtpv1u_eNB.c | 2 +- openair3/NAS/COMMON/EMM/MSG/AttachAccept.c | 1 - openair3/S1AP/s1ap_eNB.c | 6 ++++-- openair3/S1AP/s1ap_eNB_decoder.c | 2 -- openair3/SCTP/sctp_eNB_task.c | 8 ++++---- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/openair3/GTPV1-U/gtpv1u_eNB.c b/openair3/GTPV1-U/gtpv1u_eNB.c index 1e2954ba95..25f506f9a1 100644 --- a/openair3/GTPV1-U/gtpv1u_eNB.c +++ b/openair3/GTPV1-U/gtpv1u_eNB.c @@ -1211,7 +1211,7 @@ int gtpv1u_eNB_init(void) { //gtpv1u_data_g.udp_data; RC.gtpv1u_data_g->seq_num = 0; RC.gtpv1u_data_g->restart_counter = 0; - + RC.gtpv1u_data_g->enb_ip_address_for_S1u_S12_S4_up = 0; /* Initializing GTPv1-U stack */ if ((rc = nwGtpv1uInitialize(&RC.gtpv1u_data_g->gtpv1u_stack, GTPU_STACK_ENB)) != NW_GTPV1U_OK) { LOG_E(GTPU, "Failed to setup nwGtpv1u stack %x\n", rc); diff --git a/openair3/NAS/COMMON/EMM/MSG/AttachAccept.c b/openair3/NAS/COMMON/EMM/MSG/AttachAccept.c index 8ac43cf7b1..637d930226 100644 --- a/openair3/NAS/COMMON/EMM/MSG/AttachAccept.c +++ b/openair3/NAS/COMMON/EMM/MSG/AttachAccept.c @@ -190,7 +190,6 @@ int decode_attach_accept(attach_accept_msg *attach_accept, uint8_t *buffer, uint default: errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI; LOG_TRACE(WARNING, "DECODE_UNEXPECTED_IEI %x (4 bits)", ieiDecoded); - AssertFatal(0, " "); return TLV_DECODE_UNEXPECTED_IEI; } } diff --git a/openair3/S1AP/s1ap_eNB.c b/openair3/S1AP/s1ap_eNB.c index c011653f76..9435296371 100644 --- a/openair3/S1AP/s1ap_eNB.c +++ b/openair3/S1AP/s1ap_eNB.c @@ -411,8 +411,10 @@ void s1ap_eNB_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind) { mme_test_s1_notify_sctp_data_ind(sctp_data_ind->assoc_id, sctp_data_ind->stream, sctp_data_ind->buffer, sctp_data_ind->buffer_length); #else - s1ap_eNB_handle_message(sctp_data_ind->assoc_id, sctp_data_ind->stream, - sctp_data_ind->buffer, sctp_data_ind->buffer_length); + if (s1ap_eNB_handle_message(sctp_data_ind->assoc_id, sctp_data_ind->stream, + sctp_data_ind->buffer, sctp_data_ind->buffer_length) == -1) { + S1AP_ERROR("Failed to handle s1ap eNB message\n"); + } #endif result = itti_free(TASK_UNKNOWN, sctp_data_ind->buffer); AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); diff --git a/openair3/S1AP/s1ap_eNB_decoder.c b/openair3/S1AP/s1ap_eNB_decoder.c index 4635946a05..14e4b49238 100644 --- a/openair3/S1AP/s1ap_eNB_decoder.c +++ b/openair3/S1AP/s1ap_eNB_decoder.c @@ -89,8 +89,6 @@ static int s1ap_eNB_decode_initiating_message(S1AP_S1AP_PDU_t *pdu) { default: S1AP_ERROR("Unknown procedure ID (%d) for initiating message\n", (int)pdu->choice.initiatingMessage.procedureCode); - AssertFatal( 0, "Unknown procedure ID (%d) for initiating message\n", - (int)pdu->choice.initiatingMessage.procedureCode); return -1; } diff --git a/openair3/SCTP/sctp_eNB_task.c b/openair3/SCTP/sctp_eNB_task.c index ec9e62bb3f..abaae7090f 100644 --- a/openair3/SCTP/sctp_eNB_task.c +++ b/openair3/SCTP/sctp_eNB_task.c @@ -270,7 +270,7 @@ sctp_handle_new_association_req_multi( sctp_new_association_req_p->remote_address.ipv6_address); //close(sd); //return; - exit(1); + exit_fun("sctp_handle_new_association_req_multi fatal: inet_pton error"); } SCTP_DEBUG("Converted ipv6 address %*s to network type\n", @@ -290,7 +290,7 @@ sctp_handle_new_association_req_multi( sctp_new_association_req_p->remote_address.ipv4_address); //close(sd); //return; - exit(1); + exit_fun("sctp_handle_new_association_req_multi fatal: inet_pton error"); } SCTP_DEBUG("Converted ipv4 address %*s to network type\n", @@ -329,7 +329,7 @@ sctp_handle_new_association_req_multi( if (ns == -1) { perror("sctp_peeloff"); printf("sctp_peeloff: sd=%d assoc_id=%d\n", sd, assoc_id); - exit(1); + exit_fun("sctp_handle_new_association_req_multi fatal: sctp_peeloff error"); } sctp_cnx = calloc(1, sizeof(*sctp_cnx)); @@ -971,7 +971,7 @@ sctp_eNB_read_from_socket( if (!(flags & MSG_EOR)) { SCTP_ERROR("fatal: partial SCTP messages are not handled\n"); - exit(1); + exit_fun("fatal: partial SCTP messages are not handled" ); } if (flags & MSG_NOTIFICATION) { From 729182f57efebaee9dc2b7c032d4eb5e732f6568 Mon Sep 17 00:00:00 2001 From: Shweta Shrivastava Date: Fri, 8 Jan 2021 11:19:29 -0600 Subject: [PATCH 030/231] Use PTRS params from RRC at MAC; remove hardcoding --- openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c | 69 +++++++++++++++++++ openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h | 6 ++ openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 40 +++++------ .../LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c | 20 +++--- 4 files changed, 103 insertions(+), 32 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index cc6b1b9de3..b94a0c3a61 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -2918,3 +2918,72 @@ bool set_dl_ptrs_values(NR_PTRS_DownlinkConfig_t *ptrs_config, //printf("[MAC] PTRS is set K= %u L= %u\n", *K_ptrs,1<<*L_ptrs); return valid; } + +/* extract UL PTRS values from RRC and validate it based upon 38.214 6.2.3 */ +bool set_ul_ptrs_values(NR_PTRS_UplinkConfig_t *ul_ptrs_config, + uint16_t rbSize,uint8_t mcsIndex, uint8_t mcsTable, + uint8_t *K_ptrs, uint8_t *L_ptrs, + uint8_t *reOffset, uint8_t *maxNumPorts, uint8_t *ulPower, + uint8_t NrOfSymbols) +{ + bool valid = true; + + /* as defined in T 38.214 6.2.3 */ + if(rbSize < 3) { + valid = false; + return valid; + } + /* Check for Frequency Density values */ + if(ul_ptrs_config->transformPrecoderDisabled->frequencyDensity->list.count < 2) { + /* Default value for K_PTRS = 2 as defined in T 38.214 6.2.3 */ + *K_ptrs = 2; + } + else { + *K_ptrs = get_K_ptrs(*ul_ptrs_config->transformPrecoderDisabled->frequencyDensity->list.array[0], + *ul_ptrs_config->transformPrecoderDisabled->frequencyDensity->list.array[1], + rbSize); + } + /* Check for time Density values */ + if(ul_ptrs_config->transformPrecoderDisabled->timeDensity->list.count < 3) { + *L_ptrs = 0; + } + else { + *L_ptrs = get_L_ptrs(*ul_ptrs_config->transformPrecoderDisabled->timeDensity->list.array[0], + *ul_ptrs_config->transformPrecoderDisabled->timeDensity->list.array[1], + *ul_ptrs_config->transformPrecoderDisabled->timeDensity->list.array[2], + mcsIndex, + mcsTable); + } + + *reOffset = *ul_ptrs_config->transformPrecoderDisabled->resourceElementOffset; + *maxNumPorts = ul_ptrs_config->transformPrecoderDisabled->maxNrofPorts; + *ulPower = ul_ptrs_config->transformPrecoderDisabled->ptrs_Power; + /* If either or both of the parameters PT-RS time density (LPT-RS) and PT-RS frequency density (KPT-RS), shown in Table + * 6.2.3.1-1 and Table 6.2.3.1-2, indicates that 'PT-RS not present', the UE shall assume that PT-RS is not present + */ + if(*K_ptrs ==2 || *K_ptrs ==4 ) { + valid = true; + } + else { + valid = false; + return valid; + } + if(*L_ptrs ==0 || *L_ptrs ==1 || *L_ptrs ==2 ) { + valid = true; + } + else { + valid = false; + return valid; + } + /* PTRS is not present also : + * When the UE is receiving a PUSCH with allocation duration of 4 symbols and if LPT-RS is set to 4, the UE shall assume + * PT-RS is not transmitted + * When the UE is receiving a PUSCH with allocation duration of 2 symbols as defined in Clause 6.4.1.2.2 of [4, TS + * 38.211] and if LPT-RS is set to 2 or 4, the UE shall assume PT-RS is not transmitted. + */ + if((NrOfSymbols == 4 && *L_ptrs ==2) || ((NrOfSymbols == 2 && *L_ptrs > 0))) { + valid = false; + return valid; + } + return valid; +} diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h index d4cc1bd2a7..690f7f99a2 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h @@ -185,4 +185,10 @@ bool set_dl_ptrs_values(NR_PTRS_DownlinkConfig_t *ptrs_config, uint8_t *K_ptrs, uint8_t *L_ptrs,uint8_t *portIndex, uint8_t *nERatio,uint8_t *reOffset, uint8_t NrOfSymbols); + +bool set_ul_ptrs_values(NR_PTRS_UplinkConfig_t *ul_ptrs_config, + uint16_t rbSize,uint8_t mcsIndex, uint8_t mcsTable, + uint8_t *K_ptrs, uint8_t *L_ptrs, + uint8_t *reOffset, uint8_t *maxNumPorts, uint8_t *ulPower, + uint8_t NrOfSymbols); #endif diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 5e615b49f4..8e6aa81f81 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -1537,31 +1537,18 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in // program PUSCH with UL DCI parameters nr_scheduled_response_t scheduled_response; fapi_nr_tx_request_t tx_req; - nfapi_nr_ue_ptrs_ports_t ptrs_ports_list; - + for (int j = 0; j < ul_config_req->number_pdus; j++) { fapi_nr_ul_config_request_pdu_t *ulcfg_pdu = &ul_config_req->ul_config_list[j]; if (ulcfg_pdu->pdu_type == FAPI_NR_UL_CONFIG_TYPE_PUSCH) { - // These should come from RRC config!!! - uint8_t ptrs_mcs1 = 2; - uint8_t ptrs_mcs2 = 4; - uint8_t ptrs_mcs3 = 10; - uint16_t n_rb0 = 25; - uint16_t n_rb1 = 75; - uint8_t ptrs_time_density = get_L_ptrs(ptrs_mcs1, ptrs_mcs2, ptrs_mcs3, ulcfg_pdu->pusch_config_pdu.mcs_index, ulcfg_pdu->pusch_config_pdu.mcs_table); - uint8_t ptrs_freq_density = get_K_ptrs(n_rb0, n_rb1, ulcfg_pdu->pusch_config_pdu.rb_size); uint16_t l_prime_mask = get_l_prime(ulcfg_pdu->pusch_config_pdu.nr_of_symbols, typeB, pusch_dmrs_pos0, pusch_len1); uint16_t ul_dmrs_symb_pos = l_prime_mask << ulcfg_pdu->pusch_config_pdu.start_symbol_index; uint8_t dmrs_config_type = 0; uint16_t number_dmrs_symbols = 0; - // PTRS ports configuration - // TbD: ptrs_dmrs_port and ptrs_port_index are not initialised! - ptrs_ports_list.ptrs_re_offset = 0; - // Num PRB Overhead from PUSCH-ServingCellConfig if (mac->scg->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->xOverhead == NULL) N_PRB_oh = 0; @@ -1573,13 +1560,8 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in ulcfg_pdu->pusch_config_pdu.num_dmrs_cdm_grps_no_data = 1; ulcfg_pdu->pusch_config_pdu.nrOfLayers = 1; ulcfg_pdu->pusch_config_pdu.pusch_data.new_data_indicator = 0; - ulcfg_pdu->pusch_config_pdu.pdu_bit_map = PUSCH_PDU_BITMAP_PUSCH_DATA; - ulcfg_pdu->pusch_config_pdu.pusch_ptrs.ptrs_time_density = ptrs_time_density; - ulcfg_pdu->pusch_config_pdu.pusch_ptrs.ptrs_freq_density = ptrs_freq_density; - ulcfg_pdu->pusch_config_pdu.pusch_ptrs.ptrs_ports_list = &ptrs_ports_list; - //ulcfg_pdu->pusch_config_pdu.target_code_rate = nr_get_code_rate_ul(ulcfg_pdu->pusch_config_pdu.mcs_index, ulcfg_pdu->pusch_config_pdu.mcs_table); - //ulcfg_pdu->pusch_config_pdu.qam_mod_order = nr_get_Qm_ul(ulcfg_pdu->pusch_config_pdu.mcs_index, ulcfg_pdu->pusch_config_pdu.mcs_table); - + ulcfg_pdu->pusch_config_pdu.pdu_bit_map |= PUSCH_PDU_BITMAP_PUSCH_DATA; + if (1 << ulcfg_pdu->pusch_config_pdu.pusch_ptrs.ptrs_time_density >= ulcfg_pdu->pusch_config_pdu.nr_of_symbols) { ulcfg_pdu->pusch_config_pdu.pdu_bit_map &= ~PUSCH_PDU_BITMAP_PUSCH_PTRS; // disable PUSCH PTRS } @@ -3624,6 +3606,22 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr // A value of "1" indicates UL-SCH shall be transmitted on the PUSCH and // a value of "0" indicates UL-SCH shall not be transmitted on the PUSCH + if (mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS != NULL) { + if (pusch_config_pdu_0_1->transform_precoding == transform_precoder_disabled) { + nfapi_nr_ue_ptrs_ports_t ptrs_ports_list; + pusch_config_pdu_0_1->pusch_ptrs.ptrs_ports_list = &ptrs_ports_list; + valid_ptrs_setup = set_ul_ptrs_values(mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup, + pusch_config_pdu_0_1->rb_size, pusch_config_pdu_0_1->mcs_index, pusch_config_pdu_0_1->mcs_table, + &pusch_config_pdu_0_1->pusch_ptrs.ptrs_freq_density,&pusch_config_pdu_0_1->pusch_ptrs.ptrs_time_density, + &pusch_config_pdu_0_1->pusch_ptrs.ptrs_ports_list->ptrs_re_offset,&pusch_config_pdu_0_1->pusch_ptrs.num_ptrs_ports, + &pusch_config_pdu_0_1->pusch_ptrs.ul_ptrs_power, pusch_config_pdu_0_1->nr_of_symbols); + if(valid_ptrs_setup==true) { + pusch_config_pdu_0_1->pdu_bit_map |= PUSCH_PDU_BITMAP_PUSCH_PTRS; + } + //LOG_I(MAC, "UL PTRS values: PTRS time den: %d, PTRS freq den: %d\n", pusch_config_pdu_0_1->pusch_ptrs.ptrs_freq_density, pusch_config_pdu_0_1->pusch_ptrs.ptrs_time_density); + } + } + ul_config->slot = slot_tx; ul_config->sfn = frame_tx; ul_config->number_pdus = ul_config->number_pdus + 1; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c index e14afacf09..bed05634c8 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c @@ -486,6 +486,7 @@ void schedule_fapi_ul_pdu(int Mod_idP, int bwp_id=1; int mu = scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.subcarrierSpacing; int UE_id = 0; + bool valid_ptrs_setup = false; NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; AssertFatal(UE_info->active[UE_id],"Cannot find UE_id %d is not active\n",UE_id); @@ -693,18 +694,15 @@ void schedule_fapi_ul_pdu(int Mod_idP, // ------- PTRS ------- // -------------------- if (NR_DMRS_UplinkConfig->phaseTrackingRS != NULL) { - // TODO to be fixed from RRC config - uint8_t ptrs_mcs1 = 2; // higher layer parameter in PTRS-UplinkConfig - uint8_t ptrs_mcs2 = 4; // higher layer parameter in PTRS-UplinkConfig - uint8_t ptrs_mcs3 = 10; // higher layer parameter in PTRS-UplinkConfig - uint16_t n_rb0 = 25; // higher layer parameter in PTRS-UplinkConfig - uint16_t n_rb1 = 75; // higher layer parameter in PTRS-UplinkConfig - pusch_pdu->pusch_ptrs.ptrs_time_density = get_L_ptrs(ptrs_mcs1, ptrs_mcs2, ptrs_mcs3, pusch_pdu->mcs_index, pusch_pdu->mcs_table); - pusch_pdu->pusch_ptrs.ptrs_freq_density = get_K_ptrs(n_rb0, n_rb1, pusch_pdu->rb_size); pusch_pdu->pusch_ptrs.ptrs_ports_list = (nfapi_nr_ptrs_ports_t *) malloc(2*sizeof(nfapi_nr_ptrs_ports_t)); - pusch_pdu->pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset = 0; - - pusch_pdu->pdu_bit_map |= PUSCH_PDU_BITMAP_PUSCH_PTRS; // enable PUSCH PTRS + valid_ptrs_setup = set_ul_ptrs_values(NR_DMRS_UplinkConfig->phaseTrackingRS->choice.setup, + pusch_pdu->rb_size, pusch_pdu->mcs_index, pusch_pdu->mcs_table, + &pusch_pdu->pusch_ptrs.ptrs_freq_density,&pusch_pdu->pusch_ptrs.ptrs_time_density, + &pusch_pdu->pusch_ptrs.ptrs_ports_list->ptrs_re_offset,&pusch_pdu->pusch_ptrs.num_ptrs_ports, + &pusch_pdu->pusch_ptrs.ul_ptrs_power, pusch_pdu->nr_of_symbols); + if(valid_ptrs_setup==true) { + pusch_pdu->pdu_bit_map |= PUSCH_PDU_BITMAP_PUSCH_PTRS; // enable PUSCH PTRS + } } else{ pusch_pdu->pdu_bit_map &= ~PUSCH_PDU_BITMAP_PUSCH_PTRS; // disable PUSCH PTRS From 9601c7a77ce1d1e11a1df744bd27c1ba5980ab11 Mon Sep 17 00:00:00 2001 From: Shweta Shrivastava Date: Fri, 8 Jan 2021 13:49:21 -0600 Subject: [PATCH 031/231] Further changes to resolve merge conflict --- .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 75b00ea6ba..1dbd268a04 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -744,18 +744,16 @@ void nr_schedule_ulsch(module_id_t module_id, /* PUSCH PTRS */ if (ps->NR_DMRS_UplinkConfig->phaseTrackingRS != NULL) { - // TODO to be fixed from RRC config - uint8_t ptrs_mcs1 = 2; // higher layer parameter in PTRS-UplinkConfig - uint8_t ptrs_mcs2 = 4; // higher layer parameter in PTRS-UplinkConfig - uint8_t ptrs_mcs3 = 10; // higher layer parameter in PTRS-UplinkConfig - uint16_t n_rb0 = 25; // higher layer parameter in PTRS-UplinkConfig - uint16_t n_rb1 = 75; // higher layer parameter in PTRS-UplinkConfig - pusch_pdu->pusch_ptrs.ptrs_time_density = get_L_ptrs(ptrs_mcs1, ptrs_mcs2, ptrs_mcs3, pusch_pdu->mcs_index, pusch_pdu->mcs_table); - pusch_pdu->pusch_ptrs.ptrs_freq_density = get_K_ptrs(n_rb0, n_rb1, pusch_pdu->rb_size); + bool valid_ptrs_setup = false; pusch_pdu->pusch_ptrs.ptrs_ports_list = (nfapi_nr_ptrs_ports_t *) malloc(2*sizeof(nfapi_nr_ptrs_ports_t)); - pusch_pdu->pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset = 0; - - pusch_pdu->pdu_bit_map |= PUSCH_PDU_BITMAP_PUSCH_PTRS; // enable PUSCH PTRS + valid_ptrs_setup = set_ul_ptrs_values(ps->NR_DMRS_UplinkConfig->phaseTrackingRS->choice.setup, + pusch_pdu->rb_size, pusch_pdu->mcs_index, pusch_pdu->mcs_table, + &pusch_pdu->pusch_ptrs.ptrs_freq_density,&pusch_pdu->pusch_ptrs.ptrs_time_density, + &pusch_pdu->pusch_ptrs.ptrs_ports_list->ptrs_re_offset,&pusch_pdu->pusch_ptrs.num_ptrs_ports, + &pusch_pdu->pusch_ptrs.ul_ptrs_power, pusch_pdu->nr_of_symbols); + if (valid_ptrs_setup==true) { + pusch_pdu->pdu_bit_map |= PUSCH_PDU_BITMAP_PUSCH_PTRS; // enable PUSCH PTRS + } } else{ pusch_pdu->pdu_bit_map &= ~PUSCH_PDU_BITMAP_PUSCH_PTRS; // disable PUSCH PTRS From f9e2d12e1c90b1b0719c343ee9ef8cf8f49d85d1 Mon Sep 17 00:00:00 2001 From: Shweta Shrivastava Date: Mon, 11 Jan 2021 15:16:29 -0600 Subject: [PATCH 032/231] Fix phy sim build errors --- openair1/SIMULATION/NR_PHY/dlsim.c | 4 ++++ openair1/SIMULATION/NR_PHY/nr_unitary_defs.h | 1 + openair1/SIMULATION/NR_PHY/ulsim.c | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 57923895d3..8df290249a 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -603,6 +603,7 @@ int main(int argc, char **argv) rrc.carrier.servingcellconfigcommon = calloc(1,sizeof(*rrc.carrier.servingcellconfigcommon)); NR_ServingCellConfigCommon_t *scc = rrc.carrier.servingcellconfigcommon; + NR_ServingCellConfig_t *scd = calloc(1,sizeof(NR_ServingCellConfig_t)); NR_CellGroupConfig_t *secondaryCellGroup=calloc(1,sizeof(*secondaryCellGroup)); prepare_scc(rrc.carrier.servingcellconfigcommon); uint64_t ssb_bitmap; @@ -610,7 +611,10 @@ int main(int argc, char **argv) fix_scc(scc,ssb_bitmap); + prepare_scd(scd); + fill_default_secondaryCellGroup(scc, + scd, secondaryCellGroup, 0, 1, diff --git a/openair1/SIMULATION/NR_PHY/nr_unitary_defs.h b/openair1/SIMULATION/NR_PHY/nr_unitary_defs.h index a7150fb2f9..dcacf4db3b 100644 --- a/openair1/SIMULATION/NR_PHY/nr_unitary_defs.h +++ b/openair1/SIMULATION/NR_PHY/nr_unitary_defs.h @@ -235,6 +235,7 @@ void fill_scc(NR_ServingCellConfigCommon_t *scc,uint64_t *ssb_bitmap,int N_RB_DL void fix_scc(NR_ServingCellConfigCommon_t *scc,uint64_t ssbmap); void prepare_scc(NR_ServingCellConfigCommon_t *scc); +void prepare_scd(NR_ServingCellConfig_t *scd); ngap_gNB_config_t ngap_config; uint32_t ngap_generate_gNB_id(void) {return 0;} void configure_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr, int pnf_p7_port, int vnf_p7_port) { return;} diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index 821ac75a64..b92546b43b 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -566,6 +566,7 @@ int main(int argc, char **argv) rrc.carrier.servingcellconfigcommon = calloc(1,sizeof(*rrc.carrier.servingcellconfigcommon)); NR_ServingCellConfigCommon_t *scc = rrc.carrier.servingcellconfigcommon; + NR_ServingCellConfig_t *scd = calloc(1,sizeof(NR_ServingCellConfig_t)); NR_CellGroupConfig_t *secondaryCellGroup=calloc(1,sizeof(*secondaryCellGroup)); prepare_scc(rrc.carrier.servingcellconfigcommon); uint64_t ssb_bitmap; @@ -573,7 +574,10 @@ int main(int argc, char **argv) fix_scc(scc,ssb_bitmap); + prepare_scd(scd); + fill_default_secondaryCellGroup(scc, + scd, secondaryCellGroup, 0, 1, From 87ada8410651ec083ce321651205dd1f1e3bacbf Mon Sep 17 00:00:00 2001 From: Parminder Singh Date: Thu, 28 Jan 2021 11:55:34 +0100 Subject: [PATCH 033/231] created a new conf file for PTRS testing - removed default PTRS values from default conf file. --- .../gnb.band78.tm1.106PRB.usrpn300.conf | 54 --- .../gnb.band78.tm1.106PRB.PTRS.usrpx300.conf | 331 ++++++++++++++++++ 2 files changed, 331 insertions(+), 54 deletions(-) create mode 100644 targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.PTRS.usrpx300.conf diff --git a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf index b148107234..bc467ad347 100644 --- a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf +++ b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf @@ -191,60 +191,6 @@ gNBs = ); - # Dedicated Serving Cell Configuration - servingCellConfigDedicated = ( - { - # PTRS-related config is optional. If any of the frequencyDensity or - # timeDensity parameters are skipped below or if the values are out- - # of-bounds, PTRS will be assumed to be not present. - - # DL PTRS related parameters. - # 3GPP TS 38.331 PTRS-DownlinkConfig - - # frequencyDensity value range: 1-276 - dl_ptrsFreqDensity0_0 = 25; - dl_ptrsFreqDensity1_0 = 75; - - # timeDensity value range: 0-29 - dl_ptrsTimeDensity0_0 = 2; - dl_ptrsTimeDensity1_0 = 4; - dl_ptrsTimeDensity2_0 = 10; - - # epre_Ratio - # 0 = "00", 1 = "01" in TS 38.214, table 4.1-2 - dl_ptrsEpreRatio_0 = 0; - - # resourceElementOffset - # 0 = offset01 1 = offset02, 2 = offset02 - # 3GPP TS 38.331 PTRS-DownlinkConfig; TS 38.211 sec. 7.4.1.2.2 - dl_ptrsReOffset_0 = 0; - - # UL PTRS related parameters. - # 3GPP TS 38.331 PTRS-UplinkConfig - - # frequencyDensity value range: 1-276 - ul_ptrsFreqDensity0_0 = 25; - ul_ptrsFreqDensity1_0 = 75; - - # timeDensity value range: 0-29 - ul_ptrsTimeDensity0_0 = 2; - ul_ptrsTimeDensity1_0 = 4; - ul_ptrsTimeDensity2_0 = 10; - - # resourceElementOffset - # 0 = offset01 1 = offset02, 2 = offset02 - # TS 38.331 PTRS-UplinkConfig; TS 38.211 sec. 6.4.1.2.2.1 - ul_ptrsReOffset_0 = 0; - - # maxNrofPorts - # 0 = n1, 1 = n2 - ul_ptrsMaxPorts_0 = 0; - - # ptrs-Power - # 0 = p00, 1 = p01, 2 = p10, 3 = p11 - #ul_ptrsPower_0 = 0; - } - ); # ------- SCTP definitions diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.PTRS.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.PTRS.usrpx300.conf new file mode 100644 index 0000000000..deed91c93c --- /dev/null +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.PTRS.usrpx300.conf @@ -0,0 +1,331 @@ +Active_gNBs = ( "gNB-Eurecom-5GNRBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +gNBs = +( + { + ////////// Identification parameters: + gNB_ID = 0xe00; + + cell_type = "CELL_MACRO_GNB"; + + gNB_name = "gNB-Eurecom-5GNRBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 1; + + plmn_list = ({mcc = 208; mnc = 93; mnc_length = 2;}); + + tr_s_preference = "local_mac" + + ////////// Physical parameters: + + ssb_SubcarrierOffset = 0; + pdsch_AntennaPorts = 1; + + servingCellConfigCommon = ( + { + #spCellConfigCommon + + physCellId = 0; + + # downlinkConfigCommon + # frequencyInfoDL + # this is 3600 MHz + 43 PRBs@30kHz SCS (same as initial BWP) + absoluteFrequencySSB = 641032; + dl_frequencyBand = 78; + # this is 3600 MHz + dl_absoluteFrequencyPointA = 640000; + #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=0,L=50 (275*(L-1))+RBstart + initialDLBWPlocationAndBandwidth = 6366; + # subcarrierSpacing + # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialDLBWPsubcarrierSpacing = 1; + #pdcch-ConfigCommon + initialDLBWPcontrolResourceSetZero = 12; + initialDLBWPsearchSpaceZero = 0; + #pdsch-ConfigCommon + #pdschTimeDomainAllocationList (up to 16 entries) + initialDLBWPk0_0 = 0; + #initialULBWPmappingType + #0=typeA,1=typeB + initialDLBWPmappingType_0 = 0; + #this is SS=1,L=13 + initialDLBWPstartSymbolAndLength_0 = 40; + + initialDLBWPk0_1 = 0; + initialDLBWPmappingType_1 = 0; + #this is SS=2,L=12 + initialDLBWPstartSymbolAndLength_1 = 53; + + initialDLBWPk0_2 = 0; + initialDLBWPmappingType_2 = 0; + #this is SS=1,L=12 + initialDLBWPstartSymbolAndLength_2 = 54; + + initialDLBWPk0_3 = 0; + initialDLBWPmappingType_3 = 0; + #this is SS=1,L=4 + initialDLBWPstartSymbolAndLength_3 = 57; + + #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 = 6366; + # 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 = -118; + #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 = 15; + #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, + + # pusch-ConfigCommon (up to 16 elements) + initialULBWPk2_0 = 6; + initialULBWPmappingType_0 = 1 + # this is SS=0 L=11 + initialULBWPstartSymbolAndLength_0 = 55; + + initialULBWPk2_1 = 6; + initialULBWPmappingType_1 = 1; + # this is SS=0 L=12 + initialULBWPstartSymbolAndLength_1 = 69; + initialULBWPk2_2 = 7; + initialULBWPmappingType_2 = 1; + # this is SS=10 L=4 + initialULBWPstartSymbolAndLength_2 = 52; + + 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 = 10; + } + + ); + + # Dedicated Serving Cell Configuration + servingCellConfigDedicated = ( + { + # DL PTRS related parameters. + # 3GPP TS 38.331 PTRS-DownlinkConfig + + # frequencyDensity value range: 1-276 + dl_ptrsFreqDensity0_0 = 25; + dl_ptrsFreqDensity1_0 = 75; + + # timeDensity value range: 0-29 + dl_ptrsTimeDensity0_0 = 2; + dl_ptrsTimeDensity1_0 = 4; + dl_ptrsTimeDensity2_0 = 10; + + # epre_Ratio + # 0 = "00", 1 = "01" in TS 38.214, table 4.1-2 + dl_ptrsEpreRatio_0 = 0; + + # resourceElementOffset + # 0 = offset01 1 = offset02, 2 = offset02 + # 3GPP TS 38.331 PTRS-DownlinkConfig; TS 38.211 sec. 7.4.1.2.2 + dl_ptrsReOffset_0 = 0; + + # UL PTRS related parameters. + # 3GPP TS 38.331 PTRS-UplinkConfig + + # frequencyDensity value range: 1-276 + ul_ptrsFreqDensity0_0 = 25; + ul_ptrsFreqDensity1_0 = 75; + + # timeDensity value range: 0-29 + ul_ptrsTimeDensity0_0 = 2; + ul_ptrsTimeDensity1_0 = 4; + ul_ptrsTimeDensity2_0 = 10; + + # resourceElementOffset + # 0 = offset01 1 = offset02, 2 = offset02 + # TS 38.331 PTRS-UplinkConfig; TS 38.211 sec. 6.4.1.2.2.1 + ul_ptrsReOffset_0 = 0; + + # maxNrofPorts + # 0 = n1, 1 = n2 + ul_ptrsMaxPorts_0 = 0; + + # ptrs-Power + # 0 = p00, 1 = p01, 2 = p10, 3 = p11 + #ul_ptrsPower_0 = 0; + } + ); + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "192.168.12.26"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + + GNB_INTERFACE_NAME_FOR_S1_MME = "eth0"; + GNB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.111/24"; + GNB_INTERFACE_NAME_FOR_S1U = "eth0"; + GNB_IPV4_ADDRESS_FOR_S1U = "192.168.12.111/24"; + GNB_PORT_FOR_S1U = 2152; # Spec 2152 + }; + } +); + +MACRLCs = ( + { + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + } +); + +L1s = ( + { + num_cc = 1; + tr_n_preference = "local_mac"; + } +); + +RUs = ( + { + local_rf = "yes" + nb_tx = 1 + nb_rx = 1 + att_tx = 0 + att_rx = 0; + bands = [7]; + max_pdschReferenceSignalPower = -27; + max_rxgain = 114; + eNB_instances = [0]; + #beamforming 1x4 matrix: + bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000]; + sdr_addrs = "type=x300"; + clock_src = "external"; + } +); + +THREAD_STRUCT = ( + { + #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" + parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; + #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" + worker_config = "WORKER_ENABLE"; + } +); + +log_config : +{ + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; +}; From 58b36aa2226cc91545d64adf0b576600b69ca4b4 Mon Sep 17 00:00:00 2001 From: Parminder Singh Date: Mon, 1 Feb 2021 13:02:25 +0100 Subject: [PATCH 034/231] Added PTRS RRC config validation for DL/UL-SIM uni tests --- openair1/SIMULATION/NR_PHY/dlsim.c | 3 +++ openair1/SIMULATION/NR_PHY/ulsim.c | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 8df290249a..da5cb6ede4 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -150,6 +150,7 @@ int is_x2ap_enabled(void) openair0_config_t openair0_cfg[MAX_CARDS]; void update_ptrs_config(NR_CellGroupConfig_t *secondaryCellGroup, uint16_t *rbSize, uint8_t *mcsIndex,int8_t *ptrs_arg); void update_dmrs_config(NR_CellGroupConfig_t *scg,PHY_VARS_NR_UE *ue, int8_t* dmrs_arg); +extern void fix_scd(NR_ServingCellConfig_t *scd);// forward declaration /* specific dlsim DL preprocessor: uses rbStart/rbSize/mcs from command line of dlsim, does not search for CCE/PUCCH occasion but simply sets to 0 */ @@ -621,6 +622,8 @@ int main(int argc, char **argv) n_tx, 0); + /* RRC parameter validation for secondaryCellGroup */ + fix_scd(scd); /* -U option modify DMRS */ if(modify_dmrs) { update_dmrs_config(secondaryCellGroup, NULL,dmrs_arg); diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index b92546b43b..ba7211b290 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -120,6 +120,8 @@ rrc_gNB_process_GTPV1U_CREATE_TUNNEL_RESP( return 0; } +extern void fix_scd(NR_ServingCellConfig_t *scd);// forward declaration + // Dummy function to avoid linking error at compilation of nr-ulsim int is_x2ap_enabled(void) { @@ -586,6 +588,9 @@ int main(int argc, char **argv) // xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void*)secondaryCellGroup); + /* RRC parameter validation for secondaryCellGroup */ + fix_scd(scd); + AssertFatal((gNB->if_inst = NR_IF_Module_init(0))!=NULL,"Cannot register interface"); gNB->if_inst->NR_PHY_config_req = nr_phy_config_request; From aecf2dfa1336caeabe6834a14756ab85658b0736 Mon Sep 17 00:00:00 2001 From: cig Date: Fri, 29 Jan 2021 16:43:25 +0100 Subject: [PATCH 035/231] Hack to make FDD compatible with current UL scheduling design - temporary solution since scheduler does not support FDD - modified is_NR_UL_slot to return always 1 when is FDD mode - this is necessary because currently the scheduler assumes that is TDD and tdd_UL_DL_ConfigurationCommon is always initialied --- openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c | 8 ++++++-- openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h | 2 +- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 5 +++-- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 3 ++- openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c | 2 +- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index d056b06450..fa4363ebd9 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -2808,11 +2808,15 @@ int is_nr_DL_slot(NR_ServingCellConfigCommon_t *scc,slot_t slot) { else return(slot_in_period <= slots1+scc->tdd_UL_DL_ConfigurationCommon->pattern2->nrofDownlinkSlots ? 1 : 0); } -int is_nr_UL_slot(NR_ServingCellConfigCommon_t *scc,slot_t slot) { +int is_nr_UL_slot(NR_ServingCellConfigCommon_t *scc, slot_t slot, lte_frame_type_t frame_type) { int period,period1,period2=0; - if (scc->tdd_UL_DL_ConfigurationCommon==NULL) return(1); + // Note: condition on frame_type + // goal: the UL scheduler assumes mode is TDD therefore this hack is needed to make FDD work + if (scc->tdd_UL_DL_ConfigurationCommon == NULL || frame_type == FDD) { + return(1); + } if (scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1 && scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530) diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h index e41ca67229..538a2277ef 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h @@ -174,7 +174,7 @@ int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,i int is_nr_DL_slot(NR_ServingCellConfigCommon_t *scc,slot_t slotP); -int is_nr_UL_slot(NR_ServingCellConfigCommon_t *scc,slot_t slotP); +int is_nr_UL_slot(NR_ServingCellConfigCommon_t *scc, slot_t slotP, lte_frame_type_t frame_type); uint16_t nr_dci_size(NR_ServingCellConfigCommon_t *scc, NR_CellGroupConfig_t *secondaryCellGroup, diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index bf95e38ae2..2f886d5164 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -1054,8 +1054,9 @@ long get_k2(NR_UE_MAC_INST_t *mac, uint8_t time_domain_ind) { * from MAC instance . */ fapi_nr_ul_config_request_t *get_ul_config_request(NR_UE_MAC_INST_t *mac, int slot) { + //Check if request to access ul_config is for a UL slot - if (is_nr_UL_slot(mac->scc, slot) == 0) { + if (is_nr_UL_slot(mac->scc, slot, mac->phy_config.config_req.cell_config.frame_duplex_type) == 0) { LOG_W(MAC, "Slot %d is not a UL slot. get_ul_config_request() called for wrong slot!!!\n", slot); return NULL; } @@ -1509,7 +1510,7 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s mac->RA_offset = 2; // to compensate the rx frame offset at the gNB mac->generate_nr_prach = 0; // Reset flag for PRACH generation - if (is_nr_UL_slot(scc, slotP)) { + if (is_nr_UL_slot(scc, slotP, mac->phy_config.config_req.cell_config.frame_duplex_type)) { uint8_t selected_gnb_ssb_idx = mac->mib_ssb; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index e15963f355..53bd1eeb47 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -210,7 +210,8 @@ void schedule_nr_prach(module_id_t module_idP, frame_t frameP, sub_frame_t slotP nfapi_nr_ul_tti_request_t *UL_tti_req = &RC.nrmac[module_idP]->UL_tti_req_ahead[0][slotP]; nfapi_nr_config_request_scf_t *cfg = &RC.nrmac[module_idP]->config[0]; - if (is_nr_UL_slot(scc,slotP)) { + if (is_nr_UL_slot(scc, slotP, cc->frame_type)) { + uint8_t config_index = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.prach_ConfigurationIndex; uint8_t mu,N_dur,N_t_slot,start_symbol = 0,N_RA_slot; uint16_t RA_sfn_index = -1; diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index 195c42f387..828749b17b 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -109,7 +109,7 @@ int nr_ue_ul_indication(nr_uplink_indication_t *ul_info){ ret = nr_ue_scheduler(NULL, ul_info); - if (is_nr_UL_slot(mac->scc, ul_info->slot_tx) && get_softmodem_params()->do_ra) + if (is_nr_UL_slot(mac->scc, ul_info->slot_tx, mac->phy_config.config_req.cell_config.frame_duplex_type) && get_softmodem_params()->do_ra) nr_ue_prach_scheduler(module_id, ul_info->frame_tx, ul_info->slot_tx, ul_info->thread_id); switch(ret){ From 682f868c94ad9112878d3796ed700c5b2540ffa1 Mon Sep 17 00:00:00 2001 From: cig Date: Fri, 29 Jan 2021 16:45:20 +0100 Subject: [PATCH 036/231] Reduced output logging in UE RF configuration for unused channels --- openair1/PHY/NR_UE_TRANSPORT/nr_ue_rf_helpers.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ue_rf_helpers.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ue_rf_helpers.c index 7cf64b28bb..76fc5f298f 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ue_rf_helpers.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ue_rf_helpers.c @@ -78,13 +78,15 @@ void nr_rf_card_config(openair0_config_t *openair0_cfg, openair0_cfg->autocal[i] = 1; - LOG_I(PHY, "HW: Configuring channel %d (rf_chain %d): setting tx_gain %f, rx_gain %f, tx_freq %f Hz, rx_freq %f Hz\n", - i, - rf_chain, - openair0_cfg->tx_gain[i], - openair0_cfg->rx_gain[i], - openair0_cfg->tx_freq[i], - openair0_cfg->rx_freq[i]); + if (i < openair0_cfg->rx_num_channels) { + LOG_I(PHY, "HW: Configuring channel %d (rf_chain %d): setting tx_gain %f, rx_gain %f, tx_freq %f Hz, rx_freq %f Hz\n", + i, + rf_chain, + openair0_cfg->tx_gain[i], + openair0_cfg->rx_gain[i], + openair0_cfg->tx_freq[i], + openair0_cfg->rx_freq[i]); + } } } \ No newline at end of file From 2a45e3199b2e0cd01311db72199d4829a06ccc09 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Fri, 5 Feb 2021 13:58:24 +0100 Subject: [PATCH 037/231] CI: adding FDD mode to 5G RF sim test Signed-off-by: Raphael Defosseux --- ci-scripts/reportTestLocally.sh | 2 +- ci-scripts/runTestOnVM.sh | 89 +++++++++++++++++++++------------ 2 files changed, 57 insertions(+), 34 deletions(-) diff --git a/ci-scripts/reportTestLocally.sh b/ci-scripts/reportTestLocally.sh index 8562f4b2de..415ded57a4 100755 --- a/ci-scripts/reportTestLocally.sh +++ b/ci-scripts/reportTestLocally.sh @@ -749,7 +749,7 @@ function report_test { echo " " >> ./test_simulator_results.html EPC_CONFIGS=("noS1") - TRANS_MODES=("tdd") + TRANS_MODES=("fdd" "tdd") BW_CASES=(106) for CN_CONFIG in ${EPC_CONFIGS[@]} do diff --git a/ci-scripts/runTestOnVM.sh b/ci-scripts/runTestOnVM.sh index 70eabb7b69..4fc740235e 100755 --- a/ci-scripts/runTestOnVM.sh +++ b/ci-scripts/runTestOnVM.sh @@ -379,7 +379,7 @@ function check_iperf { local LOC_IS_DL=`echo $LOC_BASE_LOG | grep -c _dl` local LOC_IS_BASIC_SIM=`echo $LOC_BASE_LOG | grep -c basic_sim` local LOC_IS_RF_SIM=`echo $LOC_BASE_LOG | grep -c rf_sim` - local LOC_IS_NR=`echo $LOC_BASE_LOG | grep -c tdd_106prb` + local LOC_IS_NR=`echo $LOC_BASE_LOG | grep -c _106prb` if [ -f ${LOC_BASE_LOG}_client.txt ] then local FILE_COMPLETE=`egrep -c "Server Report" ${LOC_BASE_LOG}_client.txt` @@ -2189,39 +2189,49 @@ function run_test_on_vm { if [[ "$RUN_OPTIONS" == "complex" ]] && [[ $VM_NAME =~ .*-rf-sim.* ]] then - CN_CONFIG="noS1" - CONF_FILE=gnb.band78.tm1.106PRB.usrpn300.conf - S1_NOS1_CFG=0 - PRB=106 - FREQUENCY=3510 - if [ ! -d $ARCHIVES_LOC ] then mkdir --parents $ARCHIVES_LOC fi - local try_cnt=0 - NR_STATUS=0 + CN_CONFIG="noS1" + S1_NOS1_CFG=0 ######### start of RA TEST loop - while [ $try_cnt -lt 5 ] #5 because it hardly succeed within CI + # for the moment only TDD + TRANS_MODES=("tdd") + for TMODE in ${TRANS_MODES[@]} do + if [[ $TMODE =~ .*fdd.* ]] + then + CONF_FILE=gnb.band66.tm1.106PRB.usrpn300.conf + PRB=106 + FREQUENCY=37000 + else + CONF_FILE=gnb.band78.tm1.106PRB.usrpn300.conf + PRB=106 + FREQUENCY=3510 + fi + local try_cnt=0 + NR_STATUS=0 + while [ $try_cnt -lt 1 ] + do SYNC_STATUS=0 RA_STATUS=0 - rm -f $ARCHIVES_LOC/tdd_${PRB}prb_${CN_CONFIG}*ra_test.log + rm -f $ARCHIVES_LOC/${TMODE}_${PRB}prb_${CN_CONFIG}*ra_test.log echo "############################################################" - echo "${CN_CONFIG} : Starting the gNB" + echo "${CN_CONFIG} : Starting the gNB in ${TMODE} mode (RA TEST)" echo "############################################################" - CURRENT_GNB_LOG_FILE=tdd_${PRB}prb_${CN_CONFIG}_gnb_ra_test.log + CURRENT_GNB_LOG_FILE=${TMODE}_${PRB}prb_${CN_CONFIG}_gnb_ra_test.log #last argument = 1 is to enable --do-ra for RA test start_rf_sim_gnb $GNB_VM_CMDS "$GNB_VM_IP_ADDR" $CURRENT_GNB_LOG_FILE $PRB $CONF_FILE $S1_NOS1_CFG 1 echo "############################################################" - echo "${CN_CONFIG} : Starting the NR-UE" + echo "${CN_CONFIG} : Starting the NR-UE in ${TMODE} mode (RA TEST)" echo "############################################################" - CURRENT_NR_UE_LOG_FILE=tdd_${PRB}prb_${CN_CONFIG}_ue_ra_test.log + CURRENT_NR_UE_LOG_FILE=${TMODE}_${PRB}prb_${CN_CONFIG}_ue_ra_test.log #last argument = 1 is to enable --do-ra for RA test start_rf_sim_nr_ue $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR $GNB_VM_IP_ADDR $CURRENT_NR_UE_LOG_FILE $PRB $FREQUENCY $S1_NOS1_CFG 1 if [ $NR_UE_SYNC -eq 0 ] @@ -2260,35 +2270,47 @@ function run_test_on_vm { else try_cnt=$((try_cnt+10)) fi + done done ########### end RA test sleep 30 - ######### start of PHY TEST loop - try_cnt=0 - while [ $try_cnt -lt 4 ] + SYNC_STATUS=0 + PING_STATUS=0 + IPERF_STATUS=0 + TRANS_MODES=("fdd tdd") + for TMODE in ${TRANS_MODES[@]} do + if [[ $TMODE =~ .*fdd.* ]] + then + CONF_FILE=gnb.band66.tm1.106PRB.usrpn300.conf + PRB=106 + FREQUENCY=37000 + else + CONF_FILE=gnb.band78.tm1.106PRB.usrpn300.conf + PRB=106 + FREQUENCY=3510 + fi - - SYNC_STATUS=0 - PING_STATUS=0 - IPERF_STATUS=0 - rm -f $ARCHIVES_LOC/tdd_${PRB}prb_${CN_CONFIG}_gnb.log $ARCHIVES_LOC/tdd_${PRB}prb_${CN_CONFIG}_ue.log - rm -f $ARCHIVES_LOC/tdd_${PRB}prb_${CN_CONFIG}_ping_gnb_from_nrue.log $ARCHIVES_LOC/tdd_${PRB}prb_${CN_CONFIG}_ping_from_gnb_nrue.log - rm -f $ARCHIVES_LOC/tdd_${PRB}prb_${CN_CONFIG}_iperf_dl*txt $ARCHIVES_LOC/tdd_${PRB}prb_${CN_CONFIG}_iperf_ul*txt + try_cnt=0 + while [ $try_cnt -lt 1 ] + do + rm -f $ARCHIVES_LOC/${TMODE}_${PRB}prb_${CN_CONFIG}_gnb.log $ARCHIVES_LOC/${TMODE}_${PRB}prb_${CN_CONFIG}_ue.log + rm -f $ARCHIVES_LOC/${TMODE}_${PRB}prb_${CN_CONFIG}_ping_gnb_from_nrue.log $ARCHIVES_LOC/${TMODE}_${PRB}prb_${CN_CONFIG}_ping_from_gnb_nrue.log + rm -f $ARCHIVES_LOC/${TMODE}_${PRB}prb_${CN_CONFIG}_iperf_dl*txt $ARCHIVES_LOC/${TMODE}_${PRB}prb_${CN_CONFIG}_iperf_ul*txt echo "############################################################" - echo "${CN_CONFIG} : Starting the gNB" + echo "${CN_CONFIG} : Starting the gNB in ${TMODE} mode (PHY TEST)" echo "############################################################" - CURRENT_GNB_LOG_FILE=tdd_${PRB}prb_${CN_CONFIG}_gnb.log + CURRENT_GNB_LOG_FILE=${TMODE}_${PRB}prb_${CN_CONFIG}_gnb.log start_rf_sim_gnb $GNB_VM_CMDS "$GNB_VM_IP_ADDR" $CURRENT_GNB_LOG_FILE $PRB $CONF_FILE $S1_NOS1_CFG 0 echo "############################################################" - echo "${CN_CONFIG} : Starting the NR-UE" + echo "${CN_CONFIG} : Starting the NR-UE in ${TMODE} mode (PHY TEST)" echo "############################################################" - CURRENT_NR_UE_LOG_FILE=tdd_${PRB}prb_${CN_CONFIG}_ue.log + CURRENT_NR_UE_LOG_FILE=${TMODE}_${PRB}prb_${CN_CONFIG}_ue.log start_rf_sim_nr_ue $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR $GNB_VM_IP_ADDR $CURRENT_NR_UE_LOG_FILE $PRB $FREQUENCY $S1_NOS1_CFG 0 if [ $NR_UE_SYNC -eq 0 ] then @@ -2306,7 +2328,7 @@ function run_test_on_vm { echo "${CN_CONFIG} : Pinging the gNB from NR-UE" echo "############################################################" get_enb_noS1_ip_addr $GNB_VM_CMDS $GNB_VM_IP_ADDR - PING_LOG_FILE=tdd_${PRB}prb_${CN_CONFIG}_ping_gnb_from_nrue.log + PING_LOG_FILE=${TMODE}_${PRB}prb_${CN_CONFIG}_ping_gnb_from_nrue.log ping_epc_ip_addr $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR $ENB_IP_ADDR $PING_LOG_FILE 1 0 scp -o StrictHostKeyChecking=no ubuntu@$NR_UE_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20 @@ -2315,7 +2337,7 @@ function run_test_on_vm { echo "${CN_CONFIG} : Pinging the NR-UE from gNB" echo "############################################################" get_ue_ip_addr $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR 1 - PING_LOG_FILE=tdd_${PRB}prb_${CN_CONFIG}_ping_from_gnb_nrue.log + PING_LOG_FILE=${TMODE}_${PRB}prb_${CN_CONFIG}_ping_from_gnb_nrue.log ping_enb_ip_addr $GNB_VM_CMDS $GNB_VM_IP_ADDR $UE_IP_ADDR $PING_LOG_FILE 0 scp -o StrictHostKeyChecking=no ubuntu@$GNB_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20 @@ -2324,7 +2346,7 @@ function run_test_on_vm { echo "${CN_CONFIG} : iperf DL -- NR-UE is server and gNB is client" echo "############################################################" THROUGHPUT="30K" - CURR_IPERF_LOG_BASE=tdd_${PRB}prb_${CN_CONFIG}_iperf_dl + CURR_IPERF_LOG_BASE=${TMODE}_${PRB}prb_${CN_CONFIG}_iperf_dl get_enb_noS1_ip_addr $GNB_VM_CMDS $GNB_VM_IP_ADDR get_ue_ip_addr $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR 1 generic_iperf $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR $UE_IP_ADDR $GNB_VM_CMDS $GNB_VM_IP_ADDR $ENB_IP_ADDR $THROUGHPUT $CURR_IPERF_LOG_BASE 1 0 @@ -2346,7 +2368,7 @@ function run_test_on_vm { echo "${CN_CONFIG} : iperf UL -- gNB is server and NR-UE is client" echo "############################################################" THROUGHPUT="30K" - CURR_IPERF_LOG_BASE=tdd_${PRB}prb_${CN_CONFIG}_iperf_ul + CURR_IPERF_LOG_BASE=${TMODE}_${PRB}prb_${CN_CONFIG}_iperf_ul get_enb_noS1_ip_addr $GNB_VM_CMDS $GNB_VM_IP_ADDR get_ue_ip_addr $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR 1 generic_iperf $GNB_VM_CMDS $GNB_VM_IP_ADDR $ENB_IP_ADDR $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR $UE_IP_ADDR $THROUGHPUT $CURR_IPERF_LOG_BASE 1 0 @@ -2368,6 +2390,7 @@ function run_test_on_vm { else try_cnt=$((try_cnt+10)) fi + done done ######### end of loop full_l2_sim_destroy From f4fd79c4d99901606dc9f4f6f887341dadb34f7f Mon Sep 17 00:00:00 2001 From: Sakthivel Velumani Date: Mon, 8 Feb 2021 01:06:30 +0100 Subject: [PATCH 038/231] First commit Created 3 threadpools for L1 rx, L1 tx and RU tx processing --- executables/nr-gnb.c | 53 +++- executables/nr-ru.c | 280 +++++++++++++++++- openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c | 2 +- openair1/PHY/defs_gNB.h | 8 +- openair1/SCHED_NR/phy_procedures_nr_gNB.c | 4 +- 5 files changed, 331 insertions(+), 16 deletions(-) diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index be9261a117..fbbe5813a9 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -870,7 +870,7 @@ void init_gNB_proc(int inst) { pthread_cond_init(&sync_phy_proc.cond_phy_proc_tx, NULL); sync_phy_proc.phy_proc_CC_id = 0; - gNB->threadPool = (tpool_t*)malloc(sizeof(tpool_t)); + gNB->threadPool_ulsch = (tpool_t*)malloc(sizeof(tpool_t)); gNB->respDecode = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t)); int numCPU = sysconf(_SC_NPROCESSORS_ONLN); uint32_t num_threads_pusch; @@ -884,10 +884,50 @@ void init_gNB_proc(int inst) { sprintf(ul_pool+2+s_offset,",-1"); s_offset += 3; } - initTpool(ul_pool, gNB->threadPool, false); + initTpool(ul_pool, gNB->threadPool_ulsch, false); initNotifiedFIFO(gNB->respDecode); } +void init_gNB_Tpool(int inst) { + PHY_VARS_gNB *gNB; + gNB = RC.gNB[inst]; + + // ULSCH decoding threadpool + gNB->threadPool_ulsch = (tpool_t*)malloc(sizeof(tpool_t)); + gNB->respDecode = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t)); + int numCPU = sysconf(_SC_NPROCESSORS_ONLN); + uint32_t num_threads_pusch; + paramdef_t PUSCHThreads[] = NUM_THREADS_DESC; + config_get( PUSCHThreads,sizeof(PUSCHThreads)/sizeof(paramdef_t),NULL); + int threadCnt = min(numCPU, num_threads_pusch); + char ul_pool[80]; + sprintf(ul_pool,"-1"); + int s_offset = 0; + for (int icpu=1; icputhreadPool_ulsch, false); + initNotifiedFIFO(gNB->respDecode); + + // L1 RX threadpool + gNB->threadPool_L1 = (tpool_t*)malloc(sizeof(tpool_t)); + gNB->resp_L1 = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t)); + initTpool("-1", gNB->threadPool_L1, false); + initNotifiedFIFO(gNB->resp_L1); + + // L1 TX threadpool + gNB->threadPool_L1_tx = (tpool_t*)malloc(sizeof(tpool_t)); + gNB->resp_L1_tx = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t)); + initTpool("-1",gNB->threadPool_L1_tx, false); + initNotifiedFIFO(gNB->resp_L1_tx); + + // RU TX threadpool + gNB->threadPool_RU_tx = (tpool_t*)malloc(sizeof(tpool_t)); + gNB->resp_RU_tx = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t)); + initTpool("-1",gNB->threadPool_RU_tx, false); + initNotifiedFIFO(gNB->resp_RU_tx); +} /*! @@ -1010,15 +1050,10 @@ void init_eNB_afterRU(void) { * (not tested in other modes). */ //init_precoding_weights(RC.gNB[inst]); - init_gNB_proc(inst); + //init_gNB_proc(inst); + init_gNB_Tpool(inst); } - for (ru_id=0; ru_idnr_wakeup_rxtx = wakeup_rxtx; - // RC.ru[ru_id]->wakeup_prach_eNB = wakeup_prach_gNB; - RC.ru[ru_id]->gNB_top = gNB_top; - } } void init_gNB(int single_thread_flag,int wait_for_sync) { diff --git a/executables/nr-ru.c b/executables/nr-ru.c index feff0c29c2..fa5ad3fa6e 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -120,6 +120,20 @@ extern int emulate_rf; extern int numerology; extern int usrp_tx_thread; +typedef struct processingData_L1 { + int frame_rx; + int frame_tx; + int slot_rx; + int slot_tx; + PHY_VARS_gNB *gNB; +} processingData_L1_t; + +typedef struct processingData_RU { + int frame_tx; + int slot_tx; + RU_t *ru; +} processingData_RU_t; + /*************************************************************/ /* Functions to attach and configure RRU */ @@ -1298,6 +1312,63 @@ void *ru_stats_thread(void *param) { return(NULL); } +void ru_tx_func(void *param) { + + processingData_RU_t *info = (processingData_RU_t *) param; + RU_t *ru = info->ru; + NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms; + int frame_tx = info->frame_tx; + int slot_tx = info->slot_tx; + int print_frame = 8; + char filename[40]; + + // do TX front-end processing if needed (precoding and/or IDFTs) + if (ru->feptx_prec) ru->feptx_prec(ru,frame_tx,slot_tx); + + // do OFDM with/without TX front-end processing if needed + if ((ru->fh_north_asynch_in == NULL) && (ru->feptx_ofdm)) ru->feptx_ofdm(ru,frame_tx,slot_tx); + + if(!emulate_rf) { + // do outgoing fronthaul (south) if needed + if ((ru->fh_north_asynch_in == NULL) && (ru->fh_south_out)) ru->fh_south_out(ru,frame_tx,slot_tx,ru->proc.timestamp_tx); + + if (ru->fh_north_out) ru->fh_north_out(ru); + } else { + if(frame_tx == print_frame) { + for (int i=0; inb_tx; i++) { + + if(slot_tx == 0) { + sprintf(filename,"gNBdataF_frame%d_sl%d.m", print_frame, slot_tx); + LOG_M(filename,"txdataF_frame",&ru->gNB_list[0]->common_vars.txdataF[i][0],fp->samples_per_frame_wCP, 1, 1); + + sprintf(filename,"tx%ddataF_frame%d_sl%d.m", i, print_frame, slot_tx); + LOG_M(filename,"txdataF_frame",&ru->common.txdataF[i][0],fp->samples_per_frame_wCP, 1, 1); + + sprintf(filename,"tx%ddataF_BF_frame%d_sl%d.m", i, print_frame, slot_tx); + LOG_M(filename,"txdataF_BF_frame",&ru->common.txdataF_BF[i][0],fp->samples_per_subframe_wCP, 1, 1); + } + + if(slot_tx == 9) { + sprintf(filename,"tx%ddata_frame%d.m", i, print_frame); + LOG_M(filename,"txdata_frame",&ru->common.txdata[i][0],fp->samples_per_frame, 1, 1); + sprintf(filename,"tx%ddata_frame%d.dat", i, print_frame); + FILE *output_fd = fopen(filename,"w"); + + if (output_fd) { + fwrite(&ru->common.txdata[i][0], + sizeof(int32_t), + fp->samples_per_frame, + output_fd); + fclose(output_fd); + } else { + LOG_E(PHY,"Cannot write to file %s\n",filename); + } + }//if(slot_tx == 9) + }//for (i=0; inb_tx; i++) + }//if(frame_tx == print_frame) + }//else emulate_rf +} + void *ru_thread_tx( void *param ) { RU_t *ru = (RU_t *)param; RU_proc_t *proc = &ru->proc; @@ -1430,11 +1501,201 @@ void *ru_thread_tx( void *param ) { return 0; } +void tx_func(void *param) { + + processingData_L1_t *info = (processingData_L1_t *) param; + PHY_VARS_gNB *gNB = info->gNB; + int frame_tx = info->frame_tx; + int slot_tx = info->slot_tx; + + phy_procedures_gNB_TX(gNB, frame_tx,slot_tx, 1); + + // start FH TX processing + notifiedFIFO_elt_t *msg = newNotifiedFIFO_elt(sizeof(processingData_RU_t),0,gNB->resp_RU_tx,ru_tx_func); + processingData_RU_t *syncMsg = (processingData_RU_t *)NotifiedFifoData(msg); + notifiedFIFO_elt_t *res; + syncMsg->frame_tx = frame_tx; + syncMsg->slot_tx = slot_tx; + syncMsg->ru = gNB->RU_list[0]; + + res = tryPullTpool(gNB->resp_RU_tx, gNB->threadPool_RU_tx); + if (res == NULL) { + LOG_W(PHY,"RU TX of previous slot is still being processed. Adding current slot to queue (%d.%d)\n", frame_tx, slot_tx); + } + msg->key = slot_tx; + pushTpool(gNB->threadPool_RU_tx, msg); +} + +void rx_func(void *param) { + + processingData_L1_t *info = (processingData_L1_t *) param; + PHY_VARS_gNB *gNB = info->gNB; + int frame_rx = info->frame_rx; + int slot_rx = info->slot_rx; + int frame_tx = info->frame_tx; + int slot_tx = info->slot_tx; + sl_ahead = sf_ahead*gNB->frame_parms.slots_per_subframe; + nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config; + + //start_meas(&softmodem_stats_rxtx_sf); + + T(T_GNB_PHY_DL_TICK, T_INT(gNB->Mod_id), T_INT(frame_tx), T_INT(slot_tx)); + + /* hack to remove UEs */ + extern int rnti_to_remove[10]; + extern volatile int rnti_to_remove_count; + extern pthread_mutex_t rnti_to_remove_mutex; + if (pthread_mutex_lock(&rnti_to_remove_mutex)) exit(1); + int up_removed = 0; + int down_removed = 0; + int pucch_removed = 0; + for (int i = 0; i < rnti_to_remove_count; i++) { + LOG_W(PHY, "to remove rnti %d\n", rnti_to_remove[i]); + void clean_gNB_ulsch(NR_gNB_ULSCH_t *ulsch); + void clean_gNB_dlsch(NR_gNB_DLSCH_t *dlsch); + int j; + for (j = 0; j < NUMBER_OF_NR_ULSCH_MAX; j++) + if (gNB->ulsch[j][0]->rnti == rnti_to_remove[i]) { + gNB->ulsch[j][0]->rnti = 0; + gNB->ulsch[j][0]->harq_mask = 0; + //clean_gNB_ulsch(gNB->ulsch[j][0]); + int h; + for (h = 0; h < NR_MAX_ULSCH_HARQ_PROCESSES; h++) { + gNB->ulsch[j][0]->harq_processes[h]->status = SCH_IDLE; + gNB->ulsch[j][0]->harq_processes[h]->round = 0; + gNB->ulsch[j][0]->harq_processes[h]->handled = 0; + } + up_removed++; + } + for (j = 0; j < NUMBER_OF_NR_DLSCH_MAX; j++) + if (gNB->dlsch[j][0]->rnti == rnti_to_remove[i]) { + gNB->dlsch[j][0]->rnti = 0; + gNB->dlsch[j][0]->harq_mask = 0; + //clean_gNB_dlsch(gNB->dlsch[j][0]); + down_removed++; + } + for (j = 0; j < NUMBER_OF_NR_PUCCH_MAX; j++) + if (gNB->pucch[j]->active > 0 && + gNB->pucch[j]->pucch_pdu.rnti == rnti_to_remove[i]) { + gNB->pucch[j]->active = 0; + gNB->pucch[j]->pucch_pdu.rnti = 0; + pucch_removed++; + } +#if 0 + for (j = 0; j < NUMBER_OF_NR_PDCCH_MAX; j++) + gNB->pdcch_pdu[j].frame = -1; + for (j = 0; j < NUMBER_OF_NR_PDCCH_MAX; j++) + gNB->ul_pdcch_pdu[j].frame = -1; + for (j = 0; j < NUMBER_OF_NR_PRACH_MAX; j++) + gNB->prach_vars.list[j].frame = -1; +#endif + } + if (rnti_to_remove_count) LOG_W(PHY, "to remove rnti_to_remove_count=%d, up_removed=%d down_removed=%d pucch_removed=%d\n", rnti_to_remove_count, up_removed, down_removed, pucch_removed); + rnti_to_remove_count = 0; + if (pthread_mutex_unlock(&rnti_to_remove_mutex)) exit(1); + + // Call the scheduler + + pthread_mutex_lock(&gNB->UL_INFO_mutex); + gNB->UL_INFO.frame = frame_rx; + gNB->UL_INFO.slot = slot_rx; + gNB->UL_INFO.module_id = gNB->Mod_id; + gNB->UL_INFO.CC_id = gNB->CC_id; + gNB->if_inst->NR_UL_indication(&gNB->UL_INFO); + pthread_mutex_unlock(&gNB->UL_INFO_mutex); + + // RX processing + int tx_slot_type = nr_slot_select(cfg,frame_tx,slot_tx); + int rx_slot_type = nr_slot_select(cfg,frame_rx,slot_rx); + + if (rx_slot_type == NR_UPLINK_SLOT || rx_slot_type == NR_MIXED_SLOT) { + // UE-specific RX processing for subframe n + // TODO: check if this is correct for PARALLEL_RU_L1_TRX_SPLIT + + // Do PRACH RU processing + L1_nr_prach_procedures(gNB,frame_rx,slot_rx); + + //apply the rx signal rotation here + apply_nr_rotation_ul(&gNB->frame_parms, + gNB->common_vars.rxdataF[0], + slot_rx, + 0, + gNB->frame_parms.Ncp==EXTENDED?12:14, + gNB->frame_parms.ofdm_symbol_size); + + phy_procedures_gNB_uespec_RX(gNB, frame_rx, slot_rx); + } + + if (oai_exit) return(-1); + + //stop_meas( &softmodem_stats_rxtx_sf ); + LOG_D(PHY,"%s() Exit proc[rx:%d%d tx:%d%d]\n", __FUNCTION__, frame_rx, slot_rx, frame_tx, slot_tx); + + notifiedFIFO_elt_t *msg = newNotifiedFIFO_elt(sizeof(processingData_L1_t),0,gNB->resp_L1_tx,tx_func); + processingData_L1_t *syncMsg = (processingData_L1_t *)NotifiedFifoData(msg); + notifiedFIFO_elt_t *res; + syncMsg->gNB = gNB; + syncMsg->frame_rx = frame_rx; + syncMsg->slot_rx = slot_rx; + syncMsg->frame_tx = frame_tx; + syncMsg->slot_tx = slot_tx; + + if (tx_slot_type == NR_DOWNLINK_SLOT || tx_slot_type == NR_MIXED_SLOT) { + res = tryPullTpool(gNB->resp_L1_tx, gNB->threadPool_L1_tx); + if (res == NULL) { + LOG_W(PHY,"L1 TX of previous slot is still being processed. Adding current slot to queue (%d.%d)\n", frame_tx, slot_tx); + } + msg->key = slot_tx; + pushTpool(gNB->threadPool_L1_tx, msg); + } + +#if 0 + LOG_D(PHY, "rxtx:%lld nfapi:%lld phy:%lld tx:%lld rx:%lld prach:%lld ofdm:%lld ", + softmodem_stats_rxtx_sf.diff_now, nfapi_meas.diff_now, + TICK_TO_US(gNB->phy_proc), + TICK_TO_US(gNB->phy_proc_tx), + TICK_TO_US(gNB->phy_proc_rx), + TICK_TO_US(gNB->rx_prach), + TICK_TO_US(gNB->ofdm_mod_stats), + softmodem_stats_rxtx_sf.diff_now, nfapi_meas.diff_now); + LOG_D(PHY, + "dlsch[enc:%lld mod:%lld scr:%lld rm:%lld t:%lld i:%lld] rx_dft:%lld ", + TICK_TO_US(gNB->dlsch_encoding_stats), + TICK_TO_US(gNB->dlsch_modulation_stats), + TICK_TO_US(gNB->dlsch_scrambling_stats), + TICK_TO_US(gNB->dlsch_rate_matching_stats), + TICK_TO_US(gNB->dlsch_turbo_encoding_stats), + TICK_TO_US(gNB->dlsch_interleaving_stats), + TICK_TO_US(gNB->rx_dft_stats)); + LOG_D(PHY," ulsch[ch:%lld freq:%lld dec:%lld demod:%lld ru:%lld ", + TICK_TO_US(gNB->ulsch_channel_estimation_stats), + TICK_TO_US(gNB->ulsch_freq_offset_estimation_stats), + TICK_TO_US(gNB->ulsch_decoding_stats), + TICK_TO_US(gNB->ulsch_demodulation_stats), + TICK_TO_US(gNB->ulsch_rate_unmatching_stats)); + LOG_D(PHY, "td:%lld dei:%lld dem:%lld llr:%lld tci:%lld ", + TICK_TO_US(gNB->ulsch_turbo_decoding_stats), + TICK_TO_US(gNB->ulsch_deinterleaving_stats), + TICK_TO_US(gNB->ulsch_demultiplexing_stats), + TICK_TO_US(gNB->ulsch_llr_stats), + TICK_TO_US(gNB->ulsch_tc_init_stats)); + LOG_D(PHY, "tca:%lld tcb:%lld tcg:%lld tce:%lld l1:%lld l2:%lld]\n\n", + TICK_TO_US(gNB->ulsch_tc_alpha_stats), + TICK_TO_US(gNB->ulsch_tc_beta_stats), + TICK_TO_US(gNB->ulsch_tc_gamma_stats), + TICK_TO_US(gNB->ulsch_tc_ext_stats), + TICK_TO_US(gNB->ulsch_tc_intl1_stats), + TICK_TO_US(gNB->ulsch_tc_intl2_stats) + ); +#endif +} + void *ru_thread( void *param ) { static int ru_thread_status; RU_t *ru = (RU_t *)param; RU_proc_t *proc = &ru->proc; NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms; + PHY_VARS_gNB *gNB = RC.gNB[0]; int ret; int slot = fp->slots_per_frame-1; int frame = 1023; @@ -1500,6 +1761,10 @@ void *ru_thread( void *param ) { pthread_mutex_unlock(&RC.ru_mutex); wait_sync("ru_thread"); + notifiedFIFO_elt_t *msg = newNotifiedFIFO_elt(sizeof(processingData_L1_t),0,gNB->resp_L1,rx_func); + processingData_L1_t *syncMsg = (processingData_L1_t *)NotifiedFifoData(msg); + notifiedFIFO_elt_t *res; + if(!emulate_rf) { // Start RF device if any if (ru->start_rf) { @@ -1580,7 +1845,6 @@ void *ru_thread( void *param ) { int slot_type = nr_slot_select(cfg,proc->frame_rx,proc->tti_rx); if (slot_type == NR_UPLINK_SLOT || slot_type == NR_MIXED_SLOT) { - //if (proc->tti_rx==8) { if (ru->feprx) { ru->feprx(ru,proc->tti_rx); @@ -1630,9 +1894,19 @@ void *ru_thread( void *param ) { } // At this point, all information for subframe has been received on FH interface + syncMsg->gNB = gNB; + syncMsg->frame_rx = proc->frame_rx; + syncMsg->slot_rx = proc->tti_rx; + syncMsg->frame_tx = proc->frame_tx; + syncMsg->slot_tx = proc->tti_tx; - // wakeup all gNB processes waiting for this RU - if (ru->num_gNB>0) wakeup_gNB_L1s(ru); + // check if previous L1 slot processing is finished + res = tryPullTpool(gNB->resp_L1, gNB->threadPool_L1); + if (res == NULL) { + LOG_W(PHY,"L1 RX of previous slot is still being processed. Adding current slot to queue (%d.%d)\n", proc->frame_rx, proc->tti_rx); + } + msg->key = proc->tti_rx; + pushTpool(gNB->threadPool_L1, msg); if(get_thread_parallel_conf() == PARALLEL_SINGLE_THREAD || ru->num_gNB==0) { // do TX front-end processing if needed (precoding and/or IDFTs) diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c index d990176d79..b9cf21c04c 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c @@ -640,7 +640,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, rdata->offset = offset; rdata->ulsch = ulsch; rdata->ulsch_id = UE_id; - pushTpool(phy_vars_gNB->threadPool,req); + pushTpool(phy_vars_gNB->threadPool_ulsch,req); phy_vars_gNB->nbDecode++; LOG_D(PHY,"Added a block to decode, in pipe: %d\n",phy_vars_gNB->nbDecode); r_offset += E; diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index 7b33b2040f..ed9c992173 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -832,7 +832,13 @@ typedef struct PHY_VARS_gNB_s { time_stats_t ulsch_freq_offset_estimation_stats; */ notifiedFIFO_t *respDecode; - tpool_t *threadPool; + notifiedFIFO_t *resp_L1; + notifiedFIFO_t *resp_L1_tx; + notifiedFIFO_t *resp_RU_tx; + tpool_t *threadPool_ulsch; + tpool_t *threadPool_L1; + tpool_t *threadPool_L1_tx; + tpool_t *threadPool_RU_tx; int nbDecode; } PHY_VARS_gNB; diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index 6b5c1a9b22..ea8b0370f9 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -243,7 +243,7 @@ void nr_postDecode(PHY_VARS_gNB *gNB, notifiedFIFO_elt_t *req) { } else { if ( rdata->nbSegments != ulsch_harq->processedSegments ) { - int nb=abortTpool(gNB->threadPool, req->key); + int nb=abortTpool(gNB->threadPool_ulsch, req->key); nb+=abortNotifiedFIFO(gNB->respDecode, req->key); gNB->nbDecode-=nb; LOG_D(PHY,"uplink segment error %d/%d, aborted %d segments\n",rdata->segment_r,rdata->nbSegments, nb); @@ -353,7 +353,7 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH G); while (gNB->nbDecode > 0) { - notifiedFIFO_elt_t *req=pullTpool(gNB->respDecode, gNB->threadPool); + notifiedFIFO_elt_t *req=pullTpool(gNB->respDecode, gNB->threadPool_ulsch); nr_postDecode(gNB, req); delNotifiedFIFO_elt(req); } From 3eb2b4d7b2fc246516a851d0554837bf9c521b6e Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Thu, 4 Feb 2021 14:50:55 +0100 Subject: [PATCH 039/231] Generalize some frame parameter calculations Enabling more numerology combinations and 100 MHz support with 3/4 sampling for USRP X300/X310, too. --- executables/nr-ru.c | 276 +++++++++++++++++++++------------ executables/nr-softmodem.c | 90 ----------- executables/nr-ue.c | 37 ----- executables/nr-uesoftmodem.c | 92 +---------- openair1/PHY/INIT/nr_init_ue.c | 34 ++-- openair1/PHY/INIT/nr_parms.c | 120 ++------------ 6 files changed, 211 insertions(+), 438 deletions(-) diff --git a/executables/nr-ru.c b/executables/nr-ru.c index 7d4e3607df..3ef5b3d157 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -1049,58 +1049,21 @@ void fill_rf_config(RU_t *ru, char *rf_config_file) { int mu = config->ssb_config.scs_common.value; int N_RB = config->carrier_config.dl_grid_size[config->ssb_config.scs_common.value].value; - if (mu == NR_MU_0) { //or if LTE - if(N_RB == 100) { - if (fp->threequarter_fs) { - cfg->sample_rate=23.04e6; - cfg->samples_per_frame = 230400; - cfg->tx_bw = 10e6; - cfg->rx_bw = 10e6; - } else { - cfg->sample_rate=30.72e6; - cfg->samples_per_frame = 307200; - cfg->tx_bw = 10e6; - cfg->rx_bw = 10e6; - } - } else if(N_RB == 50) { - cfg->sample_rate=15.36e6; - cfg->samples_per_frame = 153600; - cfg->tx_bw = 5e6; - cfg->rx_bw = 5e6; - } else if (N_RB == 25) { - cfg->sample_rate=7.68e6; - cfg->samples_per_frame = 76800; - cfg->tx_bw = 2.5e6; - cfg->rx_bw = 2.5e6; - } else if (N_RB == 6) { - cfg->sample_rate=1.92e6; - cfg->samples_per_frame = 19200; - cfg->tx_bw = 1.5e6; - cfg->rx_bw = 1.5e6; - } else AssertFatal(1==0,"Unknown N_RB %d\n",N_RB); - } else if (mu == NR_MU_1) { - if(N_RB == 273) { - if (fp->threequarter_fs) { - AssertFatal(0 == 1,"three quarter sampling not supported for N_RB 273\n"); - } else { - cfg->sample_rate=122.88e6; - cfg->samples_per_frame = 1228800; - cfg->tx_bw = 100e6; - cfg->rx_bw = 100e6; - } - } else if(N_RB == 217) { + if (mu == NR_MU_0) { + switch(N_RB) { + case 270: if (fp->threequarter_fs) { cfg->sample_rate=92.16e6; cfg->samples_per_frame = 921600; - cfg->tx_bw = 80e6; - cfg->rx_bw = 80e6; + cfg->tx_bw = 50e6; + cfg->rx_bw = 50e6; } else { - cfg->sample_rate=122.88e6; - cfg->samples_per_frame = 1228800; - cfg->tx_bw = 80e6; - cfg->rx_bw = 80e6; + cfg->sample_rate=61.44e6; + cfg->samples_per_frame = 614400; + cfg->tx_bw = 50e6; + cfg->rx_bw = 50e6; } - } else if(N_RB == 106) { + case 216: if (fp->threequarter_fs) { cfg->sample_rate=46.08e6; cfg->samples_per_frame = 460800; @@ -1113,29 +1076,154 @@ void fill_rf_config(RU_t *ru, char *rf_config_file) { cfg->tx_bw = 40e6; cfg->rx_bw = 40e6; } - } else if(N_RB == 24) { + break; + case 106: if (fp->threequarter_fs) { - AssertFatal(0 == 1,"three quarter sampling not supported for N_RB 24\n"); - } else { + cfg->sample_rate=23.04e6; + cfg->samples_per_frame = 230400; + cfg->tx_bw = 20e6; + cfg->rx_bw = 20e6; + } + else { + cfg->sample_rate=30.72e6; + cfg->samples_per_frame = 307200; + cfg->tx_bw = 20e6; + cfg->rx_bw = 20e6; + } + break; + case 52: + if (fp->threequarter_fs) { + cfg->sample_rate=11.52e6; + cfg->samples_per_frame = 115200; + cfg->tx_bw = 10e6; + cfg->rx_bw = 10e6; + } + else { cfg->sample_rate=15.36e6; cfg->samples_per_frame = 153600; cfg->tx_bw = 10e6; cfg->rx_bw = 10e6; } - } else { + case 25: + if (fp->threequarter_fs) { + cfg->sample_rate=5.76e6; + cfg->samples_per_frame = 57600; + cfg->tx_bw = 5e6; + cfg->rx_bw = 5e6; + } + else { + cfg->sample_rate=7.68e6; + cfg->samples_per_frame = 76800; + cfg->tx_bw = 5e6; + cfg->rx_bw = 5e6; + } + break; + default: + AssertFatal(0==1,"N_RB %d not yet supported for numerology %d\n",N_RB,mu); + } + } else if (mu == NR_MU_1) { + switch(N_RB) { + case 273: + if (fp->threequarter_fs) { + cfg->sample_rate=184.32e6; + cfg->samples_per_frame = 1843200; + cfg->tx_bw = 100e6; + cfg->rx_bw = 100e6; + } else { + cfg->sample_rate=122.88e6; + cfg->samples_per_frame = 1228800; + cfg->tx_bw = 100e6; + cfg->rx_bw = 100e6; + } + break; + case 217: + if (fp->threequarter_fs) { + cfg->sample_rate=92.16e6; + cfg->samples_per_frame = 921600; + cfg->tx_bw = 80e6; + cfg->rx_bw = 80e6; + } else { + cfg->sample_rate=122.88e6; + cfg->samples_per_frame = 1228800; + cfg->tx_bw = 80e6; + cfg->rx_bw = 80e6; + } + break; + case 106: + if (fp->threequarter_fs) { + cfg->sample_rate=46.08e6; + cfg->samples_per_frame = 460800; + cfg->tx_bw = 40e6; + cfg->rx_bw = 40e6; + } + else { + cfg->sample_rate=61.44e6; + cfg->samples_per_frame = 614400; + cfg->tx_bw = 40e6; + cfg->rx_bw = 40e6; + } + break; + case 51: + if (fp->threequarter_fs) { + cfg->sample_rate=23.04e6; + cfg->samples_per_frame = 230400; + cfg->tx_bw = 20e6; + cfg->rx_bw = 20e6; + } + else { + cfg->sample_rate=30.72e6; + cfg->samples_per_frame = 307200; + cfg->tx_bw = 20e6; + cfg->rx_bw = 20e6; + } + break; + case 24: + if (fp->threequarter_fs) { + cfg->sample_rate=11.52e6; + cfg->samples_per_frame = 115200; + cfg->tx_bw = 10e6; + cfg->rx_bw = 10e6; + } + else { + cfg->sample_rate=15.36e6; + cfg->samples_per_frame = 153600; + cfg->tx_bw = 10e6; + cfg->rx_bw = 10e6; + } + break; + default: AssertFatal(0==1,"N_RB %d not yet supported for numerology %d\n",N_RB,mu); } } else if (mu == NR_MU_3) { - if (N_RB == 66) { - cfg->sample_rate = 122.88e6; - cfg->samples_per_frame = 1228800; - cfg->tx_bw = 100e6; - cfg->rx_bw = 100e6; - } else if(N_RB == 32) { - cfg->sample_rate=61.44e6; - cfg->samples_per_frame = 614400; - cfg->tx_bw = 50e6; - cfg->rx_bw = 50e6; + switch(N_RB) { + case 66: + if (fp->threequarter_fs) { + cfg->sample_rate=184.32e6; + cfg->samples_per_frame = 1843200; + cfg->tx_bw = 100e6; + cfg->rx_bw = 100e6; + } else { + cfg->sample_rate = 122.88e6; + cfg->samples_per_frame = 1228800; + cfg->tx_bw = 100e6; + cfg->rx_bw = 100e6; + } + break; + case 32: + if (fp->threequarter_fs) { + cfg->sample_rate=92.16e6; + cfg->samples_per_frame = 921600; + cfg->tx_bw = 50e6; + cfg->rx_bw = 50e6; + } else { + cfg->sample_rate=61.44e6; + cfg->samples_per_frame = 614400; + cfg->tx_bw = 50e6; + cfg->rx_bw = 50e6; + } + break; + default: + AssertFatal(0==1,"N_RB %d not yet supported for numerology %d\n",N_RB,mu); } } else { AssertFatal(0 == 1,"Numerology %d not supported for the moment\n",mu); @@ -1182,60 +1270,52 @@ int setup_RU_buffers(RU_t *ru) { int i,j; int card,ant; //uint16_t N_TA_offset = 0; - NR_DL_FRAME_PARMS *frame_parms; + NR_DL_FRAME_PARMS *fp; nfapi_nr_config_request_scf_t *config = &ru->config; if (ru) { - frame_parms = ru->nr_frame_parms; - printf("setup_RU_buffers: frame_parms = %p\n",frame_parms); + fp = ru->nr_frame_parms; + printf("setup_RU_buffers: frame_parms = %p\n",fp); } else { printf("ru pointer is NULL\n"); return(-1); } + int mu = config->ssb_config.scs_common.value; int N_RB = config->carrier_config.dl_grid_size[config->ssb_config.scs_common.value].value; - if (config->cell_config.frame_duplex_type.value == TDD) { int N_TA_offset = config->carrier_config.uplink_frequency.value < 6000000 ? 400 : 431; // reference samples for 25600Tc @ 30.72 Ms/s for FR1, same @ 61.44 Ms/s for FR2 double factor=1; - switch (mu) { - case 0: //15 kHz scs - AssertFatal(N_TA_offset == 400,"scs_common 15kHz only for FR1\n"); - if (N_RB <= 25) factor = .25; // 7.68 Ms/s - else if (N_RB <=50) factor = .5; // 15.36 Ms/s - else if (N_RB <=75) factor = 1.0; // 30.72 Ms/s - else if (N_RB <=100) factor = 1.0; // 30.72 Ms/s - else AssertFatal(1==0,"Too many PRBS for mu=0\n"); - break; - case 1: //30 kHz sc - AssertFatal(N_TA_offset == 400,"scs_common 30kHz only for FR1\n"); - if (N_RB <= 106) factor = 2.0; // 61.44 Ms/s - else if (N_RB <= 275) factor = 4.0; // 122.88 Ms/s - break; - case 2: //60 kHz scs - AssertFatal(1==0,"scs_common should not be 60 kHz\n"); - break; - case 3: //120 kHz scs - AssertFatal(N_TA_offset == 431,"scs_common 120kHz only for FR2\n"); - break; - case 4: //240 kHz scs - AssertFatal(1==0,"scs_common should not be 60 kHz\n"); - if (N_RB <= 32) factor = 1.0; // 61.44 Ms/s - else if (N_RB <= 66) factor = 2.0; // 122.88 Ms/s - else AssertFatal(1==0,"N_RB %d is too big for curretn FR2 implementation\n",N_RB); - break; - - if (N_RB == 100) ru->N_TA_offset = 624; - else if (N_RB == 50) ru->N_TA_offset = 624/2; - else if (N_RB == 25) ru->N_TA_offset = 624/4; + case 0: //15 kHz scs + AssertFatal(N_TA_offset == 400, "scs_common 15kHz only for FR1\n"); + factor = fp->samples_per_subframe / 30720.0; + break; + case 1: //30 kHz sc + AssertFatal(N_TA_offset == 400, "scs_common 30kHz only for FR1\n"); + factor = fp->samples_per_subframe / 30720.0; + break; + case 2: //60 kHz scs + AssertFatal(1==0, "scs_common should not be 60 kHz\n"); + break; + case 3: //120 kHz scs + AssertFatal(N_TA_offset == 431, "scs_common 120kHz only for FR2\n"); + factor = fp->samples_per_subframe / 61440.0; + break; + case 4: //240 kHz scs + AssertFatal(N_TA_offset == 431, "scs_common 240kHz only for FR2\n"); + factor = fp->samples_per_subframe / 61440.0; + break; + default: + AssertFatal(1==0, "Invalid scs_common!\n"); } - if (frame_parms->threequarter_fs == 1) factor = factor*.75; + ru->N_TA_offset = (int)(N_TA_offset * factor); - LOG_I(PHY,"RU %d Setting N_TA_offset to %d samples (factor %f, UL Freq %d, N_RB %d)\n",ru->idx,ru->N_TA_offset,factor, - config->carrier_config.uplink_frequency.value, N_RB); + + LOG_I(PHY,"RU %d Setting N_TA_offset to %d samples (factor %f, UL Freq %d, N_RB %d, mu %d)\n",ru->idx,ru->N_TA_offset,factor, + config->carrier_config.uplink_frequency.value, N_RB, mu); } else ru->N_TA_offset = 0; diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index d986e98267..4e4aa50661 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -135,9 +135,6 @@ double rx_gain[MAX_NUM_CCs][4] = {{110,0,0,0},{20,0,0,0}}; double rx_gain_off = 0.0; -double sample_rate=30.72e6; -double bw = 10.0e6; - static int tx_max_power[MAX_NUM_CCs]; /* = {0,0}*/; @@ -475,93 +472,6 @@ void set_default_frame_parms(nfapi_nr_config_request_scf_t *config[MAX_NUM_CCs], } } -/* -void init_openair0(void) { - - int card; - int i; - - for (card=0; cardrf_config.dl_carrier_bandwidth.value == 100) { - if (frame_parms[0]->threequarter_fs) { - openair0_cfg[card].sample_rate=23.04e6; - openair0_cfg[card].samples_per_frame = 230400; - openair0_cfg[card].tx_bw = 10e6; - openair0_cfg[card].rx_bw = 10e6; - } else { - openair0_cfg[card].sample_rate=30.72e6; - openair0_cfg[card].samples_per_frame = 307200; - openair0_cfg[card].tx_bw = 10e6; - openair0_cfg[card].rx_bw = 10e6; - } - } else if(config[0]->rf_config.dl_carrier_bandwidth.value == 50) { - openair0_cfg[card].sample_rate=15.36e6; - openair0_cfg[card].samples_per_frame = 153600; - openair0_cfg[card].tx_bw = 5e6; - openair0_cfg[card].rx_bw = 5e6; - } else if (config[0]->rf_config.dl_carrier_bandwidth.value == 25) { - openair0_cfg[card].sample_rate=7.68e6; - openair0_cfg[card].samples_per_frame = 76800; - openair0_cfg[card].tx_bw = 2.5e6; - openair0_cfg[card].rx_bw = 2.5e6; - } else if (config[0]->rf_config.dl_carrier_bandwidth.value == 6) { - openair0_cfg[card].sample_rate=1.92e6; - openair0_cfg[card].samples_per_frame = 19200; - openair0_cfg[card].tx_bw = 1.5e6; - openair0_cfg[card].rx_bw = 1.5e6; - } - - - if (config[0]->subframe_config.duplex_mode.value==TDD) - openair0_cfg[card].duplex_mode = duplex_mode_TDD; - else //FDD - openair0_cfg[card].duplex_mode = duplex_mode_FDD; - - printf("HW: Configuring card %d, nb_antennas_tx/rx %d/%d\n",card, - RC.gNB[0]->gNB_config.rf_config.tx_antenna_ports.value, - RC.gNB[0]->gNB_config.rf_config.tx_antenna_ports.value ); - openair0_cfg[card].Mod_id = 0; - - openair0_cfg[card].num_rb_dl=config[0]->rf_config.dl_carrier_bandwidth.value; - - openair0_cfg[card].clock_source = clock_source; - - - openair0_cfg[card].tx_num_channels=min(2,RC.gNB[0]->gNB_config.rf_config.tx_antenna_ports.value ); - openair0_cfg[card].rx_num_channels=min(2,RC.gNB[0]->gNB_config.rf_config.tx_antenna_ports.value ); - - for (i=0; i<4; i++) { - - if (irx_total_gain_dB; - - - openair0_cfg[card].configFilename = get_softmodem_params()->rf_config_file; - printf("Card %d, channel %d, Setting tx_gain %f, rx_gain %f, tx_freq %f, rx_freq %f\n", - card,i, openair0_cfg[card].tx_gain[i], - openair0_cfg[card].rx_gain[i], - openair0_cfg[card].tx_freq[i], - openair0_cfg[card].rx_freq[i]); - } - } // for loop on cards -} -*/ - void wait_RUs(void) { LOG_I(PHY,"Waiting for RUs to be configured ... RC.ru_mask:%02lx\n", RC.ru_mask); // wait for all RUs to be configured over fronthaul diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 6833f2fed3..fcea62ee53 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -237,43 +237,6 @@ static void UE_synch(void *arg) { openair0_cfg[UE->rf_map.card].rx_freq[0], openair0_cfg[UE->rf_map.card].tx_freq[0]); - // reconfigure for potentially different bandwidth - switch(UE->frame_parms.N_RB_DL) { - case 6: - openair0_cfg[UE->rf_map.card].sample_rate =1.92e6; - openair0_cfg[UE->rf_map.card].rx_bw =.96e6; - openair0_cfg[UE->rf_map.card].tx_bw =.96e6; - // openair0_cfg[0].rx_gain[0] -= 12; - break; - - case 25: - openair0_cfg[UE->rf_map.card].sample_rate =7.68e6; - openair0_cfg[UE->rf_map.card].rx_bw =2.5e6; - openair0_cfg[UE->rf_map.card].tx_bw =2.5e6; - // openair0_cfg[0].rx_gain[0] -= 6; - break; - - case 50: - openair0_cfg[UE->rf_map.card].sample_rate =15.36e6; - openair0_cfg[UE->rf_map.card].rx_bw =5.0e6; - openair0_cfg[UE->rf_map.card].tx_bw =5.0e6; - // openair0_cfg[0].rx_gain[0] -= 3; - break; - - case 100: - openair0_cfg[UE->rf_map.card].sample_rate=30.72e6; - openair0_cfg[UE->rf_map.card].rx_bw=10.0e6; - openair0_cfg[UE->rf_map.card].tx_bw=10.0e6; - // openair0_cfg[0].rx_gain[0] -= 0; - break; - - case 66: - openair0_cfg[UE->rf_map.card].sample_rate=122.88e6; - openair0_cfg[UE->rf_map.card].rx_bw=100.e6; - openair0_cfg[UE->rf_map.card].tx_bw=100.e6; - break; - } - if (UE->mode != loop_through_memory) { UE->rfdevice.trx_set_freq_func(&UE->rfdevice,&openair0_cfg[0],0); //UE->rfdevice.trx_set_gains_func(&openair0,&openair0_cfg[0]); diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 4f445f394d..7624506011 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -145,7 +145,6 @@ int chain_offset = 0; int card_offset = 0; uint64_t num_missed_slots = 0; // counter for the number of missed slots int transmission_mode = 1; -int numerology = 0; int usrp_tx_thread = 0; int oaisim_flag = 0; int emulate_rf = 0; @@ -316,90 +315,10 @@ void init_openair0(void) { for (card=0; cardthreequarter_fs; - numerology = frame_parms->numerology_index; - if(frame_parms->N_RB_DL == 24) { - if (numerology==1) { - openair0_cfg[card].sample_rate=15.36e6; - openair0_cfg[card].samples_per_frame = 153600; - } else { - LOG_E(PHY,"Unsupported numerology!\n"); - exit(-1); - } - }else if(frame_parms->N_RB_DL == 66) { - if (numerology==3) { - openair0_cfg[card].sample_rate=122.88e6; - openair0_cfg[card].samples_per_frame = 1228800; - } else { - LOG_E(PHY,"Unsupported numerology! FR2 supports only 120KHz SCS for now.\n"); - exit(-1); - } - }else if(frame_parms->N_RB_DL == 32) { - if (numerology==3) { - openair0_cfg[card].sample_rate=61.44e6; - openair0_cfg[card].samples_per_frame = 614400; - } else { - LOG_E(PHY,"Unsupported numerology! FR2 supports only 120KHz SCS for now.\n"); - exit(-1); - } - }else if(frame_parms->N_RB_DL == 217) { - if (numerology==1) { - if (frame_parms->threequarter_fs) { - openair0_cfg[card].sample_rate=92.16e6; - openair0_cfg[card].samples_per_frame = 921600; - } - else { - openair0_cfg[card].sample_rate=122.88e6; - openair0_cfg[card].samples_per_frame = 1228800; - } - } else { - LOG_E(PHY,"Unsupported numerology!\n"); - exit(-1); - } - } else if(frame_parms->N_RB_DL == 273) { - if (numerology==1) { - if (frame_parms->threequarter_fs) { - AssertFatal(0 == 1,"three quarter sampling not supported for N_RB 273\n"); - } - else { - openair0_cfg[card].sample_rate=122.88e6; - openair0_cfg[card].samples_per_frame = 1228800; - } - } else { - LOG_E(PHY,"Unsupported numerology!\n"); - exit(-1); - } - } else if(frame_parms->N_RB_DL == 106) { - if (numerology==0) { - if (frame_parms->threequarter_fs) { - openair0_cfg[card].sample_rate=23.04e6; - openair0_cfg[card].samples_per_frame = 230400; - } else { - openair0_cfg[card].sample_rate=30.72e6; - openair0_cfg[card].samples_per_frame = 307200; - } - } else if (numerology==1) { - if (frame_parms->threequarter_fs) { - openair0_cfg[card].sample_rate=46.08e6; - openair0_cfg[card].samples_per_frame = 460800; - } - else { - openair0_cfg[card].sample_rate=61.44e6; - openair0_cfg[card].samples_per_frame = 614400; - } - } else if (numerology==2) { - openair0_cfg[card].sample_rate=122.88e6; - openair0_cfg[card].samples_per_frame = 1228800; - } else { - LOG_E(PHY,"Unsupported numerology!\n"); - exit(-1); - } - } - else { - LOG_E(PHY,"Unknown NB_RB %d!\n",frame_parms->N_RB_DL); - exit(-1); - } + openair0_cfg[card].configFilename = NULL; + openair0_cfg[card].threequarter_fs = frame_parms->threequarter_fs; + openair0_cfg[card].sample_rate = frame_parms->samples_per_subframe * 1e3; + openair0_cfg[card].samples_per_frame = frame_parms->samples_per_frame; if (frame_parms->frame_type==TDD) openair0_cfg[card].duplex_mode = duplex_mode_TDD; @@ -413,8 +332,9 @@ void init_openair0(void) { openair0_cfg[card].tx_num_channels = min(2, frame_parms->nb_antennas_tx); openair0_cfg[card].rx_num_channels = min(2, frame_parms->nb_antennas_rx); - LOG_I(PHY, "HW: Configuring card %d, tx/rx num_channels %d/%d, duplex_mode %s\n", + LOG_I(PHY, "HW: Configuring card %d, sample_rate %f, tx/rx num_channels %d/%d, duplex_mode %s\n", card, + openair0_cfg[card].sample_rate, openair0_cfg[card].tx_num_channels, openair0_cfg[card].rx_num_channels, duplex_mode[openair0_cfg[card].duplex_mode]); diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c index 8bcc58160f..3132fb9960 100644 --- a/openair1/PHY/INIT/nr_init_ue.c +++ b/openair1/PHY/INIT/nr_init_ue.c @@ -507,50 +507,36 @@ void init_N_TA_offset(PHY_VARS_NR_UE *ue){ if (fp->frame_type == FDD) { ue->N_TA_offset = 0; } else { - int N_RB = fp->N_RB_DL; int N_TA_offset = fp->ul_CarrierFreq < 6e9 ? 400 : 431; // reference samples for 25600Tc @ 30.72 Ms/s for FR1, same @ 61.44 Ms/s for FR2 - double factor = 1; + + double factor = 1.0; switch (fp->numerology_index) { case 0: //15 kHz scs AssertFatal(N_TA_offset == 400, "scs_common 15kHz only for FR1\n"); - if (N_RB <= 25) factor = .25; // 7.68 Ms/s - else if (N_RB <=50) factor = .5; // 15.36 Ms/s - else if (N_RB <=75) factor = 1.0; // 30.72 Ms/s - else if (N_RB <=100) factor = 1.0; // 30.72 Ms/s - else AssertFatal(1==0, "Too many PRBS for mu=0\n"); + factor = fp->samples_per_subframe / 30720.0; break; case 1: //30 kHz sc AssertFatal(N_TA_offset == 400, "scs_common 30kHz only for FR1\n"); - if (N_RB <= 106) factor = 2.0; // 61.44 Ms/s - else if (N_RB <= 275) factor = 4.0; // 122.88 Ms/s + factor = fp->samples_per_subframe / 30720.0; break; case 2: //60 kHz scs AssertFatal(1==0, "scs_common should not be 60 kHz\n"); break; case 3: //120 kHz scs AssertFatal(N_TA_offset == 431, "scs_common 120kHz only for FR2\n"); + factor = fp->samples_per_subframe / 61440.0; break; case 4: //240 kHz scs - AssertFatal(1==0, "scs_common should not be 60 kHz\n"); - if (N_RB <= 32) factor = 1.0; // 61.44 Ms/s - else if (N_RB <= 66) factor = 2.0; // 122.88 Ms/s - else AssertFatal(1==0, "N_RB %d is too big for curretn FR2 implementation\n", N_RB); + AssertFatal(N_TA_offset == 431, "scs_common 240kHz only for FR2\n"); + factor = fp->samples_per_subframe / 61440.0; break; - - if (N_RB == 100) - ue->N_TA_offset = 624; - else if (N_RB == 50) - ue->N_TA_offset = 624/2; - else if (N_RB == 25) - ue->N_TA_offset = 624/4; + default: + AssertFatal(1==0, "Invalid scs_common!\n"); } - if (fp->threequarter_fs == 1) - factor = factor*.75; - ue->N_TA_offset = (int)(N_TA_offset * factor); - LOG_I(PHY,"UE %d Setting N_TA_offset to %d samples (factor %f, UL Freq %lu, N_RB %d)\n", ue->Mod_id, ue->N_TA_offset, factor, fp->ul_CarrierFreq, N_RB); + LOG_I(PHY,"UE %d Setting N_TA_offset to %d samples (factor %f, UL Freq %lu, N_RB %d, mu %d)\n", ue->Mod_id, ue->N_TA_offset, factor, fp->ul_CarrierFreq, fp->N_RB_DL, fp->numerology_index); } } diff --git a/openair1/PHY/INIT/nr_parms.c b/openair1/PHY/INIT/nr_parms.c index e11fedf973..d0fc227492 100644 --- a/openair1/PHY/INIT/nr_parms.c +++ b/openair1/PHY/INIT/nr_parms.c @@ -75,9 +75,8 @@ int nr_get_ssb_start_symbol(NR_DL_FRAME_PARMS *fp) return symbol; } -void set_scs_parameters (NR_DL_FRAME_PARMS *fp, int mu, uint16_t bw) +void set_scs_parameters (NR_DL_FRAME_PARMS *fp, int mu, int N_RB_DL) { - switch(mu) { case NR_MU_0: //15kHz scs @@ -99,114 +98,17 @@ void set_scs_parameters (NR_DL_FRAME_PARMS *fp, int mu, uint16_t bw) else AssertFatal(1==0,"NR Operating Band n%d not available for SS block SCS with mu=%d\n", fp->nr_band, mu); } - - switch(bw){ - case 5: - case 10: - fp->ofdm_symbol_size = 512; - fp->first_carrier_offset = 368; //512 - ( (24*12) / 2 ) - fp->nb_prefix_samples0 = 44; - fp->nb_prefix_samples = 36; - break; - case 15: - case 20: - case 25: - case 30: - case 40: //40 MHz - if (fp->threequarter_fs) { - fp->ofdm_symbol_size = 1536; - fp->first_carrier_offset = 900; //1536 - ( (106*12) / 2 ) - fp->nb_prefix_samples0 = 132; - fp->nb_prefix_samples = 108; - } - else { - fp->ofdm_symbol_size = 2048; - fp->first_carrier_offset = 1412; //2048 - ( (106*12) / 2 ) - fp->nb_prefix_samples0 = 176; - fp->nb_prefix_samples = 144; - } - break; - - case 50: - case 60: - case 70: - - case 80: //80 MHz - if (fp->threequarter_fs) { - fp->ofdm_symbol_size = 3072; - fp->first_carrier_offset = 1770; //3072 - ( (217*12) / 2 ) - fp->nb_prefix_samples0 = 264; - fp->nb_prefix_samples = 216; - } - else { - fp->ofdm_symbol_size = 4096; - fp->first_carrier_offset = 2794; //4096 - ( (217*12) / 2 ) - fp->nb_prefix_samples0 = 352; - fp->nb_prefix_samples = 288; - } - break; - - case 90: - AssertFatal(fp->threequarter_fs==0,"3/4 sampling impossible for %d MHz band and MU %d\n",bw,mu); - fp->ofdm_symbol_size = 4096; - fp->first_carrier_offset = 2626; //4096 - ( (245*12) / 2 ) - fp->nb_prefix_samples0 = 352; - fp->nb_prefix_samples = 288; - break; - case 100: - AssertFatal(fp->threequarter_fs==0,"3/4 sampling impossible for %d MHz band and MU %d\n",bw,mu); - fp->ofdm_symbol_size = 4096; - fp->first_carrier_offset = 2458; //4096 - ( (273*12) / 2 ) - fp->nb_prefix_samples0 = 352; - fp->nb_prefix_samples = 288; - break; - default: - AssertFatal(1==0,"%d MHz band undefined for mu %d, frame parms = %p\n", bw, mu, fp); - } break; case NR_MU_2: //60kHz scs fp->subcarrier_spacing = nr_subcarrier_spacing[NR_MU_2]; fp->slots_per_subframe = nr_slots_per_subframe[NR_MU_2]; - - switch(bw){ //FR1 bands only - case 10: - case 15: - case 20: - case 25: - case 30: - case 40: - case 50: - case 60: - case 70: - case 80: - case 90: - case 100: - default: - AssertFatal(1==0,"%d MHz band undefined for mu %d, frame parms = %p\n", bw, mu, fp); - } break; case NR_MU_3: fp->subcarrier_spacing = nr_subcarrier_spacing[NR_MU_3]; fp->slots_per_subframe = nr_slots_per_subframe[NR_MU_3]; fp->ssb_type = nr_ssb_type_D; - switch(bw){ - case 100: - fp->ofdm_symbol_size = 1024; - fp->first_carrier_offset = 628; //1024 - ( (66*12) / 2 ) - fp->nb_prefix_samples0 = 136; - fp->nb_prefix_samples = 72; - break; - case 50: - fp->ofdm_symbol_size = 512; - fp->first_carrier_offset = 320; //512 - ( (32*12) / 2 ) - fp->nb_prefix_samples0 = 68; - fp->nb_prefix_samples = 36; - break; - default: - AssertFatal(1==0,"%d MHz band undefined for mu %d, frame parms = %p\n", bw, mu, fp); - } break; case NR_MU_4: @@ -215,9 +117,21 @@ void set_scs_parameters (NR_DL_FRAME_PARMS *fp, int mu, uint16_t bw) fp->ssb_type = nr_ssb_type_E; break; - default: - AssertFatal(1==0,"Invalid numerology index %d", mu); + default: + AssertFatal(1==0,"Invalid numerology index %d", mu); } + + if(fp->threequarter_fs) + fp->ofdm_symbol_size = 3 * 128; + else + fp->ofdm_symbol_size = 4 * 128; + + while(fp->ofdm_symbol_size < N_RB_DL * 12) + fp->ofdm_symbol_size <<= 1; + + fp->first_carrier_offset = fp->ofdm_symbol_size - (N_RB_DL * 12 / 2); + fp->nb_prefix_samples = fp->ofdm_symbol_size / 128 * 9; + fp->nb_prefix_samples0 = fp->ofdm_symbol_size / 128 * (9 + (1 << mu)); } uint32_t get_samples_per_slot(int slot, NR_DL_FRAME_PARMS* fp) @@ -286,7 +200,7 @@ int nr_init_frame_parms(nfapi_nr_config_request_scf_t* cfg, fp->half_frame_bit = 0; // half frame bit initialized to 0 here fp->numerology_index = mu; - set_scs_parameters(fp, mu, cfg->carrier_config.dl_bandwidth.value); + set_scs_parameters(fp, mu, fp->N_RB_DL); fp->slots_per_frame = 10* fp->slots_per_subframe; @@ -380,7 +294,7 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp, fp->Ncp = Ncp; - set_scs_parameters(fp,fp->numerology_index,config->carrier_config.dl_bandwidth); + set_scs_parameters(fp, fp->numerology_index, fp->N_RB_DL); fp->slots_per_frame = 10* fp->slots_per_subframe; fp->symbols_per_slot = ((Ncp == NORMAL)? 14 : 12); // to redefine for different slot formats From 6e57abc7ae25633a85b6df443ca3eefb577a64d5 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Mon, 8 Feb 2021 13:44:58 +0100 Subject: [PATCH 040/231] NR_UE: consider sync position (1/8 CP) in initial sync and UL write timestamp --- executables/nr-ue.c | 2 +- openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index fcea62ee53..0fca5bbd2d 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -657,7 +657,7 @@ void *UE_thread(void *arg) { // use previous timing_advance value to compute writeTimestamp writeTimestamp = timestamp + UE->frame_parms.get_samples_slot_timestamp(slot_nr, &UE->frame_parms,DURATION_RX_TO_TX - RX_NB_TH) - - firstSymSamp - openair0_cfg[0].tx_sample_advance - UE->N_TA_offset - timing_advance; + firstSymSamp - openair0_cfg[0].tx_sample_advance - UE->N_TA_offset - timing_advance + UE->frame_parms.nb_prefix_samples / 8; // but use current UE->timing_advance value to compute writeBlockSize if (UE->timing_advance != timing_advance) { diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c index 13270c5c4b..3d750d2ab3 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c @@ -309,6 +309,7 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, int n_frames) // every 7*(1<symbol_offset/(7*(1<ofdm_symbol_size + fp->nb_prefix_samples0)+(ue->symbol_offset-n_symb_prefix0)*(fp->ofdm_symbol_size + fp->nb_prefix_samples); + sync_pos_frame += fp->nb_prefix_samples / 8; // shift sync position ahead by 1/8th of cyclic prefix, same as in nr_adjust_synch_ue() if (ue->ssb_offset < sync_pos_frame) ue->rx_offset = fp->samples_per_frame - sync_pos_frame + ue->ssb_offset; else From a676ccbb80609f7464312db5ca11a0925737271a Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Mon, 8 Feb 2021 13:51:17 +0100 Subject: [PATCH 041/231] gNB: fix PRACH reception for some configurations and some cleanup --- openair1/PHY/NR_TRANSPORT/nr_prach.c | 71 ++++++++++++++-------------- 1 file changed, 36 insertions(+), 35 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/nr_prach.c b/openair1/PHY/NR_TRANSPORT/nr_prach.c index aae310d45a..2ddb75af04 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_prach.c +++ b/openair1/PHY/NR_TRANSPORT/nr_prach.c @@ -301,13 +301,10 @@ void rx_nr_prach_ru(RU_t *ru, // do DFT if (mu==1) { - if (fp->N_RB_UL <= 100) - AssertFatal(1==0,"N_RB_UL %d not support for NR PRACH yet\n",fp->N_RB_UL); - else if (fp->N_RB_UL < 137) { - if (fp->threequarter_fs==0) { - //40 MHz @ 61.44 Ms/s - //50 MHz @ 61.44 Ms/s - prach2 = prach[aa] + (Ncp<<2); // Ncp is for 30.72 Ms/s, so multiply by 2 for I/Q, and 2 to bring to 61.44 Ms/s + switch(fp->samples_per_subframe) { + case 61440: + // 40, 50, 60 MHz @ 61.44 Ms/s + prach2 = prach[aa] + (4*Ncp); // Ncp is for 30.72 Ms/s, so multiply by 2 for I/Q, and 2 to bring to 61.44 Ms/s if (prach_sequence_length == 0) { if (prachFormat == 0 || prachFormat == 1 || prachFormat == 2) { dftlen=49152; @@ -327,10 +324,9 @@ void rx_nr_prach_ru(RU_t *ru, for (int i=0;i<4;i++) dft(DFT_12288,prach2+(i*12288*2),rxsigF[aa]+(i*12288*2),1); reps=4; } - }// 839 sequence - else { - if (prachStartSymbol == 0) - prach2+=64; // 32 samples @ 61.44 Ms/s in first symbol of each half subframe (15/30 kHz only) + } else { // 839 sequence + if (prachStartSymbol == 0) prach2+=64; // 32 samples @ 61.44 Ms/s in first symbol of each half subframe (15/30 kHz only) + dftlen=2048; dft(DFT_2048,prach2,rxsigF[aa],1); if (prachFormat != 9/*C0*/) { @@ -352,15 +348,15 @@ void rx_nr_prach_ru(RU_t *ru, reps+=6; } } - } else { // threequarter sampling - // 40 MHz @ 46.08 Ms/s + break; + + case 46080: + // 40 MHz @ 46.08 Ms/s prach2 = prach[aa] + (3*Ncp); // 46.08 is 1.5 * 30.72, times 2 for I/Q if (prach_sequence_length == 0) { - AssertFatal(fp->N_RB_UL <= 107,"cannot do 108..136 PRBs with 3/4 sampling\n"); if (prachFormat == 0 || prachFormat == 1 || prachFormat == 2) { dftlen=36864; dft(DFT_36864,prach2,rxsigF[aa],1); - reps++; } if (prachFormat == 1 || prachFormat == 2) { dft(DFT_36864,prach2+73728,rxsigF[aa]+73728,1); @@ -374,10 +370,11 @@ void rx_nr_prach_ru(RU_t *ru, if (prachFormat == 3) { dftlen=9216; for (int i=0;i<4;i++) dft(DFT_9216,prach2+(i*9216*2),rxsigF[aa]+(i*9216*2),1); - reps=4; + reps=4; } - } else { + } else { // 839 sequence if (prachStartSymbol == 0) prach2+=48; // 24 samples @ 46.08 Ms/s in first symbol of each half subframe (15/30 kHz only) + dftlen=1536; dft(DFT_1536,prach2,rxsigF[aa],1); if (prachFormat != 9/*C0*/) { @@ -398,14 +395,12 @@ void rx_nr_prach_ru(RU_t *ru, for (int i=6;i<12;i++) dft(DFT_1536,prach2+(3072*i),rxsigF[aa]+(3072*i),1); reps+=6; } - } // short format - } // 3/4 sampling - } // <=50 MHz BW - else if (fp->N_RB_UL <= 273) { - if (fp->threequarter_fs==0) { - prach2 = prach[aa] + (Ncp<<3); - //80,90,100 MHz @ 122.88 Ms/s + } + break; + case 122880: + // 70, 80, 90, 100 MHz @ 122.88 Ms/s + prach2 = prach[aa] + (8*Ncp); if (prach_sequence_length == 0) { if (prachFormat == 0 || prachFormat == 1 || prachFormat == 2) { dftlen=98304; @@ -425,8 +420,7 @@ void rx_nr_prach_ru(RU_t *ru, for (int i=0;i<4;i++) dft(DFT_24576,prach2+(i*2*24576),rxsigF[aa]+(i*2*24576),1); reps=4; } - } - else { + } else { // 839 sequence if (prachStartSymbol == 0) prach2+=128; // 64 samples @ 122.88 Ms/s in first symbol of each half subframe (15/30 kHz only) dftlen=4096; @@ -451,24 +445,29 @@ void rx_nr_prach_ru(RU_t *ru, reps+=6; } } - } else { - AssertFatal(fp->N_RB_UL <= 217,"cannot do more than 217 PRBs with 3/4 sampling\n"); + break; + + case 92160: + // 80, 90 MHz @ 92.16 Ms/s prach2 = prach[aa] + (6*Ncp); - // 80 MHz @ 92.16 Ms/s if (prach_sequence_length == 0) { if (prachFormat == 0 || prachFormat == 1 || prachFormat == 2) { dftlen=73728; - dft(DFT_73728,prach2,rxsigF[aa],1); - reps++; + dft(DFT_73728,prach2,rxsigF[aa],1); } if (prachFormat == 1 || prachFormat == 2) { - dft(DFT_73728,prach2+(2*73728),rxsigF[aa]+(2*73728),1); + dft(DFT_73728,prach2+147456,rxsigF[aa]+147456,1); reps++; } + if (prachFormat == 2) { + dft(DFT_73728,prach2+(147456*2),rxsigF[aa]+(147456*2),1); + dft(DFT_73728,prach2+(147456*3),rxsigF[aa]+(147456*3),1); + reps+=2; + } if (prachFormat == 3) { dftlen=18432; - for (int i=0;i<4;i++) dft(DFT_18432,prach2+(i*2*18432),rxsigF[aa]+(i*2*18432),1); - reps=4; + for (int i=0;i<4;i++) dft(DFT_18432,prach2+(i*2*18432),rxsigF[aa]+(i*2*18432),1); + reps=4; } } else { if (prachStartSymbol == 0) prach2+=96; // 64 samples @ 122.88 Ms/s in first symbol of each half subframe (15/30 kHz only) @@ -495,7 +494,9 @@ void rx_nr_prach_ru(RU_t *ru, reps+=6; } } - } + break; + default: + AssertFatal(1==0,"sample_rate %f MHz not support for NR PRACH yet\n", fp->samples_per_subframe / 1000.0); } } else if (mu==3) { From 92e654c6fc4a3f05e58394fc325adc2bf871b6bd Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Mon, 8 Feb 2021 13:58:32 +0100 Subject: [PATCH 042/231] gNB: Add PRACH reception support for 10 to 30 MHz (30 kHz SCS) --- openair1/PHY/NR_TRANSPORT/nr_prach.c | 96 ++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) diff --git a/openair1/PHY/NR_TRANSPORT/nr_prach.c b/openair1/PHY/NR_TRANSPORT/nr_prach.c index 2ddb75af04..64b14091d6 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_prach.c +++ b/openair1/PHY/NR_TRANSPORT/nr_prach.c @@ -302,6 +302,102 @@ void rx_nr_prach_ru(RU_t *ru, // do DFT if (mu==1) { switch(fp->samples_per_subframe) { + case 15360: + // 10, 15 MHz @ 15.36 Ms/s + prach2 = prach[aa] + (1*Ncp); // Ncp is for 30.72 Ms/s, so divide by 2 to bring to 15.36 Ms/s and multiply by 2 for I/Q + if (prach_sequence_length == 0) { + if (prachFormat == 0 || prachFormat == 1 || prachFormat == 2) { + dftlen=12288; + dft(DFT_12288,prach2,rxsigF[aa],1); + } + if (prachFormat == 1 || prachFormat == 2) { + dft(DFT_12288,prach2+24576,rxsigF[aa]+24576,1); + reps++; + } + if (prachFormat == 2) { + dft(DFT_12288,prach2+(24576*2),rxsigF[aa]+(24576*2),1); + dft(DFT_12288,prach2+(24576*3),rxsigF[aa]+(24576*3),1); + reps+=2; + } + if (prachFormat == 3) { + dftlen=3072; + for (int i=0;i<4;i++) dft(DFT_3072,prach2+(i*3072*2),rxsigF[aa]+(i*3072*2),1); + reps=4; + } + } else { // 839 sequence + if (prachStartSymbol == 0) prach2+=16; // 8 samples @ 15.36 Ms/s in first symbol of each half subframe (15/30 kHz only) + + dftlen=512; + dft(DFT_512,prach2,rxsigF[aa],1); + if (prachFormat != 9/*C0*/) { + dft(DFT_512,prach2+1024,rxsigF[aa]+1024,1); + reps++; + } + if (prachFormat == 5/*A2*/ || prachFormat == 6/*A3*/|| prachFormat == 8/*B4*/ || prachFormat == 10/*C2*/) { + dft(DFT_512,prach2+1024*2,rxsigF[aa]+1024*2,1); + dft(DFT_512,prach2+1024*3,rxsigF[aa]+1024*3,1); + reps+=2; + } + if (prachFormat == 6/*A3*/ || prachFormat == 8/*B4*/) { + dft(DFT_512,prach2+1024*4,rxsigF[aa]+1024*4,1); + dft(DFT_512,prach2+1024*5,rxsigF[aa]+1024*5,1); + reps+=2; + } + if (prachFormat == 8/*B4*/) { + for (int i=6;i<12;i++) dft(DFT_512,prach2+(1024*i),rxsigF[aa]+(1024*i),1); + reps+=6; + } + } + break; + + case 30720: + // 20, 25, 30 MHz @ 30.72 Ms/s + prach2 = prach[aa] + (2*Ncp); // Ncp is for 30.72 Ms/s, so just multiply by 2 for I/Q + if (prach_sequence_length == 0) { + if (prachFormat == 0 || prachFormat == 1 || prachFormat == 2) { + dftlen=24576; + dft(DFT_24576,prach2,rxsigF[aa],1); + } + if (prachFormat == 1 || prachFormat == 2) { + dft(DFT_24576,prach2+49152,rxsigF[aa]+49152,1); + reps++; + } + if (prachFormat == 2) { + dft(DFT_24576,prach2+(49152*2),rxsigF[aa]+(49152*2),1); + dft(DFT_24576,prach2+(49152*3),rxsigF[aa]+(49152*3),1); + reps+=2; + } + if (prachFormat == 3) { + dftlen=6144; + for (int i=0;i<4;i++) dft(DFT_6144,prach2+(i*6144*2),rxsigF[aa]+(i*6144*2),1); + reps=4; + } + } else { // 839 sequence + if (prachStartSymbol == 0) prach2+=32; // 16 samples @ 30.72 Ms/s in first symbol of each half subframe (15/30 kHz only) + + dftlen=1024; + dft(DFT_1024,prach2,rxsigF[aa],1); + if (prachFormat != 9/*C0*/) { + dft(DFT_1024,prach2+2048,rxsigF[aa]+2048,1); + reps++; + } + if (prachFormat == 5/*A2*/ || prachFormat == 6/*A3*/|| prachFormat == 8/*B4*/ || prachFormat == 10/*C2*/) { + dft(DFT_1024,prach2+2048*2,rxsigF[aa]+2048*2,1); + dft(DFT_1024,prach2+2048*3,rxsigF[aa]+2048*3,1); + reps+=2; + } + if (prachFormat == 6/*A3*/ || prachFormat == 8/*B4*/) { + dft(DFT_1024,prach2+2048*4,rxsigF[aa]+2048*4,1); + dft(DFT_1024,prach2+2048*5,rxsigF[aa]+2048*5,1); + reps+=2; + } + if (prachFormat == 8/*B4*/) { + for (int i=6;i<12;i++) dft(DFT_1024,prach2+(2048*i),rxsigF[aa]+(2048*i),1); + reps+=6; + } + } + break; + case 61440: // 40, 50, 60 MHz @ 61.44 Ms/s prach2 = prach[aa] + (4*Ncp); // Ncp is for 30.72 Ms/s, so multiply by 2 for I/Q, and 2 to bring to 61.44 Ms/s From c5734aa110263d91360d868fe233ed4bfe2d20b4 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Mon, 8 Feb 2021 14:02:12 +0100 Subject: [PATCH 043/231] NR_UE: slightly cleanup PRACH generation --- openair1/PHY/NR_UE_TRANSPORT/nr_prach.c | 157 ++++++++++-------------- 1 file changed, 68 insertions(+), 89 deletions(-) diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c b/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c index 9ce49cd4b7..fe62b4cacc 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c @@ -244,86 +244,58 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ *********************************************************/ if (mu==1) { - if (fp->N_RB_UL <= 100) - AssertFatal(1 == 0, "N_RB_UL %d not support for NR PRACH yet\n", fp->N_RB_UL); - else if (fp->N_RB_UL < 137) { - if (fp->threequarter_fs == 0) { - //40 MHz @ 61.44 Ms/s - //50 MHz @ 61.44 Ms/s + switch(fp->samples_per_subframe) { + case 46080: + // 40 MHz @ 46.08 Ms/s if (prach_sequence_length == 0) { - if (prach_fmt_id == 0 || prach_fmt_id == 1 || prach_fmt_id == 2) - dftlen = 49152; - if (prach_fmt_id == 3) - dftlen = 12288; - } // 839 sequence - else { - switch (mu){ - case 1: - dftlen = 2048; - break; - default: - AssertFatal(1 == 0, "Shouldn't get here\n"); - break; - } - } - } else { // threequarter sampling - // 40 MHz @ 46.08 Ms/s - if (prach_sequence_length == 0) { - AssertFatal(fp->N_RB_UL <= 107, "cannot do 108..136 PRBs with 3/4 sampling\n"); if (prach_fmt_id == 0 || prach_fmt_id == 1 || prach_fmt_id == 2) dftlen = 36864; if (prach_fmt_id == 3) dftlen = 9216; - } else { - switch (mu){ - case 1: - dftlen = 1536; - break; - default: - AssertFatal(1 == 0, "Shouldn't get here\n"); - break; - } - } // short format - } // 3/4 sampling - } // <=50 MHz BW - else if (fp->N_RB_UL <= 273) { - if (fp->threequarter_fs == 0) { - //80,90,100 MHz @ 122.88 Ms/s + } else { // 839 sequence + dftlen = 1536; + } + break; + + case 61440: + // 40, 50, 60 MHz @ 61.44 Ms/s + if (prach_sequence_length == 0) { + if (prach_fmt_id == 0 || prach_fmt_id == 1 || prach_fmt_id == 2) + dftlen = 49152; + if (prach_fmt_id == 3) + dftlen = 12288; + } else { // 839 sequence + dftlen = 2048; + } + break; + + case 92160: + // 50, 60, 70, 80, 90 MHz @ 92.16 Ms/s + if (prach_sequence_length == 0) { + if (prach_fmt_id == 0 || prach_fmt_id == 1 || prach_fmt_id == 2) + dftlen = 73728; + if (prach_fmt_id == 3) + dftlen = 18432; + } else { // 839 sequence + dftlen = 3072; + } + break; + + case 122880: + // 70, 80, 90, 100 MHz @ 122.88 Ms/s if (prach_sequence_length == 0) { if (prach_fmt_id == 0 || prach_fmt_id == 1 || prach_fmt_id == 2) dftlen = 98304; if (prach_fmt_id == 3) dftlen = 24576; + } else { // 839 sequence + dftlen = 4096; } - } else { // threequarter sampling - switch (mu){ - case 1: - dftlen = 4096; - break; - default: - AssertFatal(1 == 0, "Shouldn't get here\n"); - break; - } + break; + + default: + AssertFatal(1==0,"sample rate %f MHz not supported for numerology %d\n", fp->samples_per_subframe / 1000.0, mu); } - } else { - AssertFatal(fp->N_RB_UL <= 217, "cannot do more than 217 PRBs with 3/4 sampling\n"); - // 80 MHz @ 92.16 Ms/s - if (prach_sequence_length == 0) { - if (prach_fmt_id == 0 || prach_fmt_id == 1 || prach_fmt_id == 2) - dftlen = 73728; - if (prach_fmt_id == 3) - dftlen = 18432; - } else { - switch (mu){ - case 1: - dftlen = 3072; - break; - default: - AssertFatal(1 == 0, "Shouldn't get here\n"); - break; - } - } - } } else if (mu==3) { if (fp->threequarter_fs) @@ -432,8 +404,9 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ use_extended_prach_prefix = 1; } - if (fp->N_RB_UL <= 34) { //32 PRB case 61.44Msps - if (fp->threequarter_fs == 0) { + if (mu == 3) { + switch (fp->samples_per_subframe) { + case 61440: // 32 PRB case, 61.44 Msps Ncp<<=1; //to account for 61.44Mbps // This is after cyclic prefix prach2 = prach+(Ncp<<1); //times 2 for complex samples @@ -491,13 +464,9 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ prach_len = (512*12)+Ncp; } } - } - else - AssertFatal(1==0,"3/4 sampling not supported for this PRACH size %d\n",fp->N_RB_UL); - - } - else if (fp->N_RB_UL <= 68) {//66 PRB case, 122.88 Msps - if (fp->threequarter_fs == 0) { + break; + + case 122880: // 66 PRB case, 122.88 Msps Ncp<<=2; //to account for 122.88Mbps // This is after cyclic prefix prach2 = prach+(Ncp<<1); //times 2 for complex samples @@ -555,13 +524,15 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ prach_len = (1024*12)+Ncp; } } + break; + + default: + AssertFatal(1==0,"sample rate %f MHz not supported for numerology %d\n", fp->samples_per_subframe / 1000.0, mu); } - else - AssertFatal(1==0,"3/4 sampling not supported for this PRACH size %d\n",fp->N_RB_UL); - } - else if (fp->N_RB_UL < 137) { // 46.08 or 61.44 Ms/s - if (fp->threequarter_fs == 0) { // full sampling @ 61.44 Ms/s - Ncp<<=1; //to account for 61.44Mbps + } else if (mu == 1) { + switch (fp->samples_per_subframe) { + case 61440: // full sampling @ 61.44 Ms/s + Ncp = Ncp*2; // to account for 61.44 Ms/s // This is after cyclic prefix prach2 = prach+(Ncp<<1); //times 2 for complex samples if (prach_sequence_length == 0){ @@ -587,7 +558,7 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ memmove(prach,prach+(49152<<3),(Ncp<<2)); // here we have |Prefix | Prach49152 | Prach49152| Prach49152 | Prach49152 prach_len = (49152*4)+Ncp; - } else if (prach_fmt_id == 3) { // //6144 samples @ 30.72 Ms/s, 12288 samples @ 61.44 Ms/s + } else if (prach_fmt_id == 3) { // 6144 samples @ 30.72 Ms/s, 12288 samples @ 61.44 Ms/s idft(IDFT_12288,prachF,prach2,1); memmove(prach2+(12288<<1),prach2,(12288<<2)); // here we have |empty | Prach12288 | Prach12288| empty12288 | empty12288 @@ -649,7 +620,9 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ prach_len = (2048*12)+Ncp; } } - } else { // threequarter sampling @ 46.08 Ms/s + break; + + case 46080: // threequarter sampling @ 46.08 Ms/s Ncp = (Ncp*3)/2; prach2 = prach+(Ncp<<1); if (prach_sequence_length == 0){ @@ -738,9 +711,9 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ prach_len = (1536*12)+Ncp; } } - } - } else if (fp->N_RB_UL <= 273) {// 92.16 or 122.88 Ms/s - if (fp->threequarter_fs == 0) { // full sampling @ 122.88 Ms/s + break; + + case 122880: // full sampling @ 122.88 Ms/s Ncp<<=2; //to account for 122.88Mbps // This is after cyclic prefix prach2 = prach+(Ncp<<1); //times 2 for complex samples @@ -828,7 +801,9 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ prach_len = (4096*12)+Ncp; } } - } else { // three quarter sampling @ 92.16 Ms/s + break; + + case 92160: // three quarter sampling @ 92.16 Ms/s Ncp = (Ncp*3); //to account for 92.16 Msps prach2 = prach+(Ncp<<1); //times 2 for complex samples if (prach_sequence_length == 0){ @@ -915,6 +890,10 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ prach_len = (3072*12)+Ncp; } } + break; + + default: + AssertFatal(1==0,"sample rate %f MHz not supported for numerology %d\n", fp->samples_per_subframe / 1000.0, mu); } } From adc24a797ed78cf26f167e303daac4bb947998be Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Mon, 8 Feb 2021 14:04:43 +0100 Subject: [PATCH 044/231] NR_UE: Add PRACH generation for 10 to 30 MHz (30 kHz SCS) --- openair1/PHY/NR_UE_TRANSPORT/nr_prach.c | 220 ++++++++++++++++++++++++ 1 file changed, 220 insertions(+) diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c b/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c index fe62b4cacc..0ba02c6bac 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c @@ -245,6 +245,30 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ if (mu==1) { switch(fp->samples_per_subframe) { + case 15360: + // 10, 15 MHz @ 15.36 Ms/s + if (prach_sequence_length == 0) { + if (prach_fmt_id == 0 || prach_fmt_id == 1 || prach_fmt_id == 2) + dftlen = 12288; + if (prach_fmt_id == 3) + dftlen = 3072; + } else { // 839 sequence + dftlen = 512; + } + break; + + case 30720: + // 20, 25, 30 MHz @ 30.72 Ms/s + if (prach_sequence_length == 0) { + if (prach_fmt_id == 0 || prach_fmt_id == 1 || prach_fmt_id == 2) + dftlen = 24576; + if (prach_fmt_id == 3) + dftlen = 6144; + } else { // 839 sequence + dftlen = 1024; + } + break; + case 46080: // 40 MHz @ 46.08 Ms/s if (prach_sequence_length == 0) { @@ -531,6 +555,202 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ } } else if (mu == 1) { switch (fp->samples_per_subframe) { + case 15360: // full sampling @ 15.36 Ms/s + Ncp = Ncp/2; // to account for 15.36 Ms/s + // This is after cyclic prefix + prach2 = prach+(2*Ncp); // times 2 for complex samples + if (prach_sequence_length == 0){ + if (prach_fmt_id == 0) { // 24576 samples @ 30.72 Ms/s, 12288 samples @ 15.36 Ms/s + idft(IDFT_12288,prachF,prach2,1); + // here we have | empty | Prach12288 | + memmove(prach,prach+(12288<<1),(Ncp<<2)); + // here we have | Prefix | Prach12288 | + prach_len = 12288+Ncp; + } else if (prach_fmt_id == 1) { // 24576 samples @ 30.72 Ms/s, 12288 samples @ 15.36 Ms/s + idft(IDFT_12288,prachF,prach2,1); + // here we have | empty | Prach12288 | empty12288 | + memmove(prach2+(12288<<1),prach2,(12288<<2)); + // here we have | empty | Prach12288 | Prach12288 | + memmove(prach,prach+(12288<<2),(Ncp<<2)); + // here we have | Prefix | Prach12288 | Prach12288 | + prach_len = (12288*2)+Ncp; + } else if (prach_fmt_id == 2) { // 24576 samples @ 30.72 Ms/s, 12288 samples @ 15.36 Ms/s + idft(IDFT_12288,prachF,prach2,1); + // here we have | empty | Prach12288 | empty12288 | empty12288 | empty12288 | + memmove(prach2+(12288<<1),prach2,(12288<<2)); + // here we have | empty | Prach12288 | Prach12288 | empty12288 | empty12288 | + memmove(prach2+(12288<<2),prach2,(12288<<3)); + // here we have | empty | Prach12288 | Prach12288 | Prach12288 | Prach12288 | + memmove(prach,prach+(12288<<3),(Ncp<<2)); + // here we have | Prefix | Prach12288 | Prach12288 | Prach12288 | Prach12288 | + prach_len = (12288*4)+Ncp; + } else if (prach_fmt_id == 3) { // 6144 samples @ 30.72 Ms/s, 3072 samples @ 15.36 Ms/s + idft(IDFT_3072,prachF,prach2,1); + // here we have | empty | Prach3072 | empty3072 | empty3072 | empty3072 | + memmove(prach2+(3072<<1),prach2,(3072<<2)); + // here we have | empty | Prach3072 | Prach3072 | empty3072 | empty3072 | + memmove(prach2+(3072<<2),prach2,(3072<<3)); + // here we have | empty | Prach3072 | Prach3072 | Prach3072 | Prach3072 | + memmove(prach,prach+(3072<<3),(Ncp<<2)); + // here we have | Prefix | Prach3072 | Prach3072 | Prach3072 | Prach3072 | + prach_len = (3072*4)+Ncp; + } + } else { // short PRACH sequence + if (use_extended_prach_prefix) + Ncp += 8; // 16*kappa, kappa=0.5 for 15.36 Ms/s + prach2 = prach+(2*Ncp); // times 2 for complex samples + if (prach_fmt_id == 9) { + idft(IDFT_512,prachF,prach2,1); + // here we have | empty | Prach512 | + memmove(prach,prach+(512<<1),(Ncp<<2)); + // here we have | Prefix | Prach512 | + prach_len = (512*1)+Ncp; + } else if (prach_fmt_id == 4 || prach_fmt_id == 7) { + idft(IDFT_512,prachF,prach2,1); + // here we have | empty | Prach512 | empty512 | + memmove(prach2+(512<<1),prach2,(512<<2)); + // here we have | empty | Prach512 | Prach512 | + memmove(prach,prach+(512<<1),(Ncp<<2)); + // here we have | Prefix | Prach512 | Prach512 | + prach_len = (512*2)+Ncp; + } else if (prach_fmt_id == 5) { // 4x512 + idft(IDFT_512,prachF,prach2,1); + // here we have | empty | Prach512 | empty512 | empty512 | empty512 | + memmove(prach2+(512<<1),prach2,(512<<2)); + // here we have | empty | Prach512 | Prach512 | empty512 | empty512 | + memmove(prach2+(512<<2),prach2,(512<<3)); + // here we have | empty | Prach512 | Prach512 | Prach512 | Prach512 | + memmove(prach,prach+(512<<1),(Ncp<<2)); + // here we have | Prefix | Prach512 | Prach512 | Prach512 | Prach512 | + prach_len = (512*4)+Ncp; + } else if (prach_fmt_id == 6) { // 6x512 + idft(IDFT_512,prachF,prach2,1); + // here we have | empty | Prach512 | empty512 | empty512 | empty512 | empty512 | empty512 | + memmove(prach2+(512<<1),prach2,(512<<2)); + // here we have | empty | Prach512 | Prach512 | empty512 | empty512 | empty512 | empty512 | + memmove(prach2+(512<<2),prach2,(512<<3)); + // here we have | empty | Prach512 | Prach512 | Prach512 | Prach512 | empty512 | empty512 | + memmove(prach2+(512<<3),prach2,(512<<3)); + // here we have | empty | Prach512 | Prach512 | Prach512 | Prach512 | Prach512 | Prach512 | + memmove(prach,prach+(512<<1),(Ncp<<2)); + // here we have | Prefix | Prach512 | Prach512 | Prach512 | Prach512 | Prach512 | Prach512 | + prach_len = (512*6)+Ncp; + } else if (prach_fmt_id == 8) { // 12x512 + idft(IDFT_512,prachF,prach2,1); + // here we have | empty | Prach512 | empty512 | empty512 | empty512 | empty512 | empty512 | empty512 | empty512 | empty512 | empty512 | empty512 | empty512 | + memmove(prach2+(512<<1),prach2,(512<<2)); + // here we have | empty | Prach512 | Prach512 | empty512 | empty512 | empty512 | empty512 | empty512 | empty512 | empty512 | empty512 | empty512 | empty512 | + memmove(prach2+(512<<2),prach2,(512<<3)); + // here we have | empty | Prach512 | Prach512 | Prach512 | Prach512 | empty512 | empty512 | empty512 | empty512 | empty512 | empty512 | empty512 | empty512 | + memmove(prach2+(512<<3),prach2,(512<<3)); + // here we have | empty | Prach512 | Prach512 | Prach512 | Prach512 | Prach512 | Prach512 | empty512 | empty512 | empty512 | empty512 | empty512 | empty512 | + memmove(prach2+(512<<1)*6,prach2,(512<<2)*6); + // here we have | empty | Prach512 | Prach512 | Prach512 | Prach512 | Prach512 | Prach512 | Prach512 | Prach512 | Prach512 | Prach512 | Prach512 | Prach512 | + memmove(prach,prach+(512<<1),(Ncp<<2)); + // here we have | Prefix | Prach512 | Prach512 | Prach512 | Prach512 | Prach512 | Prach512 | Prach512 | Prach512 | Prach512 | Prach512 | Prach512 | Prach512 | + prach_len = (512*12)+Ncp; + } + } + break; + + case 30720: // full sampling @ 30.72 Ms/s + Ncp = Ncp*1; // to account for 30.72 Ms/s + // This is after cyclic prefix + prach2 = prach+(2*Ncp); // times 2 for complex samples + if (prach_sequence_length == 0){ + if (prach_fmt_id == 0) { // 24576 samples @ 30.72 Ms/s + idft(IDFT_24576,prachF,prach2,1); + // here we have | empty | Prach24576 | + memmove(prach,prach+(24576<<1),(Ncp<<2)); + // here we have | Prefix | Prach24576 | + prach_len = 24576+Ncp; + } else if (prach_fmt_id == 1) { // 24576 samples @ 30.72 Ms/s + idft(IDFT_24576,prachF,prach2,1); + // here we have | empty | Prach24576 | empty24576 | + memmove(prach2+(24576<<1),prach2,(24576<<2)); + // here we have | empty | Prach24576 | Prach24576 | + memmove(prach,prach+(24576<<2),(Ncp<<2)); + // here we have | Prefix | Prach24576 | Prach24576 | + prach_len = (24576*2)+Ncp; + } else if (prach_fmt_id == 2) { // 24576 samples @ 30.72 Ms/s + idft(IDFT_24576,prachF,prach2,1); + // here we have | empty | Prach24576 | empty24576 | empty24576 | empty24576 | + memmove(prach2+(24576<<1),prach2,(24576<<2)); + // here we have | empty | Prach24576 | Prach24576 | empty24576 | empty24576 | + memmove(prach2+(24576<<2),prach2,(24576<<3)); + // here we have | empty | Prach24576 | Prach24576 | Prach24576 | Prach24576 | + memmove(prach,prach+(24576<<3),(Ncp<<2)); + // here we have | Prefix | Prach24576 | Prach24576 | Prach24576 | Prach24576 | + prach_len = (24576*4)+Ncp; + } else if (prach_fmt_id == 3) { // 6144 samples @ 30.72 Ms/s + idft(IDFT_6144,prachF,prach2,1); + // here we have | empty | Prach6144 | empty6144 | empty6144 | empty6144 | + memmove(prach2+(6144<<1),prach2,(6144<<2)); + // here we have | empty | Prach6144 | Prach6144 | empty6144 | empty6144 | + memmove(prach2+(6144<<2),prach2,(6144<<3)); + // here we have | empty | Prach6144 | Prach6144 | Prach6144 | Prach6144 | + memmove(prach,prach+(6144<<3),(Ncp<<2)); + // here we have | Prefix | Prach6144 | Prach6144 | Prach6144 | Prach6144 | + prach_len = (6144*4)+Ncp; + } + } else { // short PRACH sequence + if (use_extended_prach_prefix) + Ncp += 16; // 16*kappa, kappa=1 for 30.72Msps + prach2 = prach+(2*Ncp); // times 2 for complex samples + if (prach_fmt_id == 9) { + idft(IDFT_1024,prachF,prach2,1); + // here we have | empty | Prach1024 | + memmove(prach,prach+(1024<<1),(Ncp<<2)); + // here we have | Prefix | Prach1024 | + prach_len = (1024*1)+Ncp; + } else if (prach_fmt_id == 4 || prach_fmt_id == 7) { + idft(IDFT_1024,prachF,prach2,1); + // here we have | empty | Prach1024 | empty1024 | + memmove(prach2+(1024<<1),prach2,(1024<<2)); + // here we have | empty | Prach1024 | Prach1024 | + memmove(prach,prach+(1024<<1),(Ncp<<2)); + // here we have | Prefix | Prach1024 | Prach1024 | + prach_len = (1024*2)+Ncp; + } else if (prach_fmt_id == 5) { // 4x1024 + idft(IDFT_1024,prachF,prach2,1); + // here we have | empty | Prach1024 | empty1024 | empty1024 | empty1024 | + memmove(prach2+(1024<<1),prach2,(1024<<2)); + // here we have | empty | Prach1024 | Prach1024 | empty1024 | empty1024 | + memmove(prach2+(1024<<2),prach2,(1024<<3)); + // here we have | empty | Prach1024 | Prach1024 | Prach1024 | Prach1024 | + memmove(prach,prach+(1024<<1),(Ncp<<2)); + // here we have | Prefix | Prach1024 | Prach1024 | Prach1024 | Prach1024 | + prach_len = (1024*4)+Ncp; + } else if (prach_fmt_id == 6) { // 6x1024 + idft(IDFT_1024,prachF,prach2,1); + // here we have | empty | Prach1024 | empty1024 | empty1024 | empty1024 | empty1024 | empty1024 | + memmove(prach2+(1024<<1),prach2,(1024<<2)); + // here we have | empty | Prach1024 | Prach1024 | empty1024 | empty1024 | empty1024 | empty1024 | + memmove(prach2+(1024<<2),prach2,(1024<<3)); + // here we have | empty | Prach1024 | Prach1024 | Prach1024 | Prach1024 | empty1024 | empty1024 | + memmove(prach2+(1024<<3),prach2,(1024<<3)); + // here we have | empty | Prach1024 | Prach1024 | Prach1024 | Prach1024 | Prach1024 | Prach1024 | + memmove(prach,prach+(1024<<1),(Ncp<<2)); + // here we have | Prefix | Prach1024 | Prach1024 | Prach1024 | Prach1024 | Prach1024 | Prach1024 | + prach_len = (1024*6)+Ncp; + } else if (prach_fmt_id == 8) { // 12x1024 + idft(IDFT_1024,prachF,prach2,1); + // here we have | empty | Prach1024 | empty1024 | empty1024 | empty1024 | empty1024 | empty1024 | empty1024 | empty1024 | empty1024 | empty1024 | empty1024 | empty1024 | + memmove(prach2+(1024<<1),prach2,(1024<<2)); + // here we have | empty | Prach1024 | Prach1024 | empty1024 | empty1024 | empty1024 | empty1024 | empty1024 | empty1024 | empty1024 | empty1024 | empty1024 | empty1024 | + memmove(prach2+(1024<<2),prach2,(1024<<3)); + // here we have | empty | Prach1024 | Prach1024 | Prach1024 | Prach1024 | empty1024 | empty1024 | empty1024 | empty1024 | empty1024 | empty1024 | empty1024 | empty1024 | + memmove(prach2+(1024<<3),prach2,(1024<<3)); + // here we have | empty | Prach1024 | Prach1024 | Prach1024 | Prach1024 | Prach1024 | Prach1024 | empty1024 | empty1024 | empty1024 | empty1024 | empty1024 | empty1024 | + memmove(prach2+(1024<<1)*6,prach2,(1024<<2)*6); + // here we have | empty | Prach1024 | Prach1024 | Prach1024 | Prach1024 | Prach1024 | Prach1024 | Prach1024 | Prach1024 | Prach1024 | Prach1024 | Prach1024 | Prach1024 | + memmove(prach,prach+(1024<<1),(Ncp<<2)); + // here we have | Prefix | Prach1024 | Prach1024 | Prach1024 | Prach1024 | Prach1024 | Prach1024 | Prach1024 | Prach1024 | Prach1024 | Prach1024 | Prach1024 | Prach1024 | + prach_len = (1024*12)+Ncp; + } + } + break; + case 61440: // full sampling @ 61.44 Ms/s Ncp = Ncp*2; // to account for 61.44 Ms/s // This is after cyclic prefix From ff05ec89f63aa12b5e4df1d7beb38f9667cd6e5a Mon Sep 17 00:00:00 2001 From: Sakthivel Velumani Date: Mon, 8 Feb 2021 18:23:41 +0100 Subject: [PATCH 045/231] Slot tx compute in ru_thread --- executables/nr-ru.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/executables/nr-ru.c b/executables/nr-ru.c index fa5ad3fa6e..97d865a930 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -1821,6 +1821,9 @@ void *ru_thread( void *param ) { if (ru->fh_south_in) ru->fh_south_in(ru,&frame,&slot); else AssertFatal(1==0, "No fronthaul interface at south port"); + proc->frame_tx = (proc->tti_rx > (fp->slots_per_frame-1-(fp->slots_per_subframe*sf_ahead))) ? (proc->frame_rx+1)&1023 : proc->frame_rx; + proc->tti_tx = (proc->tti_rx + (fp->slots_per_subframe*sf_ahead))%fp->slots_per_frame; + LOG_D(PHY,"AFTER fh_south_in - SFN/SL:%d%d RU->proc[RX:%d.%d TX:%d.%d] RC.gNB[0]:[RX:%d%d TX(SFN):%d]\n", frame,slot, proc->frame_rx,proc->tti_rx, From f622bdedf40ec14507532aff93490a4efa2835e3 Mon Sep 17 00:00:00 2001 From: Sakthivel Velumani Date: Mon, 8 Feb 2021 21:15:40 +0100 Subject: [PATCH 046/231] Replacing tryPull by pull for L1 rx --- executables/nr-gnb.c | 3 ++- executables/nr-ru.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index fbbe5813a9..efc1b31c51 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -915,11 +915,12 @@ void init_gNB_Tpool(int inst) { gNB->resp_L1 = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t)); initTpool("-1", gNB->threadPool_L1, false); initNotifiedFIFO(gNB->resp_L1); + pushNotifiedFIFO_nothreadSafe(gNB->resp_L1, newNotifiedFIFO_elt(20, 0,NULL,NULL)); // L1 TX threadpool gNB->threadPool_L1_tx = (tpool_t*)malloc(sizeof(tpool_t)); gNB->resp_L1_tx = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t)); - initTpool("-1",gNB->threadPool_L1_tx, false); + initTpool("-1,-1,-1",gNB->threadPool_L1_tx, false); initNotifiedFIFO(gNB->resp_L1_tx); // RU TX threadpool diff --git a/executables/nr-ru.c b/executables/nr-ru.c index 97d865a930..f3e1857eaf 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -1821,6 +1821,7 @@ void *ru_thread( void *param ) { if (ru->fh_south_in) ru->fh_south_in(ru,&frame,&slot); else AssertFatal(1==0, "No fronthaul interface at south port"); + proc->timestamp_tx = proc->timestamp_rx + (sf_ahead*fp->samples_per_subframe); proc->frame_tx = (proc->tti_rx > (fp->slots_per_frame-1-(fp->slots_per_subframe*sf_ahead))) ? (proc->frame_rx+1)&1023 : proc->frame_rx; proc->tti_tx = (proc->tti_rx + (fp->slots_per_subframe*sf_ahead))%fp->slots_per_frame; @@ -1904,7 +1905,7 @@ void *ru_thread( void *param ) { syncMsg->slot_tx = proc->tti_tx; // check if previous L1 slot processing is finished - res = tryPullTpool(gNB->resp_L1, gNB->threadPool_L1); + res = pullTpool(gNB->resp_L1, gNB->threadPool_L1); if (res == NULL) { LOG_W(PHY,"L1 RX of previous slot is still being processed. Adding current slot to queue (%d.%d)\n", proc->frame_rx, proc->tti_rx); } From d29e09cdb16c56ab7b03a1b42574a635f1ea3e3f Mon Sep 17 00:00:00 2001 From: Sakthivel Velumani Date: Mon, 8 Feb 2021 23:59:33 +0100 Subject: [PATCH 047/231] Passing tx timestamp through pipeline --- executables/nr-ru.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/executables/nr-ru.c b/executables/nr-ru.c index f3e1857eaf..23454e2d50 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -125,12 +125,14 @@ typedef struct processingData_L1 { int frame_tx; int slot_rx; int slot_tx; + openair0_timestamp timestamp_tx; PHY_VARS_gNB *gNB; } processingData_L1_t; typedef struct processingData_RU { int frame_tx; int slot_tx; + openair0_timestamp timestamp_tx; RU_t *ru; } processingData_RU_t; @@ -1330,7 +1332,7 @@ void ru_tx_func(void *param) { if(!emulate_rf) { // do outgoing fronthaul (south) if needed - if ((ru->fh_north_asynch_in == NULL) && (ru->fh_south_out)) ru->fh_south_out(ru,frame_tx,slot_tx,ru->proc.timestamp_tx); + if ((ru->fh_north_asynch_in == NULL) && (ru->fh_south_out)) ru->fh_south_out(ru,frame_tx,slot_tx,info->timestamp_tx); if (ru->fh_north_out) ru->fh_north_out(ru); } else { @@ -1516,6 +1518,7 @@ void tx_func(void *param) { notifiedFIFO_elt_t *res; syncMsg->frame_tx = frame_tx; syncMsg->slot_tx = slot_tx; + syncMsg->timestamp_tx = info->timestamp_tx; syncMsg->ru = gNB->RU_list[0]; res = tryPullTpool(gNB->resp_RU_tx, gNB->threadPool_RU_tx); @@ -1639,6 +1642,7 @@ void rx_func(void *param) { syncMsg->slot_rx = slot_rx; syncMsg->frame_tx = frame_tx; syncMsg->slot_tx = slot_tx; + syncMsg->timestamp_tx = info->timestamp_tx; if (tx_slot_type == NR_DOWNLINK_SLOT || tx_slot_type == NR_MIXED_SLOT) { res = tryPullTpool(gNB->resp_L1_tx, gNB->threadPool_L1_tx); @@ -1903,6 +1907,7 @@ void *ru_thread( void *param ) { syncMsg->slot_rx = proc->tti_rx; syncMsg->frame_tx = proc->frame_tx; syncMsg->slot_tx = proc->tti_tx; + syncMsg->timestamp_tx = proc->timestamp_tx; // check if previous L1 slot processing is finished res = pullTpool(gNB->resp_L1, gNB->threadPool_L1); From 09230ceb5ef2aa69480c3c7ade8a5a2e3448e620 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Tue, 9 Feb 2021 09:38:23 +0100 Subject: [PATCH 048/231] CI: forgot to add 5G GNB FDD conf file for RF sim test Signed-off-by: Raphael Defosseux --- .../gnb.band66.tm1.106PRB.usrpn300.conf | 284 ++++++++++++++++++ 1 file changed, 284 insertions(+) create mode 100644 ci-scripts/conf_files/gnb.band66.tm1.106PRB.usrpn300.conf diff --git a/ci-scripts/conf_files/gnb.band66.tm1.106PRB.usrpn300.conf b/ci-scripts/conf_files/gnb.band66.tm1.106PRB.usrpn300.conf new file mode 100644 index 0000000000..9e13d493a8 --- /dev/null +++ b/ci-scripts/conf_files/gnb.band66.tm1.106PRB.usrpn300.conf @@ -0,0 +1,284 @@ +Active_gNBs = ( "gNB-Eurecom-5GNRBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +gNBs = +( + { + ////////// Identification parameters: + gNB_ID = 0xe00; + + cell_type = "CELL_MACRO_GNB"; + + gNB_name = "gNB-Eurecom-5GNRBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 1; + + plmn_list = ({mcc = 208; mnc = 93; mnc_length = 2;}); + + tr_s_preference = "local_mac" + + ////////// Physical parameters: + + ssb_SubcarrierOffset = 0; + pdsch_AntennaPorts = 1; + + servingCellConfigCommon = ( + { + #spCellConfigCommon + + physCellId = 0; + +# downlinkConfigCommon + #frequencyInfoDL + # this is 2150 MHz + 43 PRBs@30kHz SCS (same as initial BWP) + absoluteFrequencySSB = 433096; + dl_frequencyBand = 66; + # this is 2150 MHz + dl_absoluteFrequencyPointA = 430000; + #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=0,L=50 (275*(L-1))+RBstart + initialDLBWPlocationAndBandwidth = 13475; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialDLBWPsubcarrierSpacing = 1; + #pdcch-ConfigCommon + initialDLBWPcontrolResourceSetZero = 12; + initialDLBWPsearchSpaceZero = 0; + #pdsch-ConfigCommon + #pdschTimeDomainAllocationList (up to 16 entries) + initialDLBWPk0_0 = 0; + #initialULBWPmappingType + #0=typeA,1=typeB + initialDLBWPmappingType_0 = 0; + #this is SS=1,L=13 + initialDLBWPstartSymbolAndLength_0 = 40; + + initialDLBWPk0_1 = 0; + initialDLBWPmappingType_1 = 0; + #this is SS=2,L=12 + initialDLBWPstartSymbolAndLength_1 = 53; + + initialDLBWPk0_2 = 0; + initialDLBWPmappingType_2 = 0; + #this is SS=1,L=12 + initialDLBWPstartSymbolAndLength_2 = 54; + + initialDLBWPk0_3 = 0; + initialDLBWPmappingType_3 = 0; + #this is SS=1,L=4 + initialDLBWPstartSymbolAndLength_3 = 57; + #uplinkConfigCommon + #frequencyInfoUL + ul_frequencyBand = 66; + ul_absoluteFrequencyPointA = 350000; + #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 = 13475; +# 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 = -118; +#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 = 15; +#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, + # pusch-ConfigCommon (up to 16 elements) + initialULBWPk2_0 = 6; + initialULBWPmappingType_0 = 1 + # this is SS=0 L=11 + initialULBWPstartSymbolAndLength_0 = 55; + + initialULBWPk2_1 = 6; + initialULBWPmappingType_1 = 1; + # this is SS=0 L=12 + initialULBWPstartSymbolAndLength_1 = 69; + + initialULBWPk2_2 = 7; + initialULBWPmappingType_2 = 1; + # this is SS=10 L=4 + initialULBWPstartSymbolAndLength_2 = 52; + 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 = 10; + } + + ); + + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "192.168.12.26"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + + GNB_INTERFACE_NAME_FOR_S1_MME = "eth0"; + GNB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.111/24"; + GNB_INTERFACE_NAME_FOR_S1U = "eth0"; + GNB_IPV4_ADDRESS_FOR_S1U = "192.168.12.111/24"; + GNB_PORT_FOR_S1U = 2152; # Spec 2152 + }; + } +); + +MACRLCs = ( + { + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + } +); + +L1s = ( + { + num_cc = 1; + tr_n_preference = "local_mac"; + } +); + +RUs = ( + { + local_rf = "yes" + nb_tx = 1; + nb_rx = 1; + att_tx = 0; + att_rx = 0; + bands = [7]; + max_pdschReferenceSignalPower = -27; + max_rxgain = 75; + eNB_instances = [0]; + #beamforming 1x4 matrix: + bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000]; + sdr_addrs = "addr=192.168.10.2,mgmt_addr=192.168.10.2,second_addr=192.168.20.2"; + clock_src = "external"; + # if_freq = 3700000000L; + # if_offset = 1000000; + } +); + +THREAD_STRUCT = ( + { + #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" + parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; + #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" + worker_config = "WORKER_ENABLE"; + } +); + + log_config : + { + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + }; + From 28f739bb707c19a935af42ff324adcac1de4efa4 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Tue, 9 Feb 2021 17:50:32 +0100 Subject: [PATCH 049/231] add 10 MHz configuration file for USRP X300 --- .../CONF/gnb.band78.tm1.24PRB.usrpx300.conf | 283 ++++++++++++++++++ 1 file changed, 283 insertions(+) create mode 100644 targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpx300.conf diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpx300.conf new file mode 100644 index 0000000000..b6a0847843 --- /dev/null +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpx300.conf @@ -0,0 +1,283 @@ +Active_gNBs = ( "gNB-Eurecom-5GNRBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +gNBs = +( + { + ////////// Identification parameters: + gNB_ID = 0xe00; + + cell_type = "CELL_MACRO_GNB"; + + gNB_name = "gNB-Eurecom-5GNRBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 1; + + plmn_list = ({mcc = 208; mnc = 93; mnc_length = 2;}); + + tr_s_preference = "local_mac" + + ////////// Physical parameters: + + ssb_SubcarrierOffset = 0; + pdsch_AntennaPorts = 1; + + servingCellConfigCommon = ( + { + #spCellConfigCommon + + physCellId = 0; + +# downlinkConfigCommon + #frequencyInfoDL + # this is 3600 MHz + 43 PRBs@30kHz SCS (same as initial BWP) + absoluteFrequencySSB = 640288; + dl_frequencyBand = 78; + # this is 3600 MHz + dl_absoluteFrequencyPointA = 640000; + #scs-SpecificCarrierList + dl_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + dl_subcarrierSpacing = 1; + dl_carrierBandwidth = 24; + #initialDownlinkBWP + #genericParameters + # this is RBstart=41,L=24 (275*(L-1))+RBstart + initialDLBWPlocationAndBandwidth = 6325; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialDLBWPsubcarrierSpacing = 1; + #pdcch-ConfigCommon + initialDLBWPcontrolResourceSetZero = 0; + initialDLBWPsearchSpaceZero = 0; + #pdsch-ConfigCommon + #pdschTimeDomainAllocationList (up to 16 entries) + initialDLBWPk0_0 = 0; + #initialULBWPmappingType + #0=typeA,1=typeB + initialDLBWPmappingType_0 = 0; + #this is SS=1,L=13 + initialDLBWPstartSymbolAndLength_0 = 40; + + initialDLBWPk0_1 = 0; + initialDLBWPmappingType_1 = 0; + #this is SS=2,L=12 + initialDLBWPstartSymbolAndLength_1 = 53; + + initialDLBWPk0_2 = 0; + initialDLBWPmappingType_2 = 0; + #this is SS=1,L=12 + initialDLBWPstartSymbolAndLength_2 = 54; + + initialDLBWPk0_3 = 0; + initialDLBWPmappingType_3 = 0; + #this is SS=1,L=5 + initialDLBWPstartSymbolAndLength_3 = 57; + + #uplinkConfigCommon + #frequencyInfoUL + ul_frequencyBand = 78; + #scs-SpecificCarrierList + ul_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + ul_subcarrierSpacing = 1; + ul_carrierBandwidth = 24; + pMax = 20; + #initialUplinkBWP + #genericParameters + initialULBWPlocationAndBandwidth = 6325; +# 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 = -118; +#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 = 15; +#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, + + # pusch-ConfigCommon (up to 16 elements) + initialULBWPk2_0 = 6; + initialULBWPmappingType_0 = 1 + # this is SS=0 L=11 + initialULBWPstartSymbolAndLength_0 = 55; + + initialULBWPk2_1 = 6; + initialULBWPmappingType_1 = 1; + # this is SS=0 L=12 + initialULBWPstartSymbolAndLength_1 = 69; + + initialULBWPk2_2 = 7; + initialULBWPmappingType_2 = 1; + # this is SS=10 L=4 + initialULBWPstartSymbolAndLength_2 = 52; + + 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 = 10; + } + + ); + + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "192.168.12.26"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + + GNB_INTERFACE_NAME_FOR_S1_MME = "eth0"; + GNB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.111/24"; + GNB_INTERFACE_NAME_FOR_S1U = "eth0"; + GNB_IPV4_ADDRESS_FOR_S1U = "192.168.12.111/24"; + GNB_PORT_FOR_S1U = 2152; # Spec 2152 + }; + } +); + +MACRLCs = ( + { + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + } +); + +L1s = ( + { + num_cc = 1; + tr_n_preference = "local_mac"; + } +); + +RUs = ( + { + local_rf = "yes" + nb_tx = 1 + nb_rx = 1 + att_tx = 0 + att_rx = 0; + bands = [7]; + max_pdschReferenceSignalPower = -27; + max_rxgain = 114; + eNB_instances = [0]; + #beamforming 1x4 matrix: + bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000]; + sdr_addrs = "type=x300"; + clock_src = "external"; + } +); + +THREAD_STRUCT = ( + { + #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" + parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; + #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" + worker_config = "WORKER_ENABLE"; + } +); + + log_config : + { + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + }; + From b9e99f1e649636a157964c14f9dd77744e190d87 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Tue, 9 Feb 2021 17:51:33 +0100 Subject: [PATCH 050/231] update tx_sample_advance for 10 MHz and USRP X300 Tests with our USRP X300, connected via PCIe, show that tx_sample_advance of 45 is slightly too much. Unfortunately, transmitting the PRACH preamble too early is very bad, slightly too late is no problem. So change this value from 45 to 40. This helps receiving the PRACH preamble reliably. --- targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp index dd29d01fae..ac14633130 100644 --- a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp +++ b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp @@ -1125,7 +1125,7 @@ extern "C" { case 15360000: //openair0_cfg[0].samples_per_packet = 2048; - openair0_cfg[0].tx_sample_advance = 45; + openair0_cfg[0].tx_sample_advance = 40; openair0_cfg[0].tx_bw = 10e6; openair0_cfg[0].rx_bw = 10e6; break; From 75cd4c79d9bc3b5129f7e7137cdc8974fc0552d4 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Tue, 9 Feb 2021 18:09:11 +0100 Subject: [PATCH 051/231] update tx_sample_advance for 40 MHz and USRP X300 (3/4 sampling) Testing RA with OAI gNB and UE both using X300 via PCIe link indicated a value of 15 was way too small. The correct value for this setup seems to be 65. --- targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp index ac14633130..61a742af65 100644 --- a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp +++ b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp @@ -1110,7 +1110,7 @@ extern "C" { case 46080000: //openair0_cfg[0].samples_per_packet = 2048; - openair0_cfg[0].tx_sample_advance = 15; + openair0_cfg[0].tx_sample_advance = 65; openair0_cfg[0].tx_bw = 40e6; openair0_cfg[0].rx_bw = 40e6; break; From 9202c583f5ce1eec93c12b83d218719ba6db86da Mon Sep 17 00:00:00 2001 From: Parminder Singh Date: Wed, 10 Feb 2021 11:10:19 +0100 Subject: [PATCH 052/231] Spaces are corrected, tabs replaced with spaces --- openair1/SIMULATION/NR_PHY/dlsim.c | 12 +++---- openair2/GNB_APP/gnb_config.c | 58 +++++++++++++++--------------- openair2/RRC/NR/nr_rrc_proto.h | 22 ++++++------ 3 files changed, 46 insertions(+), 46 deletions(-) diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 9995a3065d..7e55c8a05a 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -649,12 +649,12 @@ int main(int argc, char **argv) prepare_scd(scd); fill_default_secondaryCellGroup(scc, - scd, - secondaryCellGroup, - 0, - 1, - n_tx, - 0); + scd, + secondaryCellGroup, + 0, + 1, + n_tx, + 0); /* RRC parameter validation for secondaryCellGroup */ fix_scd(scd); diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index d53b109f70..99f1a75ae8 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -294,38 +294,38 @@ void fix_scc(NR_ServingCellConfigCommon_t *scc,uint64_t ssbmap) { void prepare_scd(NR_ServingCellConfig_t *scd) { // Allocate downlink structures - scd->downlinkBWP_ToAddModList = CALLOC(1,sizeof(scd->downlinkBWP_ToAddModList)); + scd->downlinkBWP_ToAddModList = CALLOC(1, sizeof(scd->downlinkBWP_ToAddModList)); // Downlink bandwidth part - NR_BWP_Downlink_t *bwp=calloc(1,sizeof(*bwp)); - bwp->bwp_Id=1; + NR_BWP_Downlink_t *bwp = calloc(1, sizeof(*bwp)); + bwp->bwp_Id = 1; // Allocate downlink dedicated bandwidth part and PDSCH structures - bwp->bwp_Dedicated=calloc(1,sizeof(*bwp->bwp_Dedicated)); - bwp->bwp_Dedicated->pdsch_Config = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config)); + bwp->bwp_Dedicated = calloc(1, sizeof(*bwp->bwp_Dedicated)); + bwp->bwp_Dedicated->pdsch_Config = calloc(1, sizeof(*bwp->bwp_Dedicated->pdsch_Config)); bwp->bwp_Dedicated->pdsch_Config->present = NR_SetupRelease_PDSCH_Config_PR_setup; - bwp->bwp_Dedicated->pdsch_Config->choice.setup = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup)); - bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA)); - bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->present= NR_SetupRelease_DMRS_DownlinkConfig_PR_setup; + bwp->bwp_Dedicated->pdsch_Config->choice.setup = calloc(1, sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup)); + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA = calloc(1, sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA)); + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->present = NR_SetupRelease_DMRS_DownlinkConfig_PR_setup; // Allocate DL DMRS and PTRS configuration - bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup)); + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup = calloc(1, sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup)); NR_DMRS_DownlinkConfig_t *NR_DMRS_DownlinkCfg = bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup; - NR_DMRS_DownlinkCfg->phaseTrackingRS=CALLOC(1,sizeof(*NR_DMRS_DownlinkCfg->phaseTrackingRS)); + NR_DMRS_DownlinkCfg->phaseTrackingRS=CALLOC(1, sizeof(*NR_DMRS_DownlinkCfg->phaseTrackingRS)); NR_DMRS_DownlinkCfg->phaseTrackingRS->present = NR_SetupRelease_PTRS_DownlinkConfig_PR_setup; - NR_DMRS_DownlinkCfg->phaseTrackingRS->choice.setup = CALLOC(1,sizeof(*NR_DMRS_DownlinkCfg->phaseTrackingRS->choice.setup)); + NR_DMRS_DownlinkCfg->phaseTrackingRS->choice.setup = CALLOC(1, sizeof(*NR_DMRS_DownlinkCfg->phaseTrackingRS->choice.setup)); NR_PTRS_DownlinkConfig_t *NR_PTRS_DownlinkCfg = NR_DMRS_DownlinkCfg->phaseTrackingRS->choice.setup; NR_PTRS_DownlinkCfg->frequencyDensity = CALLOC(1, sizeof(NR_PTRS_DownlinkCfg->frequencyDensity)); int *dl_rbs[2]; for (int i=0;i<2;i++) { - dl_rbs[i] = CALLOC(1,sizeof(*dl_rbs[i])); + dl_rbs[i] = CALLOC(1, sizeof(*dl_rbs[i])); *dl_rbs[i] = 0; ASN_SEQUENCE_ADD(&NR_PTRS_DownlinkCfg->frequencyDensity->list, dl_rbs[i]); } NR_PTRS_DownlinkCfg->timeDensity = CALLOC(1, sizeof(NR_PTRS_DownlinkCfg->timeDensity)); int *dl_mcs[3]; for (int i=0;i<3;i++) { - dl_mcs[i] = CALLOC(1,sizeof(*dl_mcs[i])); + dl_mcs[i] = CALLOC(1, sizeof(*dl_mcs[i])); *dl_mcs[i] = 0; ASN_SEQUENCE_ADD(&NR_PTRS_DownlinkCfg->timeDensity->list, dl_mcs[i]); } @@ -337,31 +337,31 @@ void prepare_scd(NR_ServingCellConfig_t *scd) { // Allocate uplink structures scd->uplinkConfig = CALLOC(1, sizeof(NR_UplinkConfig_t)); - scd->uplinkConfig->uplinkBWP_ToAddModList = CALLOC(1,sizeof(scd->uplinkConfig->uplinkBWP_ToAddModList)); + scd->uplinkConfig->uplinkBWP_ToAddModList = CALLOC(1, sizeof(scd->uplinkConfig->uplinkBWP_ToAddModList)); - NR_PUSCH_Config_t *pusch_Config = CALLOC(1,sizeof(*pusch_Config)); + NR_PUSCH_Config_t *pusch_Config = CALLOC(1, sizeof(*pusch_Config)); // Allocate UL DMRS and PTRS structures - pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB = CALLOC(1,sizeof(*pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB)); + pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB = CALLOC(1, sizeof(*pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB)); pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->present = NR_SetupRelease_DMRS_UplinkConfig_PR_setup; - pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup = CALLOC(1,sizeof(*pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup)); + pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup = CALLOC(1, sizeof(*pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup)); NR_DMRS_UplinkConfig_t *NR_DMRS_UplinkConfig = pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup; - NR_DMRS_UplinkConfig->phaseTrackingRS = CALLOC(1,sizeof(*NR_DMRS_UplinkConfig->phaseTrackingRS)); + NR_DMRS_UplinkConfig->phaseTrackingRS = CALLOC(1, sizeof(*NR_DMRS_UplinkConfig->phaseTrackingRS)); NR_DMRS_UplinkConfig->phaseTrackingRS->present = NR_SetupRelease_PTRS_UplinkConfig_PR_setup; - NR_DMRS_UplinkConfig->phaseTrackingRS->choice.setup = CALLOC(1,sizeof(*NR_DMRS_UplinkConfig->phaseTrackingRS->choice.setup)); + NR_DMRS_UplinkConfig->phaseTrackingRS->choice.setup = CALLOC(1, sizeof(*NR_DMRS_UplinkConfig->phaseTrackingRS->choice.setup)); NR_PTRS_UplinkConfig_t *NR_PTRS_UplinkConfig = NR_DMRS_UplinkConfig->phaseTrackingRS->choice.setup; - NR_PTRS_UplinkConfig->transformPrecoderDisabled = CALLOC(1,sizeof(*NR_PTRS_UplinkConfig->transformPrecoderDisabled)); - NR_PTRS_UplinkConfig->transformPrecoderDisabled->frequencyDensity = CALLOC(1,sizeof(*NR_PTRS_UplinkConfig->transformPrecoderDisabled->frequencyDensity)); + NR_PTRS_UplinkConfig->transformPrecoderDisabled = CALLOC(1, sizeof(*NR_PTRS_UplinkConfig->transformPrecoderDisabled)); + NR_PTRS_UplinkConfig->transformPrecoderDisabled->frequencyDensity = CALLOC(1, sizeof(*NR_PTRS_UplinkConfig->transformPrecoderDisabled->frequencyDensity)); int *n_rbs[2]; for (int i=0;i<2;i++) { - n_rbs[i] = CALLOC(1,sizeof(*n_rbs[i])); + n_rbs[i] = CALLOC(1, sizeof(*n_rbs[i])); *n_rbs[i] = 0; ASN_SEQUENCE_ADD(&NR_PTRS_UplinkConfig->transformPrecoderDisabled->frequencyDensity->list, n_rbs[i]); } - NR_PTRS_UplinkConfig->transformPrecoderDisabled->timeDensity = CALLOC(1,sizeof(*NR_PTRS_UplinkConfig->transformPrecoderDisabled->timeDensity)); + NR_PTRS_UplinkConfig->transformPrecoderDisabled->timeDensity = CALLOC(1, sizeof(*NR_PTRS_UplinkConfig->transformPrecoderDisabled->timeDensity)); int *ptrs_mcs[3]; for (int i = 0; i < 3; i++) { - ptrs_mcs[i] = CALLOC(1,sizeof(*ptrs_mcs[i])); + ptrs_mcs[i] = CALLOC(1, sizeof(*ptrs_mcs[i])); *ptrs_mcs[i] = 0; ASN_SEQUENCE_ADD(&NR_PTRS_UplinkConfig->transformPrecoderDisabled->timeDensity->list, ptrs_mcs[i]); } @@ -369,11 +369,11 @@ void prepare_scd(NR_ServingCellConfig_t *scd) { *NR_PTRS_UplinkConfig->transformPrecoderDisabled->resourceElementOffset = 0; // UL bandwidth part - NR_BWP_Uplink_t *ubwp = CALLOC(1,sizeof(*ubwp)); - ubwp->bwp_Id=1; - ubwp->bwp_Dedicated = CALLOC(1,sizeof(*ubwp->bwp_Dedicated)); + NR_BWP_Uplink_t *ubwp = CALLOC(1, sizeof(*ubwp)); + ubwp->bwp_Id = 1; + ubwp->bwp_Dedicated = CALLOC(1, sizeof(*ubwp->bwp_Dedicated)); - ubwp->bwp_Dedicated->pusch_Config = CALLOC(1,sizeof(*ubwp->bwp_Dedicated->pusch_Config)); + ubwp->bwp_Dedicated->pusch_Config = CALLOC(1, sizeof(*ubwp->bwp_Dedicated->pusch_Config)); ubwp->bwp_Dedicated->pusch_Config->present = NR_SetupRelease_PUSCH_Config_PR_setup; ubwp->bwp_Dedicated->pusch_Config->choice.setup = pusch_Config; @@ -398,7 +398,7 @@ void fix_scd(NR_ServingCellConfig_t *scd) { if (scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS) { // If any of the timeDensity values are not set or are out of bounds, PTRS is assumed to be not present for (int i = scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->timeDensity->list.count-1; i >= 0; i--) { - if ((*scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->timeDensity->list.array[i] < 0) + if ((*scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->timeDensity->list.array[i] < 0) || (*scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->timeDensity->list.array[i] > 29)) { LOG_I(RRC, "DL PTRS timeDensity %d not set. Assuming PTRS not present! \n", i); free(scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS); diff --git a/openair2/RRC/NR/nr_rrc_proto.h b/openair2/RRC/NR/nr_rrc_proto.h index 8e8e4be609..bcb8f79542 100644 --- a/openair2/RRC/NR/nr_rrc_proto.h +++ b/openair2/RRC/NR/nr_rrc_proto.h @@ -78,19 +78,19 @@ void fill_default_coresetZero(NR_ControlResourceSet_t *coreset0, NR_ServingCellC void fill_default_searchSpaceZero(NR_SearchSpace_t *ss0); void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellconfigcommon, - NR_ServingCellConfig_t *servingcellconfigdedicated, - NR_CellGroupConfig_t *secondaryCellGroup, - int scg_id, - int servCellIndex, - int n_physical_antenna_ports, - int initial_csi_index); + NR_ServingCellConfig_t *servingcellconfigdedicated, + NR_CellGroupConfig_t *secondaryCellGroup, + int scg_id, + int servCellIndex, + int n_physical_antenna_ports, + int initial_csi_index); void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon, - NR_ServingCellConfig_t *servingcellconfigdedicated, - NR_RRCReconfiguration_IEs_t *reconfig, - NR_CellGroupConfig_t *secondaryCellGroup, - int n_physical_antenna_ports, - int initial_csi_index); + NR_ServingCellConfig_t *servingcellconfigdedicated, + NR_RRCReconfiguration_IEs_t *reconfig, + NR_CellGroupConfig_t *secondaryCellGroup, + int n_physical_antenna_ports, + int initial_csi_index); void fill_default_rbconfig(NR_RadioBearerConfig_t *rbconfig); From f59a9360f57f2c71ed19cf1513c896070326d2cb Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Wed, 10 Feb 2021 13:43:35 +0100 Subject: [PATCH 053/231] Apply 2 suggestion(s) to 1 file(s) --- ci-scripts/runTestOnVM.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ci-scripts/runTestOnVM.sh b/ci-scripts/runTestOnVM.sh index 4fc740235e..f818685049 100755 --- a/ci-scripts/runTestOnVM.sh +++ b/ci-scripts/runTestOnVM.sh @@ -2215,7 +2215,8 @@ function run_test_on_vm { local try_cnt=0 NR_STATUS=0 - while [ $try_cnt -lt 1 ] + while [ $try_cnt -lt 5 ] #5 because it hardly succeed within CI + do SYNC_STATUS=0 RA_STATUS=0 @@ -2295,7 +2296,7 @@ function run_test_on_vm { fi try_cnt=0 - while [ $try_cnt -lt 1 ] + while [ $try_cnt -lt 4 ] do rm -f $ARCHIVES_LOC/${TMODE}_${PRB}prb_${CN_CONFIG}_gnb.log $ARCHIVES_LOC/${TMODE}_${PRB}prb_${CN_CONFIG}_ue.log rm -f $ARCHIVES_LOC/${TMODE}_${PRB}prb_${CN_CONFIG}_ping_gnb_from_nrue.log $ARCHIVES_LOC/${TMODE}_${PRB}prb_${CN_CONFIG}_ping_from_gnb_nrue.log From 2e0ed038d3471ade1fa58ecb259dafceee0b29ea Mon Sep 17 00:00:00 2001 From: Sakthivel Velumani Date: Wed, 10 Feb 2021 15:45:40 +0100 Subject: [PATCH 054/231] Using only one threadPool for nr-softmodem --- executables/nr-gnb.c | 24 ++-- executables/nr-ru.c | 104 +++++------------- openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c | 2 +- openair1/PHY/defs_gNB.h | 5 +- openair1/SCHED_NR/phy_procedures_nr_gNB.c | 4 +- 5 files changed, 42 insertions(+), 97 deletions(-) diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index efc1b31c51..c36db7b1ef 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -870,7 +870,7 @@ void init_gNB_proc(int inst) { pthread_cond_init(&sync_phy_proc.cond_phy_proc_tx, NULL); sync_phy_proc.phy_proc_CC_id = 0; - gNB->threadPool_ulsch = (tpool_t*)malloc(sizeof(tpool_t)); + gNB->threadPool = (tpool_t*)malloc(sizeof(tpool_t)); gNB->respDecode = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t)); int numCPU = sysconf(_SC_NPROCESSORS_ONLN); uint32_t num_threads_pusch; @@ -884,7 +884,7 @@ void init_gNB_proc(int inst) { sprintf(ul_pool+2+s_offset,",-1"); s_offset += 3; } - initTpool(ul_pool, gNB->threadPool_ulsch, false); + initTpool(ul_pool, gNB->threadPool, false); initNotifiedFIFO(gNB->respDecode); } @@ -893,8 +893,7 @@ void init_gNB_Tpool(int inst) { gNB = RC.gNB[inst]; // ULSCH decoding threadpool - gNB->threadPool_ulsch = (tpool_t*)malloc(sizeof(tpool_t)); - gNB->respDecode = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t)); + gNB->threadPool = (tpool_t*)malloc(sizeof(tpool_t)); int numCPU = sysconf(_SC_NPROCESSORS_ONLN); uint32_t num_threads_pusch; paramdef_t PUSCHThreads[] = NUM_THREADS_DESC; @@ -907,26 +906,21 @@ void init_gNB_Tpool(int inst) { sprintf(ul_pool+2+s_offset,",-1"); s_offset += 3; } - initTpool(ul_pool, gNB->threadPool_ulsch, false); + initTpool(ul_pool, gNB->threadPool, false); + // ULSCH decoder result FIFO + gNB->respDecode = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t)); initNotifiedFIFO(gNB->respDecode); - // L1 RX threadpool - gNB->threadPool_L1 = (tpool_t*)malloc(sizeof(tpool_t)); + // L1 RX result FIFO gNB->resp_L1 = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t)); - initTpool("-1", gNB->threadPool_L1, false); initNotifiedFIFO(gNB->resp_L1); - pushNotifiedFIFO_nothreadSafe(gNB->resp_L1, newNotifiedFIFO_elt(20, 0,NULL,NULL)); - // L1 TX threadpool - gNB->threadPool_L1_tx = (tpool_t*)malloc(sizeof(tpool_t)); + // L1 TX result FIFO gNB->resp_L1_tx = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t)); - initTpool("-1,-1,-1",gNB->threadPool_L1_tx, false); initNotifiedFIFO(gNB->resp_L1_tx); - // RU TX threadpool - gNB->threadPool_RU_tx = (tpool_t*)malloc(sizeof(tpool_t)); + // RU TX result FIFO gNB->resp_RU_tx = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t)); - initTpool("-1",gNB->threadPool_RU_tx, false); initNotifiedFIFO(gNB->resp_RU_tx); } diff --git a/executables/nr-ru.c b/executables/nr-ru.c index 23454e2d50..dec62469da 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -1513,20 +1513,15 @@ void tx_func(void *param) { phy_procedures_gNB_TX(gNB, frame_tx,slot_tx, 1); // start FH TX processing - notifiedFIFO_elt_t *msg = newNotifiedFIFO_elt(sizeof(processingData_RU_t),0,gNB->resp_RU_tx,ru_tx_func); - processingData_RU_t *syncMsg = (processingData_RU_t *)NotifiedFifoData(msg); notifiedFIFO_elt_t *res; + res = pullTpool(gNB->resp_RU_tx, gNB->threadPool); + processingData_RU_t *syncMsg = (processingData_RU_t *)NotifiedFifoData(res); syncMsg->frame_tx = frame_tx; syncMsg->slot_tx = slot_tx; syncMsg->timestamp_tx = info->timestamp_tx; syncMsg->ru = gNB->RU_list[0]; - - res = tryPullTpool(gNB->resp_RU_tx, gNB->threadPool_RU_tx); - if (res == NULL) { - LOG_W(PHY,"RU TX of previous slot is still being processed. Adding current slot to queue (%d.%d)\n", frame_tx, slot_tx); - } - msg->key = slot_tx; - pushTpool(gNB->threadPool_RU_tx, msg); + res->key = slot_tx; + pushTpool(gNB->threadPool, res); } void rx_func(void *param) { @@ -1634,23 +1629,19 @@ void rx_func(void *param) { //stop_meas( &softmodem_stats_rxtx_sf ); LOG_D(PHY,"%s() Exit proc[rx:%d%d tx:%d%d]\n", __FUNCTION__, frame_rx, slot_rx, frame_tx, slot_tx); - notifiedFIFO_elt_t *msg = newNotifiedFIFO_elt(sizeof(processingData_L1_t),0,gNB->resp_L1_tx,tx_func); - processingData_L1_t *syncMsg = (processingData_L1_t *)NotifiedFifoData(msg); notifiedFIFO_elt_t *res; - syncMsg->gNB = gNB; - syncMsg->frame_rx = frame_rx; - syncMsg->slot_rx = slot_rx; - syncMsg->frame_tx = frame_tx; - syncMsg->slot_tx = slot_tx; - syncMsg->timestamp_tx = info->timestamp_tx; if (tx_slot_type == NR_DOWNLINK_SLOT || tx_slot_type == NR_MIXED_SLOT) { - res = tryPullTpool(gNB->resp_L1_tx, gNB->threadPool_L1_tx); - if (res == NULL) { - LOG_W(PHY,"L1 TX of previous slot is still being processed. Adding current slot to queue (%d.%d)\n", frame_tx, slot_tx); - } - msg->key = slot_tx; - pushTpool(gNB->threadPool_L1_tx, msg); + res = pullTpool(gNB->resp_L1_tx, gNB->threadPool); + processingData_L1_t *syncMsg = (processingData_L1_t *)NotifiedFifoData(res); + syncMsg->gNB = gNB; + syncMsg->frame_rx = frame_rx; + syncMsg->slot_rx = slot_rx; + syncMsg->frame_tx = frame_tx; + syncMsg->slot_tx = slot_tx; + syncMsg->timestamp_tx = info->timestamp_tx; + res->key = slot_tx; + pushTpool(gNB->threadPool, res); } #if 0 @@ -1703,9 +1694,7 @@ void *ru_thread( void *param ) { int ret; int slot = fp->slots_per_frame-1; int frame = 1023; - char filename[40], threadname[40]; - int print_frame = 8; - int i = 0; + char threadname[40]; int aa; nfapi_nr_config_request_scf_t *cfg = &ru->config; @@ -1766,8 +1755,13 @@ void *ru_thread( void *param ) { wait_sync("ru_thread"); notifiedFIFO_elt_t *msg = newNotifiedFIFO_elt(sizeof(processingData_L1_t),0,gNB->resp_L1,rx_func); - processingData_L1_t *syncMsg = (processingData_L1_t *)NotifiedFifoData(msg); + notifiedFIFO_elt_t *msgL1Tx = newNotifiedFIFO_elt(sizeof(processingData_L1_t),0,gNB->resp_L1_tx,tx_func); + notifiedFIFO_elt_t *msgRUTx = newNotifiedFIFO_elt(sizeof(processingData_L1_t),0,gNB->resp_RU_tx,ru_tx_func); + processingData_L1_t *syncMsg; notifiedFIFO_elt_t *res; + pushNotifiedFIFO(gNB->resp_L1,msg); // to unblock the process in the beginning + pushNotifiedFIFO(gNB->resp_L1_tx,msgL1Tx); // to unblock the process in the beginning + pushNotifiedFIFO(gNB->resp_RU_tx,msgRUTx); // to unblock the process in the beginning if(!emulate_rf) { // Start RF device if any @@ -1902,61 +1896,17 @@ void *ru_thread( void *param ) { } // At this point, all information for subframe has been received on FH interface + res = pullTpool(gNB->resp_L1, gNB->threadPool); + syncMsg = (processingData_L1_t *)NotifiedFifoData(res); syncMsg->gNB = gNB; syncMsg->frame_rx = proc->frame_rx; syncMsg->slot_rx = proc->tti_rx; syncMsg->frame_tx = proc->frame_tx; syncMsg->slot_tx = proc->tti_tx; syncMsg->timestamp_tx = proc->timestamp_tx; + res->key = proc->tti_rx; + pushTpool(gNB->threadPool, res); - // check if previous L1 slot processing is finished - res = pullTpool(gNB->resp_L1, gNB->threadPool_L1); - if (res == NULL) { - LOG_W(PHY,"L1 RX of previous slot is still being processed. Adding current slot to queue (%d.%d)\n", proc->frame_rx, proc->tti_rx); - } - msg->key = proc->tti_rx; - pushTpool(gNB->threadPool_L1, msg); - - if(get_thread_parallel_conf() == PARALLEL_SINGLE_THREAD || ru->num_gNB==0) { - // do TX front-end processing if needed (precoding and/or IDFTs) - if (ru->feptx_prec) ru->feptx_prec(ru,proc->frame_tx,proc->tti_tx); - - // do OFDM with/without TX front-end processing if needed - if ((ru->fh_north_asynch_in == NULL) && (ru->feptx_ofdm)) ru->feptx_ofdm(ru,proc->frame_tx,proc->tti_tx); - - if(!emulate_rf) { - // do outgoing fronthaul (south) if needed - if ((ru->fh_north_asynch_in == NULL) && (ru->fh_south_out)) ru->fh_south_out(ru,proc->frame_tx,proc->tti_tx,proc->timestamp_tx); - - if (ru->fh_north_out) ru->fh_north_out(ru); - } else { - if(proc->frame_tx == print_frame) { - for (i=0; inb_tx; i++) { - sprintf(filename,"tx%ddataF_frame%d_sl%d.m", i, print_frame, proc->tti_tx); - LOG_M(filename,"txdataF_frame",&ru->common.txdataF_BF[i][0],fp->samples_per_slot_wCP, 1, 1); - - if(proc->tti_tx == 9) { - sprintf(filename,"tx%ddata_frame%d.m", i, print_frame); - LOG_M(filename,"txdata_frame",&ru->common.txdata[i][0],fp->samples_per_frame, 1, 1); - sprintf(filename,"tx%ddata_frame%d.dat", i, print_frame); - FILE *output_fd = fopen(filename,"w"); - - if (output_fd) { - fwrite(&ru->common.txdata[i][0], - sizeof(int32_t), - fp->samples_per_frame, - output_fd); - fclose(output_fd); - } else { - LOG_E(PHY,"Cannot write to file %s\n",filename); - } - }//if(proc->tti_tx == 9) - }//for (i=0; inb_tx; i++) - }//if(proc->frame_tx == print_frame) - }//else emulate_rf - - proc->emulate_rf_busy = 0; - }//if(get_thread_parallel_conf() == PARALLEL_SINGLE_THREAD) } printf( "Exiting ru_thread \n"); @@ -1967,6 +1917,10 @@ void *ru_thread( void *param ) { else LOG_I(PHY,"RU %d rf device stopped\n",ru->idx); } + delNotifiedFIFO_elt(msg); + delNotifiedFIFO_elt(msgL1Tx); + delNotifiedFIFO_elt(msgRUTx); + ru_thread_status = 0; return &ru_thread_status; } diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c index b9cf21c04c..d990176d79 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c @@ -640,7 +640,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, rdata->offset = offset; rdata->ulsch = ulsch; rdata->ulsch_id = UE_id; - pushTpool(phy_vars_gNB->threadPool_ulsch,req); + pushTpool(phy_vars_gNB->threadPool,req); phy_vars_gNB->nbDecode++; LOG_D(PHY,"Added a block to decode, in pipe: %d\n",phy_vars_gNB->nbDecode); r_offset += E; diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index ed9c992173..440cfc7a69 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -835,10 +835,7 @@ typedef struct PHY_VARS_gNB_s { notifiedFIFO_t *resp_L1; notifiedFIFO_t *resp_L1_tx; notifiedFIFO_t *resp_RU_tx; - tpool_t *threadPool_ulsch; - tpool_t *threadPool_L1; - tpool_t *threadPool_L1_tx; - tpool_t *threadPool_RU_tx; + tpool_t *threadPool; int nbDecode; } PHY_VARS_gNB; diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index ea8b0370f9..6b5c1a9b22 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -243,7 +243,7 @@ void nr_postDecode(PHY_VARS_gNB *gNB, notifiedFIFO_elt_t *req) { } else { if ( rdata->nbSegments != ulsch_harq->processedSegments ) { - int nb=abortTpool(gNB->threadPool_ulsch, req->key); + int nb=abortTpool(gNB->threadPool, req->key); nb+=abortNotifiedFIFO(gNB->respDecode, req->key); gNB->nbDecode-=nb; LOG_D(PHY,"uplink segment error %d/%d, aborted %d segments\n",rdata->segment_r,rdata->nbSegments, nb); @@ -353,7 +353,7 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH G); while (gNB->nbDecode > 0) { - notifiedFIFO_elt_t *req=pullTpool(gNB->respDecode, gNB->threadPool_ulsch); + notifiedFIFO_elt_t *req=pullTpool(gNB->respDecode, gNB->threadPool); nr_postDecode(gNB, req); delNotifiedFIFO_elt(req); } From 7854133bc2f573d574b49c83a52341d2722f13fc Mon Sep 17 00:00:00 2001 From: Sakthivel Velumani Date: Wed, 10 Feb 2021 22:00:09 +0100 Subject: [PATCH 055/231] Removing some of the old pthreads Leaving ru_thread and L1 stats thread --- executables/nr-gnb.c | 700 +++------------------------------ executables/nr-ru.c | 642 ------------------------------ executables/softmodem-common.h | 4 + openair1/PHY/defs_RU.h | 6 + openair1/PHY/defs_gNB.h | 9 + 5 files changed, 71 insertions(+), 1290 deletions(-) diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index c36db7b1ef..a23a8a4a5d 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -81,7 +81,7 @@ #include "s1ap_eNB.h" #include "SIMULATION/ETH_TRANSPORT/proto.h" - +#include #include "T.h" @@ -111,30 +111,15 @@ time_stats_t softmodem_stats_rxtx_sf; // total tx time time_stats_t nfapi_meas; // total tx time time_stats_t softmodem_stats_rx_sf; // total rx time -/* mutex, cond and variable to serialize phy proc TX calls - * (this mechanism may be relaxed in the future for better - * performances) - */ -static struct { - pthread_mutex_t mutex_phy_proc_tx; - pthread_cond_t cond_phy_proc_tx; - volatile uint8_t phy_proc_CC_id; -} sync_phy_proc; - extern double cpuf; void init_gNB(int,int); void stop_gNB(int nb_inst); -int wakeup_txfh(PHY_VARS_gNB *gNB, gNB_L1_rxtx_proc_t *proc, int frame_tx, int slot_tx, uint64_t timestamp_tx); -int wakeup_tx(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int frame_tx, int slot_tx, uint64_t timestamp_tx); #include "executables/thread-common.h" //extern PARALLEL_CONF_t get_thread_parallel_conf(void); //extern WORKER_CONF_t get_thread_worker_conf(void); - -void wakeup_prach_gNB(PHY_VARS_gNB *gNB, RU_t *ru, int frame, int subframe); - extern uint8_t nfapi_mode; extern void oai_subframe_ind(uint16_t sfn, uint16_t sf); extern void add_subframe(uint16_t *frameP, uint16_t *subframeP, int offset); @@ -142,41 +127,42 @@ extern void add_subframe(uint16_t *frameP, uint16_t *subframeP, int offset); //#define TICK_TO_US(ts) (ts.diff) #define TICK_TO_US(ts) (ts.trials==0?0:ts.diff/ts.trials) -static inline int rxtx(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int frame_tx, int slot_tx, char *thread_name) { +extern void init_td_thread(PHY_VARS_gNB *); +extern void init_te_thread(PHY_VARS_gNB *); +void tx_func(void *param) { + + processingData_L1_t *info = (processingData_L1_t *) param; + PHY_VARS_gNB *gNB = info->gNB; + int frame_tx = info->frame_tx; + int slot_tx = info->slot_tx; + + phy_procedures_gNB_TX(gNB, frame_tx,slot_tx, 1); + + // start FH TX processing + notifiedFIFO_elt_t *res; + res = pullTpool(gNB->resp_RU_tx, gNB->threadPool); + processingData_RU_t *syncMsg = (processingData_RU_t *)NotifiedFifoData(res); + syncMsg->frame_tx = frame_tx; + syncMsg->slot_tx = slot_tx; + syncMsg->timestamp_tx = info->timestamp_tx; + syncMsg->ru = gNB->RU_list[0]; + res->key = slot_tx; + pushTpool(gNB->threadPool, res); +} + +void rx_func(void *param) { + + processingData_L1_t *info = (processingData_L1_t *) param; + PHY_VARS_gNB *gNB = info->gNB; + int frame_rx = info->frame_rx; + int slot_rx = info->slot_rx; + int frame_tx = info->frame_tx; + int slot_tx = info->slot_tx; sl_ahead = sf_ahead*gNB->frame_parms.slots_per_subframe; nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config; - start_meas(&softmodem_stats_rxtx_sf); - - // ******************************************************************* - // NFAPI not yet supported for NR - this code has to be revised - if (nfapi_mode == 1) { - // I am a PNF and I need to let nFAPI know that we have a (sub)frame tick - //add_subframe(&frame, &subframe, 4); - //oai_subframe_ind(proc->frame_tx, proc->subframe_tx); - //LOG_D(PHY, "oai_subframe_ind(frame:%u, subframe:%d) - NOT CALLED ********\n", frame, subframe); - start_meas(&nfapi_meas); - oai_subframe_ind(frame_rx, slot_rx); - stop_meas(&nfapi_meas); - - /*if (gNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus|| - gNB->UL_INFO.harq_ind.harq_indication_body.number_of_harqs || - gNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs || - gNB->UL_INFO.rach_ind.number_of_pdus || - gNB->UL_INFO.cqi_ind.number_of_cqis - ) { - LOG_D(PHY, "UL_info[rx_ind:%05d:%d harqs:%05d:%d crcs:%05d:%d rach_pdus:%0d.%d:%d cqis:%d] RX:%04d%d TX:%04d%d \n", - NFAPI_SFNSF2DEC(gNB->UL_INFO.rx_ind.sfn_sf), gNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus, - NFAPI_SFNSF2DEC(gNB->UL_INFO.harq_ind.sfn_sf), gNB->UL_INFO.harq_ind.harq_indication_body.number_of_harqs, - NFAPI_SFNSF2DEC(gNB->UL_INFO.crc_ind.sfn_sf), gNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs, - gNB->UL_INFO.rach_ind.sfn, gNB->UL_INFO.rach_ind.slot,gNB->UL_INFO.rach_ind.number_of_pdus, - gNB->UL_INFO.cqi_ind.number_of_cqis, - frame_rx, slot_rx, - frame_tx, slot_tx); - }*/ - } - // **************************************** + //start_meas(&softmodem_stats_rxtx_sf); T(T_GNB_PHY_DL_TICK, T_INT(gNB->Mod_id), T_INT(frame_tx), T_INT(slot_tx)); @@ -233,12 +219,6 @@ static inline int rxtx(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int frame_t rnti_to_remove_count = 0; if (pthread_mutex_unlock(&rnti_to_remove_mutex)) exit(1); - /* - // if this is IF5 or 3GPP_gNB - if (gNB && gNB->RU_list && gNB->RU_list[0] && gNB->RU_list[0]->function < NGFI_RAU_IF4p5) { - wakeup_prach_gNB(gNB,NULL,proc->frame_rx,proc->slot_rx); - } - */ // Call the scheduler pthread_mutex_lock(&gNB->UL_INFO_mutex); @@ -273,21 +253,24 @@ static inline int rxtx(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int frame_t if (oai_exit) return(-1); - // ***************************************** - // TX processing for subframe n+sf_ahead - // run PHY TX procedures the one after the other for all CCs to avoid race conditions - // (may be relaxed in the future for performance reasons) - // ***************************************** + //stop_meas( &softmodem_stats_rxtx_sf ); + LOG_D(PHY,"%s() Exit proc[rx:%d%d tx:%d%d]\n", __FUNCTION__, frame_rx, slot_rx, frame_tx, slot_tx); + + notifiedFIFO_elt_t *res; if (tx_slot_type == NR_DOWNLINK_SLOT || tx_slot_type == NR_MIXED_SLOT) { - - if(get_thread_parallel_conf() != PARALLEL_RU_L1_TRX_SPLIT) { - phy_procedures_gNB_TX(gNB, frame_tx,slot_tx, 1); - } + res = pullTpool(gNB->resp_L1_tx, gNB->threadPool); + processingData_L1_t *syncMsg = (processingData_L1_t *)NotifiedFifoData(res); + syncMsg->gNB = gNB; + syncMsg->frame_rx = frame_rx; + syncMsg->slot_rx = slot_rx; + syncMsg->frame_tx = frame_tx; + syncMsg->slot_tx = slot_tx; + syncMsg->timestamp_tx = info->timestamp_tx; + res->key = slot_tx; + pushTpool(gNB->threadPool, res); } - - stop_meas( &softmodem_stats_rxtx_sf ); - LOG_D(PHY,"%s() Exit proc[rx:%d%d tx:%d%d]\n", __FUNCTION__, frame_rx, slot_rx, frame_tx, slot_tx); + #if 0 LOG_D(PHY, "rxtx:%lld nfapi:%lld phy:%lld tx:%lld rx:%lld prach:%lld ofdm:%lld ", softmodem_stats_rxtx_sf.diff_now, nfapi_meas.diff_now, @@ -327,466 +310,7 @@ static inline int rxtx(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int frame_t TICK_TO_US(gNB->ulsch_tc_intl2_stats) ); #endif - return(0); } - -static void *gNB_L1_thread_tx(void *param) { - PHY_VARS_gNB *gNB = (PHY_VARS_gNB *)param; - gNB_L1_proc_t *gNB_proc = &gNB->proc; - gNB_L1_rxtx_proc_t *L1_proc_tx = &gNB_proc->L1_proc_tx; - //PHY_VARS_gNB *gNB = RC.gNB[0][proc->CC_id]; - char thread_name[100]; - - sprintf(thread_name,"gNB_L1_thread_tx\n"); - - while (!oai_exit) { - if (wait_on_condition(&L1_proc_tx->mutex,&L1_proc_tx->cond,&L1_proc_tx->instance_cnt,thread_name)<0) break; - - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_PROC_RXTX1, 1 ); - - if (oai_exit) break; - - // ***************************************** - // TX processing for subframe n+4 - // run PHY TX procedures the one after the other for all CCs to avoid race conditions - // (may be relaxed in the future for performance reasons) - // ***************************************** - int frame_tx = L1_proc_tx->frame_tx; - int slot_tx = L1_proc_tx->slot_tx; - uint64_t timestamp_tx = L1_proc_tx->timestamp_tx; - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SLOT_NUMBER_TX1_GNB,slot_tx); - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX1_GNB,frame_tx); - phy_procedures_gNB_TX(gNB, frame_tx,slot_tx, 1); - - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_WAKEUP_TXFH, 1 ); - pthread_mutex_lock( &L1_proc_tx->mutex ); - L1_proc_tx->instance_cnt = -1; - - // the thread can now be woken up - if (pthread_cond_signal(&L1_proc_tx->cond) != 0) { - LOG_E( PHY, "[gNB] ERROR pthread_cond_signal for gNB TXnp4 thread\n"); - exit_fun( "ERROR pthread_cond_signal" ); - } - pthread_mutex_unlock(&L1_proc_tx->mutex); - - wakeup_txfh(gNB,L1_proc_tx,frame_tx,slot_tx,timestamp_tx); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_WAKEUP_TXFH, 0 ); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_PROC_RXTX1, 0 ); - } - - return 0; -} - -/*! - * \brief The RX UE-specific and TX thread of gNB. - * \param param is a \ref gNB_L1_proc_t structure which contains the info what to process. - * \returns a pointer to an int. The storage is not on the heap and must not be freed. - */ - -static void *gNB_L1_thread( void *param ) { - static int gNB_thread_rxtx_status; - PHY_VARS_gNB *gNB = (PHY_VARS_gNB *)param; - gNB_L1_proc_t *gNB_proc = &gNB->proc; - gNB_L1_rxtx_proc_t *L1_proc = &gNB_proc->L1_proc; - //PHY_VARS_gNB *gNB = RC.gNB[0][proc->CC_id]; - char thread_name[100]; - // set default return value - // set default return value - gNB_thread_rxtx_status = 0; - - sprintf(thread_name,"gNB_L1_thread"); - - - while (!oai_exit) { - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_PROC_RXTX0, 0 ); - if (wait_on_condition(&L1_proc->mutex,&L1_proc->cond,&L1_proc->instance_cnt,thread_name)<0) break; - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_PROC_RXTX0, 1 ); - - int frame_rx = L1_proc->frame_rx; - int slot_rx = L1_proc->slot_rx; - int frame_tx = L1_proc->frame_tx; - int slot_tx = L1_proc->slot_tx; - uint64_t timestamp_tx = L1_proc->timestamp_tx; - - - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SLOT_NUMBER_TX0_GNB,slot_tx); - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SLOT_NUMBER_RX0_GNB,slot_rx); - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_GNB,frame_tx); - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX0_GNB,frame_rx); - - if (oai_exit) break; - - if (gNB->CC_id==0) { - if (rxtx(gNB,frame_rx,slot_rx,frame_tx,slot_tx,thread_name) < 0) break; - } - - if (release_thread(&L1_proc->mutex,&L1_proc->instance_cnt,thread_name)<0) break; - - if(get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT) wakeup_tx(gNB,frame_rx,slot_rx,frame_tx,slot_tx,timestamp_tx); - else if(get_thread_parallel_conf() == PARALLEL_RU_L1_SPLIT) wakeup_txfh(gNB,L1_proc,frame_tx,slot_tx,timestamp_tx); - } // while !oai_exit - - LOG_D(PHY, " *** Exiting gNB thread RXn_TXnp4\n"); - gNB_thread_rxtx_status = 0; - return &gNB_thread_rxtx_status; -} - - -#if 0 -// Wait for gNB application initialization to be complete (gNB registration to MME) -static void wait_system_ready (char *message, volatile int *start_flag) { - static char *indicator[] = {". ", ".. ", "... ", ".... ", ".....", - " ....", " ...", " ..", " .", " " - }; - int i = 0; - - while ((!oai_exit) && (*start_flag == 0)) { - LOG_N(EMU, message, indicator[i]); - fflush(stdout); - i = (i + 1) % (sizeof(indicator) / sizeof(indicator[0])); - usleep(200000); - } - - LOG_D(EMU,"\n"); -} -#endif - - - - - -void gNB_top(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, char *string, struct RU_t_s *ru) { - gNB_L1_proc_t *proc = &gNB->proc; - gNB_L1_rxtx_proc_t *L1_proc = &proc->L1_proc; - NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms; - RU_proc_t *ru_proc=&ru->proc; - proc->frame_rx = frame_rx; - proc->slot_rx = slot_rx; - sl_ahead = sf_ahead*fp->slots_per_subframe; - - if (!oai_exit) { - T(T_ENB_MASTER_TICK, T_INT(0), T_INT(proc->frame_rx), T_INT(proc->slot_rx)); - L1_proc->timestamp_tx = ru_proc->timestamp_rx + (sf_ahead*fp->samples_per_subframe); - L1_proc->frame_rx = ru_proc->frame_rx; - L1_proc->slot_rx = ru_proc->tti_rx; - L1_proc->frame_tx = (L1_proc->slot_rx > (fp->slots_per_frame-1-(fp->slots_per_subframe*sf_ahead))) ? (L1_proc->frame_rx+1)&1023 : L1_proc->frame_rx; - L1_proc->slot_tx = (L1_proc->slot_rx + (fp->slots_per_subframe*sf_ahead))%fp->slots_per_frame; - - if (rxtx(gNB,L1_proc->frame_rx,L1_proc->slot_rx,L1_proc->frame_tx,L1_proc->slot_tx,string) < 0) LOG_E(PHY,"gNB %d CC_id %d failed during execution\n",gNB->Mod_id,gNB->CC_id); - - ru_proc->timestamp_tx = L1_proc->timestamp_tx; - ru_proc->tti_tx = L1_proc->slot_tx; - ru_proc->frame_tx = L1_proc->frame_tx; - } -} - -int wakeup_txfh(PHY_VARS_gNB *gNB,gNB_L1_rxtx_proc_t *proc,int frame_tx,int slot_tx,uint64_t timestamp_tx) { - - RU_t *ru; - RU_proc_t *ru_proc; - - int waitret = 0, ret = 0, time_ns = 1000*1000; - struct timespec now, abstime; - // note this should depend on the numerology used by the TX L1 thread, set here for 500us slot time - // note this should depend on the numerology used by the TX L1 thread, set here for 500us slot time - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GAIN_CONTROL,1); - time_ns = time_ns/gNB->frame_parms.slots_per_subframe; - AssertFatal((ret = pthread_mutex_lock(&proc->mutex_RUs_tx))==0,"mutex_lock returns %d\n",ret); - while (proc->instance_cnt_RUs < 0) { - clock_gettime(CLOCK_REALTIME, &now); - abstime.tv_sec = now.tv_sec; - abstime.tv_nsec = now.tv_nsec + time_ns; - - if (abstime.tv_nsec >= 1000*1000*1000) { - abstime.tv_nsec -= 1000*1000*1000; - abstime.tv_sec += 1; - } - if((waitret = pthread_cond_timedwait(&proc->cond_RUs,&proc->mutex_RUs_tx,&abstime)) == 0) break; // this unlocks mutex_rxtx while waiting and then locks it again - } - proc->instance_cnt_RUs = -1; - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX0_UE,proc->instance_cnt_RUs); - AssertFatal((ret = pthread_mutex_unlock(&proc->mutex_RUs_tx))==0,"mutex_unlock returns %d\n",ret); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GAIN_CONTROL,0); - - if (waitret == ETIMEDOUT) { - LOG_W(PHY,"Dropping TX slot (%d.%d) because FH is blocked more than 1 slot times (500us)\n",frame_tx,slot_tx); - - AssertFatal((ret=pthread_mutex_lock(&gNB->proc.mutex_RU_tx))==0,"mutex_lock returns %d\n",ret); - gNB->proc.RU_mask_tx = 0; - AssertFatal((ret=pthread_mutex_unlock(&gNB->proc.mutex_RU_tx))==0,"mutex_unlock returns %d\n",ret); - AssertFatal((ret=pthread_mutex_lock(&proc->mutex_RUs_tx))==0,"mutex_lock returns %d\n",ret); - proc->instance_cnt_RUs = 0; - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX0_UE,proc->instance_cnt_RUs); - AssertFatal((ret=pthread_mutex_unlock(&proc->mutex_RUs_tx))==0,"mutex_unlock returns %d\n",ret); - - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_UE,1); - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_UE,0); - - return(-1); - } - - for(int i=0; inum_RU; i++) - { - ru = gNB->RU_list[i]; - ru_proc = &ru->proc; - - - if (ru_proc->instance_cnt_gNBs == 0) { - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST_UE, 1); - LOG_E(PHY,"Frame %d, subframe %d: TX FH thread busy, dropping Frame %d, subframe %d\n", ru_proc->frame_tx, ru_proc->tti_tx, proc->frame_rx, proc->slot_rx); - AssertFatal((ret=pthread_mutex_lock(&gNB->proc.mutex_RU_tx))==0,"mutex_lock returns %d\n",ret); - gNB->proc.RU_mask_tx = 0; - AssertFatal((ret=pthread_mutex_unlock(&gNB->proc.mutex_RU_tx))==0,"mutex_unlock returns %d\n",ret); - - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST_UE, 0); - return(-1); - } - AssertFatal((ret = pthread_mutex_lock(&ru_proc->mutex_gNBs))==0,"ERROR pthread_mutex_lock failed on mutex_gNBs L1_thread_tx with ret=%d\n",ret); - - ru_proc->instance_cnt_gNBs = 0; - ru_proc->timestamp_tx = timestamp_tx; - ru_proc->tti_tx = slot_tx; - ru_proc->frame_tx = frame_tx; - - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX1_UE, ru_proc->instance_cnt_gNBs); - - LOG_D(PHY,"Signaling tx_thread_fh for %d.%d\n",frame_tx,slot_tx); - // the thread can now be woken up - AssertFatal(pthread_cond_signal(&ru_proc->cond_gNBs) == 0, - "[gNB] ERROR pthread_cond_signal for gNB TXnp4 thread\n"); - AssertFatal((ret=pthread_mutex_unlock(&ru_proc->mutex_gNBs))==0,"mutex_unlock returned %d\n",ret); - - } - return(0); -} - -int wakeup_tx(PHY_VARS_gNB *gNB,int frame_rx,int slot_rx,int frame_tx,int slot_tx,uint64_t timestamp_tx) { - - - gNB_L1_rxtx_proc_t *L1_proc_tx = &gNB->proc.L1_proc_tx; - - int ret; - - - AssertFatal((ret = pthread_mutex_lock(&L1_proc_tx->mutex))==0,"mutex_lock returns %d\n",ret); - - - while(L1_proc_tx->instance_cnt == 0) { - pthread_cond_wait(&L1_proc_tx->cond,&L1_proc_tx->mutex); - } - - L1_proc_tx->instance_cnt = 0; - - - L1_proc_tx->slot_rx = slot_rx; - L1_proc_tx->frame_rx = frame_rx; - L1_proc_tx->slot_tx = slot_tx; - L1_proc_tx->frame_tx = frame_tx; - L1_proc_tx->timestamp_tx = timestamp_tx; - - - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX1_UE,1); - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX1_UE,0); - // the thread can now be woken up - // the thread can now be woken up - AssertFatal(pthread_cond_signal(&L1_proc_tx->cond) == 0, "ERROR pthread_cond_signal for gNB L1 thread\n"); - - AssertFatal((ret=pthread_mutex_unlock(&L1_proc_tx->mutex))==0,"mutex_unlock returns %d\n",ret); - - return(0); -} - -int wakeup_rxtx(PHY_VARS_gNB *gNB,RU_t *ru) { - gNB_L1_proc_t *proc=&gNB->proc; - gNB_L1_rxtx_proc_t *L1_proc=&proc->L1_proc; - NR_DL_FRAME_PARMS *fp = &gNB->frame_parms; - RU_proc_t *ru_proc=&ru->proc; - int ret; - int i; - struct timespec abstime; - int time_ns = 50000; - int wait_timer = 0; - bool do_last_check = 1; - - AssertFatal((ret=pthread_mutex_lock(&proc->mutex_RU))==0,"mutex_lock returns %d\n",ret); - for (i=0; inum_RU; i++) { - if (ru == gNB->RU_list[i]) { - if ((proc->RU_mask&(1< 0) - LOG_E(PHY,"gNB %d frame %d, subframe %d : previous information from RU %d (num_RU %d,mask %x) has not been served yet!\n", - gNB->Mod_id,proc->frame_rx,proc->slot_rx,ru->idx,gNB->num_RU,proc->RU_mask); - proc->RU_mask |= (1<RU_mask != (1<num_RU)-1) { // not all RUs have provided their information so return - LOG_E(PHY,"Not all RUs have provided their info\n"); - AssertFatal((ret=pthread_mutex_unlock(&proc->mutex_RU))==0,"mutex_unlock returns %d\n",ret); - return(0); - } - else { // all RUs have provided their information so continue on and wakeup gNB processing - proc->RU_mask = 0; - AssertFatal((ret=pthread_mutex_unlock(&proc->mutex_RU))==0,"muex_unlock returns %d\n",ret); - } - - // wake up TX for subframe n+sf_ahead - // lock the TX mutex and make sure the thread is ready - while (wait_timer < 200) { - clock_gettime(CLOCK_REALTIME, &abstime); - abstime.tv_nsec = abstime.tv_nsec + time_ns; - - if (abstime.tv_nsec >= 1000*1000*1000) { - abstime.tv_nsec -= 1000*1000*1000; - abstime.tv_sec += 1; - } - - AssertFatal((ret=pthread_mutex_timedlock(&L1_proc->mutex, &abstime)) == 0,"mutex_lock returns %d\n", ret); - - if (L1_proc->instance_cnt == 0) { // L1_thread is busy so wait for a bit - AssertFatal((ret=pthread_mutex_unlock( &L1_proc->mutex))==0,"muex_unlock return %d\n",ret); - wait_timer += 50; - usleep(50); - } - else { - do_last_check = 0; - break; - } - } - if (do_last_check) { - AssertFatal((ret=pthread_mutex_timedlock(&L1_proc->mutex, &abstime)) == 0,"mutex_lock returns %d\n", ret); - if (L1_proc->instance_cnt == 0) { // L1_thread is busy so abort the subframe - AssertFatal((ret=pthread_mutex_unlock( &L1_proc->mutex))==0,"muex_unlock return %d\n",ret); - LOG_W(PHY,"L1_thread isn't ready in %d.%d, aborting RX processing\n",ru_proc->frame_rx,ru_proc->tti_rx); - return (-1); - } - } - - ++L1_proc->instance_cnt; - // We have just received and processed the common part of a subframe, say n. - // TS_rx is the last received timestamp (start of 1st slot), TS_tx is the desired - // transmitted timestamp of the next TX slot (first). - - // The last (TS_rx mod samples_per_frame) was n*samples_per_tti, - // we want to generate subframe (n+sf_ahead), so TS_tx = TX_rx+sf_ahead*samples_per_tti, - // and proc->slot_tx = proc->slot_rx+sf_ahead - L1_proc->timestamp_tx = ru_proc->timestamp_rx + (sf_ahead*fp->samples_per_subframe); - L1_proc->frame_rx = ru_proc->frame_rx; - L1_proc->slot_rx = ru_proc->tti_rx; - L1_proc->frame_tx = (L1_proc->slot_rx > (fp->slots_per_frame-1-(fp->slots_per_subframe*sf_ahead))) ? (L1_proc->frame_rx+1)&1023 : L1_proc->frame_rx; - L1_proc->slot_tx = (L1_proc->slot_rx + (fp->slots_per_subframe*sf_ahead))%fp->slots_per_frame; - - LOG_D(PHY,"wakeupL1: passing parameter IC = %d, RX: %d.%d, TX: %d.%d to L1 sf_ahead = %d\n", L1_proc->instance_cnt, L1_proc->frame_rx, L1_proc->slot_rx, L1_proc->frame_tx, L1_proc->slot_tx, sf_ahead); - - pthread_mutex_unlock( &L1_proc->mutex ); - - // the thread can now be woken up - if (pthread_cond_signal(&L1_proc->cond) != 0) { - LOG_E( PHY, "[gNB] ERROR pthread_cond_signal for gNB RXn-TXnp4 thread\n"); - exit_fun( "ERROR pthread_cond_signal" ); - return(-1); - } - - return(0); -} -/* -void wakeup_prach_gNB(PHY_VARS_gNB *gNB,RU_t *ru,int frame,int subframe) { - - gNB_L1_proc_t *proc = &gNB->proc; - LTE_DL_FRAME_PARMS *fp=&gNB->frame_parms; - int i; - - if (ru!=NULL) { - pthread_mutex_lock(&proc->mutex_RU_PRACH); - for (i=0;inum_RU;i++) { - if (ru == gNB->RU_list[i]) { - LOG_D(PHY,"frame %d, subframe %d: RU %d for gNB %d signals PRACH (mask %x, num_RU %d)\n",frame,subframe,i,gNB->Mod_id,proc->RU_mask_prach,gNB->num_RU); - if ((proc->RU_mask_prach&(1< 0) - LOG_E(PHY,"gNB %d frame %d, subframe %d : previous information (PRACH) from RU %d (num_RU %d, mask %x) has not been served yet!\n", - gNB->Mod_id,frame,subframe,ru->idx,gNB->num_RU,proc->RU_mask_prach); - proc->RU_mask_prach |= (1<RU_mask_prach != (1<num_RU)-1) { // not all RUs have provided their information so return - pthread_mutex_unlock(&proc->mutex_RU_PRACH); - return; - } - else { // all RUs have provided their information so continue on and wakeup gNB processing - proc->RU_mask_prach = 0; - pthread_mutex_unlock(&proc->mutex_RU_PRACH); - } - } - - // check if we have to detect PRACH first - if (is_prach_subframe(fp,frame,subframe)>0) { - LOG_D(PHY,"Triggering prach processing, frame %d, subframe %d\n",frame,subframe); - if (proc->instance_cnt_prach == 0) { - LOG_W(PHY,"[gNB] Frame %d Subframe %d, dropping PRACH\n", frame,subframe); - return; - } - - // wake up thread for PRACH RX - if (pthread_mutex_lock(&proc->mutex_prach) != 0) { - LOG_E( PHY, "[gNB] ERROR pthread_mutex_lock for gNB PRACH thread %d (IC %d)\n", proc->thread_index, proc->instance_cnt_prach); - exit_fun( "error locking mutex_prach" ); - return; - } - - ++proc->instance_cnt_prach; - // set timing for prach thread - proc->frame_prach = frame; - proc->subframe_prach = subframe; - - // the thread can now be woken up - if (pthread_cond_signal(&proc->cond_prach) != 0) { - LOG_E( PHY, "[gNB] ERROR pthread_cond_signal for gNB PRACH thread %d\n", proc->thread_index); - exit_fun( "ERROR pthread_cond_signal" ); - return; - } - - pthread_mutex_unlock( &proc->mutex_prach ); - } - -}*/ - -/*! - * \brief The prach receive thread of gNB. - * \param param is a \ref gNB_L1_proc_t structure which contains the info what to process. - * \returns a pointer to an int. The storage is not on the heap and must not be freed. - */ -/* -static void* gNB_thread_prach( void* param ) { - static int gNB_thread_prach_status; - - - PHY_VARS_gNB *gNB= (PHY_VARS_gNB *)param; - gNB_L1_proc_t *proc = &gNB->proc; - - // set default return value - gNB_thread_prach_status = 0; - - - - while (!oai_exit) { - - if (oai_exit) break; - - - if (wait_on_condition(&proc->mutex_prach,&proc->cond_prach,&proc->instance_cnt_prach,"gNB_prach_thread") < 0) break; - - LOG_D(PHY,"Running gNB prach procedures\n"); - prach_procedures(gNB ,0); - - if (release_thread(&proc->mutex_prach,&proc->instance_cnt_prach,"gNB_prach_thread") < 0) break; - } - - LOG_I(PHY, "Exiting gNB thread PRACH\n"); - - gNB_thread_prach_status = 0; - return &gNB_thread_prach_status; -} -*/ - -extern void init_td_thread(PHY_VARS_gNB *); -extern void init_te_thread(PHY_VARS_gNB *); - static void *process_stats_thread(void *param) { PHY_VARS_gNB *gNB = (PHY_VARS_gNB *)param; @@ -807,90 +331,10 @@ static void *process_stats_thread(void *param) { return(NULL); } - -void init_gNB_proc(int inst) { - int i=0; - int CC_id = 0; - PHY_VARS_gNB *gNB; - gNB_L1_proc_t *proc; - gNB_L1_rxtx_proc_t *L1_proc,*L1_proc_tx; -// LOG_I(PHY,"%s(inst:%d) RC.nb_nr_CC[inst]:%d \n",__FUNCTION__,inst,RC.nb_nr_CC[inst]); - gNB = RC.gNB[inst]; - LOG_I(PHY,"Initializing gNB processes instance:%d CC_id %d \n",inst,CC_id); - - proc = &gNB->proc; - L1_proc = &proc->L1_proc; - L1_proc_tx = &proc->L1_proc_tx; - L1_proc->instance_cnt = -1; - L1_proc_tx->instance_cnt = -1; - L1_proc->instance_cnt_RUs = 0; - L1_proc_tx->instance_cnt_RUs = 0; - proc->instance_cnt_prach = -1; - proc->instance_cnt_asynch_rxtx = -1; - proc->CC_id = CC_id; - proc->first_rx =1; - proc->first_tx =1; - proc->RU_mask =0; - proc->RU_mask_tx = (1<num_RU)-1; - proc->RU_mask_prach =0; - pthread_mutex_init( &gNB->UL_INFO_mutex, NULL); - pthread_mutex_init( &L1_proc->mutex, NULL); - pthread_mutex_init( &L1_proc_tx->mutex, NULL); - pthread_cond_init( &L1_proc->cond, NULL); - pthread_cond_init( &L1_proc_tx->cond, NULL); - pthread_mutex_init( &proc->mutex_prach, NULL); - pthread_mutex_init( &proc->mutex_asynch_rxtx, NULL); - pthread_mutex_init( &proc->mutex_RU,NULL); - pthread_mutex_init( &proc->mutex_RU_tx,NULL); - pthread_mutex_init( &proc->mutex_RU_PRACH,NULL); - pthread_cond_init( &proc->cond_prach, NULL); - pthread_cond_init( &proc->cond_asynch_rxtx, NULL); - LOG_I(PHY,"gNB->single_thread_flag:%d\n", gNB->single_thread_flag); - - if (get_thread_parallel_conf() == PARALLEL_RU_L1_SPLIT || get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT) { - threadCreate( &L1_proc->pthread, gNB_L1_thread, gNB, "L1_proc", -1, OAI_PRIORITY_RT ); - threadCreate( &L1_proc_tx->pthread, gNB_L1_thread_tx, gNB,"L1_proc_tx", -1, OAI_PRIORITY_RT); - } - - if(opp_enabled == 1) threadCreate(&proc->L1_stats_thread, process_stats_thread,(void *)gNB, "time_meas", -1, OAI_PRIORITY_RT_LOW); - //pthread_create( &proc->pthread_prach, attr_prach, gNB_thread_prach, gNB ); - char name[16]; - - if (gNB->single_thread_flag==0) { - snprintf( name, sizeof(name), "L1 %d", i ); - pthread_setname_np( L1_proc->pthread, name ); - snprintf( name, sizeof(name), "L1TX %d", i ); - pthread_setname_np( L1_proc_tx->pthread, name ); - } - - AssertFatal(proc->instance_cnt_prach == -1,"instance_cnt_prach = %d\n",proc->instance_cnt_prach); - - /* setup PHY proc TX sync mechanism */ - pthread_mutex_init(&sync_phy_proc.mutex_phy_proc_tx, NULL); - pthread_cond_init(&sync_phy_proc.cond_phy_proc_tx, NULL); - sync_phy_proc.phy_proc_CC_id = 0; - - gNB->threadPool = (tpool_t*)malloc(sizeof(tpool_t)); - gNB->respDecode = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t)); - int numCPU = sysconf(_SC_NPROCESSORS_ONLN); - uint32_t num_threads_pusch; - paramdef_t PUSCHThreads[] = NUM_THREADS_DESC; - config_get( PUSCHThreads,sizeof(PUSCHThreads)/sizeof(paramdef_t),NULL); - int threadCnt = min(numCPU, num_threads_pusch); - char ul_pool[80]; - sprintf(ul_pool,"-1"); - int s_offset = 0; - for (int icpu=1; icputhreadPool, false); - initNotifiedFIFO(gNB->respDecode); -} - void init_gNB_Tpool(int inst) { PHY_VARS_gNB *gNB; gNB = RC.gNB[inst]; + gNB_L1_proc_t *proc = &gNB->proc; // ULSCH decoding threadpool gNB->threadPool = (tpool_t*)malloc(sizeof(tpool_t)); @@ -922,6 +366,9 @@ void init_gNB_Tpool(int inst) { // RU TX result FIFO gNB->resp_RU_tx = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t)); initNotifiedFIFO(gNB->resp_RU_tx); + + // Stats measurement thread + if(opp_enabled == 1) threadCreate(&proc->L1_stats_thread, process_stats_thread,(void *)gNB, "time_meas", -1, OAI_PRIORITY_RT_LOW); } @@ -929,56 +376,13 @@ void init_gNB_Tpool(int inst) { * \brief Terminate gNB TX and RX threads. */ void kill_gNB_proc(int inst) { - int *status; PHY_VARS_gNB *gNB; - gNB_L1_proc_t *proc; - gNB_L1_rxtx_proc_t *L1_proc, *L1_proc_tx; gNB=RC.gNB[inst]; - proc = &gNB->proc; - L1_proc = &proc->L1_proc; - L1_proc_tx = &proc->L1_proc_tx; - LOG_I(PHY, "Killing TX inst %d\n",inst ); - if (get_thread_parallel_conf() == PARALLEL_RU_L1_SPLIT || get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT) { - pthread_mutex_lock(&L1_proc->mutex); - L1_proc->instance_cnt = 0; - pthread_cond_signal(&L1_proc->cond); - pthread_mutex_unlock(&L1_proc->mutex); - pthread_mutex_lock(&L1_proc_tx->mutex); - L1_proc_tx->instance_cnt = 0; - pthread_cond_signal(&L1_proc_tx->cond); - pthread_mutex_unlock(&L1_proc_tx->mutex); - } - - proc->instance_cnt_prach = 0; - pthread_cond_signal( &proc->cond_prach ); - pthread_cond_signal( &proc->cond_asynch_rxtx ); - pthread_cond_broadcast(&sync_phy_proc.cond_phy_proc_tx); - // LOG_D(PHY, "joining pthread_prach\n"); - // pthread_join( proc->pthread_prach, (void**)&status ); - LOG_I(PHY, "Destroying prach mutex/cond\n"); - pthread_mutex_destroy( &proc->mutex_prach ); - pthread_cond_destroy( &proc->cond_prach ); LOG_I(PHY, "Destroying UL_INFO mutex\n"); pthread_mutex_destroy(&gNB->UL_INFO_mutex); - if (get_thread_parallel_conf() == PARALLEL_RU_L1_SPLIT || get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT) { - LOG_I(PHY, "Joining L1_proc mutex/cond\n"); - pthread_join( L1_proc->pthread, (void **)&status ); - LOG_I(PHY, "Joining L1_proc_tx mutex/cond\n"); - pthread_join( L1_proc_tx->pthread, (void **)&status ); - } - - LOG_I(PHY, "Destroying L1_proc mutex/cond\n"); - pthread_mutex_destroy( &L1_proc->mutex ); - pthread_cond_destroy( &L1_proc->cond ); - LOG_I(PHY, "Destroying L1_proc_tx mutex/cond\n"); - pthread_mutex_destroy( &L1_proc_tx->mutex ); - pthread_cond_destroy( &L1_proc_tx->cond ); - pthread_mutex_destroy( &proc->mutex_RU ); - pthread_mutex_destroy( &proc->mutex_RU_tx ); - } diff --git a/executables/nr-ru.c b/executables/nr-ru.c index dec62469da..9fd83bab76 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -120,22 +120,6 @@ extern int emulate_rf; extern int numerology; extern int usrp_tx_thread; -typedef struct processingData_L1 { - int frame_rx; - int frame_tx; - int slot_rx; - int slot_tx; - openair0_timestamp timestamp_tx; - PHY_VARS_gNB *gNB; -} processingData_L1_t; - -typedef struct processingData_RU { - int frame_tx; - int slot_tx; - openair0_timestamp timestamp_tx; - RU_t *ru; -} processingData_RU_t; - /*************************************************************/ /* Functions to attach and configure RRU */ @@ -805,101 +789,6 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) { -/*! - * \brief The Asynchronous RX/TX FH thread of RAU/RCC/gNB/RRU. - * This handles the RX FH for an asynchronous RRU/UE - * \param param is a \ref gNB_L1_proc_t structure which contains the info what to process. - * \returns a pointer to an int. The storage is not on the heap and must not be freed. - */ -void *ru_thread_asynch_rxtx( void *param ) { - static int ru_thread_asynch_rxtx_status; - RU_t *ru = (RU_t *)param; - RU_proc_t *proc = &ru->proc; - nfapi_nr_config_request_scf_t *cfg = &ru->config; - int slot=0, frame=0; - // wait for top-level synchronization and do one acquisition to get timestamp for setting frame/subframe - wait_sync("ru_thread_asynch_rxtx"); - // wait for top-level synchronization and do one acquisition to get timestamp for setting frame/subframe - printf( "waiting for devices (ru_thread_asynch_rx)\n"); - wait_on_condition(&proc->mutex_asynch_rxtx,&proc->cond_asynch_rxtx,&proc->instance_cnt_asynch_rxtx,"thread_asynch"); - printf( "devices ok (ru_thread_asynch_rx)\n"); - - while (!oai_exit) { - - if (slot==ru->nr_frame_parms->slots_per_frame) { - slot=0; - frame++; - frame&=1023; - } else { - slot++; - } - - LOG_D(PHY,"ru_thread_asynch_rxtx: Waiting on incoming fronthaul\n"); - - // asynchronous receive from north (RRU IF4/IF5) - if (ru->fh_north_asynch_in) { - if ((nr_slot_select(cfg,frame,slot) & NR_DOWNLINK_SLOT)>0) - ru->fh_north_asynch_in(ru,&frame,&slot); - } else AssertFatal(1==0,"Unknown function in ru_thread_asynch_rxtx\n"); - } - - ru_thread_asynch_rxtx_status=0; - return(&ru_thread_asynch_rxtx_status); -} - - - - -/*! - * \brief The prach receive thread of RU. - * \param param is a \ref RU_proc_t structure which contains the info what to process. - * \returns a pointer to an int. The storage is not on the heap and must not be freed. - */ -void *ru_thread_prach( void *param ) { - static int ru_thread_prach_status; - RU_t *ru = (RU_t *)param; - RU_proc_t *proc = (RU_proc_t *)&ru->proc; - // set default return value - ru_thread_prach_status = 0; - - while (RC.ru_mask>0) { - usleep(1e6); - LOG_I(PHY,"%s() RACH waiting for RU to be configured\n", __FUNCTION__); - } - - LOG_I(PHY,"%s() RU configured - RACH processing thread running\n", __FUNCTION__); - - while (!oai_exit) { - - - if (wait_on_condition(&proc->mutex_prach,&proc->cond_prach,&proc->instance_cnt_prach,"ru_prach_thread") < 0) break; - - /*VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_RU_PRACH_RX, 1 ); - - if (ru->gNB_list[0]){ - prach_procedures( - ru->gNB_list[0],0 - ); - } - else { - rx_prach(NULL, - ru, - NULL, - NULL, - NULL, - proc->frame_prach, - 0,0 - ); - } - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_RU_PRACH_RX, 0 );*/ - if (release_thread(&proc->mutex_prach,&proc->instance_cnt_prach,"ru_prach_thread") < 0) break; - } - - LOG_I(PHY, "Exiting RU thread PRACH\n"); - ru_thread_prach_status = 0; - return &ru_thread_prach_status; -} - int wakeup_synch(RU_t *ru) { struct timespec wait; @@ -999,63 +888,6 @@ void do_ru_synch(RU_t *ru) { ru->rfdevice.trx_set_freq_func(&ru->rfdevice,ru->rfdevice.openair0_cfg,0); } - - -void wakeup_gNB_L1s(RU_t *ru) { - int i; - PHY_VARS_gNB **gNB_list = ru->gNB_list; - LOG_D(PHY,"wakeup_gNB_L1s (num %d) for RU %d ru->gNB_top:%p\n",ru->num_gNB,ru->idx, ru->gNB_top); - - if (ru->num_gNB==1 && ru->gNB_top!=0 && get_thread_parallel_conf() == PARALLEL_SINGLE_THREAD) { - // call gNB function directly - char string[20]; - sprintf(string,"Incoming RU %u",ru->idx); - LOG_D(PHY,"RU %d Call gNB_top\n",ru->idx); - ru->gNB_top(gNB_list[0],ru->proc.frame_rx,ru->proc.tti_rx,string,ru); - } else { - LOG_D(PHY,"ru->num_gNB:%d\n", ru->num_gNB); - - for (i=0; inum_gNB; i++) { - LOG_D(PHY,"ru->wakeup_rxtx:%p\n", ru->nr_wakeup_rxtx); - - if (ru->nr_wakeup_rxtx!=0 && ru->nr_wakeup_rxtx(gNB_list[i],ru) < 0) { - LOG_E(PHY,"could not wakeup gNB rxtx process for subframe %d\n", ru->proc.tti_rx); - } - } - } -} - -int wakeup_prach_ru(RU_t *ru) { - struct timespec wait; - wait.tv_sec=0; - wait.tv_nsec=5000000L; - - if (pthread_mutex_timedlock(&ru->proc.mutex_prach,&wait) !=0) { - LOG_E( PHY, "[RU] ERROR pthread_mutex_lock for RU prach thread (IC %d)\n", ru->proc.instance_cnt_prach); - exit_fun( "error locking mutex_rxtx" ); - return(-1); - } - - if (ru->proc.instance_cnt_prach==-1) { - ++ru->proc.instance_cnt_prach; - ru->proc.frame_prach = ru->proc.frame_rx; - ru->proc.subframe_prach = ru->proc.tti_rx; - - // DJP - think prach_procedures() is looking at gNB frame_prach - if (ru->gNB_list[0]) { - ru->gNB_list[0]->proc.frame_prach = ru->proc.frame_rx; - ru->gNB_list[0]->proc.slot_prach = ru->proc.tti_rx; - } - - LOG_I(PHY,"RU %d: waking up PRACH thread\n",ru->idx); - // the thread can now be woken up - AssertFatal(pthread_cond_signal(&ru->proc.cond_prach) == 0, "ERROR pthread_cond_signal for RU prach thread\n"); - } else LOG_W(PHY,"RU prach thread busy, skipping\n"); - - pthread_mutex_unlock( &ru->proc.mutex_prach ); - return(0); -} - // this is for RU with local RF unit void fill_rf_config(RU_t *ru, char *rf_config_file) { int i; @@ -1371,320 +1203,6 @@ void ru_tx_func(void *param) { }//else emulate_rf } -void *ru_thread_tx( void *param ) { - RU_t *ru = (RU_t *)param; - RU_proc_t *proc = &ru->proc; - NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms; - PHY_VARS_gNB *gNB; - gNB_L1_proc_t *gNB_proc; - gNB_L1_rxtx_proc_t *L1_proc; - char filename[40]; - int print_frame = 8; - int i = 0; - int ret; - - - wait_on_condition(&proc->mutex_FH1,&proc->cond_FH1,&proc->instance_cnt_FH1,"ru_thread_tx"); - printf( "ru_thread_tx ready\n"); - - while (!oai_exit) { - - LOG_D(PHY,"ru_thread_tx: Waiting for TX processing\n"); - // wait until eNBs are finished subframe RX n and TX n+4 - - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_RU_TX_WAIT, 1 ); - wait_on_condition(&proc->mutex_gNBs,&proc->cond_gNBs,&proc->instance_cnt_gNBs,"ru_thread_tx"); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_RU_TX_WAIT, 0 ); - - ret = pthread_mutex_lock(&proc->mutex_gNBs); - AssertFatal(ret == 0,"mutex_lock return %d\n",ret); - int frame_tx=proc->frame_tx; - int tti_tx =proc->tti_tx; - uint64_t timestamp_tx = proc->timestamp_tx; - - ret = pthread_mutex_unlock(&proc->mutex_gNBs); - AssertFatal(ret == 0,"mutex_lock returns %d\n",ret); - - if (oai_exit) break; - - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_RU, frame_tx ); - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TTI_NUMBER_TX0_RU, tti_tx ); - - // do TX front-end processing if needed (precoding and/or IDFTs) - if (ru->feptx_prec) ru->feptx_prec(ru,frame_tx,tti_tx); - - // do OFDM with/without TX front-end processing if needed - if ((ru->fh_north_asynch_in == NULL) && (ru->feptx_ofdm)) ru->feptx_ofdm(ru,frame_tx,tti_tx); - - if(!emulate_rf) { - // do outgoing fronthaul (south) if needed - if ((ru->fh_north_asynch_in == NULL) && (ru->fh_south_out)) ru->fh_south_out(ru,frame_tx,tti_tx,timestamp_tx); - - if (ru->fh_north_out) ru->fh_north_out(ru); - } else { - if(proc->frame_tx == print_frame) { - for (i=0; inb_tx; i++) { - - if(proc->tti_tx == 0) { - sprintf(filename,"gNBdataF_frame%d_sl%d.m", print_frame, proc->tti_tx); - LOG_M(filename,"txdataF_frame",&ru->gNB_list[0]->common_vars.txdataF[i][0],fp->samples_per_frame_wCP, 1, 1); - - sprintf(filename,"tx%ddataF_frame%d_sl%d.m", i, print_frame, proc->tti_tx); - LOG_M(filename,"txdataF_frame",&ru->common.txdataF[i][0],fp->samples_per_frame_wCP, 1, 1); - - sprintf(filename,"tx%ddataF_BF_frame%d_sl%d.m", i, print_frame, proc->tti_tx); - LOG_M(filename,"txdataF_BF_frame",&ru->common.txdataF_BF[i][0],fp->samples_per_subframe_wCP, 1, 1); - } - - if(proc->tti_tx == 9) { - sprintf(filename,"tx%ddata_frame%d.m", i, print_frame); - LOG_M(filename,"txdata_frame",&ru->common.txdata[i][0],fp->samples_per_frame, 1, 1); - sprintf(filename,"tx%ddata_frame%d.dat", i, print_frame); - FILE *output_fd = fopen(filename,"w"); - - if (output_fd) { - fwrite(&ru->common.txdata[i][0], - sizeof(int32_t), - fp->samples_per_frame, - output_fd); - fclose(output_fd); - } else { - LOG_E(PHY,"Cannot write to file %s\n",filename); - } - }//if(proc->tti_tx == 9) - }//for (i=0; inb_tx; i++) - }//if(proc->frame_tx == print_frame) - }//else emulate_rf - - release_thread(&proc->mutex_gNBs,&proc->instance_cnt_gNBs,"ru_thread_tx"); - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX1_UE, proc->instance_cnt_gNBs); - - for(i = 0; inum_gNB; i++) { - gNB = ru->gNB_list[i]; - gNB_proc = &gNB->proc; - L1_proc = (get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT)? &gNB_proc->L1_proc_tx : &gNB_proc->L1_proc; - ret = pthread_mutex_lock(&gNB_proc->mutex_RU_tx); - AssertFatal(ret == 0,"mutex_lock returns %d\n",ret); - - for (int j=0; jnum_RU; j++) { - if (ru == gNB->RU_list[j]) { - if ((gNB_proc->RU_mask_tx&(1< 0) - LOG_E(PHY,"gNB %d frame %d, subframe %d : previous information from RU tx %d (num_RU %d,mask %x) has not been served yet!\n", - gNB->Mod_id,gNB_proc->frame_rx,gNB_proc->slot_rx,ru->idx,gNB->num_RU,gNB_proc->RU_mask_tx); - - gNB_proc->RU_mask_tx |= (1<RU_mask_tx != (1<num_RU)-1) { // not all RUs have provided their information so return - ret = pthread_mutex_unlock(&gNB_proc->mutex_RU_tx); - AssertFatal(ret == 0,"mutex_unlock returns %d\n",ret); - } else { // all RUs TX are finished so send the ready signal to gNB processing - gNB_proc->RU_mask_tx = 0; - ret = pthread_mutex_unlock(&gNB_proc->mutex_RU_tx); - AssertFatal(ret == 0,"mutex_unlock returns %d\n",ret); - - ret = pthread_mutex_lock(&L1_proc->mutex_RUs_tx); - AssertFatal(ret == 0,"mutex_lock returns %d\n",ret); - // the thread can now be woken up - if (L1_proc->instance_cnt_RUs == -1) { - L1_proc->instance_cnt_RUs = 0; - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX0_UE,L1_proc->instance_cnt_RUs); - AssertFatal(pthread_cond_signal(&L1_proc->cond_RUs) == 0, - "ERROR pthread_cond_signal for gNB_L1_thread\n"); - } //else AssertFatal(1==0,"gNB TX thread is not ready\n"); - ret = pthread_mutex_unlock(&L1_proc->mutex_RUs_tx); - AssertFatal(ret == 0,"mutex_unlock returns %d\n",ret); - } - } - } - - release_thread(&proc->mutex_FH1,&proc->instance_cnt_FH1,"ru_thread_tx"); - return 0; -} - -void tx_func(void *param) { - - processingData_L1_t *info = (processingData_L1_t *) param; - PHY_VARS_gNB *gNB = info->gNB; - int frame_tx = info->frame_tx; - int slot_tx = info->slot_tx; - - phy_procedures_gNB_TX(gNB, frame_tx,slot_tx, 1); - - // start FH TX processing - notifiedFIFO_elt_t *res; - res = pullTpool(gNB->resp_RU_tx, gNB->threadPool); - processingData_RU_t *syncMsg = (processingData_RU_t *)NotifiedFifoData(res); - syncMsg->frame_tx = frame_tx; - syncMsg->slot_tx = slot_tx; - syncMsg->timestamp_tx = info->timestamp_tx; - syncMsg->ru = gNB->RU_list[0]; - res->key = slot_tx; - pushTpool(gNB->threadPool, res); -} - -void rx_func(void *param) { - - processingData_L1_t *info = (processingData_L1_t *) param; - PHY_VARS_gNB *gNB = info->gNB; - int frame_rx = info->frame_rx; - int slot_rx = info->slot_rx; - int frame_tx = info->frame_tx; - int slot_tx = info->slot_tx; - sl_ahead = sf_ahead*gNB->frame_parms.slots_per_subframe; - nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config; - - //start_meas(&softmodem_stats_rxtx_sf); - - T(T_GNB_PHY_DL_TICK, T_INT(gNB->Mod_id), T_INT(frame_tx), T_INT(slot_tx)); - - /* hack to remove UEs */ - extern int rnti_to_remove[10]; - extern volatile int rnti_to_remove_count; - extern pthread_mutex_t rnti_to_remove_mutex; - if (pthread_mutex_lock(&rnti_to_remove_mutex)) exit(1); - int up_removed = 0; - int down_removed = 0; - int pucch_removed = 0; - for (int i = 0; i < rnti_to_remove_count; i++) { - LOG_W(PHY, "to remove rnti %d\n", rnti_to_remove[i]); - void clean_gNB_ulsch(NR_gNB_ULSCH_t *ulsch); - void clean_gNB_dlsch(NR_gNB_DLSCH_t *dlsch); - int j; - for (j = 0; j < NUMBER_OF_NR_ULSCH_MAX; j++) - if (gNB->ulsch[j][0]->rnti == rnti_to_remove[i]) { - gNB->ulsch[j][0]->rnti = 0; - gNB->ulsch[j][0]->harq_mask = 0; - //clean_gNB_ulsch(gNB->ulsch[j][0]); - int h; - for (h = 0; h < NR_MAX_ULSCH_HARQ_PROCESSES; h++) { - gNB->ulsch[j][0]->harq_processes[h]->status = SCH_IDLE; - gNB->ulsch[j][0]->harq_processes[h]->round = 0; - gNB->ulsch[j][0]->harq_processes[h]->handled = 0; - } - up_removed++; - } - for (j = 0; j < NUMBER_OF_NR_DLSCH_MAX; j++) - if (gNB->dlsch[j][0]->rnti == rnti_to_remove[i]) { - gNB->dlsch[j][0]->rnti = 0; - gNB->dlsch[j][0]->harq_mask = 0; - //clean_gNB_dlsch(gNB->dlsch[j][0]); - down_removed++; - } - for (j = 0; j < NUMBER_OF_NR_PUCCH_MAX; j++) - if (gNB->pucch[j]->active > 0 && - gNB->pucch[j]->pucch_pdu.rnti == rnti_to_remove[i]) { - gNB->pucch[j]->active = 0; - gNB->pucch[j]->pucch_pdu.rnti = 0; - pucch_removed++; - } -#if 0 - for (j = 0; j < NUMBER_OF_NR_PDCCH_MAX; j++) - gNB->pdcch_pdu[j].frame = -1; - for (j = 0; j < NUMBER_OF_NR_PDCCH_MAX; j++) - gNB->ul_pdcch_pdu[j].frame = -1; - for (j = 0; j < NUMBER_OF_NR_PRACH_MAX; j++) - gNB->prach_vars.list[j].frame = -1; -#endif - } - if (rnti_to_remove_count) LOG_W(PHY, "to remove rnti_to_remove_count=%d, up_removed=%d down_removed=%d pucch_removed=%d\n", rnti_to_remove_count, up_removed, down_removed, pucch_removed); - rnti_to_remove_count = 0; - if (pthread_mutex_unlock(&rnti_to_remove_mutex)) exit(1); - - // Call the scheduler - - pthread_mutex_lock(&gNB->UL_INFO_mutex); - gNB->UL_INFO.frame = frame_rx; - gNB->UL_INFO.slot = slot_rx; - gNB->UL_INFO.module_id = gNB->Mod_id; - gNB->UL_INFO.CC_id = gNB->CC_id; - gNB->if_inst->NR_UL_indication(&gNB->UL_INFO); - pthread_mutex_unlock(&gNB->UL_INFO_mutex); - - // RX processing - int tx_slot_type = nr_slot_select(cfg,frame_tx,slot_tx); - int rx_slot_type = nr_slot_select(cfg,frame_rx,slot_rx); - - if (rx_slot_type == NR_UPLINK_SLOT || rx_slot_type == NR_MIXED_SLOT) { - // UE-specific RX processing for subframe n - // TODO: check if this is correct for PARALLEL_RU_L1_TRX_SPLIT - - // Do PRACH RU processing - L1_nr_prach_procedures(gNB,frame_rx,slot_rx); - - //apply the rx signal rotation here - apply_nr_rotation_ul(&gNB->frame_parms, - gNB->common_vars.rxdataF[0], - slot_rx, - 0, - gNB->frame_parms.Ncp==EXTENDED?12:14, - gNB->frame_parms.ofdm_symbol_size); - - phy_procedures_gNB_uespec_RX(gNB, frame_rx, slot_rx); - } - - if (oai_exit) return(-1); - - //stop_meas( &softmodem_stats_rxtx_sf ); - LOG_D(PHY,"%s() Exit proc[rx:%d%d tx:%d%d]\n", __FUNCTION__, frame_rx, slot_rx, frame_tx, slot_tx); - - notifiedFIFO_elt_t *res; - - if (tx_slot_type == NR_DOWNLINK_SLOT || tx_slot_type == NR_MIXED_SLOT) { - res = pullTpool(gNB->resp_L1_tx, gNB->threadPool); - processingData_L1_t *syncMsg = (processingData_L1_t *)NotifiedFifoData(res); - syncMsg->gNB = gNB; - syncMsg->frame_rx = frame_rx; - syncMsg->slot_rx = slot_rx; - syncMsg->frame_tx = frame_tx; - syncMsg->slot_tx = slot_tx; - syncMsg->timestamp_tx = info->timestamp_tx; - res->key = slot_tx; - pushTpool(gNB->threadPool, res); - } - -#if 0 - LOG_D(PHY, "rxtx:%lld nfapi:%lld phy:%lld tx:%lld rx:%lld prach:%lld ofdm:%lld ", - softmodem_stats_rxtx_sf.diff_now, nfapi_meas.diff_now, - TICK_TO_US(gNB->phy_proc), - TICK_TO_US(gNB->phy_proc_tx), - TICK_TO_US(gNB->phy_proc_rx), - TICK_TO_US(gNB->rx_prach), - TICK_TO_US(gNB->ofdm_mod_stats), - softmodem_stats_rxtx_sf.diff_now, nfapi_meas.diff_now); - LOG_D(PHY, - "dlsch[enc:%lld mod:%lld scr:%lld rm:%lld t:%lld i:%lld] rx_dft:%lld ", - TICK_TO_US(gNB->dlsch_encoding_stats), - TICK_TO_US(gNB->dlsch_modulation_stats), - TICK_TO_US(gNB->dlsch_scrambling_stats), - TICK_TO_US(gNB->dlsch_rate_matching_stats), - TICK_TO_US(gNB->dlsch_turbo_encoding_stats), - TICK_TO_US(gNB->dlsch_interleaving_stats), - TICK_TO_US(gNB->rx_dft_stats)); - LOG_D(PHY," ulsch[ch:%lld freq:%lld dec:%lld demod:%lld ru:%lld ", - TICK_TO_US(gNB->ulsch_channel_estimation_stats), - TICK_TO_US(gNB->ulsch_freq_offset_estimation_stats), - TICK_TO_US(gNB->ulsch_decoding_stats), - TICK_TO_US(gNB->ulsch_demodulation_stats), - TICK_TO_US(gNB->ulsch_rate_unmatching_stats)); - LOG_D(PHY, "td:%lld dei:%lld dem:%lld llr:%lld tci:%lld ", - TICK_TO_US(gNB->ulsch_turbo_decoding_stats), - TICK_TO_US(gNB->ulsch_deinterleaving_stats), - TICK_TO_US(gNB->ulsch_demultiplexing_stats), - TICK_TO_US(gNB->ulsch_llr_stats), - TICK_TO_US(gNB->ulsch_tc_init_stats)); - LOG_D(PHY, "tca:%lld tcb:%lld tcg:%lld tce:%lld l1:%lld l2:%lld]\n\n", - TICK_TO_US(gNB->ulsch_tc_alpha_stats), - TICK_TO_US(gNB->ulsch_tc_beta_stats), - TICK_TO_US(gNB->ulsch_tc_gamma_stats), - TICK_TO_US(gNB->ulsch_tc_ext_stats), - TICK_TO_US(gNB->ulsch_tc_intl1_stats), - TICK_TO_US(gNB->ulsch_tc_intl2_stats) - ); -#endif -} - void *ru_thread( void *param ) { static int ru_thread_status; RU_t *ru = (RU_t *)param; @@ -1771,16 +1289,6 @@ void *ru_thread( void *param ) { else LOG_I(PHY,"RU %d rf device ready\n",ru->idx); } else LOG_I(PHY,"RU %d no rf device\n",ru->idx); - // if an asnych_rxtx thread exists - // wakeup the thread because the devices are ready at this point - - if ((ru->fh_south_asynch_in)||(ru->fh_north_asynch_in)) { - pthread_mutex_lock(&proc->mutex_asynch_rxtx); - proc->instance_cnt_asynch_rxtx=0; - pthread_mutex_unlock(&proc->mutex_asynch_rxtx); - pthread_cond_signal(&proc->cond_asynch_rxtx); - } else LOG_I(PHY,"RU %d no asynch_south interface\n",ru->idx); - // if this is a slave RRU, try to synchronize on the DL frequency if ((ru->is_slave) && (ru->if_south == LOCAL_RF)) do_ru_synch(ru); @@ -1797,11 +1305,6 @@ void *ru_thread( void *param ) { } } - pthread_mutex_lock(&proc->mutex_FH1); - proc->instance_cnt_FH1 = 0; - pthread_mutex_unlock(&proc->mutex_FH1); - pthread_cond_signal(&proc->cond_FH1); - // This is a forever while loop, it loops over subframes which are scheduled by incoming samples from HW devices while (!oai_exit) { // these are local subframe/frame counters to check that we are in synch with the fronthaul timing. @@ -1829,18 +1332,7 @@ void *ru_thread( void *param ) { proc->frame_tx,proc->tti_tx, RC.gNB[0]->proc.frame_rx,RC.gNB[0]->proc.slot_rx, RC.gNB[0]->proc.frame_tx); - /* - LOG_D(PHY,"RU thread (do_prach %d, is_prach_subframe %d), received frame %d, subframe %d\n", - ru->do_prach, - is_prach_subframe(fp, proc->frame_rx, proc->tti_rx), - proc->frame_rx,proc->tti_rx); - if ((ru->do_prach>0) && (is_prach_subframe(fp, proc->frame_rx, proc->tti_rx)==1)) { - wakeup_prach_ru(ru); - }*/ - - // adjust for timing offset between RU - //printf("~~~~~~~~~~~~~~~~~~~~~~~~~~%d.%d in ru_thread is in process\n", proc->frame_rx, proc->tti_rx); if (ru->idx!=0) proc->frame_tx = (proc->frame_tx+proc->frame_offset)&1023; // do RX front-end processing (frequency-shift, dft) if needed @@ -1924,82 +1416,6 @@ void *ru_thread( void *param ) { ru_thread_status = 0; return &ru_thread_status; } -/* -// This thread run the initial synchronization like a UE -void *ru_thread_synch(void *arg) { - - RU_t *ru = (RU_t*)arg; - NR_DL_FRAME_PARMS *fp=ru->nr_frame_parms; - int32_t sync_pos,sync_pos2; - uint32_t peak_val; - uint32_t sync_corr[307200] __attribute__((aligned(32))); - static int ru_thread_synch_status; - - - - wait_sync("ru_thread_synch"); - - // initialize variables for PSS detection - lte_sync_time_init(ru->nr_frame_parms); - - while (!oai_exit) { - - // wait to be woken up - if (wait_on_condition(&ru->proc.mutex_synch,&ru->proc.cond_synch,&ru->proc.instance_cnt_synch,"ru_thread_synch")<0) break; - - // if we're not in synch, then run initial synch - if (ru->in_synch == 0) { - // run intial synch like UE - LOG_I(PHY,"Running initial synchronization\n"); - - sync_pos = lte_sync_time_gNB(ru->common.rxdata, - fp, - fp->samples_per_subframe*5, - &peak_val, - sync_corr); - LOG_I(PHY,"RU synch: %d, val %d\n",sync_pos,peak_val); - - if (sync_pos >= 0) { - if (sync_pos >= fp->nb_prefix_samples) - sync_pos2 = sync_pos - fp->nb_prefix_samples; - else - sync_pos2 = sync_pos + (fp->samples_per_subframe*10) - fp->nb_prefix_samples; - - if (fp->frame_type == FDD) { - - // PSS is hypothesized in last symbol of first slot in Frame - int sync_pos_slot = (fp->samples_per_subframe>>1) - fp->ofdm_symbol_size - fp->nb_prefix_samples; - - if (sync_pos2 >= sync_pos_slot) - ru->rx_offset = sync_pos2 - sync_pos_slot; - else - ru->rx_offset = (fp->samples_per_subframe*10) + sync_pos2 - sync_pos_slot; - } - else { - - } - - LOG_I(PHY,"Estimated sync_pos %d, peak_val %d => timing offset %d\n",sync_pos,peak_val,ru->rx_offset); - - if ((peak_val > 300000) && (sync_pos > 0)) { - // if (sync_pos++ > 3) { - write_output("ru_sync.m","sync",(void*)&sync_corr[0],fp->samples_per_subframe*5,1,2); - write_output("ru_rx.m","rxs",(void*)ru->ru_time.rxdata[0][0],fp->samples_per_subframe*10,1,1); - exit(-1); - } - - ru->in_synch=1; - } - } - - if (release_thread(&ru->proc.mutex_synch,&ru->proc.instance_cnt_synch,"ru_synch_thread") < 0) break; - } // oai_exit - - ru_thread_synch_status = 0; - return &ru_thread_synch_status; - -} -*/ int nr_start_if(struct RU_t_s *ru, struct PHY_VARS_gNB_s *gNB) { return(ru->ifdevice.trx_start_func(&ru->ifdevice)); @@ -2026,12 +1442,7 @@ void init_RU_proc(RU_t *ru) { proc = &ru->proc; memset((void *)proc,0,sizeof(RU_proc_t)); proc->ru = ru; - proc->instance_cnt_prach = -1; proc->instance_cnt_synch = -1; - proc->instance_cnt_FH = -1; - proc->instance_cnt_FH1 = -1; - proc->instance_cnt_gNBs = -1; - proc->instance_cnt_asynch_rxtx = -1; proc->instance_cnt_emulateRF = -1; proc->first_rx = 1; proc->first_tx = 1; @@ -2042,44 +1453,15 @@ void init_RU_proc(RU_t *ru) { for (i=0; i<10; i++) proc->symbol_mask[i]=0; - pthread_mutex_init( &proc->mutex_prach, NULL); - pthread_mutex_init( &proc->mutex_asynch_rxtx, NULL); pthread_mutex_init( &proc->mutex_synch,NULL); - pthread_mutex_init( &proc->mutex_FH,NULL); - pthread_mutex_init( &proc->mutex_FH1,NULL); pthread_mutex_init( &proc->mutex_emulateRF,NULL); - pthread_mutex_init( &proc->mutex_gNBs, NULL); - pthread_cond_init( &proc->cond_prach, NULL); - pthread_cond_init( &proc->cond_FH, NULL); - pthread_cond_init( &proc->cond_FH1, NULL); pthread_cond_init( &proc->cond_emulateRF, NULL); - pthread_cond_init( &proc->cond_asynch_rxtx, NULL); pthread_cond_init( &proc->cond_synch,NULL); - pthread_cond_init( &proc->cond_gNBs, NULL); threadCreate( &proc->pthread_FH, ru_thread, (void *)ru, "thread_FH", -1, OAI_PRIORITY_RT_MAX ); - if (get_thread_parallel_conf() == PARALLEL_RU_L1_SPLIT || get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT) - threadCreate( &proc->pthread_FH1, ru_thread_tx, (void *)ru, "thread_FH1", -1, OAI_PRIORITY_RT ); - if(emulate_rf) threadCreate( &proc->pthread_emulateRF, emulatedRF_thread, (void *)proc, "emulateRF", -1, OAI_PRIORITY_RT ); - if (ru->function == NGFI_RRU_IF4p5) { - threadCreate( &proc->pthread_prach, ru_thread_prach, (void *)ru, "RACH", -1, OAI_PRIORITY_RT ); - ///tmp deactivation of synch thread - // if (ru->is_slave == 1) pthread_create( &proc->pthread_synch, attr_synch, ru_thread_synch, (void*)ru); - - if ((ru->if_timing == synch_to_other) || - (ru->function == NGFI_RRU_IF5) || - (ru->function == NGFI_RRU_IF4p5)) threadCreate( &proc->pthread_asynch_rxtx, ru_thread_asynch_rxtx, (void *)ru, "asynch_rxtx", -1, OAI_PRIORITY_RT ); - - snprintf( name, sizeof(name), "ru_thread_FH %d", ru->idx ); - pthread_setname_np( proc->pthread_FH, name ); - } else if (ru->function == gNodeB_3GPP && ru->if_south == LOCAL_RF) { // DJP - need something else to distinguish between monolithic and PNF - LOG_I(PHY,"%s() DJP - added creation of pthread_prach\n", __FUNCTION__); - threadCreate( &proc->pthread_prach, ru_thread_prach, (void *)ru,"RACH", -1, OAI_PRIORITY_RT ); - } - if (get_thread_worker_conf() == WORKER_ENABLE) { if (ru->feprx) nr_init_feprx_thread(ru); @@ -2092,26 +1474,10 @@ void init_RU_proc(RU_t *ru) { void kill_NR_RU_proc(int inst) { RU_t *ru = RC.ru[inst]; RU_proc_t *proc = &ru->proc; - pthread_mutex_lock(&proc->mutex_FH); - proc->instance_cnt_FH = 0; - pthread_mutex_unlock(&proc->mutex_FH); - pthread_cond_signal(&proc->cond_FH); - pthread_mutex_lock(&proc->mutex_prach); - proc->instance_cnt_prach = 0; - pthread_mutex_unlock(&proc->mutex_prach); - pthread_cond_signal(&proc->cond_prach); pthread_mutex_lock(&proc->mutex_synch); proc->instance_cnt_synch = 0; pthread_mutex_unlock(&proc->mutex_synch); pthread_cond_signal(&proc->cond_synch); - pthread_mutex_lock(&proc->mutex_gNBs); - proc->instance_cnt_gNBs = 0; - pthread_mutex_unlock(&proc->mutex_gNBs); - pthread_cond_signal(&proc->cond_gNBs); - pthread_mutex_lock(&proc->mutex_asynch_rxtx); - proc->instance_cnt_asynch_rxtx = 0; - pthread_mutex_unlock(&proc->mutex_asynch_rxtx); - pthread_cond_signal(&proc->cond_asynch_rxtx); LOG_D(PHY, "Joining pthread_FH\n"); pthread_join(proc->pthread_FH, NULL); @@ -2161,16 +1527,8 @@ void kill_NR_RU_proc(int inst) { pthread_join(ru->ru_stats_thread, NULL); } - pthread_mutex_destroy(&proc->mutex_prach); - pthread_mutex_destroy(&proc->mutex_asynch_rxtx); pthread_mutex_destroy(&proc->mutex_synch); - pthread_mutex_destroy(&proc->mutex_FH); - pthread_mutex_destroy(&proc->mutex_gNBs); - pthread_cond_destroy(&proc->cond_prach); - pthread_cond_destroy(&proc->cond_FH); - pthread_cond_destroy(&proc->cond_asynch_rxtx); pthread_cond_destroy(&proc->cond_synch); - pthread_cond_destroy(&proc->cond_gNBs); } int check_capabilities(RU_t *ru,RRU_capabilities_t *cap) diff --git a/executables/softmodem-common.h b/executables/softmodem-common.h index a6035122c0..47aecd7b10 100644 --- a/executables/softmodem-common.h +++ b/executables/softmodem-common.h @@ -240,6 +240,10 @@ extern char *get_softmodem_function(uint64_t *sofmodemfunc_mask_ptr); extern void set_softmodem_sighandler(void); extern uint64_t downlink_frequency[MAX_NUM_CCs][4]; extern int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; + +void tx_func(void *param); +void rx_func(void *param); +void ru_tx_func(void *param); #ifdef __cplusplus } #endif diff --git a/openair1/PHY/defs_RU.h b/openair1/PHY/defs_RU.h index b465a51a2a..885f955a2a 100644 --- a/openair1/PHY/defs_RU.h +++ b/openair1/PHY/defs_RU.h @@ -741,4 +741,10 @@ typedef struct RRU_config_s { MBSFN_config_t MBSFN_config[8]; } RRU_config_t; +typedef struct processingData_RU { + int frame_tx; + int slot_tx; + openair0_timestamp timestamp_tx; + RU_t *ru; +} processingData_RU_t; #endif //__PHY_DEFS_RU__H__ diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index 440cfc7a69..24cecc85da 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -875,4 +875,13 @@ union ldpcReqUnion { uint64_t p; }; +typedef struct processingData_L1 { + int frame_rx; + int frame_tx; + int slot_rx; + int slot_tx; + openair0_timestamp timestamp_tx; + PHY_VARS_gNB *gNB; +} processingData_L1_t; + #endif From 82804981bd2bc72bd8e9a676b8fc8c08d4db9d8e Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Thu, 11 Feb 2021 17:42:20 +0100 Subject: [PATCH 056/231] fix timing advance command scaling scaling with 2^mu is already part of 'bw_scaling', so don't do it twice! Also simplify the computation in get_bw_scaling() by using a one-line computation instead of a switch-case table. --- openair1/SCHED_NR/phy_procedures_nr_gNB.c | 14 +------ openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 41 ++++++++------------- 2 files changed, 18 insertions(+), 37 deletions(-) diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index 12ebf9cf43..fb2ca60d7d 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -367,7 +367,6 @@ void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id, int timing_advance_update, cqi; int sync_pos; - uint16_t mu = gNB->frame_parms.numerology_index; NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ULSCH_id][0]; NR_UL_gNB_HARQ_t *harq_process = ulsch->harq_processes[harq_pid]; @@ -375,19 +374,10 @@ void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id, // pdu->data = gNB->ulsch[ULSCH_id+1][0]->harq_processes[harq_pid]->b; sync_pos = nr_est_timing_advance_pusch(gNB, ULSCH_id); // estimate timing advance for MAC - timing_advance_update = sync_pos * (1 << mu); // scale by the used scs numerology // scale the 16 factor in N_TA calculation in 38.213 section 4.2 according to the used FFT size - switch (gNB->frame_parms.N_RB_DL) { - case 24: timing_advance_update /= 4; break; - case 106: timing_advance_update /= 16; break; - case 217: timing_advance_update /= 32; break; - case 245: timing_advance_update /= 32; break; - case 273: timing_advance_update /= 32; break; - case 66: timing_advance_update /= 12; break; - case 32: timing_advance_update /= 12; break; - default: AssertFatal(0==1,"No case defined for PRB %d to calculate timing_advance_update\n",gNB->frame_parms.N_RB_DL); - } + uint16_t bw_scaling = 16 * gNB->frame_parms.ofdm_symbol_size / 2048; + timing_advance_update = sync_pos / bw_scaling; // put timing advance command in 0..63 range timing_advance_update += 31; diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index 02a8238abe..5b4446b3e0 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -202,22 +202,15 @@ uint8_t get_ra_PreambleIndex(uint8_t Mod_id, uint8_t CC_id, uint8_t gNB_id){ } - -// scale the 16 factor in N_TA calculation in 38.213 section 4.2 according to the used FFT size -uint16_t get_bw_scaling(uint16_t nb_rb){ - uint16_t bw_scaling; - - switch (nb_rb) { - case 24: bw_scaling = 4; break; - case 32: bw_scaling = 4; break; - case 66: bw_scaling = 8; break; - case 106: bw_scaling = 16; break; - case 217: bw_scaling = 32; break; - case 245: bw_scaling = 32; break; - case 273: bw_scaling = 32; break; - default: AssertFatal(1==0,"N_RB_UL %d not supported\n",nb_rb); - } - return bw_scaling; +// convert time factor "16 * 64 * T_c / (2^mu)" in N_TA calculation in TS38.213 section 4.2 to samples by multiplying with samples per second +// 16 * 64 * T_c / (2^mu) * samples_per_second +// = 16 * T_s / (2^mu) * samples_per_second +// = 16 * 1 / (15 kHz * 2048) / (2^mu) * (15 kHz * 2^mu * ofdm_symbol_size) +// = 16 * 1 / 2048 * ofdm_symbol_size +// = 16 * ofdm_symbol_size / 2048 +static inline +uint16_t get_bw_scaling(uint16_t ofdm_symbol_size){ + return 16 * ofdm_symbol_size / 2048; } // UL time alignment procedures: @@ -235,18 +228,16 @@ void ue_ta_procedures(PHY_VARS_NR_UE *ue, int slot_tx, int frame_tx){ if (frame_tx == ul_time_alignment->ta_frame && slot_tx == ul_time_alignment->ta_slot) { - uint8_t numerology = ue->frame_parms.numerology_index; - uint16_t bwp_ul_NB_RB = ue->frame_parms.N_RB_UL; - int factor_mu = 1 << numerology; - uint16_t bw_scaling = get_bw_scaling(bwp_ul_NB_RB); + uint16_t ofdm_symbol_size = ue->frame_parms.ofdm_symbol_size; + uint16_t bw_scaling = get_bw_scaling(ofdm_symbol_size); LOG_D(PHY, "In %s: applying timing advance -- frame %d -- slot %d -- UE_mode %d\n", __FUNCTION__, frame_tx, slot_tx, ue->UE_mode[gNB_id]); if (ue->UE_mode[gNB_id] == RA_RESPONSE){ - ue->timing_advance = ul_time_alignment->ta_command * bw_scaling / factor_mu; + ue->timing_advance += ul_time_alignment->ta_command * bw_scaling; - LOG_D(PHY, "In %s: [UE %d] [%d.%d] Received (RAR) timing advance command %d new value is %u \n", + LOG_D(PHY, "In %s: [UE %d] [%d.%d] Received (RAR) timing advance command %u new value is %d\n", __FUNCTION__, ue->Mod_id, frame_tx, @@ -256,7 +247,7 @@ void ue_ta_procedures(PHY_VARS_NR_UE *ue, int slot_tx, int frame_tx){ } else if (ue->UE_mode[gNB_id] == PUSCH){ - ue->timing_advance += (ul_time_alignment->ta_command - 31) * bw_scaling / factor_mu; + ue->timing_advance += (ul_time_alignment->ta_command - 31) * bw_scaling; LOG_D(PHY, "In %s: [UE %d] [%d.%d] Got timing advance command %u from MAC, new value is %d\n", __FUNCTION__, @@ -1259,7 +1250,7 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, if (ue->mac_enabled == 1) { - uint16_t bw_scaling = get_bw_scaling(ue->frame_parms.N_RB_DL); + uint16_t bw_scaling = get_bw_scaling(ofdm_symbol_size); /* Time Alignment procedure // - UE processing capability 1 @@ -1268,7 +1259,7 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, // - Durations of N1 and N2 symbols corresponding to PDSCH and PUSCH are // computed according to sections 5.3 and 6.4 of TS 38.214 */ factor_mu = 1 << numerology; - N_TA_max = 3846 * bw_scaling / factor_mu; + N_TA_max = 3846 * bw_scaling; /* PDSCH decoding time N_1 for processing capability 1 */ if (ue->dmrs_DownlinkConfig.pdsch_dmrs_AdditionalPosition == pdsch_dmrs_pos0) From 00a7adf198047cd1b23cc033b99535b2c5e3d46a Mon Sep 17 00:00:00 2001 From: cig Date: Wed, 10 Feb 2021 10:46:50 +0100 Subject: [PATCH 057/231] NR_UE: cleanup and fix computation of ta_slot (when to apply the timing advance value) - made hardcoded constants explicit - made the code more readable according to OAI coding style guidelines - fixed some formatting and logging --- openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 106 ++++++-------------- 1 file changed, 33 insertions(+), 73 deletions(-) diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index 5b4446b3e0..19a4e43569 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -920,33 +920,19 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, int nr_slot_rx = proc->nr_slot_rx; int ret=0, ret1=0; NR_UE_PDSCH *pdsch_vars; - uint8_t is_cw0_active = 0; - uint8_t is_cw1_active = 0; - uint8_t dmrs_type, nb_re_dmrs; uint16_t dmrs_len = get_num_dmrs(dlsch0->harq_processes[dlsch0->current_harq_pid]->dlDmrsSymbPos); - uint16_t nb_symb_sch = 9; nr_downlink_indication_t dl_indication; fapi_nr_rx_indication_t rx_ind; uint16_t number_pdus = 1; // params for UL time alignment procedure NR_UL_TIME_ALIGNMENT_t *ul_time_alignment = &ue->ul_time_alignment[eNB_id]; - uint16_t slots_per_frame = ue->frame_parms.slots_per_frame; - uint16_t slots_per_subframe = ue->frame_parms.slots_per_subframe; - uint8_t numerology = ue->frame_parms.numerology_index, mapping_type_ul, mapping_type_dl; - int ul_tx_timing_adjustment, N_TA_max, factor_mu, N_t_1, N_t_2, N_1, N_2, d_1_1 = 0, d_2_1, d; - uint8_t d_2_2 = 0;// set to 0 because there is only 1 BWP - // TODO this should corresponds to the switching time as defined in - // TS 38.133 - uint16_t ofdm_symbol_size = ue->frame_parms.ofdm_symbol_size; - uint16_t nb_prefix_samples = ue->frame_parms.nb_prefix_samples; - uint32_t t_subframe = 1; // subframe duration of 1 msec - uint16_t start_symbol; - float tc_factor; - is_cw0_active = dlsch0->harq_processes[harq_pid]->status; - nb_symb_sch = dlsch0->harq_processes[harq_pid]->nb_symbols; - start_symbol = dlsch0->harq_processes[harq_pid]->start_symbol; - dmrs_type = dlsch0->harq_processes[harq_pid]->dmrsConfigType; + uint8_t is_cw0_active = dlsch0->harq_processes[harq_pid]->status; + uint16_t nb_symb_sch = dlsch0->harq_processes[harq_pid]->nb_symbols; + uint16_t start_symbol = dlsch0->harq_processes[harq_pid]->start_symbol; + uint8_t dmrs_type = dlsch0->harq_processes[harq_pid]->dmrsConfigType; + + uint8_t nb_re_dmrs; if (dmrs_type==NFAPI_NR_DMRS_TYPE1) { nb_re_dmrs = 6*dlsch0->harq_processes[harq_pid]->n_dmrs_cdm_groups; } @@ -954,6 +940,7 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, nb_re_dmrs = 4*dlsch0->harq_processes[harq_pid]->n_dmrs_cdm_groups; } + uint8_t is_cw1_active = 0; if(dlsch1) is_cw1_active = dlsch1->harq_processes[harq_pid]->status; @@ -1215,53 +1202,29 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, } } - // TODO CRC check for CW0 - - // Check CRC for CW 0 - /*if (ret == (1+dlsch0->max_turbo_iterations)) { - *dlsch_errors=*dlsch_errors+1; - if(dlsch0->rnti != 0xffff){ - LOG_D(PHY,"[UE %d][PDSCH %x/%d] AbsSubframe %d.%d : DLSCH CW0 in error (rv %d,round %d, mcs %d,TBS %d)\n", - ue->Mod_id,dlsch0->rnti, - harq_pid,frame_rx,nr_slot_rx, - dlsch0->harq_processes[harq_pid]->rvidx, - dlsch0->harq_processes[harq_pid]->round, - dlsch0->harq_processes[harq_pid]->mcs, - dlsch0->harq_processes[harq_pid]->TBS); - } - } else { - if(dlsch0->rnti != 0xffff){ - LOG_D(PHY,"[UE %d][PDSCH %x/%d] AbsSubframe %d.%d : Received DLSCH CW0 (rv %d,round %d, mcs %d,TBS %d)\n", - ue->Mod_id,dlsch0->rnti, - harq_pid,frame_rx,nr_slot_rx, - dlsch0->harq_processes[harq_pid]->rvidx, - dlsch0->harq_processes[harq_pid]->round, - dlsch0->harq_processes[harq_pid]->mcs, - dlsch0->harq_processes[harq_pid]->TBS); - } - if ( LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)){ - int j; - LOG_D(PHY,"dlsch harq_pid %d (rx): \n",dlsch0->current_harq_pid); - - for (j=0; jharq_processes[dlsch0->current_harq_pid]->TBS>>3; j++) - LOG_T(PHY,"%x.",dlsch0->harq_processes[dlsch0->current_harq_pid]->b[j]); - LOG_T(PHY,"\n"); - }*/ - if (ue->mac_enabled == 1) { - uint16_t bw_scaling = get_bw_scaling(ofdm_symbol_size); - /* Time Alignment procedure // - UE processing capability 1 // - Setting the TA update to be applied after the reception of the TA command // - Timing adjustment computed according to TS 38.213 section 4.2 // - Durations of N1 and N2 symbols corresponding to PDSCH and PUSCH are // computed according to sections 5.3 and 6.4 of TS 38.214 */ - factor_mu = 1 << numerology; - N_TA_max = 3846 * bw_scaling; + const int numerology = ue->frame_parms.numerology_index; + const int ofdm_symbol_size = ue->frame_parms.ofdm_symbol_size; + const int nb_prefix_samples = ue->frame_parms.nb_prefix_samples; + const int samples_per_subframe = ue->frame_parms.samples_per_subframe; + const int slots_per_frame = ue->frame_parms.slots_per_frame; + const int slots_per_subframe = ue->frame_parms.slots_per_subframe; + + const double tc_factor = 1.0 / samples_per_subframe; + const uint16_t bw_scaling = get_bw_scaling(ofdm_symbol_size); + + const int Ta_max = 3846; // Max value of 12 bits TA Command + const double N_TA_max = Ta_max * bw_scaling * tc_factor; /* PDSCH decoding time N_1 for processing capability 1 */ + int N_1; if (ue->dmrs_DownlinkConfig.pdsch_dmrs_AdditionalPosition == pdsch_dmrs_pos0) N_1 = pdsch_N_1_capability_1[numerology][1]; else if (ue->dmrs_DownlinkConfig.pdsch_dmrs_AdditionalPosition == pdsch_dmrs_pos1 || ue->dmrs_DownlinkConfig.pdsch_dmrs_AdditionalPosition == 2) // TODO set to pdsch_dmrs_pos2 when available @@ -1270,12 +1233,12 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, N_1 = pdsch_N_1_capability_1[numerology][3]; /* PUSCH preapration time N_2 for processing capability 1 */ - N_2 = pusch_N_2_timing_capability_1[numerology][1]; - mapping_type_dl = ue->PDSCH_Config.pdsch_TimeDomainResourceAllocation[0]->mappingType; - mapping_type_ul = ue->pusch_config.pusch_TimeDomainResourceAllocation[0]->mappingType; + const int N_2 = pusch_N_2_timing_capability_1[numerology][1]; /* d_1_1 depending on the number of PDSCH symbols allocated */ - d = 0; // TODO number of overlapping symbols of the scheduling PDCCH and the scheduled PDSCH + const int d = 0; // TODO number of overlapping symbols of the scheduling PDCCH and the scheduled PDSCH + int d_1_1 = 0; + mappingType_t mapping_type_dl = ue->PDSCH_Config.pdsch_TimeDomainResourceAllocation[0]->mappingType; if (mapping_type_dl == typeA) if (nb_symb_sch + start_symbol < 7) d_1_1 = 7 - (nb_symb_sch + start_symbol); @@ -1290,22 +1253,26 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, } /* d_2_1 */ + int d_2_1; + mappingType_t mapping_type_ul = ue->pusch_config.pusch_TimeDomainResourceAllocation[0]->mappingType; if (mapping_type_ul == typeB && start_symbol != 0) d_2_1 = 0; else d_2_1 = 1; + /* d_2_2 */ + const double d_2_2 = 0.0; // set to 0 because there is only 1 BWP: TODO this should corresponds to the switching time as defined in TS 38.133 + /* N_t_1 time duration in msec of N_1 symbols corresponding to a PDSCH reception time // N_t_2 time duration in msec of N_2 symbols corresponding to a PUSCH preparation time */ - N_t_1 = (N_1 + d_1_1) * (ofdm_symbol_size + nb_prefix_samples) / factor_mu; - N_t_2 = (N_2 + d_2_1) * (ofdm_symbol_size + nb_prefix_samples) / factor_mu; + double N_t_1 = (N_1 + d_1_1) * (ofdm_symbol_size + nb_prefix_samples) * tc_factor; + double N_t_2 = (N_2 + d_2_1) * (ofdm_symbol_size + nb_prefix_samples) * tc_factor; if (N_t_2 < d_2_2) N_t_2 = d_2_2; /* Time alignment procedure */ - // N_t_1 + N_t_2 + N_TA_max is in unit of Ts, therefore must be converted to Tc // N_t_1 + N_t_2 + N_TA_max must be in msec - tc_factor = 64 * 0.509 * 10e-7; - ul_tx_timing_adjustment = 1 + ceil(slots_per_subframe*((N_t_1 + N_t_2 + N_TA_max)*tc_factor + 0.5)/t_subframe); + const double t_subframe = 1.0; // subframe duration of 1 msec + const int ul_tx_timing_adjustment = 1 + (int)ceil(slots_per_subframe*(N_t_1 + N_t_2 + N_TA_max + 0.5)/t_subframe); if (ul_time_alignment->apply_ta == 1){ ul_time_alignment->ta_slot = (nr_slot_rx + ul_tx_timing_adjustment) % slots_per_frame; @@ -1319,13 +1286,6 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, LOG_D(PHY,"Frame %d slot %d -- Starting UL time alignment procedures. TA update will be applied at frame %d slot %d\n", frame_rx, nr_slot_rx, ul_time_alignment->ta_frame, ul_time_alignment->ta_slot); } } - - /*ue->total_TBS[eNB_id] = ue->total_TBS[eNB_id] + dlsch0->harq_processes[dlsch0->current_harq_pid]->TBS; - ue->total_received_bits[eNB_id] = ue->total_TBS[eNB_id] + dlsch0->harq_processes[dlsch0->current_harq_pid]->TBS; - }*/ - - // TODO CRC check for CW1 - } } From 24fc20e2e2e0f19feb1951f0cdc524844f68a307 Mon Sep 17 00:00:00 2001 From: cig Date: Fri, 12 Feb 2021 17:02:20 +0100 Subject: [PATCH 058/231] Bugfix in USRP flags configuration for NR UE - missing check on duplex mode before fetching the TDD period - missing flags configuration for FDD mode --- executables/nr-ue.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 6be23582b1..8d10a19f3d 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -707,12 +707,17 @@ void *UE_thread(void *arg) { uint8_t num_UL_slots = mac->scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots + (mac->scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols!=0); uint8_t first_tx_slot = tdd_period - num_UL_slots; - if (slot_tx_usrp%tdd_period==first_tx_slot) - flags=2; - else if (slot_tx_usrp%tdd_period==first_tx_slot+num_UL_slots-1) - flags = 3; - else if (slot_tx_usrp%tdd_period>first_tx_slot) + + if (openair0_cfg[0].duplex_mode == TDD) { + if (slot_tx_usrp % tdd_period == first_tx_slot) + flags = 2; + else if (slot_tx_usrp % tdd_period == first_tx_slot + num_UL_slots - 1) + flags = 3; + else if (slot_tx_usrp % tdd_period > first_tx_slot) + flags = 1; + } else { flags = 1; + } if (flags || IS_SOFTMODEM_RFSIM) AssertFatal( writeBlockSize == From d5877d75bfd912e2ef4ca2bec7e71f2fb9212328 Mon Sep 17 00:00:00 2001 From: cig Date: Fri, 12 Feb 2021 18:41:19 +0100 Subject: [PATCH 059/231] Bugfix in gNB RA scheduling for FDD duplex mode - the RA SFN index wasn't increased in the FDD case, therefore the PRACH RX was never scheduled --- openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index 407bc72714..35bebb351e 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -1220,6 +1220,11 @@ int get_nr_prach_occasion_info_from_index(uint8_t index, else { // FDD x = table_6_3_3_2_2_prachConfig_Index[index][2]; s_map = table_6_3_3_2_2_prachConfig_Index[index][4]; + for(int i = 0; i < 64 ; i++) { + if ( (s_map >> i) & 0x01) { + (*N_RA_sfn)++; + } + } *N_RA_slot = table_6_3_3_2_2_prachConfig_Index[index][6]; if (start_symbol != NULL && N_t_slot != NULL && N_dur != NULL && format != NULL){ *start_symbol = table_6_3_3_2_2_prachConfig_Index[index][5]; @@ -1429,6 +1434,11 @@ int get_nr_prach_info_from_index(uint8_t index, if ( (table_6_3_3_2_2_prachConfig_Index[index][6] <= 1) && (slot%2 == 0) ) return 0; // no prach in even slots @ 30kHz for 1 prach per subframe } + for(int i = 0; i <= subframe ; i++) { + if ( (s_map >> i) & 0x01) { + (*RA_sfn_index)++; + } + } if (start_symbol != NULL && N_t_slot != NULL && N_dur != NULL && format != NULL){ *start_symbol = table_6_3_3_2_2_prachConfig_Index[index][5]; *N_t_slot = table_6_3_3_2_2_prachConfig_Index[index][7]; From 08ab23450189f3bde995c0a5da425020d097180b Mon Sep 17 00:00:00 2001 From: Sakthivel Velumani Date: Sat, 13 Feb 2021 15:14:03 +0100 Subject: [PATCH 060/231] Removing sync_thread --- executables/nr-gnb.c | 2 - executables/nr-ru.c | 132 ------------------------------------------- 2 files changed, 134 deletions(-) diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index a23a8a4a5d..50ba578bc0 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -251,8 +251,6 @@ void rx_func(void *param) { phy_procedures_gNB_uespec_RX(gNB, frame_rx, slot_rx); } - if (oai_exit) return(-1); - //stop_meas( &softmodem_stats_rxtx_sf ); LOG_D(PHY,"%s() Exit proc[rx:%d%d tx:%d%d]\n", __FUNCTION__, frame_rx, slot_rx, frame_tx, slot_tx); diff --git a/executables/nr-ru.c b/executables/nr-ru.c index 9fd83bab76..c941e84947 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -787,107 +787,6 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) { } } - - - -int wakeup_synch(RU_t *ru) { - struct timespec wait; - wait.tv_sec=0; - wait.tv_nsec=5000000L; - - // wake up synch thread - // lock the synch mutex and make sure the thread is ready - if (pthread_mutex_timedlock(&ru->proc.mutex_synch,&wait) != 0) { - LOG_E( PHY, "[RU] ERROR pthread_mutex_lock for RU synch thread (IC %d)\n", ru->proc.instance_cnt_synch ); - exit_fun( "error locking mutex_synch" ); - return(-1); - } - - ++ru->proc.instance_cnt_synch; - - // the thread can now be woken up - if (pthread_cond_signal(&ru->proc.cond_synch) != 0) { - LOG_E( PHY, "[RU] ERROR pthread_cond_signal for RU synch thread\n"); - exit_fun( "ERROR pthread_cond_signal" ); - return(-1); - } - - pthread_mutex_unlock( &ru->proc.mutex_synch ); - return(0); -} - -void do_ru_synch(RU_t *ru) { - NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms; - RU_proc_t *proc = &ru->proc; - int i; - void *rxp[2],*rxp2[2]; - int32_t dummy_rx[ru->nb_rx][fp->samples_per_subframe] __attribute__((aligned(32))); - int rxs; - int ic; - - // initialize the synchronization buffer to the common_vars.rxdata - for (int i=0; inb_rx; i++) - rxp[i] = &ru->common.rxdata[i][0]; - - double temp_freq1 = ru->rfdevice.openair0_cfg->rx_freq[0]; - double temp_freq2 = ru->rfdevice.openair0_cfg->tx_freq[0]; - - for (i=0; i<4; i++) { - ru->rfdevice.openair0_cfg->rx_freq[i] = ru->rfdevice.openair0_cfg->tx_freq[i]; - ru->rfdevice.openair0_cfg->tx_freq[i] = temp_freq1; - } - - ru->rfdevice.trx_set_freq_func(&ru->rfdevice,ru->rfdevice.openair0_cfg,0); - - while ((ru->in_synch ==0)&&(!oai_exit)) { - // read in frame - rxs = ru->rfdevice.trx_read_func(&ru->rfdevice, - &(proc->timestamp_rx), - rxp, - fp->samples_per_subframe*10, - ru->nb_rx); - - if (rxs != fp->samples_per_subframe*10) LOG_E(PHY,"requested %d samples, got %d\n",fp->samples_per_subframe*10,rxs); - - // wakeup synchronization processing thread - wakeup_synch(ru); - ic=0; - - while ((ic>=0)&&(!oai_exit)) { - // continuously read in frames, 1ms at a time, - // until we are done with the synchronization procedure - for (i=0; inb_rx; i++) - rxp2[i] = (void *)&dummy_rx[i][0]; - - for (i=0; i<10; i++) - rxs = ru->rfdevice.trx_read_func(&ru->rfdevice, - &(proc->timestamp_rx), - rxp2, - fp->samples_per_subframe, - ru->nb_rx); - - pthread_mutex_lock(&ru->proc.mutex_synch); - ic = ru->proc.instance_cnt_synch; - pthread_mutex_unlock(&ru->proc.mutex_synch); - } // ic>=0 - } // in_synch==0 - - // read in rx_offset samples - LOG_I(PHY,"Resynchronizing by %d samples\n",ru->rx_offset); - rxs = ru->rfdevice.trx_read_func(&ru->rfdevice, - &(proc->timestamp_rx), - rxp, - ru->rx_offset, - ru->nb_rx); - - for (i=0; i<4; i++) { - ru->rfdevice.openair0_cfg->rx_freq[i] = temp_freq1; - ru->rfdevice.openair0_cfg->tx_freq[i] = temp_freq2; - } - - ru->rfdevice.trx_set_freq_func(&ru->rfdevice,ru->rfdevice.openair0_cfg,0); -} - // this is for RU with local RF unit void fill_rf_config(RU_t *ru, char *rf_config_file) { int i; @@ -1289,9 +1188,6 @@ void *ru_thread( void *param ) { else LOG_I(PHY,"RU %d rf device ready\n",ru->idx); } else LOG_I(PHY,"RU %d no rf device\n",ru->idx); - // if this is a slave RRU, try to synchronize on the DL frequency - if ((ru->is_slave) && (ru->if_south == LOCAL_RF)) do_ru_synch(ru); - // start trx write thread if(usrp_tx_thread == 1){ if (ru->start_write_thread){ @@ -1437,12 +1333,10 @@ int start_write_thread(RU_t *ru) { void init_RU_proc(RU_t *ru) { int i=0; RU_proc_t *proc; - char name[100]; 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; - proc->instance_cnt_synch = -1; proc->instance_cnt_emulateRF = -1; proc->first_rx = 1; proc->first_tx = 1; @@ -1453,10 +1347,8 @@ void init_RU_proc(RU_t *ru) { for (i=0; i<10; i++) proc->symbol_mask[i]=0; - pthread_mutex_init( &proc->mutex_synch,NULL); pthread_mutex_init( &proc->mutex_emulateRF,NULL); pthread_cond_init( &proc->cond_emulateRF, NULL); - pthread_cond_init( &proc->cond_synch,NULL); threadCreate( &proc->pthread_FH, ru_thread, (void *)ru, "thread_FH", -1, OAI_PRIORITY_RT_MAX ); if(emulate_rf) @@ -1474,30 +1366,9 @@ void init_RU_proc(RU_t *ru) { void kill_NR_RU_proc(int inst) { RU_t *ru = RC.ru[inst]; RU_proc_t *proc = &ru->proc; - pthread_mutex_lock(&proc->mutex_synch); - proc->instance_cnt_synch = 0; - pthread_mutex_unlock(&proc->mutex_synch); - pthread_cond_signal(&proc->cond_synch); LOG_D(PHY, "Joining pthread_FH\n"); pthread_join(proc->pthread_FH, NULL); - if (ru->function == NGFI_RRU_IF4p5) { - LOG_D(PHY, "Joining pthread_prach\n"); - pthread_join(proc->pthread_prach, NULL); - - if (ru->is_slave) { - LOG_D(PHY, "Joining pthread_\n"); - pthread_join(proc->pthread_synch, NULL); - } - - if ((ru->if_timing == synch_to_other) || - (ru->function == NGFI_RRU_IF5) || - (ru->function == NGFI_RRU_IF4p5)) { - LOG_D(PHY, "Joining pthread_asynch_rxtx\n"); - pthread_join(proc->pthread_asynch_rxtx, NULL); - } - } - if (get_nprocs() >= 2) { if (ru->feprx) { pthread_mutex_lock(&proc->mutex_fep); @@ -1526,9 +1397,6 @@ void kill_NR_RU_proc(int inst) { LOG_D(PHY, "Joining ru_stats_thread\n"); pthread_join(ru->ru_stats_thread, NULL); } - - pthread_mutex_destroy(&proc->mutex_synch); - pthread_cond_destroy(&proc->cond_synch); } int check_capabilities(RU_t *ru,RRU_capabilities_t *cap) From 94d956fa559cdd6dfdbca91c4fb12415d97f9621 Mon Sep 17 00:00:00 2001 From: cig Date: Mon, 15 Feb 2021 12:28:11 +0100 Subject: [PATCH 061/231] Fixed warning about use of wrong enum --- executables/nr-ue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 8d10a19f3d..0c97552c15 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -708,7 +708,7 @@ void *UE_thread(void *arg) { (mac->scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols!=0); uint8_t first_tx_slot = tdd_period - num_UL_slots; - if (openair0_cfg[0].duplex_mode == TDD) { + if (openair0_cfg[0].duplex_mode == duplex_mode_TDD) { if (slot_tx_usrp % tdd_period == first_tx_slot) flags = 2; else if (slot_tx_usrp % tdd_period == first_tx_slot + num_UL_slots - 1) From eef684d91a6127e0a85455930f68b5d800e55d80 Mon Sep 17 00:00:00 2001 From: francescomani Date: Mon, 15 Feb 2021 16:25:30 +0100 Subject: [PATCH 062/231] adding 24 PRB to X2AP function --- openair2/X2AP/x2ap_eNB_generate_messages.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/openair2/X2AP/x2ap_eNB_generate_messages.c b/openair2/X2AP/x2ap_eNB_generate_messages.c index fdce8678b0..7c3a89e7f4 100644 --- a/openair2/X2AP/x2ap_eNB_generate_messages.c +++ b/openair2/X2AP/x2ap_eNB_generate_messages.c @@ -1318,6 +1318,9 @@ MCC_MNC_TO_PLMNID(instance_p->mcc, instance_p->mnc, instance_p->mnc_digit_length ASN_SEQUENCE_ADD(&servedCellMember->servedNRCellInfo.nrModeInfo.choice.tdd.nRFreqInfo.freqBandListNr, freq_band); switch (instance_p->N_RB_DL[i]) { + case 24: + servedCellMember->servedNRCellInfo.nrModeInfo.choice.tdd.nR_TxBW.nRNRB = X2AP_NRNRB_nrb24; + break; case 32: servedCellMember->servedNRCellInfo.nrModeInfo.choice.tdd.nR_TxBW.nRNRB = X2AP_NRNRB_nrb32; break; From f62095fb32375315b59a9952f7532eac6698f6df Mon Sep 17 00:00:00 2001 From: Sakthivel Velumani Date: Tue, 16 Feb 2021 10:29:38 +0100 Subject: [PATCH 063/231] Updated nr_dlsim to generate matlab files Updated matlab file write function to write multiple vectors to a single file. --- common/utils/LOG/log.c | 9 +++++---- common/utils/LOG/log.h | 10 ++++++---- openair1/SIMULATION/NR_PHY/dlsim.c | 15 ++++++++++++--- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/common/utils/LOG/log.c b/common/utils/LOG/log.c index 2340c78bf1..be0a5b3bcd 100644 --- a/common/utils/LOG/log.c +++ b/common/utils/LOG/log.c @@ -88,7 +88,8 @@ int write_file_matlab(const char *fname, void *data, int length, int dec, - char format) + char format, + int multiVec) { FILE *fp=NULL; int i; @@ -98,7 +99,7 @@ int write_file_matlab(const char *fname, //printf("Writing %d elements of type %d to %s\n",length,format,fname); - if (format == 10 || format ==11 || format == 12 || format == 13 || format == 14) { + if (format == 10 || format ==11 || format == 12 || format == 13 || format == 14 || multiVec) { fp = fopen(fname,"a+"); } else if (format != 10 && format !=11 && format != 12 && format != 13 && format != 14) { fp = fopen(fname,"w+"); @@ -109,7 +110,7 @@ int write_file_matlab(const char *fname, return(-1); } - if (format != 10 && format !=11 && format != 12 && format != 13 && format != 14) + if ((format != 10 && format !=11 && format != 12 && format != 13 && format != 14) || multiVec) fprintf(fp,"%s = [",vname); switch (format) { @@ -216,7 +217,7 @@ int write_file_matlab(const char *fname, break; } - if (format != 10 && format !=11 && format !=12 && format != 13 && format != 15) { + if ((format != 10 && format !=11 && format !=12 && format != 13 && format != 15) || multiVec) { fprintf(fp,"];\n"); fclose(fp); return(0); diff --git a/common/utils/LOG/log.h b/common/utils/LOG/log.h index d893708a8b..a8dae8d027 100644 --- a/common/utils/LOG/log.h +++ b/common/utils/LOG/log.h @@ -335,8 +335,9 @@ typedef struct { @param length length of data vector to output @param dec decimation level @param format data format (0 = real 16-bit, 1 = complex 16-bit,2 real 32-bit, 3 complex 32-bit,4 = real 8-bit, 5 = complex 8-bit) +@param multiVec create new file or append to existing (useful for writing multiple vectors to same file. Just call the function multiple times with same file name and with this parameter set to 1) */ -int32_t write_file_matlab(const char *fname, const char *vname, void *data, int length, int dec, char format); +int32_t write_file_matlab(const char *fname, const char *vname, void *data, int length, int dec, char format, int multiVec); /*----------------macro definitions for reading log configuration from the config module */ #define CONFIG_STRING_LOG_PREFIX "log_config" @@ -396,7 +397,7 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int /* bitmask dependent macros, to generate debug file such as matlab file or message dump */ # define LOG_DUMPFLAG(D) (g_log->dump_mask & D) -# define LOG_M(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format);} while(0)/* */ +# define LOG_M(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format, 0);} while(0)/* */ /* define variable only used in LOG macro's */ # define LOG_VAR(A,B) A B # else /* T_TRACER: remove all debugging and tracing messages, except errors */ @@ -413,7 +414,7 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int # define LOG_DUMPFLAG(D) (g_log->debug_mask & D) # define LOG_DUMPMSG(c, f, b, s, x...) do { if(g_log->dump_mask & f) log_dump(c, b, s, LOG_DUMP_CHAR, x) ;} while (0) /* */ -# define LOG_M(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format);} while(0) +# define LOG_M(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format, 0);} while(0) # define LOG_VAR(A,B) A B # endif /* T_TRACER */ /* avoid warnings for variables only used in LOG macro's but set outside debug section */ @@ -421,9 +422,10 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int #define LOG_USEDINLOG_VAR(A,B) GCC_NOTUSED A B /* unfiltered macros, useful for simulators or messages at init time, before log is configured */ -#define LOG_UM(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format);} while(0) +#define LOG_UM(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format, 0);} while(0) #define LOG_UI(c, x...) do {logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_INFO, x) ; } while(0) #define LOG_UDUMPMSG(c, b, s, f, x...) do { log_dump(c, b, s, f, x) ;} while (0) /* */ +# define LOG_MM(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format, 1);} while(0) /* @}*/ diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 9581038283..a0d18b3da9 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -235,7 +235,10 @@ int main(int argc, char **argv) int i,aa;//,l; double sigma2, sigma2_dB=10, SNR, snr0=-2.0, snr1=2.0; uint8_t snr1set=0; - float roundStats[50]; + double roundStats[500] = {0}; + double blerStats[500] = {0}; + double berStats[500] = {0}; + double snrStats[500] = {0}; float effRate; //float psnr; float eff_tp_check = 0.7; @@ -1101,7 +1104,9 @@ int main(int argc, char **argv) if (UE_harq_process->harq_ack.ack==1) effRate += ((float)TBS)/round; } // noise trials + blerStats[snrRun] = (float) n_errors / (float) n_trials; roundStats[snrRun]/=((float)n_trials); + berStats[snrRun] = (double)errors_scrambling/available_bits/n_trials; effRate /= n_trials; printf("*****************************************\n"); printf("SNR %f, (false positive %f)\n", SNR, @@ -1109,7 +1114,7 @@ int main(int argc, char **argv) printf("*****************************************\n"); printf("\n"); dump_pdsch_stats(gNB); - printf("SNR %f : n_errors (negative CRC) = %d/%d, Avg round %.2f, Channel BER %e, Eff Rate %.4f bits/slot, Eff Throughput %.2f, TBS %u bits/slot\n", SNR, n_errors, n_trials,roundStats[snrRun],(double)errors_scrambling/available_bits/n_trials,effRate,effRate/TBS*100,TBS); + printf("SNR %f : n_errors (negative CRC) = %d/%d, Avg round %.2f, Channel BER %e, BLER %.2f, Eff Rate %.4f bits/slot, Eff Throughput %.2f, TBS %u bits/slot\n", SNR, n_errors, n_trials,roundStats[snrRun],berStats[snrRun],blerStats[snrRun],effRate,effRate/TBS*100,TBS); printf("\n"); if (print_perf==1) { @@ -1174,15 +1179,19 @@ int main(int argc, char **argv) break; } - //if ((float)n_errors/(float)n_trials <= target_error_rate) { if (effRate > (eff_tp_check*TBS)) { printf("PDSCH test OK\n"); break; } + snrStats[snrRun] = SNR; snrRun++; } // NSR + LOG_M("dlsimStats.m","SNR",snrStats,snrRun,1,7); + LOG_MM("dlsimStats.m","BLER",blerStats,snrRun,1,7); + LOG_MM("dlsimStats.m","BER",berStats,snrRun,1,7); + LOG_MM("dlsimStats.m","rounds",roundStats,snrRun,1,7); /*if (n_trials>1) { printf("HARQ stats:\nSNR\tRounds\n"); psnr = snr0; From 7c86b9c28990fbdbb8e83aa2ba29128ab3426b7a Mon Sep 17 00:00:00 2001 From: Sakthivel Velumani Date: Tue, 16 Feb 2021 12:07:27 +0100 Subject: [PATCH 064/231] Ulsch coding fix Do encoding only if NDI toggles instead of doing on first round. Both are same but we now remove the dependancy on rv_round_mapping. --- openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h | 2 ++ openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c | 7 ++----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h index 464bcfcfba..aa32ecc8c9 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h @@ -105,6 +105,8 @@ typedef struct { uint8_t O_ACK; /// Index of current HARQ round for this ULSCH uint8_t round; + /// Last Ndi for this harq process + uint8_t ndi; /// pointer to pdu from MAC interface (TS 36.212 V15.4.0, Sec 5.1 p. 8) unsigned char *a; /// Pointer to the payload + CRC diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c index d9bea8a3ac..1a39def26b 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c @@ -202,7 +202,6 @@ NR_UE_ULSCH_t *new_nr_ue_ulsch(uint16_t N_RB_UL, for (i=0; iharq_processes[i]->round=0; } - return(ulsch); } } @@ -257,7 +256,6 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch, Ilbrm = 0; Tbslbrm = 950984; //max tbs Coderate = 0.0; - harq_process->round = nr_rv_round_map_ue[harq_process->pusch_pdu.pusch_data.rv_index]; /////////// ///////////////////////////////////////////////////////////////////////////////////////// @@ -267,8 +265,7 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch, LOG_D(PHY,"ulsch coding nb_rb %d, Nl = %d\n", nb_rb, harq_process->pusch_pdu.nrOfLayers); LOG_D(PHY,"ulsch coding A %d G %d mod_order %d\n", A,G, mod_order); - // if (harq_process->Ndi == 1) { // this is a new packet - if (harq_process->round == 0) { // this is a new packet + if (harq_process->ndi != harq_process->pusch_pdu.pusch_data.new_data_indicator) { // this is a new packet #ifdef DEBUG_ULSCH_CODING printf("encoding thinks this is a new packet \n"); #endif @@ -415,7 +412,7 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch, /////////// /////////////////////////////////////////////////////////////////////////////// - + harq_process->ndi = harq_process->pusch_pdu.pusch_data.new_data_indicator; } F = harq_process->F; Kr = harq_process->K; From c89d3493004b3913d69e60f8cf749279a25ca091 Mon Sep 17 00:00:00 2001 From: cig Date: Tue, 16 Feb 2021 14:57:04 +0100 Subject: [PATCH 065/231] Bugfix in nr_ue_prach_scheduler - scheduled_response was called regardless of the UL config in the PRACH slot this was leading to wrong behaviour since it was interfering with the UL config of PUSCH --- openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index 041d78d0e3..66b5c7a697 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -1684,13 +1684,11 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s format0 = format & 0xff; // single PRACH format format1 = (format >> 8) & 0xff; // dual PRACH format - ul_config->sfn = frameP; - ul_config->slot = slotP; - - ul_config->ul_config_list[ul_config->number_pdus].pdu_type = FAPI_NR_UL_CONFIG_TYPE_PRACH; prach_config_pdu = &ul_config->ul_config_list[ul_config->number_pdus].prach_config_pdu; memset(prach_config_pdu, 0, sizeof(fapi_nr_ul_config_prach_pdu)); - ul_config->number_pdus += 1; + + fill_ul_config(ul_config, frameP, slotP, FAPI_NR_UL_CONFIG_TYPE_PRACH); + LOG_D(PHY, "In %s: (%p) %d UL PDUs:\n", __FUNCTION__, ul_config, ul_config->number_pdus); ncs = get_NCS(rach_ConfigGeneric->zeroCorrelationZoneConfig, format0, setup->restrictedSetConfig); @@ -1768,11 +1766,10 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s AssertFatal(1 == 0, "Invalid PRACH format"); } } // if format1 + fill_scheduled_response(&scheduled_response, NULL, ul_config, NULL, module_idP, 0 /*TBR fix*/, frameP, slotP, thread_id); + if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL) + mac->if_module->scheduled_response(&scheduled_response); } // is_nr_prach_slot - - fill_scheduled_response(&scheduled_response, NULL, ul_config, NULL, module_idP, 0 /*TBR fix*/, frameP, slotP, thread_id); - if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL) - mac->if_module->scheduled_response(&scheduled_response); } // if is_nr_UL_slot } From e023f67ed8717f78d2e0a5d5d16749064881b9e9 Mon Sep 17 00:00:00 2001 From: cig Date: Wed, 17 Feb 2021 13:50:25 +0100 Subject: [PATCH 066/231] Compute and apply symbol rotation for DL and UL - now done according to the proper DL/UL frequency - this makes it compatible with FDD mode --- executables/nr-uesoftmodem.c | 3 +- openair1/PHY/INIT/nr_init.c | 2 +- openair1/PHY/MODULATION/nr_modulation.c | 65 +++++++++++++++------- openair1/PHY/MODULATION/nr_modulation.h | 2 +- openair1/PHY/MODULATION/ofdm_mod.c | 22 +++++--- openair1/PHY/MODULATION/slot_fep_nr.c | 6 +- openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c | 20 ++++--- openair1/PHY/defs_nr_common.h | 3 +- openair1/SIMULATION/NR_PHY/pbchsim.c | 2 +- 9 files changed, 84 insertions(+), 41 deletions(-) diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 87cd157948..03bc7e14a5 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -531,7 +531,8 @@ int main( int argc, char **argv ) { fapi_nr_config_request_t *nrUE_config = &UE[CC_id]->nrUE_config; nr_init_frame_parms_ue(&UE[CC_id]->frame_parms, nrUE_config, *mac->scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]); - init_symbol_rotation(&UE[CC_id]->frame_parms, UE[CC_id]->frame_parms.dl_CarrierFreq); + + init_symbol_rotation(&UE[CC_id]->frame_parms); init_nr_ue_vars(UE[CC_id], 0, abstraction_flag); #ifdef FR2_TEST diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index bd6b944fef..cb14e12024 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -494,7 +494,7 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config) { // } RC.gNB[Mod_id]->configured = 1; - init_symbol_rotation(fp,fp->dl_CarrierFreq); + init_symbol_rotation(fp); LOG_I(PHY,"gNB %d configured\n",Mod_id); } diff --git a/openair1/PHY/MODULATION/nr_modulation.c b/openair1/PHY/MODULATION/nr_modulation.c index 0a7088ba39..e0f087c808 100644 --- a/openair1/PHY/MODULATION/nr_modulation.c +++ b/openair1/PHY/MODULATION/nr_modulation.c @@ -502,35 +502,62 @@ void nr_dft(int32_t *z, int32_t *d, uint32_t Msc_PUSCH) } -void init_symbol_rotation(NR_DL_FRAME_PARMS *fp,uint64_t CarrierFreq) { +void init_symbol_rotation(NR_DL_FRAME_PARMS *fp) { + + uint64_t dl_CarrierFreq = fp->dl_CarrierFreq; + uint64_t ul_CarrierFreq = fp->ul_CarrierFreq; + double f[2] = {(double)dl_CarrierFreq, (double)ul_CarrierFreq}; const int nsymb = fp->symbols_per_slot * fp->slots_per_frame/10; const double Tc=(1/480e3/4096); const double Nu=2048*64*(1/(float)(1<numerology_index)); - const double f0= (double)CarrierFreq; const double Ncp0=16*64 + (144*64*(1/(float)(1<numerology_index))); const double Ncp1=(144*64*(1/(float)(1<numerology_index))); double tl=0,poff,exp_re,exp_im; double Ncp,Ncpm1=Ncp0; - poff = 2*M_PI*((Ncp0*Tc))*f0; - exp_re = cos(poff); - exp_im = sin(-poff); - fp->symbol_rotation[0]=(int16_t)floor(exp_re*32767); - fp->symbol_rotation[1]=(int16_t)floor(exp_im*32767); - LOG_I(PHY,"Doing symbol rotation calculation for gNB TX/RX, f0 %f Hz, Nsymb %d\n",f0,nsymb); - LOG_I(PHY,"Symbol rotation %d/%d => (%d,%d)\n",0,nsymb,fp->symbol_rotation[0],fp->symbol_rotation[1]); - for (int l=1;lnumerology_index))) Ncp=Ncp0; - else Ncp=Ncp1; - tl += (Nu+Ncpm1)*Tc; - poff = 2*M_PI*(tl + (Ncp*Tc))*f0; + for (uint8_t ll = 0; ll < 2; ll++){ + + double f0 = f[ll]; + int16_t *symbol_rotation = fp->symbol_rotation[ll]; + + poff = 2 * M_PI * ((Ncp0 * Tc)) * f0; exp_re = cos(poff); exp_im = sin(-poff); - fp->symbol_rotation[l<<1]=(int16_t)floor(exp_re*32767); - fp->symbol_rotation[1+(l<<1)]=(int16_t)floor(exp_im*32767); - LOG_I(PHY,"Symbol rotation %d/%d => tl %f (%d,%d) (%f)\n",l,nsymb,tl,fp->symbol_rotation[l<<1],fp->symbol_rotation[1+(l<<1)], - (poff/2/M_PI)-floor(poff/2/M_PI)); - Ncpm1=Ncp; + symbol_rotation[0] = (int16_t)floor(exp_re * 32767); + symbol_rotation[1] = (int16_t)floor(exp_im * 32767); + LOG_I(PHY, "Doing symbol rotation calculation for gNB TX/RX, f0 %f Hz, Nsymb %d\n", f0, nsymb); + LOG_I(PHY, "Symbol rotation %d/%d => (%d,%d)\n", + 0, + nsymb, + symbol_rotation[0], + symbol_rotation[1]); + + for (int l = 1; l < nsymb; l++) { + + if (l == (7 * (1 << fp->numerology_index))) { + Ncp = Ncp0; + } else { + Ncp = Ncp1; + } + + tl += (Nu + Ncpm1) * Tc; + poff = 2 * M_PI * (tl + (Ncp * Tc)) * f0; + exp_re = cos(poff); + exp_im = sin(-poff); + symbol_rotation[l<<1] = (int16_t)floor(exp_re * 32767); + symbol_rotation[1 + (l<<1)] = (int16_t)floor(exp_im * 32767); + + LOG_I(PHY, "Symbol rotation %d/%d => tl %f (%d,%d) (%f)\n", + l, + nsymb, + tl, + symbol_rotation[l<<1], + symbol_rotation[1 + (l<<1)], + (poff / 2 / M_PI) - floor(poff / 2 / M_PI)); + + Ncpm1 = Ncp; + + } } } diff --git a/openair1/PHY/MODULATION/nr_modulation.h b/openair1/PHY/MODULATION/nr_modulation.h index 3d2be905ac..c6c9718f7e 100644 --- a/openair1/PHY/MODULATION/nr_modulation.h +++ b/openair1/PHY/MODULATION/nr_modulation.h @@ -110,7 +110,7 @@ void apply_nr_rotation(NR_DL_FRAME_PARMS *fp, int nsymb, int length); -void init_symbol_rotation(NR_DL_FRAME_PARMS *fp,uint64_t CarrierFreq); +void init_symbol_rotation(NR_DL_FRAME_PARMS *fp); void apply_nr_rotation_ul(NR_DL_FRAME_PARMS *frame_parms, int32_t *rxdataF, diff --git a/openair1/PHY/MODULATION/ofdm_mod.c b/openair1/PHY/MODULATION/ofdm_mod.c index 2d86b46742..8cf9f05b9b 100644 --- a/openair1/PHY/MODULATION/ofdm_mod.c +++ b/openair1/PHY/MODULATION/ofdm_mod.c @@ -306,15 +306,23 @@ void apply_nr_rotation(NR_DL_FRAME_PARMS *fp, int length) { int symb_offset = (slot%fp->slots_per_subframe)*fp->symbols_per_slot; + int16_t *symbol_rotation = fp->symbol_rotation[0]; + for (int sidx=0;sidxsymbol_rotation[2*(sidx+first_symbol+symb_offset)],fp->symbol_rotation[1+2*(sidx+first_symbol+symb_offset)]); - rotate_cpx_vector(trxdata+(sidx*length*2), - &fp->symbol_rotation[2*(sidx+first_symbol+symb_offset)], - trxdata+(sidx*length*2), - length, - 15); + first_symbol + sidx, + slot, + sidx + first_symbol + symb_offset, + length, + symbol_rotation[2 * (sidx + first_symbol + symb_offset)], + symbol_rotation[1 + 2 * (sidx + first_symbol + symb_offset)]); + + rotate_cpx_vector(trxdata + (sidx * length * 2), + &symbol_rotation[2 * (sidx + first_symbol + symb_offset)], + trxdata + (sidx * length * 2), + length, + 15); } } diff --git a/openair1/PHY/MODULATION/slot_fep_nr.c b/openair1/PHY/MODULATION/slot_fep_nr.c index 60b28d4ad1..7b5ddb230a 100644 --- a/openair1/PHY/MODULATION/slot_fep_nr.c +++ b/openair1/PHY/MODULATION/slot_fep_nr.c @@ -205,7 +205,7 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, #endif int symb_offset = (Ns%frame_parms->slots_per_subframe)*frame_parms->symbols_per_slot; - int32_t rot2 = ((uint32_t*)frame_parms->symbol_rotation)[symbol+symb_offset]; + int32_t rot2 = ((uint32_t*)frame_parms->symbol_rotation[0])[symbol + symb_offset]; ((int16_t*)&rot2)[1]=-((int16_t*)&rot2)[1]; rotate_cpx_vector((int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol], (int16_t*)&rot2, @@ -386,7 +386,7 @@ int nr_slot_fep_init_sync(PHY_VARS_NR_UE *ue, } int symb_offset = (Ns%frame_parms->slots_per_subframe)*frame_parms->symbols_per_slot; - int32_t rot2 = ((uint32_t*)frame_parms->symbol_rotation)[symbol+symb_offset]; + int32_t rot2 = ((uint32_t*)frame_parms->symbol_rotation[0])[symbol + symb_offset]; ((int16_t*)&rot2)[1]=-((int16_t*)&rot2)[1]; #ifdef DEBUG_FEP @@ -513,7 +513,7 @@ void apply_nr_rotation_ul(NR_DL_FRAME_PARMS *frame_parms, for (int symbol=0;symbolsymbol_rotation)[symbol+symb_offset]; + uint32_t rot2 = ((uint32_t*)frame_parms->symbol_rotation[1])[symbol + symb_offset]; ((int16_t*)&rot2)[1]=-((int16_t*)&rot2)[1]; LOG_D(PHY,"slot %d, symb_offset %d rotating by %d.%d\n",slot,symb_offset,((int16_t*)&rot2)[0],((int16_t*)&rot2)[1]); rotate_cpx_vector((int16_t *)&rxdataF[frame_parms->ofdm_symbol_size*symbol], diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c index 208901f289..3d8c975a5c 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c @@ -496,13 +496,19 @@ uint8_t nr_ue_pusch_common_procedures(PHY_VARS_NR_UE *UE, int symb_offset = (slot%frame_parms->slots_per_subframe)*frame_parms->symbols_per_slot; for(ap = 0; ap < Nl; ap++) { for (int s=0;s (%d.%d)\n", - s,s+symb_offset,frame_parms->symbol_rotation[2*(s+symb_offset)],frame_parms->symbol_rotation[1+(2*(s+symb_offset))]); - rotate_cpx_vector((int16_t *)&txdataF[ap][frame_parms->ofdm_symbol_size*s], - &frame_parms->symbol_rotation[2*(s+symb_offset)], - (int16_t *)&txdataF[ap][frame_parms->ofdm_symbol_size*s], - frame_parms->ofdm_symbol_size, - 15); + + LOG_D(PHY,"In %s: rotating txdataF symbol %d (%d) => (%d.%d)\n", + __FUNCTION__, + s, + s + symb_offset, + frame_parms->symbol_rotation[1][2 * (s + symb_offset)], + frame_parms->symbol_rotation[1][1 + (2 * (s + symb_offset))]); + + rotate_cpx_vector((int16_t *)&txdataF[ap][frame_parms->ofdm_symbol_size * s], + &frame_parms->symbol_rotation[1][2 * (s + symb_offset)], + (int16_t *)&txdataF[ap][frame_parms->ofdm_symbol_size * s], + frame_parms->ofdm_symbol_size, + 15); } } diff --git a/openair1/PHY/defs_nr_common.h b/openair1/PHY/defs_nr_common.h index 18c7dd413b..9458833427 100644 --- a/openair1/PHY/defs_nr_common.h +++ b/openair1/PHY/defs_nr_common.h @@ -327,7 +327,8 @@ struct NR_DL_FRAME_PARMS { /// Cyclic Prefix for DL (0=Normal CP, 1=Extended CP) lte_prefix_type_t Ncp; /// sequence which is computed based on carrier frequency and numerology to rotate/derotate each OFDM symbol according to Section 5.3 in 38.211 - int16_t symbol_rotation[224*2]; + /// First dimension is for the direction of the link (0 DL, 1 UL) + int16_t symbol_rotation[2][224*2]; /// shift of pilot position in one RB uint8_t nushift; /// SRS configuration from TS 38.331 RRC diff --git a/openair1/SIMULATION/NR_PHY/pbchsim.c b/openair1/SIMULATION/NR_PHY/pbchsim.c index 2ff89364d3..a6c51468d2 100644 --- a/openair1/SIMULATION/NR_PHY/pbchsim.c +++ b/openair1/SIMULATION/NR_PHY/pbchsim.c @@ -111,7 +111,7 @@ void nr_phy_config_request_sim_pbchsim(PHY_VARS_gNB *gNB, nr_init_frame_parms(gNB_config, fp); - init_symbol_rotation(fp,fp->dl_CarrierFreq); + init_symbol_rotation(fp); gNB->configured = 1; LOG_I(PHY,"gNB configured\n"); From eb93c078bc685313d7bb68f390a6e5dba0887f5a Mon Sep 17 00:00:00 2001 From: Rangaswami Date: Mon, 10 Aug 2020 22:15:09 +0530 Subject: [PATCH 067/231] Initial commits for TCI and CSI reporting changes --- openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 11 ++ openair2/NR_PHY_INTERFACE/NR_IF_Module.c | 184 +++++++++++++++++++++++ 2 files changed, 195 insertions(+) diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 63587d58a4..a2c40a03f1 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -246,8 +246,17 @@ typedef struct pdcchStateInd { uint8_t servingCellId; uint8_t coresetId; uint8_t tciStateId; + bool tci_present_inDCI; } pdcchStateInd_t; +typedef struct pucchSpatialRelation { + bool is_scheduled; + uint8_t servingCellId; + uint8_t bwpId; + uint8_t pucchResourceId; + bool s0tos7_actDeact[8]; +} pucchSpatialRelation_t; + typedef struct SPCSIReportingpucch { bool is_scheduled; uint8_t servingCellId; @@ -271,12 +280,14 @@ typedef struct pdschTciStatesActDeact { uint8_t bwpId; uint8_t highestTciStateActivated; bool tciStateActDeact[MAX_TCI_STATES]; + uint8_t codepoint[8]; } pdschTciStatesActDeact_t; typedef struct UE_info { sp_zp_csirs_t sp_zp_csi_rs; csi_rs_im_t csi_im; pdcchStateInd_t pdcch_state_ind; + pucchSpatialRelation_t pucch_spatial_relation; SPCSIReportingpucch_t SP_CSI_reporting_pucch; aperiodicCSI_triggerStateSelection_t aperi_CSI_trigger; pdschTciStatesActDeact_t pdsch_TCI_States_ActDeact; diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index b183b32aab..3a30844169 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -76,6 +76,189 @@ void handle_nr_rach(NR_UL_IND_t *UL_info) { } } +//!TODO : smae function can be written to handle csi_resources +uint8_t get_ssb_resources (NR_CSI_MeasConfig_t *csi_MeasConfig, + NR_CSI_ResourceConfigId_t csi_ResourceConfigId, + NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type) { + uint8_t idx = 0; + //uint8_t csi_ssb_idx =0; + + for ( idx = 0; idx < csi_MeasConfig->csi_ResourceConfigToAddModList->list.count; idx++) { + if ( csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[idx]->csi_ResourceConfigId == csi_ResourceConfigId) { + //Finding the CSI_RS or SSB Resources + if ( csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[idx]->csi_RS_ResourceSetList.present == NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB) { + + if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type ) + return (csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[idx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.count); + + else if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == reportQuantity_type) + return (csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[idx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.count); + + } else { + //TODO: find the CSI_RS IM resources + } + } else { + AssertFatal(csi_ResourceConfigId, "csi_ResourceConfigId is not configured"); + } + } + + return -1; +} + + +void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, + nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_pdu, + NR_UE_sched_ctrl_t *sched_ctrl, + frame_t frame, + slot_t slot, + NR_SubcarrierSpacing_t scs + ) { + /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ + //uint8_t bitlen_cri = (log(csi_MeasConfig->csi_ResourceConfigToAddModList->list.count)/log(2)); + uint8_t payload_size = ceil(uci_pdu->csi_part1.csi_part1_bit_len/8); + uint16_t *payload = calloc (1, payload_size); + NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type = NR_CSI_ReportConfig__reportQuantity_PR_NOTHING; + uint8_t UE_id = 0; + uint8_t csi_report_id = 0; + memcpy ( payload, uci_pdu->csi_part1.csi_part1_payload, payload_size); + + for ( csi_report_id =0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++ ) { + //Assuming in periodic reporting for one slot can be configured with only one CSI-ReportConfig + if (csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.present == NR_CSI_ReportConfig__reportConfigType_PR_periodic) { + //considering 30khz scs and + //Has to implement according to reportSlotConfig type + if (((NR_SubcarrierSpacing_kHz30 == scs) && + (0 == ((frame*20) + slot) % csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320)) + ||((NR_SubcarrierSpacing_kHz120 == scs)&& + (0 == ((frame*80) + slot) % csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320))){ + reportQuantity_type = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportQuantity.present; + } + } + } + + if ( !(reportQuantity_type)) + AssertFatal(reportQuantity_type, "reportQuantity is not configured"); + + if ( NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type ) { + uint8_t nb_ssb_resource_set = get_ssb_resources(csi_MeasConfig, + csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->resourcesForChannelMeasurement, + reportQuantity_type);//csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[0]->CSI_SSB_ResourceList.list.count; + uint8_t idx = 0; + uint8_t ssb_idx = 0; + uint8_t diff_rsrp_idx = 0; + uint8_t bitlen_ssbri = log (nb_ssb_resource_set)/log (2); + sched_ctrl->nr_of_csi_report[UE_id] = nb_ssb_resource_set; + + /*! As per the spec 38.212 and table: 6.3.1.1.2-12 in a single UCI sequence we can have multiple CSI_report + * the number of CSI_report will depend on number of CSI resource sets that are configured in CSI-ResourceConfig RRC IE + * From spec 38.331 from the IE CSI-ResourceConfig for SSB RSRP reporting we can configure only one resource set + * From spec 38.214 section 5.2.1.2 For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 + */ + for (idx = 0; idx < nb_ssb_resource_set; idx++) { + + /** from 38.214 sec 5.2.1.4.2 + - if the UE is configured with the higher layer parameter groupBasedBeamReporting set to 'disabled', the UE is + not required to update measurements for more than 64 CSI-RS and/or SSB resources, and the UE shall report in + a single report nrofReportedRS (higher layer configured) different CRI or SSBRI for each report setting + + - if the UE is configured with the higher layer parameter groupBasedBeamReporting set to 'enabled', the UE is not + required to update measurements for more than 64 CSI-RS and/or SSB resources, and the UE shall report in a + single reporting instance two different CRI or SSBRI for each report setting, where CSI-RS and/or SSB + resources can be received simultaneously by the UE either with a single spatial domain receive filter, or with + multiple simultaneous spatial domain receive filter + */ + + if (NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled == + csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.present ) { + + if ((NULL != csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.choice.disabled->nrofReportedRS) && + *(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.choice.disabled->nrofReportedRS)) + sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.nr_ssbri_cri = *(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.choice.disabled->nrofReportedRS); + + else + sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.nr_ssbri_cri = NR_CSI_ReportConfig__groupBasedBeamReporting__disabled__nrofReportedRS_n1; + + for (ssb_idx = 0; ssb_idx <= sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.nr_ssbri_cri ; ssb_idx++) { + /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ + sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.CRI_SSBRI [ssb_idx] = (*payload) & ~(~1<<(bitlen_ssbri-1)); + *payload >>= bitlen_ssbri; + } + + sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.RSRP = (*payload) & 0x7f; + + for ( diff_rsrp_idx =0; diff_rsrp_idx <= sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.nr_ssbri_cri - 1; diff_rsrp_idx++ ) { + sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.diff_RSRP[diff_rsrp_idx] = (*payload) & 0x0f; + *payload >>= 4; + } + + } else if (NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled != + csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.present ) { + sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.nr_ssbri_cri = 2; + for (ssb_idx = 0; ssb_idx < 2; ssb_idx++) { + /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ + sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.CRI_SSBRI[ssb_idx] = (*payload) & ~(~1<<(bitlen_ssbri-1)); + *payload >>= bitlen_ssbri; + } + + sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.RSRP = (*payload) & 0x7f; + /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ + sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.diff_RSRP[0] = (*payload) & 0x0f; + *payload >>= 4; + } + } + } + +#if 0 + + if ( NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI == reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_i1 == reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_i1_CQI == reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_CQI == reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI== reportQuantity_type) { + // Handling of extracting cri + sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report.cri = calloc ( 1, ceil(bitlen_cri/8)); + *(sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report.cri) = *((uint32_t *)payload) & ~(~1<<(bitlen_cri-1)); + *payload >>= bitlen_cri; + + if ( 1 == RC.nrrrc[gnb_mod_idP]->carrier.pdsch_AntennaPorts ) { + /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ + sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report->ri = NULL; + } else { + //Handling for the ri for multiple csi ports + } + } + + if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI== reportQuantity_type) { + if ( 1 == RC.nrrrc[gnb_mod_idP]->carrier.pdsch_AntennaPorts ) + /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ + sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report->li = NULL; + else { + //Handle for li for multiple CSI ports + } + } + + //TODO: check for zero padding if available shift payload to the number of zero padding bits + + if ( NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI == reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI== reportQuantity_type) { + if ( 1 == RC.nrrrc[gnb_mod_idP]->carrier.pdsch_AntennaPorts ) { + /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ + sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report->pmi_x1 = NULL; + sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report->pmi_x2 = NULL; + } + } + + if ( NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI == reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_i1_CQI == reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_CQI == reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI== reportQuantity_type) { + /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ + *(sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report->cqi) = *(payload) & 0x0f; + *(payload) >>= 4; + } + +#endif +} void handle_nr_uci(NR_UL_IND_t *UL_info) { @@ -84,6 +267,7 @@ void handle_nr_uci(NR_UL_IND_t *UL_info) const sub_frame_t slot = UL_info->slot; int num_ucis = UL_info->uci_ind.num_ucis; nfapi_nr_uci_t *uci_list = UL_info->uci_ind.uci_list; + uint8_t UE_id = 0; for (int i = 0; i < num_ucis; i++) { switch (uci_list[i].pdu_type) { From 7c6744f3bae9b0adc8cfb439e028f2b26d908c2f Mon Sep 17 00:00:00 2001 From: "r.karey" Date: Thu, 13 Aug 2020 09:33:41 +0530 Subject: [PATCH 068/231] added more debug logs --- openair2/NR_PHY_INTERFACE/NR_IF_Module.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index 3a30844169..e20dbb8e0d 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -127,11 +127,14 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, if (csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.present == NR_CSI_ReportConfig__reportConfigType_PR_periodic) { //considering 30khz scs and //Has to implement according to reportSlotConfig type + LOG_I(PHY,"SFN/SF:%d%d \n", frame,slot); if (((NR_SubcarrierSpacing_kHz30 == scs) && - (0 == ((frame*20) + slot) % csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320)) + (0 == ((frame*20) + (slot+1)) % csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320)) ||((NR_SubcarrierSpacing_kHz120 == scs)&& - (0 == ((frame*80) + slot) % csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320))){ + (0 == ((frame*80) + (slot+1)) % csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320))){ reportQuantity_type = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportQuantity.present; + LOG_I(PHY,"SFN/SF:%d%d reportQuantity type = %d\n", + frame,slot,reportQuantity_type); } } } From d4fde1eb4d3b76aa1e55be15438612c996f6e783 Mon Sep 17 00:00:00 2001 From: Rangaswami Date: Mon, 10 Aug 2020 22:15:09 +0530 Subject: [PATCH 069/231] Initial commits for TCI and CSI reporting changes --- openair2/NR_PHY_INTERFACE/NR_IF_Module.c | 183 +++++++++++++++++++++++ 1 file changed, 183 insertions(+) diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index e20dbb8e0d..3d094580c0 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -105,6 +105,189 @@ uint8_t get_ssb_resources (NR_CSI_MeasConfig_t *csi_MeasConfig, return -1; } +//!TODO : smae function can be written to handle csi_resources +uint8_t get_ssb_resources (NR_CSI_MeasConfig_t *csi_MeasConfig, + NR_CSI_ResourceConfigId_t csi_ResourceConfigId, + NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type) { + uint8_t idx = 0; + //uint8_t csi_ssb_idx =0; + + for ( idx = 0; idx < csi_MeasConfig->csi_ResourceConfigToAddModList->list.count; idx++) { + if ( csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[idx]->csi_ResourceConfigId == csi_ResourceConfigId) { + //Finding the CSI_RS or SSB Resources + if ( csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[idx]->csi_RS_ResourceSetList.present == NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB) { + + if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type ) + return (csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[idx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.count); + + else if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == reportQuantity_type) + return (csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[idx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.count); + + } else { + //TODO: find the CSI_RS IM resources + } + } else { + AssertFatal(csi_ResourceConfigId, "csi_ResourceConfigId is not configured"); + } + } + + return -1; +} + + +void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, + nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_pdu, + NR_UE_sched_ctrl_t *sched_ctrl, + frame_t frame, + slot_t slot, + NR_SubcarrierSpacing_t scs + ) { + /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ + //uint8_t bitlen_cri = (log(csi_MeasConfig->csi_ResourceConfigToAddModList->list.count)/log(2)); + uint8_t payload_size = ceil(uci_pdu->csi_part1.csi_part1_bit_len/8); + uint16_t *payload = calloc (1, payload_size); + NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type = NR_CSI_ReportConfig__reportQuantity_PR_NOTHING; + uint8_t UE_id = 0; + uint8_t csi_report_id = 0; + memcpy ( payload, uci_pdu->csi_part1.csi_part1_payload, payload_size); + + for ( csi_report_id =0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++ ) { + //Assuming in periodic reporting for one slot can be configured with only one CSI-ReportConfig + if (csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.present == NR_CSI_ReportConfig__reportConfigType_PR_periodic) { + //considering 30khz scs and + //Has to implement according to reportSlotConfig type + if (((NR_SubcarrierSpacing_kHz30 == scs) && + (0 == ((frame*20) + slot) % csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320)) + ||((NR_SubcarrierSpacing_kHz120 == scs)&& + (0 == ((frame*80) + slot) % csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320))){ + reportQuantity_type = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportQuantity.present; + } + } + } + + if ( !(reportQuantity_type)) + AssertFatal(reportQuantity_type, "reportQuantity is not configured"); + + if ( NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type ) { + uint8_t nb_ssb_resource_set = get_ssb_resources(csi_MeasConfig, + csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->resourcesForChannelMeasurement, + reportQuantity_type);//csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[0]->CSI_SSB_ResourceList.list.count; + uint8_t idx = 0; + uint8_t ssb_idx = 0; + uint8_t diff_rsrp_idx = 0; + uint8_t bitlen_ssbri = log (nb_ssb_resource_set)/log (2); + sched_ctrl->nr_of_csi_report[UE_id] = nb_ssb_resource_set; + + /*! As per the spec 38.212 and table: 6.3.1.1.2-12 in a single UCI sequence we can have multiple CSI_report + * the number of CSI_report will depend on number of CSI resource sets that are configured in CSI-ResourceConfig RRC IE + * From spec 38.331 from the IE CSI-ResourceConfig for SSB RSRP reporting we can configure only one resource set + * From spec 38.214 section 5.2.1.2 For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 + */ + for (idx = 0; idx < nb_ssb_resource_set; idx++) { + + /** from 38.214 sec 5.2.1.4.2 + - if the UE is configured with the higher layer parameter groupBasedBeamReporting set to 'disabled', the UE is + not required to update measurements for more than 64 CSI-RS and/or SSB resources, and the UE shall report in + a single report nrofReportedRS (higher layer configured) different CRI or SSBRI for each report setting + + - if the UE is configured with the higher layer parameter groupBasedBeamReporting set to 'enabled', the UE is not + required to update measurements for more than 64 CSI-RS and/or SSB resources, and the UE shall report in a + single reporting instance two different CRI or SSBRI for each report setting, where CSI-RS and/or SSB + resources can be received simultaneously by the UE either with a single spatial domain receive filter, or with + multiple simultaneous spatial domain receive filter + */ + + if (NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled == + csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.present ) { + + if ((NULL != csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.choice.disabled->nrofReportedRS) && + *(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.choice.disabled->nrofReportedRS)) + sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.nr_ssbri_cri = *(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.choice.disabled->nrofReportedRS); + + else + sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.nr_ssbri_cri = NR_CSI_ReportConfig__groupBasedBeamReporting__disabled__nrofReportedRS_n1; + + for (ssb_idx = 0; ssb_idx <= sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.nr_ssbri_cri ; ssb_idx++) { + /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ + sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.CRI_SSBRI [ssb_idx] = (*payload) & ~(~1<<(bitlen_ssbri-1)); + *payload >>= bitlen_ssbri; + } + + sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.RSRP = (*payload) & 0x7f; + + for ( diff_rsrp_idx =0; diff_rsrp_idx <= sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.nr_ssbri_cri - 1; diff_rsrp_idx++ ) { + sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.diff_RSRP[diff_rsrp_idx] = (*payload) & 0x0f; + *payload >>= 4; + } + + } else if (NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled != + csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.present ) { + sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.nr_ssbri_cri = 2; + for (ssb_idx = 0; ssb_idx < 2; ssb_idx++) { + /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ + sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.CRI_SSBRI[ssb_idx] = (*payload) & ~(~1<<(bitlen_ssbri-1)); + *payload >>= bitlen_ssbri; + } + + sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.RSRP = (*payload) & 0x7f; + /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ + sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.diff_RSRP[0] = (*payload) & 0x0f; + *payload >>= 4; + } + } + } + +#if 0 + + if ( NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI == reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_i1 == reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_i1_CQI == reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_CQI == reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI== reportQuantity_type) { + // Handling of extracting cri + sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report.cri = calloc ( 1, ceil(bitlen_cri/8)); + *(sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report.cri) = *((uint32_t *)payload) & ~(~1<<(bitlen_cri-1)); + *payload >>= bitlen_cri; + + if ( 1 == RC.nrrrc[gnb_mod_idP]->carrier.pdsch_AntennaPorts ) { + /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ + sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report->ri = NULL; + } else { + //Handling for the ri for multiple csi ports + } + } + + if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI== reportQuantity_type) { + if ( 1 == RC.nrrrc[gnb_mod_idP]->carrier.pdsch_AntennaPorts ) + /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ + sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report->li = NULL; + else { + //Handle for li for multiple CSI ports + } + } + + //TODO: check for zero padding if available shift payload to the number of zero padding bits + + if ( NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI == reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI== reportQuantity_type) { + if ( 1 == RC.nrrrc[gnb_mod_idP]->carrier.pdsch_AntennaPorts ) { + /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ + sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report->pmi_x1 = NULL; + sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report->pmi_x2 = NULL; + } + } + + if ( NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI == reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_i1_CQI == reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_CQI == reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI== reportQuantity_type) { + /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ + *(sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report->cqi) = *(payload) & 0x0f; + *(payload) >>= 4; + } + +#endif +} void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_pdu, From b47a736276b108e53813ee16a73beca8e9c639ef Mon Sep 17 00:00:00 2001 From: "r.karey" Date: Thu, 13 Aug 2020 09:33:41 +0530 Subject: [PATCH 070/231] added more debug logs --- openair2/NR_PHY_INTERFACE/NR_IF_Module.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index 3d094580c0..abdd8f81b5 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -156,11 +156,14 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, if (csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.present == NR_CSI_ReportConfig__reportConfigType_PR_periodic) { //considering 30khz scs and //Has to implement according to reportSlotConfig type + LOG_I(PHY,"SFN/SF:%d%d \n", frame,slot); if (((NR_SubcarrierSpacing_kHz30 == scs) && - (0 == ((frame*20) + slot) % csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320)) + (0 == ((frame*20) + (slot+1)) % csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320)) ||((NR_SubcarrierSpacing_kHz120 == scs)&& - (0 == ((frame*80) + slot) % csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320))){ + (0 == ((frame*80) + (slot+1)) % csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320))){ reportQuantity_type = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportQuantity.present; + LOG_I(PHY,"SFN/SF:%d%d reportQuantity type = %d\n", + frame,slot,reportQuantity_type); } } } From 6bff69664642b37c28253a49ed78bc658b35045a Mon Sep 17 00:00:00 2001 From: "vr.devendra" Date: Thu, 13 Aug 2020 12:07:53 +0530 Subject: [PATCH 071/231] updated TCI handling apis --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index 7201b29596..f5eef3210a 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -102,7 +102,6 @@ void clear_nr_nfapi_information(gNB_MAC_INST * gNB, &gNB->UL_tti_req_ahead[CC_idP][(slotP + num_slots - 1) % num_slots]; nfapi_nr_ul_dci_request_t *UL_dci_req = &gNB->UL_dci_req[0]; nfapi_nr_tx_data_request_t *TX_req = &gNB->TX_req[0]; - gNB->pdu_index[CC_idP] = 0; if (NFAPI_MODE == NFAPI_MONOLITHIC || NFAPI_MODE == NFAPI_MODE_PNF) { // monolithic or PNF @@ -131,7 +130,6 @@ void clear_nr_nfapi_information(gNB_MAC_INST * gNB, gNB->UL_tti_req[CC_idP] = &gNB->UL_tti_req_ahead[CC_idP][slotP]; TX_req[CC_idP].Number_of_PDUs = 0; - } } /* @@ -299,7 +297,6 @@ void schedule_nr_SRS(module_id_t module_idP, frame_t frameP, sub_frame_t subfram bool is_xlsch_in_slot(uint64_t bitmap, sub_frame_t slot) { return (bitmap >> slot) & 0x01; } - void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frame, sub_frame_t slot){ @@ -445,6 +442,5 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, nr_schedule_pucch(module_idP, frame, slot); stop_meas(&RC.nrmac[module_idP]->eNB_scheduler); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_DLSCH_ULSCH_SCHEDULER,VCD_FUNCTION_OUT); } From ed39ad6a0c42f112213dbebd5db2ffc9334d36ae Mon Sep 17 00:00:00 2001 From: "r.karey" Date: Sat, 15 Aug 2020 11:48:49 +0530 Subject: [PATCH 072/231] Added more logs and fixed assertion --- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 4 +++ openair2/NR_PHY_INTERFACE/NR_IF_Module.c | 32 ++++++++++++++----- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 20da8fa30a..ef5a22d583 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -698,6 +698,8 @@ void nr_configure_pucch(nfapi_nr_pucch_pdu_t* pucch_pdu, n_set = pucch_Config->resourceSetToAddModList->list.count; AssertFatal(n_set>0,"PUCCH resourceSetToAddModList is empty\n"); + LOG_I(MAC, "UCI n_set= %d\n", n_set); + N2 = 2; // procedure to select pucch resource id from resource sets according to // number of uci bits and pucch resource indicator pucch_resource @@ -725,6 +727,7 @@ void nr_configure_pucch(nfapi_nr_pucch_pdu_t* pucch_pdu, } else N2 = N3; } + LOG_I(MAC, "UCI resource id = %ld\n", *resource_id); } AssertFatal(resource_id!=NULL,"Couldn-t find any matching PUCCH resource in the PUCCH resource sets"); @@ -763,6 +766,7 @@ void nr_configure_pucch(nfapi_nr_pucch_pdu_t* pucch_pdu, pucch_pdu->sr_flag = O_sr; break; case NR_PUCCH_Resource__format_PR_format2 : + LOG_I(MAC,"UCI format2 is being scheduled\n"); pucch_pdu->format_type = 2; pucch_pdu->nr_of_symbols = pucchres->format.choice.format2->nrofSymbols; pucch_pdu->start_symbol_index = pucchres->format.choice.format2->startingSymbolIndex; diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index abdd8f81b5..91ae32a1dc 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -79,20 +79,32 @@ void handle_nr_rach(NR_UL_IND_t *UL_info) { //!TODO : smae function can be written to handle csi_resources uint8_t get_ssb_resources (NR_CSI_MeasConfig_t *csi_MeasConfig, NR_CSI_ResourceConfigId_t csi_ResourceConfigId, - NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type) { + NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type, + uint8_t *nb_resource_sets) { uint8_t idx = 0; - //uint8_t csi_ssb_idx =0; + uint8_t csi_ssb_idx =0; for ( idx = 0; idx < csi_MeasConfig->csi_ResourceConfigToAddModList->list.count; idx++) { if ( csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[idx]->csi_ResourceConfigId == csi_ResourceConfigId) { //Finding the CSI_RS or SSB Resources if ( csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[idx]->csi_RS_ResourceSetList.present == NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB) { - if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type ) - return (csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[idx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.count); + if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type ){ + *nb_resource_sets=csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[idx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.count; + + for ( csi_ssb_idx = 0; csi_ssb_idx < csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.count; csi_ssb_idx++) { + if (csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceSetId == + *(csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[idx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.array[0])) { + return csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceList.list.count; + } else { + //handle error condition + AssertFatal(csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceSetId, "csi_SSB_ResourcesSetId is not configured"); + } + } + } else if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == reportQuantity_type) - return (csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[idx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.count); + *nb_resource_sets=csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[idx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.count; } else { //TODO: find the CSI_RS IM resources @@ -172,15 +184,17 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, AssertFatal(reportQuantity_type, "reportQuantity is not configured"); if ( NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type ) { - uint8_t nb_ssb_resource_set = get_ssb_resources(csi_MeasConfig, + uint8_t nb_ssb_resource_set=0; + uint8_t nb_ssb_resources = get_ssb_resources(csi_MeasConfig, csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->resourcesForChannelMeasurement, - reportQuantity_type);//csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[0]->CSI_SSB_ResourceList.list.count; + reportQuantity_type,&nb_ssb_resource_set);//csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[0]->CSI_SSB_ResourceList.list.count; uint8_t idx = 0; uint8_t ssb_idx = 0; uint8_t diff_rsrp_idx = 0; - uint8_t bitlen_ssbri = log (nb_ssb_resource_set)/log (2); + uint8_t bitlen_ssbri = log (nb_ssb_resources)/log (2); sched_ctrl->nr_of_csi_report[UE_id] = nb_ssb_resource_set; + LOG_I(MAC,"csi_payload = %d, bitlen_ssbri = %d, nb_ssb_resource_set = %d,nb_ssb_resources = %d\n",payload_size, bitlen_ssbri, nb_ssb_resource_set,nb_ssb_resources); /*! As per the spec 38.212 and table: 6.3.1.1.2-12 in a single UCI sequence we can have multiple CSI_report * the number of CSI_report will depend on number of CSI resource sets that are configured in CSI-ResourceConfig RRC IE * From spec 38.331 from the IE CSI-ResourceConfig for SSB RSRP reporting we can configure only one resource set @@ -217,6 +231,7 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, } sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.RSRP = (*payload) & 0x7f; + *payload >>= 7; for ( diff_rsrp_idx =0; diff_rsrp_idx <= sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.nr_ssbri_cri - 1; diff_rsrp_idx++ ) { sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.diff_RSRP[diff_rsrp_idx] = (*payload) & 0x0f; @@ -233,6 +248,7 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, } sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.RSRP = (*payload) & 0x7f; + *payload >>= 7; /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.diff_RSRP[0] = (*payload) & 0x0f; *payload >>= 4; From 51965998334beb2c83f8b570ca4d36abd9881b32 Mon Sep 17 00:00:00 2001 From: "r.karey" Date: Sat, 15 Aug 2020 13:50:17 +0530 Subject: [PATCH 073/231] receiving of CSI report --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c | 1 + openair2/NR_PHY_INTERFACE/NR_IF_Module.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index ef5a22d583..72264b3b50 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -646,6 +646,7 @@ void nr_configure_pucch(nfapi_nr_pucch_pdu_t* pucch_pdu, int res_found = 0; pucch_pdu->bit_len_harq = O_ack; + pucch_pdu->bit_len_csi_part1 = O_uci-O_ack; uint16_t O_uci = O_csi + O_ack; diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index 91ae32a1dc..facbd2a6f5 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -191,7 +191,7 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, uint8_t idx = 0; uint8_t ssb_idx = 0; uint8_t diff_rsrp_idx = 0; - uint8_t bitlen_ssbri = log (nb_ssb_resources)/log (2); + uint8_t bitlen_ssbri = nb_ssb_resources>1 ?log (nb_ssb_resources)/log (2):1; sched_ctrl->nr_of_csi_report[UE_id] = nb_ssb_resource_set; LOG_I(MAC,"csi_payload = %d, bitlen_ssbri = %d, nb_ssb_resource_set = %d,nb_ssb_resources = %d\n",payload_size, bitlen_ssbri, nb_ssb_resource_set,nb_ssb_resources); From 21c0af1b7cddf1dfc9a69167018e156e51efa8ef Mon Sep 17 00:00:00 2001 From: "r.karey" Date: Wed, 19 Aug 2020 22:02:48 +0530 Subject: [PATCH 074/231] Merged rrc_gNB_reconfig for NR_CSI_reporting --- openair2/RRC/NR/rrc_gNB_reconfig.c | 1 + 1 file changed, 1 insertion(+) diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index ab3f192276..4cb227b054 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -1300,6 +1300,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco secondaryCellGroup->spCellConfig->spCellConfigDedicated->servingCellMO=NULL; } +#endif void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon, NR_RRCReconfiguration_IEs_t *reconfig, NR_CellGroupConfig_t *secondaryCellGroup, From 72d05666663f55a9760e11943dedeed5e25058b8 Mon Sep 17 00:00:00 2001 From: "r.karey" Date: Wed, 2 Sep 2020 15:22:10 +0530 Subject: [PATCH 075/231] UCI bitlength calculation --- openair2/LAYER2/NR_MAC_gNB/config.c | 63 +++++++++++++++ .../NR_MAC_gNB/gNB_scheduler_primitives.c | 2 +- openair2/NR_PHY_INTERFACE/NR_IF_Module.c | 77 ++++++++++--------- 3 files changed, 105 insertions(+), 37 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index bce0719556..994329c9a5 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -311,6 +311,68 @@ void config_common(int Mod_idP, int pdsch_AntennaPorts, NR_ServingCellConfigComm } +//!TODO : smae function can be written to handle csi_resources +void update_csi_bitlen (NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_list_t *UE_list, int UE_id) { + uint8_t csi_report_id = 0; + uint8_t csi_resourceidx =0; + uint8_t csi_ssb_idx =0; + NR_CSI_ResourceConfigId_t csi_ResourceConfigId; + for (csi_report_id=0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++){ + csi_ResourceConfigId=csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->resourcesForChannelMeasurement; + UE_list->csi_report_template[UE_id][csi_report_id].reportQuantity_type = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportQuantity.present; +// UE_list->csi_report_template[UE_id][idx]. + UE_list->csi_report_template[UE_id][csi_report_id].periodicity=csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320; + + for ( csi_resourceidx = 0; csi_resourceidx < csi_MeasConfig->csi_ResourceConfigToAddModList->list.count; csi_resourceidx++) { + if ( csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_ResourceConfigId != csi_ResourceConfigId) + continue; + else { + //Finding the CSI_RS or SSB Resources + UE_list->csi_report_template[UE_id][csi_report_id].CSI_Resource_type= csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.present; + if (NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB ==UE_list->csi_report_template[UE_id][csi_report_id].CSI_Resource_type){ + struct NR_CSI_ResourceConfig__csi_RS_ResourceSetList__nzp_CSI_RS_SSB * nzp_CSI_RS_SSB = csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB; + + UE_list->csi_report_template[UE_id][csi_report_id].nb_of_nzp_csi_report = nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList!=NULL ? nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.count:0; + UE_list->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report = nzp_CSI_RS_SSB->csi_SSB_ResourceSetList!=NULL ? nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.count:0; + } + + if (0 != UE_list->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report){ + uint8_t nb_ssb_resources =0; + + for ( csi_ssb_idx = 0; csi_ssb_idx < csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.count; csi_ssb_idx++) { + if (csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceSetId == + *(csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.array[0])) { ///We can configure only one SSB resource set from spec 38.331 IE CSI-ResourceConfig + if (NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled == + csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->groupBasedBeamReporting.present ) { + if (NULL != csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->groupBasedBeamReporting.choice.disabled->nrofReportedRS) + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].nb_ssbri_cri = *(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->groupBasedBeamReporting.choice.disabled->nrofReportedRS)+1; + else + /*! From Spec 38.331 + * nrofReportedRS + * The number (N) of measured RS resources to be reported per report setting in a non-group-based report. N <= N_max, where N_max is either 2 or 4 depending on UE + * capability. FFS: The signaling mechanism for the gNB to select a subset of N beams for the UE to measure and report. + * When the field is absent the UE applies the value 1 + */ + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].nb_ssbri_cri= 1; + }else + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].nb_ssbri_cri= 2; + + nb_ssb_resources= csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceList.list.count; + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen =nb_ssb_resources>1?log (nb_ssb_resources)/log (2):1; + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].rsrp_bitlen = 7; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen =4; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP + break ; + } + } + } + if (0 != UE_list->csi_report_template[UE_id][csi_report_id].nb_of_nzp_csi_report){ + //TODO:Currently configuring only SSB beamreporting. If CSI beamreporting configured then this has to be implemented + } + break; + } + } + } +} extern uint16_t sl_ahead; @@ -440,6 +502,7 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, UE_info->secondaryCellGroup[UE_id] = secondaryCellGroup; LOG_I(PHY,"Modified UE_id %d/%x with secondaryCellGroup\n",UE_id,rnti); } + update_csi_bitlen (secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup, UE_list, UE_id); } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_OUT); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 72264b3b50..4ccbd7c8c6 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -646,7 +646,7 @@ void nr_configure_pucch(nfapi_nr_pucch_pdu_t* pucch_pdu, int res_found = 0; pucch_pdu->bit_len_harq = O_ack; - pucch_pdu->bit_len_csi_part1 = O_uci-O_ack; + pucch_pdu->bit_len_csi_part1 = O_csi; uint16_t O_uci = O_csi + O_ack; diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index facbd2a6f5..ea20ca2f64 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -75,7 +75,7 @@ void handle_nr_rach(NR_UL_IND_t *UL_info) { } } } - +#if 0 //!TODO : smae function can be written to handle csi_resources uint8_t get_ssb_resources (NR_CSI_MeasConfig_t *csi_MeasConfig, NR_CSI_ResourceConfigId_t csi_ResourceConfigId, @@ -152,31 +152,34 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_sched_ctrl_t *sched_ctrl, frame_t frame, slot_t slot, - NR_SubcarrierSpacing_t scs + NR_SubcarrierSpacing_t scs, int UE_id, + module_id_t Mod_idP ) { /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ //uint8_t bitlen_cri = (log(csi_MeasConfig->csi_ResourceConfigToAddModList->list.count)/log(2)); + uint8_t idx = 0; uint8_t payload_size = ceil(uci_pdu->csi_part1.csi_part1_bit_len/8); uint16_t *payload = calloc (1, payload_size); NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type = NR_CSI_ReportConfig__reportQuantity_PR_NOTHING; - uint8_t UE_id = 0; + //uint8_t UE_id = 0; + NR_UE_list_t *UE_list = &(RC.nrmac[Mod_idP]->UE_list); + long periodicity; uint8_t csi_report_id = 0; memcpy ( payload, uci_pdu->csi_part1.csi_part1_payload, payload_size); for ( csi_report_id =0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++ ) { //Assuming in periodic reporting for one slot can be configured with only one CSI-ReportConfig - if (csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.present == NR_CSI_ReportConfig__reportConfigType_PR_periodic) { + // if (csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.present == NR_CSI_ReportConfig__reportConfigType_PR_periodic) { //considering 30khz scs and //Has to implement according to reportSlotConfig type - LOG_I(PHY,"SFN/SF:%d%d \n", frame,slot); - if (((NR_SubcarrierSpacing_kHz30 == scs) && - (0 == ((frame*20) + (slot+1)) % csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320)) - ||((NR_SubcarrierSpacing_kHz120 == scs)&& - (0 == ((frame*80) + (slot+1)) % csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320))){ - reportQuantity_type = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportQuantity.present; - LOG_I(PHY,"SFN/SF:%d%d reportQuantity type = %d\n", - frame,slot,reportQuantity_type); - } + periodicity = UE_list->csi_report_template[UE_id][csi_report_id].periodicity; + LOG_I(PHY,"SFN/SF:%d%d \n", frame,slot); + if (((NR_SubcarrierSpacing_kHz30 == scs) && (((((frame & 0xf)+1)*20 + slot) & periodicity) == periodicity)) + ||((NR_SubcarrierSpacing_kHz120 == scs)&&(((((frame & 0xf)+1)*80 + slot) & periodicity) == periodicity))) { + + reportQuantity_type = UE_list->csi_report_template[UE_id][csi_report_id].reportQuantity_type; + LOG_I(PHY,"SFN/SF:%d%d reportQuantity type = %d\n",frame,slot,reportQuantity_type); + break; } } @@ -184,23 +187,23 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, AssertFatal(reportQuantity_type, "reportQuantity is not configured"); if ( NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type ) { - uint8_t nb_ssb_resource_set=0; - uint8_t nb_ssb_resources = get_ssb_resources(csi_MeasConfig, + uint8_t nb_ssb_resource_set= UE_list->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report; + //uint8_t nb_ssb_resources = UE_list->csi_report_template[UE_id][csi_report_id]. + /* get_ssb_resources(csi_MeasConfig, csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->resourcesForChannelMeasurement, - reportQuantity_type,&nb_ssb_resource_set);//csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[0]->CSI_SSB_ResourceList.list.count; - uint8_t idx = 0; + reportQuantity_type,&nb_ssb_resource_set);//csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[0]->CSI_SSB_ResourceList.list.count;*/ uint8_t ssb_idx = 0; uint8_t diff_rsrp_idx = 0; - uint8_t bitlen_ssbri = nb_ssb_resources>1 ?log (nb_ssb_resources)/log (2):1; - sched_ctrl->nr_of_csi_report[UE_id] = nb_ssb_resource_set; + uint8_t bitlen_ssbri = UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen; + //sched_ctrl->nr_of_csi_report[UE_id] = nb_ssb_resource_set; - LOG_I(MAC,"csi_payload = %d, bitlen_ssbri = %d, nb_ssb_resource_set = %d,nb_ssb_resources = %d\n",payload_size, bitlen_ssbri, nb_ssb_resource_set,nb_ssb_resources); + LOG_I(MAC,"csi_payload = %d, bitlen_ssbri = %d, nb_ssb_resource_set = %d\n",payload_size, bitlen_ssbri, nb_ssb_resource_set); /*! As per the spec 38.212 and table: 6.3.1.1.2-12 in a single UCI sequence we can have multiple CSI_report * the number of CSI_report will depend on number of CSI resource sets that are configured in CSI-ResourceConfig RRC IE * From spec 38.331 from the IE CSI-ResourceConfig for SSB RSRP reporting we can configure only one resource set * From spec 38.214 section 5.2.1.2 For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 */ - for (idx = 0; idx < nb_ssb_resource_set; idx++) { + // for (idx = 0; idx < nb_ssb_resource_set; idx++) { /** from 38.214 sec 5.2.1.4.2 - if the UE is configured with the higher layer parameter groupBasedBeamReporting set to 'disabled', the UE is @@ -214,30 +217,31 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, multiple simultaneous spatial domain receive filter */ - if (NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled == +/* if (NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled == csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.present ) { if ((NULL != csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.choice.disabled->nrofReportedRS) && *(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.choice.disabled->nrofReportedRS)) sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.nr_ssbri_cri = *(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.choice.disabled->nrofReportedRS); - else - sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.nr_ssbri_cri = NR_CSI_ReportConfig__groupBasedBeamReporting__disabled__nrofReportedRS_n1; + else */ + idx = 0; //Since for SSB RSRP reporting in RRC can configure only one ssb resource set per one report config + sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri = UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].nb_ssbri_cri; - for (ssb_idx = 0; ssb_idx <= sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.nr_ssbri_cri ; ssb_idx++) { + for (ssb_idx = 0; ssb_idx < sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri ; ssb_idx++) { /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ - sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.CRI_SSBRI [ssb_idx] = (*payload) & ~(~1<<(bitlen_ssbri-1)); - *payload >>= bitlen_ssbri; - } + sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [ssb_idx] = (*payload) & ~(~1<<(bitlen_ssbri-1)); + *payload >>= bitlen_ssbri; + } - sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.RSRP = (*payload) & 0x7f; - *payload >>= 7; - - for ( diff_rsrp_idx =0; diff_rsrp_idx <= sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.nr_ssbri_cri - 1; diff_rsrp_idx++ ) { - sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.diff_RSRP[diff_rsrp_idx] = (*payload) & 0x0f; - *payload >>= 4; - } + sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP = (*payload) & 0x7f; + *payload >>= 7; + for ( diff_rsrp_idx =0; diff_rsrp_idx < sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri - 1; diff_rsrp_idx++ ) { + sched_ctrl->CSI_report[idx].choice.ssb_cri_report.diff_RSRP[diff_rsrp_idx] = (*payload) & 0x0f; + *payload >>= 4; + } +#if 0 } else if (NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled != csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.present ) { sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.nr_ssbri_cri = 2; @@ -253,7 +257,8 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.diff_RSRP[0] = (*payload) & 0x0f; *payload >>= 4; } - } +#endif + // } } #if 0 From 13ed4a3aa35a5a93f492470c657a522d9c0549b7 Mon Sep 17 00:00:00 2001 From: "r.karey" Date: Thu, 3 Sep 2020 18:13:22 +0530 Subject: [PATCH 076/231] Added debug logs --- openair2/LAYER2/NR_MAC_gNB/config.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 994329c9a5..32561a122d 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -358,9 +358,18 @@ void update_csi_bitlen (NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_list_t *UE_li UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].nb_ssbri_cri= 2; nb_ssb_resources= csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceList.list.count; - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen =nb_ssb_resources>1?log (nb_ssb_resources)/log (2):1; + if (nb_ssb_resources) + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen =nb_ssb_resources>1?ceil(log2 (nb_ssb_resources)):1; + else + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen =nb_ssb_resources; + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].rsrp_bitlen = 7; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen =4; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen =4; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP + + LOG_I (MAC, "UCI: CSI_bit len : ssbri %d, rsrp: %d, diff_rsrp: %d", + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen, + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].rsrp_bitlen, + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen); break ; } } From 07d90b44b941d9daaa60c96b194d7f66953a9f9f Mon Sep 17 00:00:00 2001 From: "r.karey" Date: Mon, 7 Sep 2020 09:08:22 +0530 Subject: [PATCH 077/231] Modified bitlen calculation for ssbri --- openair2/LAYER2/NR_MAC_gNB/config.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 32561a122d..1579c7a106 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -359,12 +359,14 @@ void update_csi_bitlen (NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_list_t *UE_li nb_ssb_resources= csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceList.list.count; if (nb_ssb_resources) - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen =nb_ssb_resources>1?ceil(log2 (nb_ssb_resources)):1; + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen =ceil(log2 (nb_ssb_resources)); + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].rsrp_bitlen = 7; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen =4; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP else - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen =nb_ssb_resources; - - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].rsrp_bitlen = 7; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen =4; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen =0; + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].rsrp_bitlen = 0; + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen =0; + LOG_I (MAC, "UCI: CSI_bit len : ssbri %d, rsrp: %d, diff_rsrp: %d", UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen, From da383da93d95d942c1253801673c123f210b3f68 Mon Sep 17 00:00:00 2001 From: "r.karey" Date: Mon, 7 Sep 2020 22:48:37 +0530 Subject: [PATCH 078/231] Changed periodicity calculation according to CSI_Reporting branch --- openair2/LAYER2/NR_MAC_gNB/config.c | 58 ++++++++++++++++++++++-- openair2/NR_PHY_INTERFACE/NR_IF_Module.c | 7 +-- 2 files changed, 59 insertions(+), 6 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 1579c7a106..a9796beb4c 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -316,12 +316,62 @@ void update_csi_bitlen (NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_list_t *UE_li uint8_t csi_report_id = 0; uint8_t csi_resourceidx =0; uint8_t csi_ssb_idx =0; + uint16_t period, offset; + NR_CSI_ReportPeriodicityAndOffset_PR p_and_o; NR_CSI_ResourceConfigId_t csi_ResourceConfigId; + for (csi_report_id=0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++){ csi_ResourceConfigId=csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->resourcesForChannelMeasurement; UE_list->csi_report_template[UE_id][csi_report_id].reportQuantity_type = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportQuantity.present; // UE_list->csi_report_template[UE_id][idx]. - UE_list->csi_report_template[UE_id][csi_report_id].periodicity=csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320; + p_and_o = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.choice.periodic->reportSlotConfig.present; + + switch(p_and_o){ + case NR_CSI_ReportPeriodicityAndOffset_PR_slots4: + period = 4; + offset = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.choice.periodic->reportSlotConfig.choice.slots4; + break; + case NR_CSI_ReportPeriodicityAndOffset_PR_slots5: + period = 5; + offset = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.choice.periodic->reportSlotConfig.choice.slots5; + break; + case NR_CSI_ReportPeriodicityAndOffset_PR_slots8: + period = 8; + offset = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.choice.periodic->reportSlotConfig.choice.slots8; + break; + case NR_CSI_ReportPeriodicityAndOffset_PR_slots10: + period = 10; + offset = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.choice.periodic->reportSlotConfig.choice.slots10; + break; + case NR_CSI_ReportPeriodicityAndOffset_PR_slots16: + period = 16; + offset = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.choice.periodic->reportSlotConfig.choice.slots16; + break; + case NR_CSI_ReportPeriodicityAndOffset_PR_slots20: + period = 20; + offset = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.choice.periodic->reportSlotConfig.choice.slots20; + break; + case NR_CSI_ReportPeriodicityAndOffset_PR_slots40: + period = 40; + offset = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.choice.periodic->reportSlotConfig.choice.slots40; + break; + case NR_CSI_ReportPeriodicityAndOffset_PR_slots80: + period = 80; + offset = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.choice.periodic->reportSlotConfig.choice.slots80; + break; + case NR_CSI_ReportPeriodicityAndOffset_PR_slots160: + period = 160; + offset = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.choice.periodic->reportSlotConfig.choice.slots160; + break; + case NR_CSI_ReportPeriodicityAndOffset_PR_slots320: + period = 320; + offset = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320; + break; + default: + AssertFatal(1==0,"No periodicity and offset resource found in CSI report"); + } + UE_list->csi_report_template[UE_id][csi_report_id].periodicity=period; + UE_list->csi_report_template[UE_id][csi_report_id].offset=offset; for ( csi_resourceidx = 0; csi_resourceidx < csi_MeasConfig->csi_ResourceConfigToAddModList->list.count; csi_resourceidx++) { if ( csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_ResourceConfigId != csi_ResourceConfigId) @@ -358,14 +408,16 @@ void update_csi_bitlen (NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_list_t *UE_li UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].nb_ssbri_cri= 2; nb_ssb_resources= csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceList.list.count; - if (nb_ssb_resources) + if (nb_ssb_resources) { UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen =ceil(log2 (nb_ssb_resources)); UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].rsrp_bitlen = 7; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen =4; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP - else + } + else { UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen =0; UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].rsrp_bitlen = 0; UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen =0; + } LOG_I (MAC, "UCI: CSI_bit len : ssbri %d, rsrp: %d, diff_rsrp: %d", diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index ea20ca2f64..6b5fab396f 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -43,7 +43,7 @@ NR_IF_Module_t *if_inst[MAX_IF_MODULES]; NR_Sched_Rsp_t Sched_INFO[MAX_IF_MODULES][MAX_NUM_CCs]; - +extern const uint8_t slots_per_frame[5]; extern int oai_nfapi_harq_indication(nfapi_harq_indication_t *harq_ind); extern int oai_nfapi_crc_indication(nfapi_crc_indication_t *crc_ind); extern int oai_nfapi_cqi_indication(nfapi_cqi_indication_t *cqi_ind); @@ -174,8 +174,9 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, //Has to implement according to reportSlotConfig type periodicity = UE_list->csi_report_template[UE_id][csi_report_id].periodicity; LOG_I(PHY,"SFN/SF:%d%d \n", frame,slot); - if (((NR_SubcarrierSpacing_kHz30 == scs) && (((((frame & 0xf)+1)*20 + slot) & periodicity) == periodicity)) - ||((NR_SubcarrierSpacing_kHz120 == scs)&&(((((frame & 0xf)+1)*80 + slot) & periodicity) == periodicity))) { + /* if (((NR_SubcarrierSpacing_kHz30 == scs) && (((((frame & 0xf)+1)*20 + slot) & periodicity) == periodicity)) + ||((NR_SubcarrierSpacing_kHz120 == scs)&&(((((frame & 0xf)+1)*80 + slot) & periodicity) == periodicity))) {*/ + if (((slots_per_frame[scs]*frame + slot -UE_list->csi_report_template[UE_id][csi_report_id].offset)%periodicity)==0) { reportQuantity_type = UE_list->csi_report_template[UE_id][csi_report_id].reportQuantity_type; LOG_I(PHY,"SFN/SF:%d%d reportQuantity type = %d\n",frame,slot,reportQuantity_type); From 1e1258742ea25c5fb0f3ddffd6538b150629401f Mon Sep 17 00:00:00 2001 From: "r.karey" Date: Wed, 16 Sep 2020 13:36:52 +0530 Subject: [PATCH 079/231] Bit length calculation for CRI-RSRP --- openair2/LAYER2/NR_MAC_gNB/config.c | 79 ++++++++++++++++------------- 1 file changed, 44 insertions(+), 35 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index a9796beb4c..c2e9ec7742 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -319,6 +319,7 @@ void update_csi_bitlen (NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_list_t *UE_li uint16_t period, offset; NR_CSI_ReportPeriodicityAndOffset_PR p_and_o; NR_CSI_ResourceConfigId_t csi_ResourceConfigId; + struct NR_CSI_ResourceConfig__csi_RS_ResourceSetList__nzp_CSI_RS_SSB * nzp_CSI_RS_SSB = NULL; for (csi_report_id=0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++){ csi_ResourceConfigId=csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->resourcesForChannelMeasurement; @@ -380,58 +381,66 @@ void update_csi_bitlen (NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_list_t *UE_li //Finding the CSI_RS or SSB Resources UE_list->csi_report_template[UE_id][csi_report_id].CSI_Resource_type= csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.present; if (NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB ==UE_list->csi_report_template[UE_id][csi_report_id].CSI_Resource_type){ - struct NR_CSI_ResourceConfig__csi_RS_ResourceSetList__nzp_CSI_RS_SSB * nzp_CSI_RS_SSB = csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB; + nzp_CSI_RS_SSB = csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB; UE_list->csi_report_template[UE_id][csi_report_id].nb_of_nzp_csi_report = nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList!=NULL ? nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.count:0; UE_list->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report = nzp_CSI_RS_SSB->csi_SSB_ResourceSetList!=NULL ? nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.count:0; } - if (0 != UE_list->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report){ + if ( NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == UE_list->csi_report_template[UE_id][csi_report_id].reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == UE_list->csi_report_template[UE_id][csi_report_id].reportQuantity_type) { + //if (0 != UE_list->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report) uint8_t nb_ssb_resources =0; - for ( csi_ssb_idx = 0; csi_ssb_idx < csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.count; csi_ssb_idx++) { - if (csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceSetId == - *(csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.array[0])) { ///We can configure only one SSB resource set from spec 38.331 IE CSI-ResourceConfig - if (NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled == - csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->groupBasedBeamReporting.present ) { - if (NULL != csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->groupBasedBeamReporting.choice.disabled->nrofReportedRS) - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].nb_ssbri_cri = *(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->groupBasedBeamReporting.choice.disabled->nrofReportedRS)+1; - else + if (NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled == + csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->groupBasedBeamReporting.present ) { + if (NULL != csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->groupBasedBeamReporting.choice.disabled->nrofReportedRS) + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].nb_ssbri_cri = *(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->groupBasedBeamReporting.choice.disabled->nrofReportedRS)+1; + else /*! From Spec 38.331 * nrofReportedRS * The number (N) of measured RS resources to be reported per report setting in a non-group-based report. N <= N_max, where N_max is either 2 or 4 depending on UE * capability. FFS: The signaling mechanism for the gNB to select a subset of N beams for the UE to measure and report. * When the field is absent the UE applies the value 1 */ - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].nb_ssbri_cri= 1; - }else - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].nb_ssbri_cri= 2; + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].nb_ssbri_cri= 1; + }else + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].nb_ssbri_cri= 2; + + if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == UE_list->csi_report_template[UE_id][csi_report_id].reportQuantity_type) { + for ( csi_ssb_idx = 0; csi_ssb_idx < csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.count; csi_ssb_idx++) { + if (csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceSetId == + *(csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.array[0])) ///We can configure only one SSB resource set from spec 38.331 IE CSI-ResourceConfig - nb_ssb_resources= csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceList.list.count; - if (nb_ssb_resources) { - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen =ceil(log2 (nb_ssb_resources)); - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].rsrp_bitlen = 7; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen =4; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP - } - else { - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen =0; - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].rsrp_bitlen = 0; - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen =0; - } - - - LOG_I (MAC, "UCI: CSI_bit len : ssbri %d, rsrp: %d, diff_rsrp: %d", - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen, - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].rsrp_bitlen, - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen); + nb_ssb_resources= csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceList.list.count; break ; - } + } + } else /*if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == UE_list->csi_report_template[UE_id][csi_report_id].reportQuantity_type)*/{ + for ( csi_ssb_idx = 0; csi_ssb_idx < csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.count; csi_ssb_idx++) { + if (csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_ResourceSetId == + *(csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.array[0])) ///For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 for spec 38.212 + + nb_ssb_resources= csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_RS_Resources.list.count; + break ; + } } + + if (nb_ssb_resources) { + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen =ceil(log2 (nb_ssb_resources)); + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].rsrp_bitlen = 7; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen =4; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP + } else { + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen =0; + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].rsrp_bitlen = 0; + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen =0; + } + + LOG_I (MAC, "UCI: CSI_bit len : ssbri %d, rsrp: %d, diff_rsrp: %d", + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen, + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].rsrp_bitlen, + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen); } - if (0 != UE_list->csi_report_template[UE_id][csi_report_id].nb_of_nzp_csi_report){ - //TODO:Currently configuring only SSB beamreporting. If CSI beamreporting configured then this has to be implemented - } - break; + break; } } } From 7b4a863018e2195647f5409cb6a0a794cefaf02c Mon Sep 17 00:00:00 2001 From: "r.karey" Date: Wed, 7 Oct 2020 11:00:30 +0530 Subject: [PATCH 080/231] CSI-RS reporting bitlength calculation for type1 single panel two CSI-RS ports --- openair2/LAYER2/NR_MAC_gNB/config.c | 272 ++++++++++++++++++++--- openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 15 +- openair2/NR_PHY_INTERFACE/NR_IF_Module.c | 119 +++------- 3 files changed, 285 insertions(+), 121 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index c2e9ec7742..5e5ed91024 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -311,20 +311,36 @@ void config_common(int Mod_idP, int pdsch_AntennaPorts, NR_ServingCellConfigComm } +//! Calculating number of bits set +uint8_t number_of_bits_set (uint8_t buf,uint8_t * max_ri){ + uint8_t nb_of_bits_set = 0; + uint8_t mask = 0xff; + uint8_t index = 0; + + for (index=7; (buf & mask) && (index>=0) ; index--){ + if (buf & (1<>=1; + } + *max_ri = 8-index; + return nb_of_bits_set; +} + //!TODO : smae function can be written to handle csi_resources -void update_csi_bitlen (NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_list_t *UE_list, int UE_id) { +void update_csi_bitlen (NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_list_t *UE_list, int UE_id, module_id_t Mod_idP) { uint8_t csi_report_id = 0; uint8_t csi_resourceidx =0; uint8_t csi_ssb_idx =0; uint16_t period, offset; NR_CSI_ReportPeriodicityAndOffset_PR p_and_o; + NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type; NR_CSI_ResourceConfigId_t csi_ResourceConfigId; - struct NR_CSI_ResourceConfig__csi_RS_ResourceSetList__nzp_CSI_RS_SSB * nzp_CSI_RS_SSB = NULL; for (csi_report_id=0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++){ csi_ResourceConfigId=csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->resourcesForChannelMeasurement; - UE_list->csi_report_template[UE_id][csi_report_id].reportQuantity_type = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportQuantity.present; -// UE_list->csi_report_template[UE_id][idx]. + reportQuantity_type = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportQuantity.present; + UE_list->csi_report_template[UE_id][csi_report_id].reportQuantity_type = reportQuantity_type; p_and_o = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.choice.periodic->reportSlotConfig.present; switch(p_and_o){ @@ -378,24 +394,15 @@ void update_csi_bitlen (NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_list_t *UE_li if ( csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_ResourceConfigId != csi_ResourceConfigId) continue; else { + uint8_t nb_ssb_resources =0; //Finding the CSI_RS or SSB Resources - UE_list->csi_report_template[UE_id][csi_report_id].CSI_Resource_type= csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.present; - if (NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB ==UE_list->csi_report_template[UE_id][csi_report_id].CSI_Resource_type){ - nzp_CSI_RS_SSB = csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB; - - UE_list->csi_report_template[UE_id][csi_report_id].nb_of_nzp_csi_report = nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList!=NULL ? nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.count:0; - UE_list->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report = nzp_CSI_RS_SSB->csi_SSB_ResourceSetList!=NULL ? nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.count:0; - } - - if ( NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == UE_list->csi_report_template[UE_id][csi_report_id].reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == UE_list->csi_report_template[UE_id][csi_report_id].reportQuantity_type) { - //if (0 != UE_list->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report) - uint8_t nb_ssb_resources =0; + if ( NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type) { if (NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled == csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->groupBasedBeamReporting.present ) { if (NULL != csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->groupBasedBeamReporting.choice.disabled->nrofReportedRS) - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].nb_ssbri_cri = *(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->groupBasedBeamReporting.choice.disabled->nrofReportedRS)+1; + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.nb_ssbri_cri = *(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->groupBasedBeamReporting.choice.disabled->nrofReportedRS)+1; else /*! From Spec 38.331 * nrofReportedRS @@ -403,43 +410,244 @@ void update_csi_bitlen (NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_list_t *UE_li * capability. FFS: The signaling mechanism for the gNB to select a subset of N beams for the UE to measure and report. * When the field is absent the UE applies the value 1 */ - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].nb_ssbri_cri= 1; + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.nb_ssbri_cri= 1; }else - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].nb_ssbri_cri= 2; + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.nb_ssbri_cri= 2; if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == UE_list->csi_report_template[UE_id][csi_report_id].reportQuantity_type) { for ( csi_ssb_idx = 0; csi_ssb_idx < csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.count; csi_ssb_idx++) { if (csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceSetId == - *(csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.array[0])) ///We can configure only one SSB resource set from spec 38.331 IE CSI-ResourceConfig + *(csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.array[0])){ ///We can configure only one SSB resource set from spec 38.331 IE CSI-ResourceConfig nb_ssb_resources= csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceList.list.count; + UE_list->csi_report_template[UE_id][csi_report_id].SSB_Index_list = csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceList.list.array; + UE_list->csi_report_template[UE_id][csi_report_id].CSI_Index_list = NULL; + } break ; } } else /*if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == UE_list->csi_report_template[UE_id][csi_report_id].reportQuantity_type)*/{ for ( csi_ssb_idx = 0; csi_ssb_idx < csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.count; csi_ssb_idx++) { if (csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_ResourceSetId == - *(csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.array[0])) ///For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 for spec 38.212 + *(csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.array[0])) { ///For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 for spec 38.212 nb_ssb_resources= csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_RS_Resources.list.count; + UE_list->csi_report_template[UE_id][csi_report_id].CSI_Index_list = csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_RS_Resources.list.array; + UE_list->csi_report_template[UE_id][csi_report_id].SSB_Index_list = NULL; + } break ; } } if (nb_ssb_resources) { - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen =ceil(log2 (nb_ssb_resources)); - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].rsrp_bitlen = 7; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen =4; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.cri_ssbri_bitlen =ceil(log2 (nb_ssb_resources)); + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.rsrp_bitlen = 7; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.diff_rsrp_bitlen =4; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP } else { - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen =0; - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].rsrp_bitlen = 0; - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen =0; + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.cri_ssbri_bitlen =0; + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.rsrp_bitlen = 0; + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.diff_rsrp_bitlen =0; } LOG_I (MAC, "UCI: CSI_bit len : ssbri %d, rsrp: %d, diff_rsrp: %d", - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen, - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].rsrp_bitlen, - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen); - } + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.cri_ssbri_bitlen, + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.rsrp_bitlen, + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.diff_rsrp_bitlen); + } + + uint8_t ri_restriction; + uint8_t ri_bitlen; + uint8_t nb_allowed_ri; + uint8_t max_ri; + + if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI == reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI==reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_CQI==reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_i1_CQI==reportQuantity_type|| + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_i1==reportQuantity_type){ + + for ( csi_ssb_idx = 0; csi_ssb_idx < csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.count; csi_ssb_idx++) { + if (csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_ResourceSetId == + *(csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.array[0])) { ///For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 for spec 38.212 + + nb_ssb_resources= csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_RS_Resources.list.count; + UE_list->csi_report_template[UE_id][csi_report_id].CSI_Index_list = csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_RS_Resources.list.array; + UE_list->csi_report_template[UE_id][csi_report_id].SSB_Index_list = NULL; + } + break ; + } + UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.cri_bitlen=ceil(log2 (nb_ssb_resources)); + + if (NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel== + csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.present){ + + switch (RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts) { + case 1:; + UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.ri_bitlen=0; + break; + case 2: + /* From Spec 38.212 + * If the higher layer parameter nrofCQIsPerReport=1, nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator + * values in the 4 LSBs of the higher layer parameter typeI-SinglePanel-ri-Restriction according to Subclause 5.2.2.2.1 [6, + * TS 38.214]; otherwise nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator values according to Subclause + * 5.2.2.2.1 [6, TS 38.214]. + * + * But from Current RRC ASN structures nrofCQIsPerReport is not present. Present a dummy variable is present so using it to + * calculate RI for antennas equal or more than two. + * */ + AssertFatal (NULL!=csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->dummy, "nrofCQIsPerReport is not present"); + + ri_restriction = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.buf[0]; + if (0==*(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->dummy)){ /* Replace dummy with the nrofCQIsPerReport from the CSIreport + config when equalent ASN structure present */ + nb_allowed_ri = number_of_bits_set((ri_restriction & 0xf0), &max_ri); + ri_bitlen = ceil(log2(nb_allowed_ri)); + } + else{ + nb_allowed_ri = number_of_bits_set(ri_restriction, &max_ri); + ri_bitlen = ceil(log2(nb_allowed_ri)); + } + ri_bitlen = ri_bitlen<1?ri_bitlen:1; //from the spec 38.212 and table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel + UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.ri_bitlen=ri_bitlen; + break; + case 4: + AssertFatal (NULL!=csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->dummy, "nrofCQIsPerReport is not present"); + + ri_restriction = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.buf[0]; + if (0==*(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->dummy)){ /* Replace dummy with the nrofCQIsPerReport from the CSIreport + config when equalent ASN structure present */ + nb_allowed_ri = number_of_bits_set((ri_restriction & 0xf0), &max_ri); + ri_bitlen = ceil(log2(nb_allowed_ri)); + } + else{ + nb_allowed_ri = number_of_bits_set(ri_restriction,&max_ri); + ri_bitlen = ceil(log2(nb_allowed_ri)); + } + ri_bitlen = ri_bitlen<2?ri_bitlen:2; //from the spec 38.212 and table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel + UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.ri_bitlen=ri_bitlen; + break; + case 6: + case 8: + AssertFatal (NULL!=csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->dummy, "nrofCQIsPerReport is not present"); + + ri_restriction = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.buf[0]; + if (0==*(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->dummy)){ /* Replace dummy with the nrofCQIsPerReport from the CSIreport + config when equalent ASN structure present */ + nb_allowed_ri = number_of_bits_set((ri_restriction & 0xf0),&max_ri); + ri_bitlen = ceil(log2(nb_allowed_ri)); + } + else{ + nb_allowed_ri = number_of_bits_set(ri_restriction, &max_ri); + ri_bitlen = ceil(log2(nb_allowed_ri)); + } + //ri_bitlen = ri_bitlen<1?ri_bitlen:1; //from the spec 38.212 and table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel + UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.ri_bitlen=ri_bitlen; + break; + default: + //UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.ri_bitlen=0; + AssertFatal(RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts>8,"Number of antennas %d are out of range", RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts); + break; + } + } + UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.li_bitlen=0; + UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.cqi_bitlen=0; + UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.pmi_x1_bitlen=0; + UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.pmi_x2_bitlen=0; + } + + if( NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI==reportQuantity_type ){ + if (NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel== + csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.present){ + + switch (RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts) { + case 1:; + UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.li_bitlen=0; + break; + case 2: + case 4: + case 6: + case 8: + /* From Spec 38.212 + * If the higher layer parameter nrofCQIsPerReport=1, nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator + * values in the 4 LSBs of the higher layer parameter typeI-SinglePanel-ri-Restriction according to Subclause 5.2.2.2.1 [6, + * TS 38.214]; otherwise nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator values according to Subclause + * 5.2.2.2.1 [6, TS 38.214]. + * + * But from Current RRC ASN structures nrofCQIsPerReport is not present. Present a dummy variable is present so using it to + * calculate RI for antennas equal or more than two. + * */ + //! TODO: The bit length of LI is as follows LI = log2(RI), Need to confirm wheather we should consider maximum RI can be reported from ri_restricted + // or we should consider reported RI. If we need to consider reported RI for calculating LI bit length then we need to modify the code. + UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.li_bitlen=ceil(log2(max_ri))<2?ceil(log2(max_ri)):2; + break; + default: + AssertFatal(RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts>8,"Number of antennas %d are out of range", RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts); + break; + } + } + } + + if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI == reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI==reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_CQI==reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_i1_CQI==reportQuantity_type){ + + + switch (RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts){ + case 1:; + case 2: + case 4: + case 6: + case 8: + /* From Spec 38.212 + * If the higher layer parameter nrofCQIsPerReport=1, nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator + * values in the 4 LSBs of the higher layer parameter typeI-SinglePanel-ri-Restriction according to Subclause 5.2.2.2.1 [6, + * TS 38.214]; otherwise nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator values according to Subclause + * 5.2.2.2.1 [6, TS 38.214]. + * + * But from Current RRC ASN structures nrofCQIsPerReport is not present. Present a dummy variable is present so using it to + * calculate RI for antennas equal or more than two. + * */ + + if (max_ri > 4 && max_ri < 8){ + if (NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel== + csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.present){ + if (NR_CSI_ReportConfig__reportFreqConfiguration__cqi_FormatIndicator_widebandCQI==csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportFreqConfiguration->cqi_FormatIndicator) + UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.cqi_bitlen = 8; + else + UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.cqi_bitlen = 4; + } + }else{ //This condition will work even for type1-multipanel. + if (NR_CSI_ReportConfig__reportFreqConfiguration__cqi_FormatIndicator_widebandCQI==csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportFreqConfiguration->cqi_FormatIndicator) + UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.cqi_bitlen = 4; + else + UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.cqi_bitlen = 2; + } + break; + default: + AssertFatal(RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts>8,"Number of antennas %d are out of range", RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts); + break; + } + + } + + if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI == reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI==reportQuantity_type){ + if (NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel== + csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.present){ + switch (csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.present){ + case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_two: + if (max_ri ==1) + UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.pmi_x1_bitlen = 2; + else if (max_ri ==2) + UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.pmi_x1_bitlen = 1; + break; + default: + AssertFatal(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.present!=NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_two, + "Not handled Yet %d", csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.present); + break; + } + } + } break; } } @@ -574,7 +782,7 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, UE_info->secondaryCellGroup[UE_id] = secondaryCellGroup; LOG_I(PHY,"Modified UE_id %d/%x with secondaryCellGroup\n",UE_id,rnti); } - update_csi_bitlen (secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup, UE_list, UE_id); + update_csi_bitlen (secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup, UE_list, UE_id, Mod_idP); } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_OUT); diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index a2c40a03f1..50fb2add02 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -393,7 +393,16 @@ typedef struct { uint8_t cri_ssbri_bitlen; uint8_t rsrp_bitlen; uint8_t diff_rsrp_bitlen; -}CRI_SSBRI_RSRP_bitlen_t; +}L1_RSRP_bitlen_t; + +typedef struct{ + uint8_t cri_bitlen; + uint8_t ri_bitlen; + uint8_t li_bitlen; + uint8_t pmi_x1_bitlen; + uint8_t pmi_x2_bitlen; + uint8_t cqi_bitlen; +} CSI_Meas_bitlen_t; #define MAX_CSI_RESOURCE_SET_IN_CSI_RESOURCE_CONFIG 16 @@ -402,11 +411,13 @@ typedef struct nr_csi_report { NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR CSI_Resource_type; uint8_t nb_of_nzp_csi_report; uint8_t nb_of_csi_ssb_report; - CRI_SSBRI_RSRP_bitlen_t CSI_report_bitlen[MAX_CSI_RESOURCE_SET_IN_CSI_RESOURCE_CONFIG]; + L1_RSRP_bitlen_t CSI_report_bitlen; + CSI_Meas_bitlen_t csi_meas_bitlen; } nr_csi_report_t; /*! \brief scheduling control information set through an API */ +#define MAX_CSI_REPORTS 48 typedef struct { /// total amount of data awaiting for this UE uint32_t num_total_bytes; diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index 6b5fab396f..acde8dff13 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -75,33 +75,6 @@ void handle_nr_rach(NR_UL_IND_t *UL_info) { } } } -#if 0 -//!TODO : smae function can be written to handle csi_resources -uint8_t get_ssb_resources (NR_CSI_MeasConfig_t *csi_MeasConfig, - NR_CSI_ResourceConfigId_t csi_ResourceConfigId, - NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type, - uint8_t *nb_resource_sets) { - uint8_t idx = 0; - uint8_t csi_ssb_idx =0; - - for ( idx = 0; idx < csi_MeasConfig->csi_ResourceConfigToAddModList->list.count; idx++) { - if ( csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[idx]->csi_ResourceConfigId == csi_ResourceConfigId) { - //Finding the CSI_RS or SSB Resources - if ( csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[idx]->csi_RS_ResourceSetList.present == NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB) { - - if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type ){ - *nb_resource_sets=csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[idx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.count; - - for ( csi_ssb_idx = 0; csi_ssb_idx < csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.count; csi_ssb_idx++) { - if (csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceSetId == - *(csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[idx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.array[0])) { - return csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceList.list.count; - } else { - //handle error condition - AssertFatal(csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceSetId, "csi_SSB_ResourcesSetId is not configured"); - } - } - } else if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == reportQuantity_type) *nb_resource_sets=csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[idx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.count; @@ -156,15 +129,14 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, module_id_t Mod_idP ) { /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ - //uint8_t bitlen_cri = (log(csi_MeasConfig->csi_ResourceConfigToAddModList->list.count)/log(2)); uint8_t idx = 0; uint8_t payload_size = ceil(uci_pdu->csi_part1.csi_part1_bit_len/8); uint16_t *payload = calloc (1, payload_size); NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type = NR_CSI_ReportConfig__reportQuantity_PR_NOTHING; - //uint8_t UE_id = 0; NR_UE_list_t *UE_list = &(RC.nrmac[Mod_idP]->UE_list); long periodicity; uint8_t csi_report_id = 0; + memcpy ( payload, uci_pdu->csi_part1.csi_part1_payload, payload_size); for ( csi_report_id =0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++ ) { @@ -176,35 +148,24 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, LOG_I(PHY,"SFN/SF:%d%d \n", frame,slot); /* if (((NR_SubcarrierSpacing_kHz30 == scs) && (((((frame & 0xf)+1)*20 + slot) & periodicity) == periodicity)) ||((NR_SubcarrierSpacing_kHz120 == scs)&&(((((frame & 0xf)+1)*80 + slot) & periodicity) == periodicity))) {*/ - if (((slots_per_frame[scs]*frame + slot -UE_list->csi_report_template[UE_id][csi_report_id].offset)%periodicity)==0) { + if (((slots_per_frame[scs]*frame + slot -UE_list->csi_report_template[UE_id][csi_report_id].offset)%periodicity)!=0) + continue; - reportQuantity_type = UE_list->csi_report_template[UE_id][csi_report_id].reportQuantity_type; - LOG_I(PHY,"SFN/SF:%d%d reportQuantity type = %d\n",frame,slot,reportQuantity_type); - break; - } - } + reportQuantity_type = UE_list->csi_report_template[UE_id][csi_report_id].reportQuantity_type; + LOG_I(PHY,"SFN/SF:%d%d reportQuantity type = %d\n",frame,slot,reportQuantity_type); + + if ( NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == reportQuantity_type) { + uint8_t csi_ssb_idx = 0; + uint8_t diff_rsrp_idx = 0; + uint8_t cri_ssbri_bitlen = UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.cri_ssbri_bitlen; - if ( !(reportQuantity_type)) - AssertFatal(reportQuantity_type, "reportQuantity is not configured"); - - if ( NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type ) { - uint8_t nb_ssb_resource_set= UE_list->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report; - //uint8_t nb_ssb_resources = UE_list->csi_report_template[UE_id][csi_report_id]. - /* get_ssb_resources(csi_MeasConfig, - csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->resourcesForChannelMeasurement, - reportQuantity_type,&nb_ssb_resource_set);//csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[0]->CSI_SSB_ResourceList.list.count;*/ - uint8_t ssb_idx = 0; - uint8_t diff_rsrp_idx = 0; - uint8_t bitlen_ssbri = UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen; - //sched_ctrl->nr_of_csi_report[UE_id] = nb_ssb_resource_set; - - LOG_I(MAC,"csi_payload = %d, bitlen_ssbri = %d, nb_ssb_resource_set = %d\n",payload_size, bitlen_ssbri, nb_ssb_resource_set); + LOG_I(MAC,"csi_payload = %d, cri_ssbri_bitlen = %d\n",payload_size, cri_ssbri_bitlen); /*! As per the spec 38.212 and table: 6.3.1.1.2-12 in a single UCI sequence we can have multiple CSI_report * the number of CSI_report will depend on number of CSI resource sets that are configured in CSI-ResourceConfig RRC IE * From spec 38.331 from the IE CSI-ResourceConfig for SSB RSRP reporting we can configure only one resource set * From spec 38.214 section 5.2.1.2 For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 */ - // for (idx = 0; idx < nb_ssb_resource_set; idx++) { /** from 38.214 sec 5.2.1.4.2 - if the UE is configured with the higher layer parameter groupBasedBeamReporting set to 'disabled', the UE is @@ -218,50 +179,34 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, multiple simultaneous spatial domain receive filter */ -/* if (NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled == - csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.present ) { + idx = 0; //Since for SSB RSRP reporting in RRC can configure only one ssb resource set per one report config + sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri = UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.nb_ssbri_cri; - if ((NULL != csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.choice.disabled->nrofReportedRS) && - *(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.choice.disabled->nrofReportedRS)) - sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.nr_ssbri_cri = *(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.choice.disabled->nrofReportedRS); + for (csi_ssb_idx = 0; csi_ssb_idx < sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri ; csi_ssb_idx++) { + if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type) - else */ - idx = 0; //Since for SSB RSRP reporting in RRC can configure only one ssb resource set per one report config - sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri = UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].nb_ssbri_cri; + sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx] = *(UE_list->csi_report_template[UE_id][csi_report_id].SSB_Index_list [(*payload) & ~(~1<<(cri_ssbri_bitlen-1))]); + else + sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx] = *(UE_list->csi_report_template[UE_id][csi_report_id].CSI_Index_list [(*payload) & ~(~1<<(cri_ssbri_bitlen-1))]); + + *payload >>= cri_ssbri_bitlen; + } - for (ssb_idx = 0; ssb_idx < sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri ; ssb_idx++) { - /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ - sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [ssb_idx] = (*payload) & ~(~1<<(bitlen_ssbri-1)); - *payload >>= bitlen_ssbri; - } + sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP = (*payload) & 0x7f; + *payload >>= 7; - sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP = (*payload) & 0x7f; - *payload >>= 7; - - for ( diff_rsrp_idx =0; diff_rsrp_idx < sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri - 1; diff_rsrp_idx++ ) { - sched_ctrl->CSI_report[idx].choice.ssb_cri_report.diff_RSRP[diff_rsrp_idx] = (*payload) & 0x0f; - *payload >>= 4; - } -#if 0 - } else if (NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled != - csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.present ) { - sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.nr_ssbri_cri = 2; - for (ssb_idx = 0; ssb_idx < 2; ssb_idx++) { - /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ - sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.CRI_SSBRI[ssb_idx] = (*payload) & ~(~1<<(bitlen_ssbri-1)); - *payload >>= bitlen_ssbri; - } - - sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.RSRP = (*payload) & 0x7f; - *payload >>= 7; - /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ - sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.diff_RSRP[0] = (*payload) & 0x0f; + for ( diff_rsrp_idx =0; diff_rsrp_idx < sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri - 1; diff_rsrp_idx++ ) { + sched_ctrl->CSI_report[idx].choice.ssb_cri_report.diff_RSRP[diff_rsrp_idx] = (*payload) & 0x0f; *payload >>= 4; } -#endif - // } + UE_list->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report++; + } } + if ( !(reportQuantity_type)) + AssertFatal(reportQuantity_type, "reportQuantity is not configured"); + + #if 0 if ( NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI == reportQuantity_type || From fcf481f8cbc9479c8d83260fb99659eeb646b9e3 Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Thu, 8 Oct 2020 15:32:41 +0200 Subject: [PATCH 081/231] make ue and physim compile again --- openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h index 087d316567..a7b4ad1c68 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h @@ -81,7 +81,7 @@ int get_nr_prach_info_from_index(uint8_t index, uint8_t *N_dur, uint16_t *RA_sfn_index, uint8_t *N_RA_slot, - uint8_t *config_period); + uint8_t *config_period); int get_nr_prach_occasion_info_from_index(uint8_t index, uint32_t pointa, From 8cfc99bd983bc43f0b3aa5665806b31745e3704d Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Fri, 9 Oct 2020 15:26:15 +0200 Subject: [PATCH 082/231] remove log --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c | 1 - 1 file changed, 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 4ccbd7c8c6..9de04a4ffd 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -728,7 +728,6 @@ void nr_configure_pucch(nfapi_nr_pucch_pdu_t* pucch_pdu, } else N2 = N3; } - LOG_I(MAC, "UCI resource id = %ld\n", *resource_id); } AssertFatal(resource_id!=NULL,"Couldn-t find any matching PUCCH resource in the PUCCH resource sets"); From 5fdadbfe8430fe0c95d3aa7a7ed371a4bd836ede Mon Sep 17 00:00:00 2001 From: "r.karey" Date: Mon, 12 Oct 2020 19:09:52 +0530 Subject: [PATCH 083/231] Changed the TCI handling after processing of CSI_measurements --- openair2/NR_PHY_INTERFACE/NR_IF_Module.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index acde8dff13..a103831c91 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -52,6 +52,7 @@ extern int oai_nfapi_rx_ind(nfapi_rx_indication_t *ind); extern uint8_t nfapi_mode; extern uint16_t sf_ahead; extern uint16_t sl_ahead; +void tci_handling(int Mod_idP, int UE_id, int CC_id, NR_UE_sched_ctrl_t *sched_ctrl, frame_t frame, slot_t slot); void handle_nr_rach(NR_UL_IND_t *UL_info) { @@ -185,9 +186,11 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, for (csi_ssb_idx = 0; csi_ssb_idx < sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri ; csi_ssb_idx++) { if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type) - sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx] = *(UE_list->csi_report_template[UE_id][csi_report_id].SSB_Index_list [(*payload) & ~(~1<<(cri_ssbri_bitlen-1))]); + sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx] = + *(UE_list->csi_report_template[UE_id][csi_report_id].SSB_Index_list [cri_ssbri_bitlen>0?((*payload)&~(~1<<(cri_ssbri_bitlen-1))):cri_ssbri_bitlen]); else - sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx] = *(UE_list->csi_report_template[UE_id][csi_report_id].CSI_Index_list [(*payload) & ~(~1<<(cri_ssbri_bitlen-1))]); + sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx] = + *(UE_list->csi_report_template[UE_id][csi_report_id].CSI_Index_list [cri_ssbri_bitlen>0?((*payload)&~(~1<<(cri_ssbri_bitlen-1))):cri_ssbri_bitlen]); *payload >>= cri_ssbri_bitlen; } From e6d057ec8a6cefb0bfab300f07d4931ef8ba4fd8 Mon Sep 17 00:00:00 2001 From: "r.karey" Date: Fri, 16 Oct 2020 18:21:12 +0530 Subject: [PATCH 084/231] Fixed the calculation of received csi payload size at MAC --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c | 1 - openair2/NR_PHY_INTERFACE/NR_IF_Module.c | 11 ++++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 9de04a4ffd..845be51f58 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -766,7 +766,6 @@ void nr_configure_pucch(nfapi_nr_pucch_pdu_t* pucch_pdu, pucch_pdu->sr_flag = O_sr; break; case NR_PUCCH_Resource__format_PR_format2 : - LOG_I(MAC,"UCI format2 is being scheduled\n"); pucch_pdu->format_type = 2; pucch_pdu->nr_of_symbols = pucchres->format.choice.format2->nrofSymbols; pucch_pdu->start_symbol_index = pucchres->format.choice.format2->startingSymbolIndex; diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index a103831c91..dd4da82939 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -131,8 +131,8 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, ) { /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ uint8_t idx = 0; - uint8_t payload_size = ceil(uci_pdu->csi_part1.csi_part1_bit_len/8); - uint16_t *payload = calloc (1, payload_size); + uint8_t payload_size = ceil((double)uci_pdu->csi_part1.csi_part1_bit_len/8); + uint8_t *payload = calloc (payload_size, sizeof(uint8_t)); NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type = NR_CSI_ReportConfig__reportQuantity_PR_NOTHING; NR_UE_list_t *UE_list = &(RC.nrmac[Mod_idP]->UE_list); long periodicity; @@ -161,7 +161,6 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, uint8_t diff_rsrp_idx = 0; uint8_t cri_ssbri_bitlen = UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.cri_ssbri_bitlen; - LOG_I(MAC,"csi_payload = %d, cri_ssbri_bitlen = %d\n",payload_size, cri_ssbri_bitlen); /*! As per the spec 38.212 and table: 6.3.1.1.2-12 in a single UCI sequence we can have multiple CSI_report * the number of CSI_report will depend on number of CSI resource sets that are configured in CSI-ResourceConfig RRC IE * From spec 38.331 from the IE CSI-ResourceConfig for SSB RSRP reporting we can configure only one resource set @@ -187,12 +186,13 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type) sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx] = - *(UE_list->csi_report_template[UE_id][csi_report_id].SSB_Index_list [cri_ssbri_bitlen>0?((*payload)&~(~1<<(cri_ssbri_bitlen-1))):cri_ssbri_bitlen]); + *(UE_list->csi_report_template[UE_id][csi_report_id].SSB_Index_list[cri_ssbri_bitlen>0?((*payload)&~(~1<<(cri_ssbri_bitlen-1))):cri_ssbri_bitlen]); else sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx] = - *(UE_list->csi_report_template[UE_id][csi_report_id].CSI_Index_list [cri_ssbri_bitlen>0?((*payload)&~(~1<<(cri_ssbri_bitlen-1))):cri_ssbri_bitlen]); + *(UE_list->csi_report_template[UE_id][csi_report_id].CSI_Index_list[cri_ssbri_bitlen>0?((*payload)&~(~1<<(cri_ssbri_bitlen-1))):cri_ssbri_bitlen]); *payload >>= cri_ssbri_bitlen; + LOG_I(PHY,"SSB_index = %d",sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx]); } sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP = (*payload) & 0x7f; @@ -203,6 +203,7 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, *payload >>= 4; } UE_list->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report++; + LOG_I(MAC,"csi_payload = %d, rsrp = %d\n",payload_size, sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP); } } From c9d7455dea16c4908c689ed77cd8400b718bda8e Mon Sep 17 00:00:00 2001 From: Rangaswami Date: Wed, 21 Oct 2020 10:29:42 +0530 Subject: [PATCH 085/231] Fixed the segemntation fault and added CSI bitlength in uci_pdu --- openair1/PHY/NR_TRANSPORT/pucch_rx.c | 1 + openair2/NR_PHY_INTERFACE/NR_IF_Module.c | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/pucch_rx.c b/openair1/PHY/NR_TRANSPORT/pucch_rx.c index 2d1fdff4be..cb75a88abb 100644 --- a/openair1/PHY/NR_TRANSPORT/pucch_rx.c +++ b/openair1/PHY/NR_TRANSPORT/pucch_rx.c @@ -1642,6 +1642,7 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB, // csi if (pucch_pdu->bit_len_csi_part1>0) { uci_pdu->pduBitmap|=4; + uci_pdu->csi_part1.csi_part1_bit_len=pucch_pdu->bit_len_csi_part1; int csi_part1_bytes=pucch_pdu->bit_len_csi_part1>>3; if ((pucch_pdu->bit_len_csi_part1&7) > 0) csi_part1_bytes++; uci_pdu->csi_part1.csi_part1_payload = (uint8_t*)malloc(csi_part1_bytes); diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index dd4da82939..c3ea02a14d 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -52,7 +52,7 @@ extern int oai_nfapi_rx_ind(nfapi_rx_indication_t *ind); extern uint8_t nfapi_mode; extern uint16_t sf_ahead; extern uint16_t sl_ahead; -void tci_handling(int Mod_idP, int UE_id, int CC_id, NR_UE_sched_ctrl_t *sched_ctrl, frame_t frame, slot_t slot); +void tci_handling(module_id_t Mod_idP, int UE_id, int CC_id, NR_UE_sched_ctrl_t *sched_ctrl, frame_t frame, slot_t slot); void handle_nr_rach(NR_UL_IND_t *UL_info) { @@ -129,9 +129,10 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, NR_SubcarrierSpacing_t scs, int UE_id, module_id_t Mod_idP ) { + /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ uint8_t idx = 0; - uint8_t payload_size = ceil((double)uci_pdu->csi_part1.csi_part1_bit_len/8); + uint8_t payload_size = ceil(((double)uci_pdu->csi_part1.csi_part1_bit_len)/8); uint8_t *payload = calloc (payload_size, sizeof(uint8_t)); NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type = NR_CSI_ReportConfig__reportQuantity_PR_NOTHING; NR_UE_list_t *UE_list = &(RC.nrmac[Mod_idP]->UE_list); @@ -140,10 +141,10 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, memcpy ( payload, uci_pdu->csi_part1.csi_part1_payload, payload_size); + UE_list->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report = 0; for ( csi_report_id =0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++ ) { //Assuming in periodic reporting for one slot can be configured with only one CSI-ReportConfig // if (csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.present == NR_CSI_ReportConfig__reportConfigType_PR_periodic) { - //considering 30khz scs and //Has to implement according to reportSlotConfig type periodicity = UE_list->csi_report_template[UE_id][csi_report_id].periodicity; LOG_I(PHY,"SFN/SF:%d%d \n", frame,slot); From 55c55d7d1769d07b10b2cf9ad322c16c2cd636d2 Mon Sep 17 00:00:00 2001 From: "p.shashikala" Date: Mon, 2 Nov 2020 12:09:14 +0545 Subject: [PATCH 086/231] CSI payload bits inversion issue --- openair2/NR_PHY_INTERFACE/NR_IF_Module.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index c3ea02a14d..6206b54fbd 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -140,6 +140,8 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, uint8_t csi_report_id = 0; memcpy ( payload, uci_pdu->csi_part1.csi_part1_payload, payload_size); + + reverse_n_bits(payload, uci_pdu->csi_part1.csi_part1_bit_len); UE_list->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report = 0; for ( csi_report_id =0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++ ) { @@ -204,7 +206,7 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, *payload >>= 4; } UE_list->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report++; - LOG_I(MAC,"csi_payload = %d, rsrp = %d\n",payload_size, sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP); + LOG_I(MAC,"csi_payload size = %d, rsrp_id = %d\n",payload_size, sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP); } } From c47a0d272f6573f83a5f1b4ba1f86054291b457a Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Tue, 3 Nov 2020 10:20:45 +0100 Subject: [PATCH 087/231] bugix for cri-rsrp in bitlen computation --- openair2/LAYER2/NR_MAC_gNB/config.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 5e5ed91024..b175c57237 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -426,7 +426,7 @@ void update_csi_bitlen (NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_list_t *UE_li break ; } } else /*if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == UE_list->csi_report_template[UE_id][csi_report_id].reportQuantity_type)*/{ - for ( csi_ssb_idx = 0; csi_ssb_idx < csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.count; csi_ssb_idx++) { + for ( csi_ssb_idx = 0; csi_ssb_idx < csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.count; csi_ssb_idx++) { if (csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_ResourceSetId == *(csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.array[0])) { ///For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 for spec 38.212 From abc13b60b297b90c53e5daf2a6993061fb9e5ce8 Mon Sep 17 00:00:00 2001 From: Rangaswami Date: Mon, 10 Aug 2020 22:15:09 +0530 Subject: [PATCH 088/231] Initial commits for TCI and CSI reporting changes --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 288 +++++++++++++++++++++ openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 52 ++++ 2 files changed, 340 insertions(+) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index f5eef3210a..9b704d6ff8 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -56,6 +56,82 @@ uint16_t nr_pdcch_order_table[6] = { 31, 31, 511, 2047, 2047, 8191 }; +#define MAX_SSB_SCHED 8 +#define L1_RSRP_HYSTERIS 10 //considering 10 dBm as hysterisis for avoiding frequent SSB Beam Switching. !Fixme provide exact value if any +//#define L1_DIFF_RSRP_STEP_SIZE 2 +#define MAX_NUM_SSB 128 +#define MIN_RSRP_VALUE -141 +//Measured RSRP Values Table 10.1.16.1-1 from 36.133 +//Stored all the upper limits[Max RSRP Value of corresponding index] +//stored -1 for invalid values +int L1_SSB_CSI_RSRP_measReport_mapping_38133_10_1_6_1_1[128] = { + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, //0 - 9 + -1, -1, -1, -1, -1, -1, -140, -139, -138, -137, //10 - 19 + -136, -135, -134, -133, -132, -131, -130, -129, -128, -127, //20 - 29 + -126, -125, -124, -123, -122, -121, -120, -119, -118, -117, //30 - 39 + -116, -115, -114, -113, -112, -111, -110, -109, -108, -107, //40 - 49 + -106, -105, -104, -103, -102, -101, -100, -99, -98, -97, //50 - 59 + -96, -95, -94, -93, -92, -91, -90, -89, -88, -87, //60 - 69 + -86, -85, -84, -83, -82, -81, -80, -79, -78, -77, //70 - 79 + -76, -75, -74, -73, -72, -71, -70, -69, -68, -67, //80 - 89 + -66, -65, -64, -63, -62, -61, -60, -59, -58, -57, //90 - 99 + -56, -55, -54, -53, -52, -51, -50, -49, -48, -47, //100 - 109 + -46, -45, -44, -44, -1, -1, -1, -1, -1, -1, //110 - 119 + -1, -1, -1, -1, -1, -1, -1, -1//120 - 127 + }; + +//Differential RSRP values Table 10.1.6.1-2 from 36.133 +//Stored the upper limits[MAX RSRP Value] +int diff_rsrp_ssb_csi_meas_10_1_6_1_2[16] = { + 0, -2, -4, -6, -8, -10, -12, -14, -16, -18, //0 - 9 + -20, -22, -24, -26, -28, -30 //10 - 15 +}; + + +//returns the measured RSRP value (upper limit) +int get_measured_rsrp(uint8_t index) { + //if index is invalid returning minimum rsrp -140 + if((index >= 0 && index <= 15) || index >= 114) + return MIN_RSRP_VALUE; + + return L1_SSB_CSI_RSRP_measReport_mapping_38133_10_1_6_1_1[index]; +} + +//returns the differential RSRP value (upper limit) +int get_diff_rsrp(uint8_t index, int strongest_rsrp) { + if(strongest_rsrp != -1) { + return strongest_rsrp + diff_rsrp_ssb_csi_meas_10_1_6_1_2[index]; + } else + return MIN_RSRP_VALUE; +} + +int checkTargetSSBInFirst64TCIStates_pdschConfig(int ssb_index_t) { + //Need to implement once configuration is received + return 0; +} + +int checkTargetSSBInTCIStates_pdcchConfig(int ssb_index_t) { + //Need to implement once configuration is received + return 0; +} + +int ssb_index_sorted[MAX_NUM_SSB] = {0}; +int ssb_rsrp_sorted[MAX_NUM_SSB] = {0}; +//Sorts ssb_index and ssb_rsrp array data and keeps in ssb_index_sorted and +//ssb_rsrp_sorted respectively +int ssb_rsrp_sort(int *ssb_index, int *ssb_rsrp) { + int i, j; + + for(i = 0; *(ssb_index+i) != 0; i++) { + for(j = i; *(ssb_index+j) != 0; j++) { + if(*(ssb_rsrp+j) >= *(ssb_rsrp+i)) { + ssb_index_sorted[i] = *(ssb_index+j); + ssb_rsrp_sorted[i] = *(ssb_rsrp+j); + } + } + } +} + void clear_mac_stats(gNB_MAC_INST *gNB) { memset((void*)gNB->UE_info.mac_stats,0,MAX_MOBILES_PER_GNB*sizeof(NR_mac_stats_t)); } @@ -89,6 +165,218 @@ void dump_mac_stats(gNB_MAC_INST *gNB) } } +//identifies the target SSB Beam index +//keeps the required date for PDCCH and PDSCH TCI state activation/deactivation CE consutruction globally +//handles triggering of PDCCH and PDSCH MAC CEs +void tci_handling(int Mod_idP, int UE_id, int CC_id, NR_UE_sched_ctrl_t *sched_ctrl, frame_t frame, slot_t slot) { + int strongest_ssb_rsrp = 0; + int cqi_idx = 0; + int curr_ssb_beam_index = 0; //ToDo: yet to know how to identify the serving ssb beam index + uint8_t target_ssb_beam_index = curr_ssb_beam_index; + //uint8_t max_reported_RSRP = 16; + //int serving_SSB_Beam_RSRP; + uint8_t is_triggering_ssb_beam_switch =0; + uint8_t ssb_idx = 0; + int pdsch_bwp_id =0; + int ssb_index[MAX_NUM_SSB] = {0}; + int ssb_rsrp[MAX_NUM_SSB] = {0}; + uint8_t idx = 0; + int bwp_id = 1; + NR_UE_list_t *UE_list = &RC.nrmac[Mod_idP]->UE_list; + //NR_COMMON_channels_t *cc = RC.nrmac[Mod_idP]->common_channels; + NR_CellGroupConfig_t *secondaryCellGroup = UE_list->secondaryCellGroup[UE_id]; + NR_BWP_Downlink_t *bwp = secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1]; + NR_CSI_MeasConfig_t *csi_MeasConfig = UE_list->secondaryCellGroup[UE_id]->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup; + //bwp indicator + int n_dl_bwp = secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count; + uint8_t nb_ssb_resources_inEachSet = sched_ctrl->CSI_report[UE_id][cqi_idx].choice.ssb_cri_report.nr_ssbri_cri; + uint8_t nb_resource_sets = sched_ctrl->nr_of_csi_report[UE_id]; + //uint8_t bitlen_ssbri = log (nb_resource_sets)/log (2); + //uint8_t max_rsrp_reported = -1; + int better_rsrp_reported = -140-(-0); /*minimum_measured_RSRP_value - minimum_differntail_RSRP_value*///considering the minimum RSRP value as better RSRP initially + uint8_t diff_rsrp_idx = 0; + uint8_t i, j; + + if (n_dl_bwp < 4) + pdsch_bwp_id = bwp_id; + else + pdsch_bwp_id = bwp_id - 1; // as per table 7.3.1.1.2-1 in 38.212 + + /*Example: + CRI_SSBRI: 1 2 3 4| 5 6 7 8| 9 10 1 2| + nb_resource_sets = 3 //3 sets as above + nb_ssb_resources_inEachSet = 4 //each set has 4 elements + storing ssb indexes in ssb_index array as ssb_index[0] = 1 .. ssb_index[4] = 5 + ssb_rsrp[0] = strongest rsrp in first set, ssb_rsrp[4] = strongest rsrp in second set, .. + idx: resource set index + */ + + //for all reported SSB + for (idx = 0; idx < nb_resource_sets; idx++) { + //if group based beam Reporting is disabled + if(NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled == + csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.present ) { + //extracting the ssb indexes + for (ssb_idx = 0; ssb_idx <= nb_ssb_resources_inEachSet; ssb_idx++) { + ssb_index[idx * nb_resource_sets + ssb_idx] = sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.CRI_SSBRI[ssb_idx]; + } + + //if strongest measured RSRP is configured + strongest_ssb_rsrp = get_measured_rsrp(sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.RSRP); + ssb_rsrp[idx * nb_resource_sets] = strongest_ssb_rsrp; + + //if current ssb rsrp is greater than better rsrp + if(ssb_rsrp[idx * nb_resource_sets] > better_rsrp_reported) { + better_rsrp_reported = ssb_rsrp[idx * nb_resource_sets]; + target_ssb_beam_index = idx * nb_resource_sets; + } + + for(diff_rsrp_idx =1; diff_rsrp_idx < nb_ssb_resources_inEachSet; diff_rsrp_idx++) { + ssb_rsrp[idx * nb_resource_sets + diff_rsrp_idx] = get_diff_rsrp(sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.diff_RSRP[diff_rsrp_idx], strongest_ssb_rsrp); + + //if current reported rsrp is greater than better rsrp + if(ssb_rsrp[idx * nb_resource_sets + diff_rsrp_idx] > better_rsrp_reported) { + better_rsrp_reported = ssb_rsrp[idx * nb_resource_sets + diff_rsrp_idx]; + target_ssb_beam_index = idx * nb_resource_sets + diff_rsrp_idx; + } + } + } + //if group based beam reporting is enabled + else if (NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled != + csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.present ) { + //extracting the ssb indexes + //for group based reporting only 2 SSB RS are reported, 38.331 + for (ssb_idx = 0; ssb_idx < 2; ssb_idx++) { + ssb_index[idx * nb_resource_sets + ssb_idx] = sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.CRI_SSBRI[ssb_idx]; + } + + strongest_ssb_rsrp = get_measured_rsrp(sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.RSRP); + ssb_rsrp[idx * nb_resource_sets] = strongest_ssb_rsrp; + + if(ssb_rsrp[idx * nb_resource_sets] > better_rsrp_reported) { + better_rsrp_reported = ssb_rsrp[idx * nb_resource_sets]; + target_ssb_beam_index = idx * nb_resource_sets; + } + + ssb_rsrp[idx * nb_resource_sets + 1] = get_diff_rsrp(sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.diff_RSRP[diff_rsrp_idx], strongest_ssb_rsrp); + + if(ssb_rsrp[idx * nb_resource_sets + 1] > better_rsrp_reported) { + better_rsrp_reported = ssb_rsrp[idx * nb_resource_sets + 1]; + target_ssb_beam_index = idx * nb_resource_sets + 1; + } + } + } + + if(ssb_index[target_ssb_beam_index] != ssb_index[curr_ssb_beam_index] && ssb_rsrp[target_ssb_beam_index] > ssb_rsrp[curr_ssb_beam_index]) { + if( ssb_rsrp[target_ssb_beam_index] - ssb_rsrp[curr_ssb_beam_index] > L1_RSRP_HYSTERIS) { + is_triggering_ssb_beam_switch = 1; + LOG_I(MAC, "Triggering ssb beam switching using tci\n"); + } + } + + if(is_triggering_ssb_beam_switch) { + //filling pdcch tci state activativation mac ce structure fields + sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.is_scheduled = 1; + //OAI currently focusing on Non CA usecase hence 0 is considered as serving + //cell id + sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.servingCellId = 0; //0 for PCell as 38.331 v15.9.0 page 353 //serving cell id for which this MAC CE applies + sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.coresetId = 0; //coreset id for which the TCI State id is being indicated + + /* 38.321 v15.8.0 page 66 + TCI State ID: This field indicates the TCI state identified by TCI-StateId as specified in TS 38.331 [5] applicable + to the Control Resource Set identified by CORESET ID field. + If the field of CORESET ID is set to 0, + this field indicates a TCI-StateId for a TCI state of the first 64 TCI-states configured by tci-States-ToAddModList and tciStates-ToReleaseList in the PDSCH-Config in the active BWP. + If the field of CORESET ID is set to the other value than 0, + this field indicates a TCI-StateId configured by tci-StatesPDCCH-ToAddList and tciStatesPDCCH-ToReleaseList in the controlResourceSet identified by the indicated CORESET ID. + The length of the field is 7 bits + */ + if(sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.coresetId == 0) { + int tci_state_id = checkTargetSSBInFirst64TCIStates_pdschConfig(ssb_index[target_ssb_beam_index]); + + if( tci_state_id != -1) + sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.tciStateId = tci_state_id; + else { + //identify the best beam within first 64 TCI States of PDSCH + //Config TCI-states-to-addModList + int flag = 0; + + for(i =0; ssb_index_sorted[i]!=0; i++) { + tci_state_id = checkTargetSSBInFirst64TCIStates_pdschConfig(ssb_index_sorted[i]); + + if(tci_state_id != -1 && ssb_rsrp_sorted[i] > ssb_rsrp[curr_ssb_beam_index] && ssb_rsrp_sorted[i] - ssb_rsrp[curr_ssb_beam_index] > L1_RSRP_HYSTERIS) { + sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.tciStateId = tci_state_id; + flag = 1; + break; + } + } + + if(flag == 0 || ssb_rsrp_sorted[i] < ssb_rsrp[curr_ssb_beam_index] || ssb_rsrp_sorted[i] - ssb_rsrp[curr_ssb_beam_index] < L1_RSRP_HYSTERIS) { + sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.is_scheduled = 0; + } + } + } else { + int tci_state_id = checkTargetSSBInTCIStates_pdcchConfig(ssb_index[target_ssb_beam_index]); + + if (tci_state_id !=-1) + sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.tciStateId = tci_state_id; + else { + //identify the best beam within CORESET/PDCCH + ////Config TCI-states-to-addModList + int flag = 0; + + for(i =0; ssb_index_sorted[i]!=0; i++) { + tci_state_id = checkTargetSSBInTCIStates_pdcchConfig(ssb_index_sorted[i]); + + if( tci_state_id != -1 && ssb_rsrp_sorted[i] > ssb_rsrp[curr_ssb_beam_index] && ssb_rsrp_sorted[i] - ssb_rsrp[curr_ssb_beam_index] > L1_RSRP_HYSTERIS) { + sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.tciStateId = tci_state_id; + flag = 1; + break; + } + } + + if(flag == 0 || ssb_rsrp_sorted[i] < ssb_rsrp[curr_ssb_beam_index] || ssb_rsrp_sorted[i] - ssb_rsrp[curr_ssb_beam_index] < L1_RSRP_HYSTERIS) { + sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.is_scheduled = 0; + } + } + } + + sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.tci_present_inDCI = bwp->bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList->list.array[bwp_id-1]->tci_PresentInDCI; + + //filling pdsch tci state activation deactivation mac ce structure fields + if(sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.tci_present_inDCI) { + sched_ctrl->UE_mac_ce_ctrl.pdsch_TCI_States_ActDeact.is_scheduled = 1; + /* + Serving Cell ID: This field indicates the identity of the Serving Cell for which the MAC CE applies + Considering only PCell exists. Serving cell index of PCell is always 0, hence configuring 0 + */ + sched_ctrl->UE_mac_ce_ctrl.pdsch_TCI_States_ActDeact.servingCellId = 0; + /* + BWP ID: This field indicates a DL BWP for which the MAC CE applies as the codepoint of the DCI bandwidth + part indicator field as specified in TS 38.212 + */ + sched_ctrl->UE_mac_ce_ctrl.pdsch_TCI_States_ActDeact.bwpId = pdsch_bwp_id; + + /* + * TODO ssb_rsrp_sort() API yet to code to find 8 best beams, rrc configuration + * is required + */ + for(i = 0; i<8; i++) { + sched_ctrl->UE_mac_ce_ctrl.pdsch_TCI_States_ActDeact.tciStateActDeact[i] = i; + } + + sched_ctrl->UE_mac_ce_ctrl.pdsch_TCI_States_ActDeact.highestTciStateActivated = 8; + + for(i = 0, j =0; iUE_mac_ce_ctrl.pdsch_TCI_States_ActDeact.tciStateActDeact[i]) { + sched_ctrl->UE_mac_ce_ctrl.pdsch_TCI_States_ActDeact.codepoint[j] = i; + j++; + } + } + }//tci_presentInDCI + }//is-triggering_beam_switch +}//tci handling + void clear_nr_nfapi_information(gNB_MAC_INST * gNB, int CC_idP, frame_t frameP, diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 50fb2add02..192de6dd91 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -416,6 +416,58 @@ typedef struct nr_csi_report { } nr_csi_report_t; +//! fixme : need to enhace for the multiple TB CQI report + + +// +/*! As per spec 38.214 section 5.2.1.4.2 + * - if the UE is configured with the higher layer parameter groupBasedBeamReporting set to 'disabled', the UE shall report in + a single report nrofReportedRS (higher layer configured) different CRI or SSBRI for each report setting. + * - if the UE is configured with the higher layer parameter groupBasedBeamReporting set to 'enabled', the UE shall report in a + single reporting instance two different CRI or SSBRI for each report setting, where CSI-RS and/or SSB + resources can be received simultaneously by the UE either with a single spatial domain receive filter, or with + multiple simultaneous spatial domain receive filter +*/ +#define MAX_NR_OF_REPORTED_RS 4 + +typedef enum NR_CSI_Report_Config { + CSI_Report_PR_cri_ri_li_pmi_cqi_report, + CSI_Report_PR_ssb_cri_report +} NR_CSI_Report_Config_PR; +struct CRI_RI_LI_PMI_CQI { + uint8_t cri; + uint8_t ri; + uint8_t li; + uint8_t pmi_x1; + uint8_t pmi_x2; + uint8_t cqi; +}; +typedef struct CRI_SSB_RSRP { + uint8_t nr_ssbri_cri; + uint8_t CRI_SSBRI[MAX_NR_OF_REPORTED_RS]; + uint8_t RSRP; + uint8_t diff_RSRP[MAX_NR_OF_REPORTED_RS - 1]; +} CRI_SSB_RSRP_t; +struct CSI_Report { + NR_CSI_Report_Config_PR present; + union Config_CSI_Report { + struct CRI_RI_LI_PMI_CQI cri_ri_li_pmi_cqi_report; + struct CRI_SSB_RSRP ssb_cri_report; + } choice; +}; + +#define MAX_SR_BITLEN 8 +typedef struct NR_UE_sr { + uint8_t nr_of_srs; + bool ul_SR [MAX_SR_BITLEN]; +} NR_UE_sr_t; + +/*! As per the spec 38.212 and table: 6.3.1.1.2-12 in a single UCI sequence we can have multiple CSI_report + the number of CSI_report will depend on number of CSI resource sets that are configured in CSI-ResourceConfig RRC IE + From spec 38.331 from the IE CSI-ResourceConfig for SSB RSRP reporting we can configure only one resource set + From spec 38.214 section 5.2.1.2 For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 + */ +#define MAX_CSI_RESOURCE_SET_IN_CSI_RESOURCE_CONFIG 16 /*! \brief scheduling control information set through an API */ #define MAX_CSI_REPORTS 48 typedef struct { From 1dfc02fdf4ad22f5d1e0f7347185d3ae306fb3c2 Mon Sep 17 00:00:00 2001 From: Rangaswami Date: Mon, 10 Aug 2020 22:15:09 +0530 Subject: [PATCH 089/231] Initial commits for TCI and CSI reporting changes --- openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 1 - 1 file changed, 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 192de6dd91..24f2218305 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -415,7 +415,6 @@ typedef struct nr_csi_report { CSI_Meas_bitlen_t csi_meas_bitlen; } nr_csi_report_t; - //! fixme : need to enhace for the multiple TB CQI report From 94ae29d9e5e1e541a75026f6d7e95ead8dd1e331 Mon Sep 17 00:00:00 2001 From: "vr.devendra" Date: Thu, 13 Aug 2020 12:07:53 +0530 Subject: [PATCH 090/231] updated TCI handling apis --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 85 ++++++++++++++++++---- 1 file changed, 71 insertions(+), 14 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index 9b704d6ff8..2830b90396 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -105,21 +105,80 @@ int get_diff_rsrp(uint8_t index, int strongest_rsrp) { return MIN_RSRP_VALUE; } -int checkTargetSSBInFirst64TCIStates_pdschConfig(int ssb_index_t) { - //Need to implement once configuration is received - return 0; +int checkTargetSSBInFirst64TCIStates_pdschConfig(int ssb_index_t, int Mod_idP, int UE_id) { + NR_UE_list_t *UE_list = &RC.nrmac[Mod_idP]->UE_list; + NR_CellGroupConfig_t *secondaryCellGroup = UE_list->secondaryCellGroup[UE_id] ; + int nb_tci_states = secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list.count; + NR_TCI_State_t *tci =NULL; + int i; + + for(i=0; ispCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list.array[i]; + + if(tci != NULL) { + if(tci->qcl_Type1.referenceSignal.present == NR_QCL_Info__referenceSignal_PR_ssb) { + if(tci->qcl_Type1.referenceSignal.choice.ssb == ssb_index_t) + return tci->tci_StateId; // returned TCI state ID + } + // if type2 is configured + else if(tci->qcl_Type2 != NULL && tci->qcl_Type2->referenceSignal.present == NR_QCL_Info__referenceSignal_PR_ssb) { + if(tci->qcl_Type2->referenceSignal.choice.ssb == ssb_index_t) + return tci->tci_StateId; // returned TCI state ID + } else LOG_I(MAC,"SSB index is not found in first 64 TCI states of TCI_statestoAddModList[%d]", i); + } + } + + // tci state not identified in first 64 TCI States of PDSCH Config + return -1; } -int checkTargetSSBInTCIStates_pdcchConfig(int ssb_index_t) { - //Need to implement once configuration is received - return 0; +int checkTargetSSBInTCIStates_pdcchConfig(int ssb_index_t, int Mod_idP, int UE_id) { + NR_UE_list_t *UE_list = &RC.nrmac[Mod_idP]->UE_list; + NR_CellGroupConfig_t *secondaryCellGroup = UE_list->secondaryCellGroup[UE_id] ; + int nb_tci_states = secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list.count; + NR_TCI_State_t *tci =NULL; + NR_TCI_StateId_t *tci_id = NULL; + int bwp_id = 1; + NR_BWP_Downlink_t *bwp = secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1]; + NR_ControlResourceSet_t *coreset = bwp->bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList->list.array[bwp_id-1]; + int i; + int flag = 0; + int tci_stateID = -1; + + for(i=0; ispCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list.array[i]; + + if(tci != NULL && tci->qcl_Type1.referenceSignal.present == NR_QCL_Info__referenceSignal_PR_ssb) { + if(tci->qcl_Type1.referenceSignal.choice.ssb == ssb_index_t) { + flag = 1; + tci_stateID = tci->tci_StateId; + break; + } else if(tci->qcl_Type2 != NULL && tci->qcl_Type2->referenceSignal.present == NR_QCL_Info__referenceSignal_PR_ssb) { + flag = 1; + tci_stateID = tci->tci_StateId; + break; + } + } + + if(flag != 0 && tci_stateID != -1 && coreset != NULL) { + for(i=0; i<64 && itci_StatesPDCCH_ToAddList->list.count; i++) { + tci_id = coreset->tci_StatesPDCCH_ToAddList->list.array[i]; + + if(tci_id != NULL && *tci_id == tci_stateID) + return tci_stateID; + } + } + } + + // Need to implement once configuration is received + return -1; } int ssb_index_sorted[MAX_NUM_SSB] = {0}; int ssb_rsrp_sorted[MAX_NUM_SSB] = {0}; //Sorts ssb_index and ssb_rsrp array data and keeps in ssb_index_sorted and //ssb_rsrp_sorted respectively -int ssb_rsrp_sort(int *ssb_index, int *ssb_rsrp) { +void ssb_rsrp_sort(int *ssb_index, int *ssb_rsrp) { int i, j; for(i = 0; *(ssb_index+i) != 0; i++) { @@ -292,7 +351,7 @@ void tci_handling(int Mod_idP, int UE_id, int CC_id, NR_UE_sched_ctrl_t *sched_c The length of the field is 7 bits */ if(sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.coresetId == 0) { - int tci_state_id = checkTargetSSBInFirst64TCIStates_pdschConfig(ssb_index[target_ssb_beam_index]); + int tci_state_id = checkTargetSSBInFirst64TCIStates_pdschConfig(ssb_index[target_ssb_beam_index], Mod_idP, UE_id); if( tci_state_id != -1) sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.tciStateId = tci_state_id; @@ -302,7 +361,7 @@ void tci_handling(int Mod_idP, int UE_id, int CC_id, NR_UE_sched_ctrl_t *sched_c int flag = 0; for(i =0; ssb_index_sorted[i]!=0; i++) { - tci_state_id = checkTargetSSBInFirst64TCIStates_pdschConfig(ssb_index_sorted[i]); + tci_state_id = checkTargetSSBInFirst64TCIStates_pdschConfig(ssb_index_sorted[i], Mod_idP, UE_id) ; if(tci_state_id != -1 && ssb_rsrp_sorted[i] > ssb_rsrp[curr_ssb_beam_index] && ssb_rsrp_sorted[i] - ssb_rsrp[curr_ssb_beam_index] > L1_RSRP_HYSTERIS) { sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.tciStateId = tci_state_id; @@ -316,7 +375,7 @@ void tci_handling(int Mod_idP, int UE_id, int CC_id, NR_UE_sched_ctrl_t *sched_c } } } else { - int tci_state_id = checkTargetSSBInTCIStates_pdcchConfig(ssb_index[target_ssb_beam_index]); + int tci_state_id = checkTargetSSBInTCIStates_pdcchConfig(ssb_index[target_ssb_beam_index], Mod_idP, UE_id); if (tci_state_id !=-1) sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.tciStateId = tci_state_id; @@ -326,7 +385,7 @@ void tci_handling(int Mod_idP, int UE_id, int CC_id, NR_UE_sched_ctrl_t *sched_c int flag = 0; for(i =0; ssb_index_sorted[i]!=0; i++) { - tci_state_id = checkTargetSSBInTCIStates_pdcchConfig(ssb_index_sorted[i]); + tci_state_id = checkTargetSSBInTCIStates_pdcchConfig(ssb_index_sorted[i], Mod_idP, UE_id); if( tci_state_id != -1 && ssb_rsrp_sorted[i] > ssb_rsrp[curr_ssb_beam_index] && ssb_rsrp_sorted[i] - ssb_rsrp[curr_ssb_beam_index] > L1_RSRP_HYSTERIS) { sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.tciStateId = tci_state_id; @@ -376,8 +435,7 @@ void tci_handling(int Mod_idP, int UE_id, int CC_id, NR_UE_sched_ctrl_t *sched_c }//tci_presentInDCI }//is-triggering_beam_switch }//tci handling - -void clear_nr_nfapi_information(gNB_MAC_INST * gNB, +void clear_nr_nfapi_information(gNB_MAC_INST *gNB, int CC_idP, frame_t frameP, sub_frame_t slotP){ @@ -644,7 +702,6 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, start_meas(&RC.nrmac[module_idP]->eNB_scheduler); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_DLSCH_ULSCH_SCHEDULER,VCD_FUNCTION_IN); - pdcp_run(&ctxt); /* send tick to RLC and RRC every ms */ if ((slot & ((1 << *scc->ssbSubcarrierSpacing) - 1)) == 0) { From 356a0033fc3ceb441720d81d959a4c44ffebf0e8 Mon Sep 17 00:00:00 2001 From: "r.karey" Date: Sat, 15 Aug 2020 11:48:49 +0530 Subject: [PATCH 091/231] Added more logs and fixed assertion --- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 2 ++ openair2/NR_PHY_INTERFACE/NR_IF_Module.c | 32 ++++++++++++++----- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 845be51f58..4ccbd7c8c6 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -728,6 +728,7 @@ void nr_configure_pucch(nfapi_nr_pucch_pdu_t* pucch_pdu, } else N2 = N3; } + LOG_I(MAC, "UCI resource id = %ld\n", *resource_id); } AssertFatal(resource_id!=NULL,"Couldn-t find any matching PUCCH resource in the PUCCH resource sets"); @@ -766,6 +767,7 @@ void nr_configure_pucch(nfapi_nr_pucch_pdu_t* pucch_pdu, pucch_pdu->sr_flag = O_sr; break; case NR_PUCCH_Resource__format_PR_format2 : + LOG_I(MAC,"UCI format2 is being scheduled\n"); pucch_pdu->format_type = 2; pucch_pdu->nr_of_symbols = pucchres->format.choice.format2->nrofSymbols; pucch_pdu->start_symbol_index = pucchres->format.choice.format2->startingSymbolIndex; diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index 6206b54fbd..a09652cb1f 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -94,20 +94,32 @@ void handle_nr_rach(NR_UL_IND_t *UL_info) { //!TODO : smae function can be written to handle csi_resources uint8_t get_ssb_resources (NR_CSI_MeasConfig_t *csi_MeasConfig, NR_CSI_ResourceConfigId_t csi_ResourceConfigId, - NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type) { + NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type, + uint8_t *nb_resource_sets) { uint8_t idx = 0; - //uint8_t csi_ssb_idx =0; + uint8_t csi_ssb_idx =0; for ( idx = 0; idx < csi_MeasConfig->csi_ResourceConfigToAddModList->list.count; idx++) { if ( csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[idx]->csi_ResourceConfigId == csi_ResourceConfigId) { //Finding the CSI_RS or SSB Resources if ( csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[idx]->csi_RS_ResourceSetList.present == NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB) { - if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type ) - return (csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[idx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.count); + if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type ){ + *nb_resource_sets=csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[idx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.count; + + for ( csi_ssb_idx = 0; csi_ssb_idx < csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.count; csi_ssb_idx++) { + if (csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceSetId == + *(csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[idx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.array[0])) { + return csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceList.list.count; + } else { + //handle error condition + AssertFatal(csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceSetId, "csi_SSB_ResourcesSetId is not configured"); + } + } + } else if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == reportQuantity_type) - return (csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[idx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.count); + *nb_resource_sets=csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[idx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.count; } else { //TODO: find the CSI_RS IM resources @@ -303,15 +315,17 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, AssertFatal(reportQuantity_type, "reportQuantity is not configured"); if ( NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type ) { - uint8_t nb_ssb_resource_set = get_ssb_resources(csi_MeasConfig, + uint8_t nb_ssb_resource_set=0; + uint8_t nb_ssb_resources = get_ssb_resources(csi_MeasConfig, csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->resourcesForChannelMeasurement, - reportQuantity_type);//csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[0]->CSI_SSB_ResourceList.list.count; + reportQuantity_type,&nb_ssb_resource_set);//csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[0]->CSI_SSB_ResourceList.list.count; uint8_t idx = 0; uint8_t ssb_idx = 0; uint8_t diff_rsrp_idx = 0; - uint8_t bitlen_ssbri = log (nb_ssb_resource_set)/log (2); + uint8_t bitlen_ssbri = log (nb_ssb_resources)/log (2); sched_ctrl->nr_of_csi_report[UE_id] = nb_ssb_resource_set; + LOG_I(MAC,"csi_payload = %d, bitlen_ssbri = %d, nb_ssb_resource_set = %d,nb_ssb_resources = %d\n",payload_size, bitlen_ssbri, nb_ssb_resource_set,nb_ssb_resources); /*! As per the spec 38.212 and table: 6.3.1.1.2-12 in a single UCI sequence we can have multiple CSI_report * the number of CSI_report will depend on number of CSI resource sets that are configured in CSI-ResourceConfig RRC IE * From spec 38.331 from the IE CSI-ResourceConfig for SSB RSRP reporting we can configure only one resource set @@ -348,6 +362,7 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, } sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.RSRP = (*payload) & 0x7f; + *payload >>= 7; for ( diff_rsrp_idx =0; diff_rsrp_idx <= sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.nr_ssbri_cri - 1; diff_rsrp_idx++ ) { sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.diff_RSRP[diff_rsrp_idx] = (*payload) & 0x0f; @@ -364,6 +379,7 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, } sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.RSRP = (*payload) & 0x7f; + *payload >>= 7; /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.diff_RSRP[0] = (*payload) & 0x0f; *payload >>= 4; From 33f3fb2262e91ca15057ad61e5fce3c4db9feb40 Mon Sep 17 00:00:00 2001 From: "r.karey" Date: Sat, 15 Aug 2020 13:50:17 +0530 Subject: [PATCH 092/231] receiving of CSI report --- openair2/NR_PHY_INTERFACE/NR_IF_Module.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index a09652cb1f..bb5dc865f9 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -322,7 +322,7 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, uint8_t idx = 0; uint8_t ssb_idx = 0; uint8_t diff_rsrp_idx = 0; - uint8_t bitlen_ssbri = log (nb_ssb_resources)/log (2); + uint8_t bitlen_ssbri = nb_ssb_resources>1 ?log (nb_ssb_resources)/log (2):1; sched_ctrl->nr_of_csi_report[UE_id] = nb_ssb_resource_set; LOG_I(MAC,"csi_payload = %d, bitlen_ssbri = %d, nb_ssb_resource_set = %d,nb_ssb_resources = %d\n",payload_size, bitlen_ssbri, nb_ssb_resource_set,nb_ssb_resources); From bece5400d746ad70585a6b80880910540fa12b83 Mon Sep 17 00:00:00 2001 From: "r.karey" Date: Wed, 2 Sep 2020 15:22:10 +0530 Subject: [PATCH 093/231] UCI bitlength calculation --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 24 ++++--- openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 20 +++++- openair2/NR_PHY_INTERFACE/NR_IF_Module.c | 74 ++++++++++++---------- 3 files changed, 72 insertions(+), 46 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index 2830b90396..3f69e92105 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -245,11 +245,11 @@ void tci_handling(int Mod_idP, int UE_id, int CC_id, NR_UE_sched_ctrl_t *sched_c //NR_COMMON_channels_t *cc = RC.nrmac[Mod_idP]->common_channels; NR_CellGroupConfig_t *secondaryCellGroup = UE_list->secondaryCellGroup[UE_id]; NR_BWP_Downlink_t *bwp = secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1]; - NR_CSI_MeasConfig_t *csi_MeasConfig = UE_list->secondaryCellGroup[UE_id]->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup; + //NR_CSI_MeasConfig_t *csi_MeasConfig = UE_list->secondaryCellGroup[UE_id]->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup; //bwp indicator int n_dl_bwp = secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count; - uint8_t nb_ssb_resources_inEachSet = sched_ctrl->CSI_report[UE_id][cqi_idx].choice.ssb_cri_report.nr_ssbri_cri; - uint8_t nb_resource_sets = sched_ctrl->nr_of_csi_report[UE_id]; + uint8_t nb_ssb_resources_inEachSet = 0; + uint8_t nb_resource_sets = UE_list->csi_report_template[UE_id][cqi_idx].nb_of_csi_ssb_report; //uint8_t bitlen_ssbri = log (nb_resource_sets)/log (2); //uint8_t max_rsrp_reported = -1; int better_rsrp_reported = -140-(-0); /*minimum_measured_RSRP_value - minimum_differntail_RSRP_value*///considering the minimum RSRP value as better RSRP initially @@ -272,16 +272,17 @@ void tci_handling(int Mod_idP, int UE_id, int CC_id, NR_UE_sched_ctrl_t *sched_c //for all reported SSB for (idx = 0; idx < nb_resource_sets; idx++) { + nb_ssb_resources_inEachSet = sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri; //if group based beam Reporting is disabled - if(NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled == - csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.present ) { + /*if(NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled == + csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.present ) {*/ //extracting the ssb indexes - for (ssb_idx = 0; ssb_idx <= nb_ssb_resources_inEachSet; ssb_idx++) { - ssb_index[idx * nb_resource_sets + ssb_idx] = sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.CRI_SSBRI[ssb_idx]; + for (ssb_idx = 0; ssb_idx < nb_ssb_resources_inEachSet; ssb_idx++) { + ssb_index[idx * nb_resource_sets + ssb_idx] = sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI[ssb_idx]; } //if strongest measured RSRP is configured - strongest_ssb_rsrp = get_measured_rsrp(sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.RSRP); + strongest_ssb_rsrp = get_measured_rsrp(sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP); ssb_rsrp[idx * nb_resource_sets] = strongest_ssb_rsrp; //if current ssb rsrp is greater than better rsrp @@ -291,7 +292,7 @@ void tci_handling(int Mod_idP, int UE_id, int CC_id, NR_UE_sched_ctrl_t *sched_c } for(diff_rsrp_idx =1; diff_rsrp_idx < nb_ssb_resources_inEachSet; diff_rsrp_idx++) { - ssb_rsrp[idx * nb_resource_sets + diff_rsrp_idx] = get_diff_rsrp(sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.diff_RSRP[diff_rsrp_idx], strongest_ssb_rsrp); + ssb_rsrp[idx * nb_resource_sets + diff_rsrp_idx] = get_diff_rsrp(sched_ctrl->CSI_report[idx].choice.ssb_cri_report.diff_RSRP[diff_rsrp_idx], strongest_ssb_rsrp); //if current reported rsrp is greater than better rsrp if(ssb_rsrp[idx * nb_resource_sets + diff_rsrp_idx] > better_rsrp_reported) { @@ -299,7 +300,8 @@ void tci_handling(int Mod_idP, int UE_id, int CC_id, NR_UE_sched_ctrl_t *sched_c target_ssb_beam_index = idx * nb_resource_sets + diff_rsrp_idx; } } - } +#if 0 + //} //if group based beam reporting is enabled else if (NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled != csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.present ) { @@ -324,6 +326,7 @@ void tci_handling(int Mod_idP, int UE_id, int CC_id, NR_UE_sched_ctrl_t *sched_c target_ssb_beam_index = idx * nb_resource_sets + 1; } } +#endif } if(ssb_index[target_ssb_beam_index] != ssb_index[curr_ssb_beam_index] && ssb_rsrp[target_ssb_beam_index] > ssb_rsrp[curr_ssb_beam_index]) { @@ -435,6 +438,7 @@ void tci_handling(int Mod_idP, int UE_id, int CC_id, NR_UE_sched_ctrl_t *sched_c }//tci_presentInDCI }//is-triggering_beam_switch }//tci handling + void clear_nr_nfapi_information(gNB_MAC_INST *gNB, int CC_idP, frame_t frameP, diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 24f2218305..b130d98db6 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -441,12 +441,14 @@ struct CRI_RI_LI_PMI_CQI { uint8_t pmi_x2; uint8_t cqi; }; + typedef struct CRI_SSB_RSRP { uint8_t nr_ssbri_cri; uint8_t CRI_SSBRI[MAX_NR_OF_REPORTED_RS]; uint8_t RSRP; uint8_t diff_RSRP[MAX_NR_OF_REPORTED_RS - 1]; } CRI_SSB_RSRP_t; + struct CSI_Report { NR_CSI_Report_Config_PR present; union Config_CSI_Report { @@ -461,12 +463,28 @@ typedef struct NR_UE_sr { bool ul_SR [MAX_SR_BITLEN]; } NR_UE_sr_t; +typedef struct { + uint8_t nb_ssbri_cri; + uint8_t cri_ssbri_bitlen; + uint8_t rsrp_bitlen; + uint8_t diff_rsrp_bitlen; +}CRI_SSBRI_RSRP_bitlen_t; + +#define MAX_CSI_RESOURCE_SET_IN_CSI_RESOURCE_CONFIG 16 +typedef struct nr_csi_report { + NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type; + long periodicity; + NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR CSI_Resource_type; + uint8_t nb_of_nzp_csi_report; + uint8_t nb_of_csi_ssb_report; + CRI_SSBRI_RSRP_bitlen_t CSI_report_bitlen[MAX_CSI_RESOURCE_SET_IN_CSI_RESOURCE_CONFIG]; +} nr_csi_report_t; + /*! As per the spec 38.212 and table: 6.3.1.1.2-12 in a single UCI sequence we can have multiple CSI_report the number of CSI_report will depend on number of CSI resource sets that are configured in CSI-ResourceConfig RRC IE From spec 38.331 from the IE CSI-ResourceConfig for SSB RSRP reporting we can configure only one resource set From spec 38.214 section 5.2.1.2 For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 */ -#define MAX_CSI_RESOURCE_SET_IN_CSI_RESOURCE_CONFIG 16 /*! \brief scheduling control information set through an API */ #define MAX_CSI_REPORTS 48 typedef struct { diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index bb5dc865f9..a98cf18ca4 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -132,7 +132,7 @@ uint8_t get_ssb_resources (NR_CSI_MeasConfig_t *csi_MeasConfig, return -1; } - +#endif void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_pdu, NR_UE_sched_ctrl_t *sched_ctrl, @@ -287,27 +287,29 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, ) { /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ //uint8_t bitlen_cri = (log(csi_MeasConfig->csi_ResourceConfigToAddModList->list.count)/log(2)); + uint8_t idx = 0; uint8_t payload_size = ceil(uci_pdu->csi_part1.csi_part1_bit_len/8); uint16_t *payload = calloc (1, payload_size); NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type = NR_CSI_ReportConfig__reportQuantity_PR_NOTHING; - uint8_t UE_id = 0; + //uint8_t UE_id = 0; + NR_UE_list_t *UE_list = &(RC.nrmac[Mod_idP]->UE_list); + long periodicity; uint8_t csi_report_id = 0; memcpy ( payload, uci_pdu->csi_part1.csi_part1_payload, payload_size); for ( csi_report_id =0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++ ) { //Assuming in periodic reporting for one slot can be configured with only one CSI-ReportConfig - if (csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.present == NR_CSI_ReportConfig__reportConfigType_PR_periodic) { + // if (csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.present == NR_CSI_ReportConfig__reportConfigType_PR_periodic) { //considering 30khz scs and //Has to implement according to reportSlotConfig type - LOG_I(PHY,"SFN/SF:%d%d \n", frame,slot); - if (((NR_SubcarrierSpacing_kHz30 == scs) && - (0 == ((frame*20) + (slot+1)) % csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320)) - ||((NR_SubcarrierSpacing_kHz120 == scs)&& - (0 == ((frame*80) + (slot+1)) % csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320))){ - reportQuantity_type = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportQuantity.present; - LOG_I(PHY,"SFN/SF:%d%d reportQuantity type = %d\n", - frame,slot,reportQuantity_type); - } + periodicity = UE_list->csi_report_template[UE_id][csi_report_id].periodicity; + LOG_I(PHY,"SFN/SF:%d%d \n", frame,slot); + if (((NR_SubcarrierSpacing_kHz30 == scs) && (((((frame & 0xf)+1)*20 + slot) & periodicity) == periodicity)) + ||((NR_SubcarrierSpacing_kHz120 == scs)&&(((((frame & 0xf)+1)*80 + slot) & periodicity) == periodicity))) { + + reportQuantity_type = UE_list->csi_report_template[UE_id][csi_report_id].reportQuantity_type; + LOG_I(PHY,"SFN/SF:%d%d reportQuantity type = %d\n",frame,slot,reportQuantity_type); + break; } } @@ -315,23 +317,23 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, AssertFatal(reportQuantity_type, "reportQuantity is not configured"); if ( NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type ) { - uint8_t nb_ssb_resource_set=0; - uint8_t nb_ssb_resources = get_ssb_resources(csi_MeasConfig, + uint8_t nb_ssb_resource_set= UE_list->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report; + //uint8_t nb_ssb_resources = UE_list->csi_report_template[UE_id][csi_report_id]. + /* get_ssb_resources(csi_MeasConfig, csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->resourcesForChannelMeasurement, - reportQuantity_type,&nb_ssb_resource_set);//csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[0]->CSI_SSB_ResourceList.list.count; - uint8_t idx = 0; + reportQuantity_type,&nb_ssb_resource_set);//csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[0]->CSI_SSB_ResourceList.list.count;*/ uint8_t ssb_idx = 0; uint8_t diff_rsrp_idx = 0; - uint8_t bitlen_ssbri = nb_ssb_resources>1 ?log (nb_ssb_resources)/log (2):1; - sched_ctrl->nr_of_csi_report[UE_id] = nb_ssb_resource_set; + uint8_t bitlen_ssbri = UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen; + //sched_ctrl->nr_of_csi_report[UE_id] = nb_ssb_resource_set; - LOG_I(MAC,"csi_payload = %d, bitlen_ssbri = %d, nb_ssb_resource_set = %d,nb_ssb_resources = %d\n",payload_size, bitlen_ssbri, nb_ssb_resource_set,nb_ssb_resources); + LOG_I(MAC,"csi_payload = %d, bitlen_ssbri = %d, nb_ssb_resource_set = %d\n",payload_size, bitlen_ssbri, nb_ssb_resource_set); /*! As per the spec 38.212 and table: 6.3.1.1.2-12 in a single UCI sequence we can have multiple CSI_report * the number of CSI_report will depend on number of CSI resource sets that are configured in CSI-ResourceConfig RRC IE * From spec 38.331 from the IE CSI-ResourceConfig for SSB RSRP reporting we can configure only one resource set * From spec 38.214 section 5.2.1.2 For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 */ - for (idx = 0; idx < nb_ssb_resource_set; idx++) { + // for (idx = 0; idx < nb_ssb_resource_set; idx++) { /** from 38.214 sec 5.2.1.4.2 - if the UE is configured with the higher layer parameter groupBasedBeamReporting set to 'disabled', the UE is @@ -345,30 +347,31 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, multiple simultaneous spatial domain receive filter */ - if (NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled == +/* if (NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled == csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.present ) { if ((NULL != csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.choice.disabled->nrofReportedRS) && *(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.choice.disabled->nrofReportedRS)) sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.nr_ssbri_cri = *(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.choice.disabled->nrofReportedRS); - else - sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.nr_ssbri_cri = NR_CSI_ReportConfig__groupBasedBeamReporting__disabled__nrofReportedRS_n1; + else */ + idx = 0; //Since for SSB RSRP reporting in RRC can configure only one ssb resource set per one report config + sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri = UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].nb_ssbri_cri; - for (ssb_idx = 0; ssb_idx <= sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.nr_ssbri_cri ; ssb_idx++) { + for (ssb_idx = 0; ssb_idx < sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri ; ssb_idx++) { /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ - sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.CRI_SSBRI [ssb_idx] = (*payload) & ~(~1<<(bitlen_ssbri-1)); - *payload >>= bitlen_ssbri; - } + sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [ssb_idx] = (*payload) & ~(~1<<(bitlen_ssbri-1)); + *payload >>= bitlen_ssbri; + } - sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.RSRP = (*payload) & 0x7f; - *payload >>= 7; - - for ( diff_rsrp_idx =0; diff_rsrp_idx <= sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.nr_ssbri_cri - 1; diff_rsrp_idx++ ) { - sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.diff_RSRP[diff_rsrp_idx] = (*payload) & 0x0f; - *payload >>= 4; - } + sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP = (*payload) & 0x7f; + *payload >>= 7; + for ( diff_rsrp_idx =0; diff_rsrp_idx < sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri - 1; diff_rsrp_idx++ ) { + sched_ctrl->CSI_report[idx].choice.ssb_cri_report.diff_RSRP[diff_rsrp_idx] = (*payload) & 0x0f; + *payload >>= 4; + } +#if 0 } else if (NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled != csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.present ) { sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.nr_ssbri_cri = 2; @@ -384,7 +387,8 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.diff_RSRP[0] = (*payload) & 0x0f; *payload >>= 4; } - } +#endif + // } } #if 0 From 132d139c9277fb122653c3ff290193551c846bf9 Mon Sep 17 00:00:00 2001 From: "r.karey" Date: Mon, 7 Sep 2020 22:48:37 +0530 Subject: [PATCH 094/231] Changed periodicity calculation according to CSI_Reporting branch --- openair2/LAYER2/NR_MAC_gNB/config.c | 2 -- openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 1 + openair2/NR_PHY_INTERFACE/NR_IF_Module.c | 5 +++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index b175c57237..778402d34a 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -341,8 +341,6 @@ void update_csi_bitlen (NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_list_t *UE_li csi_ResourceConfigId=csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->resourcesForChannelMeasurement; reportQuantity_type = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportQuantity.present; UE_list->csi_report_template[UE_id][csi_report_id].reportQuantity_type = reportQuantity_type; - p_and_o = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.choice.periodic->reportSlotConfig.present; - switch(p_and_o){ case NR_CSI_ReportPeriodicityAndOffset_PR_slots4: period = 4; diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index b130d98db6..9b770db5d1 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -474,6 +474,7 @@ typedef struct { typedef struct nr_csi_report { NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type; long periodicity; + uint16_t offset; NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR CSI_Resource_type; uint8_t nb_of_nzp_csi_report; uint8_t nb_of_csi_ssb_report; diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index a98cf18ca4..212129a83c 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -304,8 +304,9 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, //Has to implement according to reportSlotConfig type periodicity = UE_list->csi_report_template[UE_id][csi_report_id].periodicity; LOG_I(PHY,"SFN/SF:%d%d \n", frame,slot); - if (((NR_SubcarrierSpacing_kHz30 == scs) && (((((frame & 0xf)+1)*20 + slot) & periodicity) == periodicity)) - ||((NR_SubcarrierSpacing_kHz120 == scs)&&(((((frame & 0xf)+1)*80 + slot) & periodicity) == periodicity))) { + /* if (((NR_SubcarrierSpacing_kHz30 == scs) && (((((frame & 0xf)+1)*20 + slot) & periodicity) == periodicity)) + ||((NR_SubcarrierSpacing_kHz120 == scs)&&(((((frame & 0xf)+1)*80 + slot) & periodicity) == periodicity))) {*/ + if (((slots_per_frame[scs]*frame + slot -UE_list->csi_report_template[UE_id][csi_report_id].offset)%periodicity)==0) { reportQuantity_type = UE_list->csi_report_template[UE_id][csi_report_id].reportQuantity_type; LOG_I(PHY,"SFN/SF:%d%d reportQuantity type = %d\n",frame,slot,reportQuantity_type); From 88bf90e58704a946194edfb2ac1e95ddfd7493f9 Mon Sep 17 00:00:00 2001 From: "r.karey" Date: Wed, 16 Sep 2020 13:36:52 +0530 Subject: [PATCH 095/231] Bit length calculation for CRI-RSRP --- openair2/LAYER2/NR_MAC_gNB/config.c | 1 + 1 file changed, 1 insertion(+) diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 778402d34a..8370a0774d 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -336,6 +336,7 @@ void update_csi_bitlen (NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_list_t *UE_li NR_CSI_ReportPeriodicityAndOffset_PR p_and_o; NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type; NR_CSI_ResourceConfigId_t csi_ResourceConfigId; + struct NR_CSI_ResourceConfig__csi_RS_ResourceSetList__nzp_CSI_RS_SSB * nzp_CSI_RS_SSB = NULL; for (csi_report_id=0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++){ csi_ResourceConfigId=csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->resourcesForChannelMeasurement; From 78dd18940c336a216adb87f358477985ca7adfbc Mon Sep 17 00:00:00 2001 From: "r.karey" Date: Wed, 7 Oct 2020 11:00:30 +0530 Subject: [PATCH 096/231] CSI-RS reporting bitlength calculation for type1 single panel two CSI-RS ports --- openair2/LAYER2/NR_MAC_gNB/config.c | 1 - openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 20 +++-- openair2/NR_PHY_INTERFACE/NR_IF_Module.c | 104 +++++++---------------- 3 files changed, 47 insertions(+), 78 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 8370a0774d..778402d34a 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -336,7 +336,6 @@ void update_csi_bitlen (NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_list_t *UE_li NR_CSI_ReportPeriodicityAndOffset_PR p_and_o; NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type; NR_CSI_ResourceConfigId_t csi_ResourceConfigId; - struct NR_CSI_ResourceConfig__csi_RS_ResourceSetList__nzp_CSI_RS_SSB * nzp_CSI_RS_SSB = NULL; for (csi_report_id=0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++){ csi_ResourceConfigId=csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->resourcesForChannelMeasurement; diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 9b770db5d1..a988cab930 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -468,17 +468,27 @@ typedef struct { uint8_t cri_ssbri_bitlen; uint8_t rsrp_bitlen; uint8_t diff_rsrp_bitlen; -}CRI_SSBRI_RSRP_bitlen_t; +}L1_RSRP_bitlen_t; + +typedef struct{ + uint8_t cri_bitlen; + uint8_t ri_bitlen; + uint8_t li_bitlen; + uint8_t pmi_x1_bitlen; + uint8_t pmi_x2_bitlen; + uint8_t cqi_bitlen; +} CSI_Meas_bitlen_t; -#define MAX_CSI_RESOURCE_SET_IN_CSI_RESOURCE_CONFIG 16 typedef struct nr_csi_report { NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type; long periodicity; uint16_t offset; - NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR CSI_Resource_type; - uint8_t nb_of_nzp_csi_report; + long ** SSB_Index_list; + long ** CSI_Index_list; +// uint8_t nb_of_nzp_csi_report; uint8_t nb_of_csi_ssb_report; - CRI_SSBRI_RSRP_bitlen_t CSI_report_bitlen[MAX_CSI_RESOURCE_SET_IN_CSI_RESOURCE_CONFIG]; + L1_RSRP_bitlen_t CSI_report_bitlen; + CSI_Meas_bitlen_t csi_meas_bitlen; } nr_csi_report_t; /*! As per the spec 38.212 and table: 6.3.1.1.2-12 in a single UCI sequence we can have multiple CSI_report diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index 212129a83c..aa15f5905b 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -121,18 +121,6 @@ uint8_t get_ssb_resources (NR_CSI_MeasConfig_t *csi_MeasConfig, else if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == reportQuantity_type) *nb_resource_sets=csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[idx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.count; - } else { - //TODO: find the CSI_RS IM resources - } - } else { - AssertFatal(csi_ResourceConfigId, "csi_ResourceConfigId is not configured"); - } - } - - return -1; -} - -#endif void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_pdu, NR_UE_sched_ctrl_t *sched_ctrl, @@ -286,15 +274,14 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, NR_SubcarrierSpacing_t scs ) { /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ - //uint8_t bitlen_cri = (log(csi_MeasConfig->csi_ResourceConfigToAddModList->list.count)/log(2)); uint8_t idx = 0; uint8_t payload_size = ceil(uci_pdu->csi_part1.csi_part1_bit_len/8); uint16_t *payload = calloc (1, payload_size); NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type = NR_CSI_ReportConfig__reportQuantity_PR_NOTHING; - //uint8_t UE_id = 0; NR_UE_list_t *UE_list = &(RC.nrmac[Mod_idP]->UE_list); long periodicity; uint8_t csi_report_id = 0; + memcpy ( payload, uci_pdu->csi_part1.csi_part1_payload, payload_size); for ( csi_report_id =0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++ ) { @@ -306,35 +293,24 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, LOG_I(PHY,"SFN/SF:%d%d \n", frame,slot); /* if (((NR_SubcarrierSpacing_kHz30 == scs) && (((((frame & 0xf)+1)*20 + slot) & periodicity) == periodicity)) ||((NR_SubcarrierSpacing_kHz120 == scs)&&(((((frame & 0xf)+1)*80 + slot) & periodicity) == periodicity))) {*/ - if (((slots_per_frame[scs]*frame + slot -UE_list->csi_report_template[UE_id][csi_report_id].offset)%periodicity)==0) { + if (((slots_per_frame[scs]*frame + slot -UE_list->csi_report_template[UE_id][csi_report_id].offset)%periodicity)!=0) + continue; - reportQuantity_type = UE_list->csi_report_template[UE_id][csi_report_id].reportQuantity_type; - LOG_I(PHY,"SFN/SF:%d%d reportQuantity type = %d\n",frame,slot,reportQuantity_type); - break; - } - } + reportQuantity_type = UE_list->csi_report_template[UE_id][csi_report_id].reportQuantity_type; + LOG_I(PHY,"SFN/SF:%d%d reportQuantity type = %d\n",frame,slot,reportQuantity_type); + + if ( NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == reportQuantity_type) { + uint8_t csi_ssb_idx = 0; + uint8_t diff_rsrp_idx = 0; + uint8_t cri_ssbri_bitlen = UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.cri_ssbri_bitlen; - if ( !(reportQuantity_type)) - AssertFatal(reportQuantity_type, "reportQuantity is not configured"); - - if ( NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type ) { - uint8_t nb_ssb_resource_set= UE_list->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report; - //uint8_t nb_ssb_resources = UE_list->csi_report_template[UE_id][csi_report_id]. - /* get_ssb_resources(csi_MeasConfig, - csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->resourcesForChannelMeasurement, - reportQuantity_type,&nb_ssb_resource_set);//csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[0]->CSI_SSB_ResourceList.list.count;*/ - uint8_t ssb_idx = 0; - uint8_t diff_rsrp_idx = 0; - uint8_t bitlen_ssbri = UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen; - //sched_ctrl->nr_of_csi_report[UE_id] = nb_ssb_resource_set; - - LOG_I(MAC,"csi_payload = %d, bitlen_ssbri = %d, nb_ssb_resource_set = %d\n",payload_size, bitlen_ssbri, nb_ssb_resource_set); + LOG_I(MAC,"csi_payload = %d, cri_ssbri_bitlen = %d\n",payload_size, cri_ssbri_bitlen); /*! As per the spec 38.212 and table: 6.3.1.1.2-12 in a single UCI sequence we can have multiple CSI_report * the number of CSI_report will depend on number of CSI resource sets that are configured in CSI-ResourceConfig RRC IE * From spec 38.331 from the IE CSI-ResourceConfig for SSB RSRP reporting we can configure only one resource set * From spec 38.214 section 5.2.1.2 For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 */ - // for (idx = 0; idx < nb_ssb_resource_set; idx++) { /** from 38.214 sec 5.2.1.4.2 - if the UE is configured with the higher layer parameter groupBasedBeamReporting set to 'disabled', the UE is @@ -348,50 +324,34 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, multiple simultaneous spatial domain receive filter */ -/* if (NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled == - csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.present ) { + idx = 0; //Since for SSB RSRP reporting in RRC can configure only one ssb resource set per one report config + sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri = UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.nb_ssbri_cri; - if ((NULL != csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.choice.disabled->nrofReportedRS) && - *(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.choice.disabled->nrofReportedRS)) - sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.nr_ssbri_cri = *(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.choice.disabled->nrofReportedRS); + for (csi_ssb_idx = 0; csi_ssb_idx < sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri ; csi_ssb_idx++) { + if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type) - else */ - idx = 0; //Since for SSB RSRP reporting in RRC can configure only one ssb resource set per one report config - sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri = UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].nb_ssbri_cri; + sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx] = *(UE_list->csi_report_template[UE_id][csi_report_id].SSB_Index_list [(*payload) & ~(~1<<(cri_ssbri_bitlen-1))]); + else + sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx] = *(UE_list->csi_report_template[UE_id][csi_report_id].CSI_Index_list [(*payload) & ~(~1<<(cri_ssbri_bitlen-1))]); + + *payload >>= cri_ssbri_bitlen; + } - for (ssb_idx = 0; ssb_idx < sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri ; ssb_idx++) { - /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ - sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [ssb_idx] = (*payload) & ~(~1<<(bitlen_ssbri-1)); - *payload >>= bitlen_ssbri; - } + sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP = (*payload) & 0x7f; + *payload >>= 7; - sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP = (*payload) & 0x7f; - *payload >>= 7; - - for ( diff_rsrp_idx =0; diff_rsrp_idx < sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri - 1; diff_rsrp_idx++ ) { - sched_ctrl->CSI_report[idx].choice.ssb_cri_report.diff_RSRP[diff_rsrp_idx] = (*payload) & 0x0f; - *payload >>= 4; - } -#if 0 - } else if (NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled != - csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.present ) { - sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.nr_ssbri_cri = 2; - for (ssb_idx = 0; ssb_idx < 2; ssb_idx++) { - /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ - sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.CRI_SSBRI[ssb_idx] = (*payload) & ~(~1<<(bitlen_ssbri-1)); - *payload >>= bitlen_ssbri; - } - - sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.RSRP = (*payload) & 0x7f; - *payload >>= 7; - /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ - sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.diff_RSRP[0] = (*payload) & 0x0f; + for ( diff_rsrp_idx =0; diff_rsrp_idx < sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri - 1; diff_rsrp_idx++ ) { + sched_ctrl->CSI_report[idx].choice.ssb_cri_report.diff_RSRP[diff_rsrp_idx] = (*payload) & 0x0f; *payload >>= 4; } -#endif - // } + UE_list->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report++; + } } + if ( !(reportQuantity_type)) + AssertFatal(reportQuantity_type, "reportQuantity is not configured"); + + #if 0 if ( NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI == reportQuantity_type || From 7edba1b1e8aff8d8701520d7032d5f63bb9919e8 Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Fri, 9 Oct 2020 15:26:15 +0200 Subject: [PATCH 097/231] remove log --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c | 1 - 1 file changed, 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 4ccbd7c8c6..9de04a4ffd 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -728,7 +728,6 @@ void nr_configure_pucch(nfapi_nr_pucch_pdu_t* pucch_pdu, } else N2 = N3; } - LOG_I(MAC, "UCI resource id = %ld\n", *resource_id); } AssertFatal(resource_id!=NULL,"Couldn-t find any matching PUCCH resource in the PUCCH resource sets"); From 642679ddf4a160587c45b3126bc4571d2576d732 Mon Sep 17 00:00:00 2001 From: "r.karey" Date: Mon, 12 Oct 2020 19:09:52 +0530 Subject: [PATCH 098/231] Changed the TCI handling after processing of CSI_measurements --- openair2/NR_PHY_INTERFACE/NR_IF_Module.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index aa15f5905b..30986cbb5f 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -330,9 +330,11 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, for (csi_ssb_idx = 0; csi_ssb_idx < sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri ; csi_ssb_idx++) { if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type) - sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx] = *(UE_list->csi_report_template[UE_id][csi_report_id].SSB_Index_list [(*payload) & ~(~1<<(cri_ssbri_bitlen-1))]); + sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx] = + *(UE_list->csi_report_template[UE_id][csi_report_id].SSB_Index_list [cri_ssbri_bitlen>0?((*payload)&~(~1<<(cri_ssbri_bitlen-1))):cri_ssbri_bitlen]); else - sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx] = *(UE_list->csi_report_template[UE_id][csi_report_id].CSI_Index_list [(*payload) & ~(~1<<(cri_ssbri_bitlen-1))]); + sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx] = + *(UE_list->csi_report_template[UE_id][csi_report_id].CSI_Index_list [cri_ssbri_bitlen>0?((*payload)&~(~1<<(cri_ssbri_bitlen-1))):cri_ssbri_bitlen]); *payload >>= cri_ssbri_bitlen; } From 91bb8d2fab22564c801178c4f10ef9c4f38ba7af Mon Sep 17 00:00:00 2001 From: "r.karey" Date: Fri, 16 Oct 2020 18:21:12 +0530 Subject: [PATCH 099/231] Fixed the calculation of received csi payload size at MAC --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c | 1 - openair2/NR_PHY_INTERFACE/NR_IF_Module.c | 11 ++++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 9de04a4ffd..845be51f58 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -766,7 +766,6 @@ void nr_configure_pucch(nfapi_nr_pucch_pdu_t* pucch_pdu, pucch_pdu->sr_flag = O_sr; break; case NR_PUCCH_Resource__format_PR_format2 : - LOG_I(MAC,"UCI format2 is being scheduled\n"); pucch_pdu->format_type = 2; pucch_pdu->nr_of_symbols = pucchres->format.choice.format2->nrofSymbols; pucch_pdu->start_symbol_index = pucchres->format.choice.format2->startingSymbolIndex; diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index 30986cbb5f..1eca00e1a9 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -275,8 +275,8 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, ) { /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ uint8_t idx = 0; - uint8_t payload_size = ceil(uci_pdu->csi_part1.csi_part1_bit_len/8); - uint16_t *payload = calloc (1, payload_size); + uint8_t payload_size = ceil((double)uci_pdu->csi_part1.csi_part1_bit_len/8); + uint8_t *payload = calloc (payload_size, sizeof(uint8_t)); NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type = NR_CSI_ReportConfig__reportQuantity_PR_NOTHING; NR_UE_list_t *UE_list = &(RC.nrmac[Mod_idP]->UE_list); long periodicity; @@ -305,7 +305,6 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, uint8_t diff_rsrp_idx = 0; uint8_t cri_ssbri_bitlen = UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.cri_ssbri_bitlen; - LOG_I(MAC,"csi_payload = %d, cri_ssbri_bitlen = %d\n",payload_size, cri_ssbri_bitlen); /*! As per the spec 38.212 and table: 6.3.1.1.2-12 in a single UCI sequence we can have multiple CSI_report * the number of CSI_report will depend on number of CSI resource sets that are configured in CSI-ResourceConfig RRC IE * From spec 38.331 from the IE CSI-ResourceConfig for SSB RSRP reporting we can configure only one resource set @@ -331,12 +330,13 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type) sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx] = - *(UE_list->csi_report_template[UE_id][csi_report_id].SSB_Index_list [cri_ssbri_bitlen>0?((*payload)&~(~1<<(cri_ssbri_bitlen-1))):cri_ssbri_bitlen]); + *(UE_list->csi_report_template[UE_id][csi_report_id].SSB_Index_list[cri_ssbri_bitlen>0?((*payload)&~(~1<<(cri_ssbri_bitlen-1))):cri_ssbri_bitlen]); else sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx] = - *(UE_list->csi_report_template[UE_id][csi_report_id].CSI_Index_list [cri_ssbri_bitlen>0?((*payload)&~(~1<<(cri_ssbri_bitlen-1))):cri_ssbri_bitlen]); + *(UE_list->csi_report_template[UE_id][csi_report_id].CSI_Index_list[cri_ssbri_bitlen>0?((*payload)&~(~1<<(cri_ssbri_bitlen-1))):cri_ssbri_bitlen]); *payload >>= cri_ssbri_bitlen; + LOG_I(PHY,"SSB_index = %d",sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx]); } sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP = (*payload) & 0x7f; @@ -347,6 +347,7 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, *payload >>= 4; } UE_list->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report++; + LOG_I(MAC,"csi_payload = %d, rsrp = %d\n",payload_size, sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP); } } From db718321be9c4643d98e23ef1e7ace1bd203b682 Mon Sep 17 00:00:00 2001 From: Rangaswami Date: Wed, 21 Oct 2020 10:29:42 +0530 Subject: [PATCH 100/231] Fixed the segemntation fault and added CSI bitlength in uci_pdu --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 58 +++++++++++----------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index 3f69e92105..fe81430c75 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -227,7 +227,8 @@ void dump_mac_stats(gNB_MAC_INST *gNB) //identifies the target SSB Beam index //keeps the required date for PDCCH and PDSCH TCI state activation/deactivation CE consutruction globally //handles triggering of PDCCH and PDSCH MAC CEs -void tci_handling(int Mod_idP, int UE_id, int CC_id, NR_UE_sched_ctrl_t *sched_ctrl, frame_t frame, slot_t slot) { +void tci_handling(module_id_t Mod_idP, int UE_id, int CC_id, NR_UE_sched_ctrl_t *sched_ctrl, frame_t frame, slot_t slot) { + int strongest_ssb_rsrp = 0; int cqi_idx = 0; int curr_ssb_beam_index = 0; //ToDo: yet to know how to identify the serving ssb beam index @@ -248,9 +249,9 @@ void tci_handling(int Mod_idP, int UE_id, int CC_id, NR_UE_sched_ctrl_t *sched_c //NR_CSI_MeasConfig_t *csi_MeasConfig = UE_list->secondaryCellGroup[UE_id]->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup; //bwp indicator int n_dl_bwp = secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count; - uint8_t nb_ssb_resources_inEachSet = 0; - uint8_t nb_resource_sets = UE_list->csi_report_template[UE_id][cqi_idx].nb_of_csi_ssb_report; - //uint8_t bitlen_ssbri = log (nb_resource_sets)/log (2); + uint8_t nr_ssbri_cri = 0; + uint8_t nb_of_csi_ssb_report = UE_list->csi_report_template[UE_id][cqi_idx].nb_of_csi_ssb_report; + //uint8_t bitlen_ssbri = log (nb_of_csi_ssb_report)/log (2); //uint8_t max_rsrp_reported = -1; int better_rsrp_reported = -140-(-0); /*minimum_measured_RSRP_value - minimum_differntail_RSRP_value*///considering the minimum RSRP value as better RSRP initially uint8_t diff_rsrp_idx = 0; @@ -263,41 +264,41 @@ void tci_handling(int Mod_idP, int UE_id, int CC_id, NR_UE_sched_ctrl_t *sched_c /*Example: CRI_SSBRI: 1 2 3 4| 5 6 7 8| 9 10 1 2| - nb_resource_sets = 3 //3 sets as above - nb_ssb_resources_inEachSet = 4 //each set has 4 elements + nb_of_csi_ssb_report = 3 //3 sets as above + nr_ssbri_cri = 4 //each set has 4 elements storing ssb indexes in ssb_index array as ssb_index[0] = 1 .. ssb_index[4] = 5 ssb_rsrp[0] = strongest rsrp in first set, ssb_rsrp[4] = strongest rsrp in second set, .. idx: resource set index */ //for all reported SSB - for (idx = 0; idx < nb_resource_sets; idx++) { - nb_ssb_resources_inEachSet = sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri; + for (idx = 0; idx < nb_of_csi_ssb_report; idx++) { + nr_ssbri_cri = sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri; //if group based beam Reporting is disabled /*if(NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled == csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.present ) {*/ //extracting the ssb indexes - for (ssb_idx = 0; ssb_idx < nb_ssb_resources_inEachSet; ssb_idx++) { - ssb_index[idx * nb_resource_sets + ssb_idx] = sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI[ssb_idx]; + for (ssb_idx = 0; ssb_idx < nr_ssbri_cri; ssb_idx++) { + ssb_index[idx * nb_of_csi_ssb_report + ssb_idx] = sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI[ssb_idx]; } //if strongest measured RSRP is configured strongest_ssb_rsrp = get_measured_rsrp(sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP); - ssb_rsrp[idx * nb_resource_sets] = strongest_ssb_rsrp; + ssb_rsrp[idx * nb_of_csi_ssb_report] = strongest_ssb_rsrp; //if current ssb rsrp is greater than better rsrp - if(ssb_rsrp[idx * nb_resource_sets] > better_rsrp_reported) { - better_rsrp_reported = ssb_rsrp[idx * nb_resource_sets]; - target_ssb_beam_index = idx * nb_resource_sets; + if(ssb_rsrp[idx * nb_of_csi_ssb_report] > better_rsrp_reported) { + better_rsrp_reported = ssb_rsrp[idx * nb_of_csi_ssb_report]; + target_ssb_beam_index = idx * nb_of_csi_ssb_report; } - for(diff_rsrp_idx =1; diff_rsrp_idx < nb_ssb_resources_inEachSet; diff_rsrp_idx++) { - ssb_rsrp[idx * nb_resource_sets + diff_rsrp_idx] = get_diff_rsrp(sched_ctrl->CSI_report[idx].choice.ssb_cri_report.diff_RSRP[diff_rsrp_idx], strongest_ssb_rsrp); + for(diff_rsrp_idx =1; diff_rsrp_idx < nr_ssbri_cri; diff_rsrp_idx++) { + ssb_rsrp[idx * nb_of_csi_ssb_report + diff_rsrp_idx] = get_diff_rsrp(sched_ctrl->CSI_report[idx].choice.ssb_cri_report.diff_RSRP[diff_rsrp_idx-1], strongest_ssb_rsrp); //if current reported rsrp is greater than better rsrp - if(ssb_rsrp[idx * nb_resource_sets + diff_rsrp_idx] > better_rsrp_reported) { - better_rsrp_reported = ssb_rsrp[idx * nb_resource_sets + diff_rsrp_idx]; - target_ssb_beam_index = idx * nb_resource_sets + diff_rsrp_idx; + if(ssb_rsrp[idx * nb_of_csi_ssb_report + diff_rsrp_idx] > better_rsrp_reported) { + better_rsrp_reported = ssb_rsrp[idx * nb_of_csi_ssb_report + diff_rsrp_idx]; + target_ssb_beam_index = idx * nb_of_csi_ssb_report + diff_rsrp_idx; } } #if 0 @@ -308,27 +309,28 @@ void tci_handling(int Mod_idP, int UE_id, int CC_id, NR_UE_sched_ctrl_t *sched_c //extracting the ssb indexes //for group based reporting only 2 SSB RS are reported, 38.331 for (ssb_idx = 0; ssb_idx < 2; ssb_idx++) { - ssb_index[idx * nb_resource_sets + ssb_idx] = sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.CRI_SSBRI[ssb_idx]; + ssb_index[idx * nb_of_csi_ssb_report + ssb_idx] = sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.CRI_SSBRI[ssb_idx]; } strongest_ssb_rsrp = get_measured_rsrp(sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.RSRP); - ssb_rsrp[idx * nb_resource_sets] = strongest_ssb_rsrp; + ssb_rsrp[idx * nb_of_csi_ssb_report] = strongest_ssb_rsrp; - if(ssb_rsrp[idx * nb_resource_sets] > better_rsrp_reported) { - better_rsrp_reported = ssb_rsrp[idx * nb_resource_sets]; - target_ssb_beam_index = idx * nb_resource_sets; + if(ssb_rsrp[idx * nb_of_csi_ssb_report] > better_rsrp_reported) { + better_rsrp_reported = ssb_rsrp[idx * nb_of_csi_ssb_report]; + target_ssb_beam_index = idx * nb_of_csi_ssb_report; } - ssb_rsrp[idx * nb_resource_sets + 1] = get_diff_rsrp(sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.diff_RSRP[diff_rsrp_idx], strongest_ssb_rsrp); + ssb_rsrp[idx * nb_of_csi_ssb_report + 1] = get_diff_rsrp(sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.diff_RSRP[diff_rsrp_idx], strongest_ssb_rsrp); - if(ssb_rsrp[idx * nb_resource_sets + 1] > better_rsrp_reported) { - better_rsrp_reported = ssb_rsrp[idx * nb_resource_sets + 1]; - target_ssb_beam_index = idx * nb_resource_sets + 1; + if(ssb_rsrp[idx * nb_of_csi_ssb_report + 1] > better_rsrp_reported) { + better_rsrp_reported = ssb_rsrp[idx * nb_of_csi_ssb_report + 1]; + target_ssb_beam_index = idx * nb_of_csi_ssb_report + 1; } } #endif } + if(ssb_index[target_ssb_beam_index] != ssb_index[curr_ssb_beam_index] && ssb_rsrp[target_ssb_beam_index] > ssb_rsrp[curr_ssb_beam_index]) { if( ssb_rsrp[target_ssb_beam_index] - ssb_rsrp[curr_ssb_beam_index] > L1_RSRP_HYSTERIS) { is_triggering_ssb_beam_switch = 1; From 6a0168b42b0b1b39529ce5b1af4547ccbf1eecc6 Mon Sep 17 00:00:00 2001 From: "p.shashikala" Date: Mon, 2 Nov 2020 12:09:14 +0545 Subject: [PATCH 101/231] CSI payload bits inversion issue --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 1 + 1 file changed, 1 insertion(+) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index fe81430c75..29cfd9c5eb 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -285,6 +285,7 @@ void tci_handling(module_id_t Mod_idP, int UE_id, int CC_id, NR_UE_sched_ctrl_t //if strongest measured RSRP is configured strongest_ssb_rsrp = get_measured_rsrp(sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP); ssb_rsrp[idx * nb_of_csi_ssb_report] = strongest_ssb_rsrp; + LOG_I(MAC,"ssb_rsrp = %d\n",strongest_ssb_rsrp); //if current ssb rsrp is greater than better rsrp if(ssb_rsrp[idx * nb_of_csi_ssb_report] > better_rsrp_reported) { From 8e9b8f6cd03bb7d5bb30ee1932e6e3c63faf526c Mon Sep 17 00:00:00 2001 From: Rangaswami Date: Wed, 4 Nov 2020 14:14:01 +0530 Subject: [PATCH 102/231] fixed CSI payload issue with multiple SSBs --- openair2/NR_PHY_INTERFACE/NR_IF_Module.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index 1eca00e1a9..2a7ea9b904 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -141,7 +141,6 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, memcpy ( payload, uci_pdu->csi_part1.csi_part1_payload, payload_size); - reverse_n_bits(payload, uci_pdu->csi_part1.csi_part1_bit_len); UE_list->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report = 0; for ( csi_report_id =0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++ ) { @@ -186,8 +185,10 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri = UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.nb_ssbri_cri; for (csi_ssb_idx = 0; csi_ssb_idx < sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri ; csi_ssb_idx++) { - if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type) + if(cri_ssbri_bitlen > 1) + reverse_n_bits(payload, cri_ssbri_bitlen); + if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type) sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx] = *(UE_list->csi_report_template[UE_id][csi_report_id].SSB_Index_list[cri_ssbri_bitlen>0?((*payload)&~(~1<<(cri_ssbri_bitlen-1))):cri_ssbri_bitlen]); else @@ -195,13 +196,15 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, *(UE_list->csi_report_template[UE_id][csi_report_id].CSI_Index_list[cri_ssbri_bitlen>0?((*payload)&~(~1<<(cri_ssbri_bitlen-1))):cri_ssbri_bitlen]); *payload >>= cri_ssbri_bitlen; - LOG_I(PHY,"SSB_index = %d",sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx]); + LOG_I(PHY,"SSB_index = %d",sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx]); } - + + reverse_n_bits(payload, 7); sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP = (*payload) & 0x7f; *payload >>= 7; for ( diff_rsrp_idx =0; diff_rsrp_idx < sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri - 1; diff_rsrp_idx++ ) { + reverse_n_bits(payload,4); sched_ctrl->CSI_report[idx].choice.ssb_cri_report.diff_RSRP[diff_rsrp_idx] = (*payload) & 0x0f; *payload >>= 4; } From 7bdf08630192ed1cf74688ab96b0b53ad5b53480 Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Mon, 9 Nov 2020 11:19:45 +0100 Subject: [PATCH 103/231] fix in csi pucch2 payload reporting --- openair1/PHY/NR_TRANSPORT/pucch_rx.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/pucch_rx.c b/openair1/PHY/NR_TRANSPORT/pucch_rx.c index cb75a88abb..51742daf72 100644 --- a/openair1/PHY/NR_TRANSPORT/pucch_rx.c +++ b/openair1/PHY/NR_TRANSPORT/pucch_rx.c @@ -1604,7 +1604,7 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB, re_offset = (12*pucch_pdu->prb_start) + (12*pucch_pdu->bwp_start) + frame_parms->first_carrier_offset; // estimate CQI for MAC (from antenna port 0 only) int SNRtimes10 = dB_fixed_times10(signal_energy_nodc(&rxdataF[0][(l2*frame_parms->ofdm_symbol_size)+re_offset],12*pucch_pdu->prb_size)) - (10*gNB->measurements.n0_power_tot_dB); - int cqi; + int cqi,bit_left; if (SNRtimes10 < -640) cqi=0; else if (SNRtimes10 > 635) cqi=255; else cqi=(640+SNRtimes10)/5; @@ -1628,7 +1628,8 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB, uci_pdu->harq.harq_payload[i] = decodedPayload[0] & 255; decodedPayload[0]>>=8; } - uci_pdu->harq.harq_payload[i] = decodedPayload[0] & ((1<<(pucch_pdu->bit_len_harq&7))-1); + bit_left = pucch_pdu->bit_len_harq-(harq_bytes-1)<<3; + uci_pdu->harq.harq_payload[i] = decodedPayload[0] & ((1<>= pucch_pdu->bit_len_harq; } @@ -1652,7 +1653,8 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB, uci_pdu->csi_part1.csi_part1_payload[i] = decodedPayload[0] & 255; decodedPayload[0]>>=8; } - uci_pdu->csi_part1.csi_part1_payload[i] = decodedPayload[0] & ((1<<(pucch_pdu->bit_len_csi_part1&7))-1); + bit_left = pucch_pdu->bit_len_csi_part1-(csi_part1_bytes-1)<<3; + uci_pdu->csi_part1.csi_part1_payload[i] = decodedPayload[0] & ((1<>= pucch_pdu->bit_len_csi_part1; } From cad40aabff9f076811c58676c84764bc633bb1e6 Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Fri, 20 Nov 2020 10:22:10 +0100 Subject: [PATCH 104/231] uci mac functions in a new file --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 2 ++ openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index 29cfd9c5eb..7174f5f4d2 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -650,6 +650,8 @@ void schedule_nr_SRS(module_id_t module_idP, frame_t frameP, sub_frame_t subfram bool is_xlsch_in_slot(uint64_t bitmap, sub_frame_t slot) { return (bitmap >> slot) & 0x01; } + + void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frame, sub_frame_t slot){ diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index 3502a11580..a9a0e4a1c2 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -194,6 +194,22 @@ bool nr_acknack_scheduling(int Mod_idP, frame_t frameP, sub_frame_t slotP); +int checkTargetSSBInTCIStates_pdcchConfig(int ssb_index_t, int Mod_idP, int UE_id); + +int checkTargetSSBInFirst64TCIStates_pdschConfig(int ssb_index_t, int Mod_idP, int UE_id); + +int get_measured_rsrp(uint8_t index); + +int get_diff_rsrp(uint8_t index, int strongest_rsrp); + +void extract_pucch_csi_report (NR_CSI_MeasConfig_t *csi_MeasConfig, + nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_pdu, + NR_UE_sched_ctrl_t *sched_ctrl, + frame_t frame, + slot_t slot, + NR_SubcarrierSpacing_t scs, int UE_id, + module_id_t Mod_idP); + void get_pdsch_to_harq_feedback(int Mod_idP, int UE_id, NR_SearchSpace__searchSpaceType_PR ss_type, From c54062194e0ff7d5514ac5729a61c512637750b2 Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Mon, 23 Nov 2020 11:05:33 +0100 Subject: [PATCH 105/231] bugfix in pucch_rx --- openair1/PHY/NR_TRANSPORT/pucch_rx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/pucch_rx.c b/openair1/PHY/NR_TRANSPORT/pucch_rx.c index 51742daf72..70481fe67e 100644 --- a/openair1/PHY/NR_TRANSPORT/pucch_rx.c +++ b/openair1/PHY/NR_TRANSPORT/pucch_rx.c @@ -1628,7 +1628,7 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB, uci_pdu->harq.harq_payload[i] = decodedPayload[0] & 255; decodedPayload[0]>>=8; } - bit_left = pucch_pdu->bit_len_harq-(harq_bytes-1)<<3; + bit_left = pucch_pdu->bit_len_harq-((harq_bytes-1)<<3); uci_pdu->harq.harq_payload[i] = decodedPayload[0] & ((1<>= pucch_pdu->bit_len_harq; } @@ -1653,7 +1653,7 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB, uci_pdu->csi_part1.csi_part1_payload[i] = decodedPayload[0] & 255; decodedPayload[0]>>=8; } - bit_left = pucch_pdu->bit_len_csi_part1-(csi_part1_bytes-1)<<3; + bit_left = pucch_pdu->bit_len_csi_part1-((csi_part1_bytes-1)<<3); uci_pdu->csi_part1.csi_part1_payload[i] = decodedPayload[0] & ((1<>= pucch_pdu->bit_len_csi_part1; } From 947eba9be8530dd0fe345eaed1f23abf593edc19 Mon Sep 17 00:00:00 2001 From: Rangaswami Date: Mon, 10 Aug 2020 22:15:09 +0530 Subject: [PATCH 106/231] Initial commits for TCI and CSI reporting changes --- openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 52 +++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index a988cab930..fde0d8daba 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -363,6 +363,58 @@ typedef struct NR_UE_harq { uint32_t tb_size; } NR_UE_harq_t; +//! fixme : need to enhace for the multiple TB CQI report + + +// +/*! As per spec 38.214 section 5.2.1.4.2 + * - if the UE is configured with the higher layer parameter groupBasedBeamReporting set to 'disabled', the UE shall report in + a single report nrofReportedRS (higher layer configured) different CRI or SSBRI for each report setting. + * - if the UE is configured with the higher layer parameter groupBasedBeamReporting set to 'enabled', the UE shall report in a + single reporting instance two different CRI or SSBRI for each report setting, where CSI-RS and/or SSB + resources can be received simultaneously by the UE either with a single spatial domain receive filter, or with + multiple simultaneous spatial domain receive filter +*/ +#define MAX_NR_OF_REPORTED_RS 4 + +typedef enum NR_CSI_Report_Config { + CSI_Report_PR_cri_ri_li_pmi_cqi_report, + CSI_Report_PR_ssb_cri_report +} NR_CSI_Report_Config_PR; +struct CRI_RI_LI_PMI_CQI { + uint8_t cri; + uint8_t ri; + uint8_t li; + uint8_t pmi_x1; + uint8_t pmi_x2; + uint8_t cqi; +}; +typedef struct CRI_SSB_RSRP { + uint8_t nr_ssbri_cri; + uint8_t CRI_SSBRI[MAX_NR_OF_REPORTED_RS]; + uint8_t RSRP; + uint8_t diff_RSRP[MAX_NR_OF_REPORTED_RS - 1]; +} CRI_SSB_RSRP_t; +struct CSI_Report { + NR_CSI_Report_Config_PR present; + union Config_CSI_Report { + struct CRI_RI_LI_PMI_CQI cri_ri_li_pmi_cqi_report; + struct CRI_SSB_RSRP ssb_cri_report; + } choice; +}; + +#define MAX_SR_BITLEN 8 +typedef struct NR_UE_sr { + uint8_t nr_of_srs; + bool ul_SR [MAX_SR_BITLEN]; +} NR_UE_sr_t; + +/*! As per the spec 38.212 and table: 6.3.1.1.2-12 in a single UCI sequence we can have multiple CSI_report + the number of CSI_report will depend on number of CSI resource sets that are configured in CSI-ResourceConfig RRC IE + From spec 38.331 from the IE CSI-ResourceConfig for SSB RSRP reporting we can configure only one resource set + From spec 38.214 section 5.2.1.2 For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 + */ +#define MAX_CSI_RESOURCE_SET_IN_CSI_RESOURCE_CONFIG 16 typedef struct NR_UE_old_sched { uint16_t rbSize; int time_domain_allocation; From 59937eeb2b3c4b13921edf6390558c2f917906ec Mon Sep 17 00:00:00 2001 From: Rangaswami Date: Mon, 10 Aug 2020 22:15:09 +0530 Subject: [PATCH 107/231] Initial commits for TCI and CSI reporting changes --- openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index fde0d8daba..c01cbfebc9 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -604,6 +604,9 @@ typedef struct { uint8_t tpc0; uint8_t tpc1; uint16_t ul_rssi; + uint8_t current_harq_pid; + struct CSI_Report CSI_report[MAX_MOBILES_PER_GNB][MAX_CSI_RESOURCE_SET_IN_CSI_RESOURCE_CONFIG]; + NR_UE_sr_t sr_req; /// information about every HARQ process NR_UE_harq_t harq_processes[NR_MAX_NB_HARQ_PROCESSES]; /// HARQ processes that are free From 32139c6f91ba00685e02be1a8504be454c4fce9f Mon Sep 17 00:00:00 2001 From: "r.karey" Date: Sat, 15 Aug 2020 11:48:49 +0530 Subject: [PATCH 108/231] Added more logs and fixed assertion --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 1 - .../NR_MAC_gNB/gNB_scheduler_primitives.c | 55 +++++++++++++++++++ openair2/NR_PHY_INTERFACE/NR_IF_Module.c | 1 + 3 files changed, 56 insertions(+), 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index 7174f5f4d2..1161e79a31 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -747,7 +747,6 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, if ((slot == 0) && (frame & 127) == 0) dump_mac_stats(RC.nrmac[module_idP]); - // This schedules MIB schedule_nr_mib(module_idP, frame, slot, nr_slots_per_frame[*scc->ssbSubcarrierSpacing]); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 845be51f58..99d7de58ca 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -728,6 +728,7 @@ void nr_configure_pucch(nfapi_nr_pucch_pdu_t* pucch_pdu, } else N2 = N3; } + LOG_I(MAC, "UCI resource id = %ld\n", *resource_id); } AssertFatal(resource_id!=NULL,"Couldn-t find any matching PUCCH resource in the PUCCH resource sets"); @@ -766,6 +767,7 @@ void nr_configure_pucch(nfapi_nr_pucch_pdu_t* pucch_pdu, pucch_pdu->sr_flag = O_sr; break; case NR_PUCCH_Resource__format_PR_format2 : + LOG_I(MAC,"UCI format2 is being scheduled\n"); pucch_pdu->format_type = 2; pucch_pdu->nr_of_symbols = pucchres->format.choice.format2->nrofSymbols; pucch_pdu->start_symbol_index = pucchres->format.choice.format2->startingSymbolIndex; @@ -1804,6 +1806,59 @@ void get_pdsch_to_harq_feedback(int Mod_idP, } } +<<<<<<< HEAD +======= +// function to update pucch scheduling parameters in UE list when a USS DL is scheduled +void nr_update_pucch_scheduling(int Mod_idP, + int UE_id, + frame_t frameP, + sub_frame_t slotP, + int slots_per_tdd, + int *pucch_id) { + + NR_ServingCellConfigCommon_t *scc = RC.nrmac[Mod_idP]->common_channels->ServingCellConfigCommon; + NR_UE_list_t *UE_list = &RC.nrmac[Mod_idP]->UE_list; + NR_sched_pucch *curr_pucch; + int first_ul_slot_tdd,k,i; + uint8_t pdsch_to_harq_feedback[8]; + int found = 0; + int nr_ulmix_slots = scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots; + if (scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols!=0) + nr_ulmix_slots++; + + // this is hardcoded for now as ue specific + NR_SearchSpace__searchSpaceType_PR ss_type = NR_SearchSpace__searchSpaceType_PR_ue_Specific; + get_pdsch_to_harq_feedback(Mod_idP,UE_id,ss_type,pdsch_to_harq_feedback); + + // for each possible ul or mixed slot + for (k=0; kUE_sched_ctrl[UE_id].sched_pucch[k]; + // if there is free room in current pucch structure + if (curr_pucch->dai_cframe = frameP; + curr_pucch->dai_c++; + curr_pucch->resource_indicator = 0;//4;//0; // in phytest with only 1 UE we are using just the 1st resource + // first pucch occasion in first UL or MIXED slot + first_ul_slot_tdd = scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots; + i = 0; + while (i<8 && found == 0) { // look if timing indicator is among allowed values + if (pdsch_to_harq_feedback[i]==(first_ul_slot_tdd+k)-(slotP % slots_per_tdd)) + found = 1; + if (found == 0) i++; + } + if (found == 1) { + // computing slot in which pucch is scheduled + curr_pucch->ul_slot = first_ul_slot_tdd + k + (slotP - (slotP % slots_per_tdd)); + curr_pucch->timing_indicator = i; // index in the list of timing indicators + *pucch_id = k; + return; + } + } + } + AssertFatal(1==0,"No Uplink slot available in accordance to allowed timing indicator\n"); +} + +>>>>>>> Added more logs and fixed assertion bool find_free_CCE(module_id_t module_id, sub_frame_t slot, diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index 2a7ea9b904..468e895fd9 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -308,6 +308,7 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, uint8_t diff_rsrp_idx = 0; uint8_t cri_ssbri_bitlen = UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.cri_ssbri_bitlen; + LOG_I(MAC,"csi_payload = %d, bitlen_ssbri = %d, nb_ssb_resource_set = %d,nb_ssb_resources = %d\n",payload_size, bitlen_ssbri, nb_ssb_resource_set,nb_ssb_resources); /*! As per the spec 38.212 and table: 6.3.1.1.2-12 in a single UCI sequence we can have multiple CSI_report * the number of CSI_report will depend on number of CSI resource sets that are configured in CSI-ResourceConfig RRC IE * From spec 38.331 from the IE CSI-ResourceConfig for SSB RSRP reporting we can configure only one resource set From 4c3c53d28822d95fd3871c24050c44d72e1147cd Mon Sep 17 00:00:00 2001 From: "r.karey" Date: Sat, 15 Aug 2020 13:50:17 +0530 Subject: [PATCH 109/231] receiving of CSI report --- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 53 ------------------- 1 file changed, 53 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 99d7de58ca..4ccbd7c8c6 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -1806,59 +1806,6 @@ void get_pdsch_to_harq_feedback(int Mod_idP, } } -<<<<<<< HEAD -======= -// function to update pucch scheduling parameters in UE list when a USS DL is scheduled -void nr_update_pucch_scheduling(int Mod_idP, - int UE_id, - frame_t frameP, - sub_frame_t slotP, - int slots_per_tdd, - int *pucch_id) { - - NR_ServingCellConfigCommon_t *scc = RC.nrmac[Mod_idP]->common_channels->ServingCellConfigCommon; - NR_UE_list_t *UE_list = &RC.nrmac[Mod_idP]->UE_list; - NR_sched_pucch *curr_pucch; - int first_ul_slot_tdd,k,i; - uint8_t pdsch_to_harq_feedback[8]; - int found = 0; - int nr_ulmix_slots = scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots; - if (scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols!=0) - nr_ulmix_slots++; - - // this is hardcoded for now as ue specific - NR_SearchSpace__searchSpaceType_PR ss_type = NR_SearchSpace__searchSpaceType_PR_ue_Specific; - get_pdsch_to_harq_feedback(Mod_idP,UE_id,ss_type,pdsch_to_harq_feedback); - - // for each possible ul or mixed slot - for (k=0; kUE_sched_ctrl[UE_id].sched_pucch[k]; - // if there is free room in current pucch structure - if (curr_pucch->dai_cframe = frameP; - curr_pucch->dai_c++; - curr_pucch->resource_indicator = 0;//4;//0; // in phytest with only 1 UE we are using just the 1st resource - // first pucch occasion in first UL or MIXED slot - first_ul_slot_tdd = scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots; - i = 0; - while (i<8 && found == 0) { // look if timing indicator is among allowed values - if (pdsch_to_harq_feedback[i]==(first_ul_slot_tdd+k)-(slotP % slots_per_tdd)) - found = 1; - if (found == 0) i++; - } - if (found == 1) { - // computing slot in which pucch is scheduled - curr_pucch->ul_slot = first_ul_slot_tdd + k + (slotP - (slotP % slots_per_tdd)); - curr_pucch->timing_indicator = i; // index in the list of timing indicators - *pucch_id = k; - return; - } - } - } - AssertFatal(1==0,"No Uplink slot available in accordance to allowed timing indicator\n"); -} - ->>>>>>> Added more logs and fixed assertion bool find_free_CCE(module_id_t module_id, sub_frame_t slot, From 03ea28df44fbcb427fcafa840892fab939d449bf Mon Sep 17 00:00:00 2001 From: "r.karey" Date: Wed, 19 Aug 2020 22:02:48 +0530 Subject: [PATCH 110/231] Merged rrc_gNB_reconfig for NR_CSI_reporting --- openair2/RRC/NR/rrc_gNB_reconfig.c | 1118 ++++++++++++++++++++++++++++ 1 file changed, 1118 insertions(+) diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index 4cb227b054..3317525fbc 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -142,6 +142,1124 @@ void fill_default_searchSpaceZero(NR_SearchSpace_t *ss0) { ss0->searchSpaceType->present = NR_SearchSpace__searchSpaceType_PR_common; } +void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellconfigcommon, + NR_CellGroupConfig_t *secondaryCellGroup, + int scg_id, + int servCellIndex, + int n_physical_antenna_ports, + int initial_csi_index) { + AssertFatal(servingcellconfigcommon!=NULL,"servingcellconfigcommon is null\n"); + AssertFatal(secondaryCellGroup!=NULL,"secondaryCellGroup is null\n"); + + if(servingcellconfigcommon->ssb_PositionsInBurst->present !=2) + AssertFatal(1==0,"Currenrly implemented only for medium size SSB bitmap\n"); + uint8_t bitmap = servingcellconfigcommon->ssb_PositionsInBurst->choice.mediumBitmap.buf[0]; + + memset(secondaryCellGroup,0,sizeof(NR_CellGroupConfig_t)); + secondaryCellGroup->cellGroupId = scg_id; + NR_RLC_BearerConfig_t *RLC_BearerConfig = calloc(1,sizeof(*RLC_BearerConfig)); + RLC_BearerConfig->logicalChannelIdentity = 4; + RLC_BearerConfig->servedRadioBearer = calloc(1,sizeof(*RLC_BearerConfig->servedRadioBearer)); + RLC_BearerConfig->servedRadioBearer->present = NR_RLC_BearerConfig__servedRadioBearer_PR_drb_Identity; + RLC_BearerConfig->servedRadioBearer->choice.drb_Identity=1; + RLC_BearerConfig->reestablishRLC=calloc(1,sizeof(*RLC_BearerConfig->reestablishRLC)); + *RLC_BearerConfig->reestablishRLC=NR_RLC_BearerConfig__reestablishRLC_true; + RLC_BearerConfig->rlc_Config=calloc(1,sizeof(*RLC_BearerConfig->rlc_Config)); + RLC_BearerConfig->rlc_Config->present = NR_RLC_Config_PR_am; + RLC_BearerConfig->rlc_Config->choice.am = calloc(1,sizeof(*RLC_BearerConfig->rlc_Config->choice.am)); + RLC_BearerConfig->rlc_Config->choice.am->ul_AM_RLC.sn_FieldLength = calloc(1,sizeof(*RLC_BearerConfig->rlc_Config->choice.am->ul_AM_RLC.sn_FieldLength)); + *RLC_BearerConfig->rlc_Config->choice.am->ul_AM_RLC.sn_FieldLength = NR_SN_FieldLengthAM_size18; + RLC_BearerConfig->rlc_Config->choice.am->ul_AM_RLC.t_PollRetransmit = NR_T_PollRetransmit_ms45; + RLC_BearerConfig->rlc_Config->choice.am->ul_AM_RLC.pollPDU = NR_PollPDU_p64; + RLC_BearerConfig->rlc_Config->choice.am->ul_AM_RLC.pollByte = NR_PollByte_kB500; + RLC_BearerConfig->rlc_Config->choice.am->ul_AM_RLC.maxRetxThreshold = NR_UL_AM_RLC__maxRetxThreshold_t32; + RLC_BearerConfig->rlc_Config->choice.am->dl_AM_RLC.sn_FieldLength = calloc(1,sizeof(*RLC_BearerConfig->rlc_Config->choice.am->dl_AM_RLC.sn_FieldLength)); + *RLC_BearerConfig->rlc_Config->choice.am->dl_AM_RLC.sn_FieldLength = NR_SN_FieldLengthAM_size18; + RLC_BearerConfig->rlc_Config->choice.am->dl_AM_RLC.t_Reassembly = NR_T_Reassembly_ms15; + RLC_BearerConfig->rlc_Config->choice.am->dl_AM_RLC.t_StatusProhibit = NR_T_StatusProhibit_ms15; + RLC_BearerConfig->mac_LogicalChannelConfig = calloc(1,sizeof(*RLC_BearerConfig->mac_LogicalChannelConfig)); + RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters = calloc(1,sizeof(*RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters)); + RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters->priority = 1; + RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters->prioritisedBitRate = NR_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; + RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters->bucketSizeDuration = NR_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; + RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters->allowedServingCells = NULL; + RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters->allowedSCS_List = NULL; + RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters->maxPUSCH_Duration = NULL; + RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters->configuredGrantType1Allowed = NULL; + RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters->logicalChannelGroup = calloc(1,sizeof(*RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters->logicalChannelGroup)); + *RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters->logicalChannelGroup = 1; + RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters->schedulingRequestID = NULL; + RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters->logicalChannelSR_Mask = false; + RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters->logicalChannelSR_DelayTimerApplied = false; + RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters->bitRateQueryProhibitTimer = NULL; + secondaryCellGroup->rlc_BearerToAddModList = calloc(1,sizeof(*secondaryCellGroup->rlc_BearerToAddModList)); + ASN_SEQUENCE_ADD(&secondaryCellGroup->rlc_BearerToAddModList->list, RLC_BearerConfig); + secondaryCellGroup->mac_CellGroupConfig=calloc(1,sizeof(*secondaryCellGroup->mac_CellGroupConfig)); + secondaryCellGroup->mac_CellGroupConfig->drx_Config = NULL; + secondaryCellGroup->mac_CellGroupConfig->schedulingRequestConfig = NULL; + secondaryCellGroup->mac_CellGroupConfig->bsr_Config=calloc(1,sizeof(*secondaryCellGroup->mac_CellGroupConfig->bsr_Config)); + secondaryCellGroup->mac_CellGroupConfig->bsr_Config->periodicBSR_Timer = NR_BSR_Config__periodicBSR_Timer_sf80; + secondaryCellGroup->mac_CellGroupConfig->bsr_Config->retxBSR_Timer = NR_BSR_Config__retxBSR_Timer_sf320; + secondaryCellGroup->mac_CellGroupConfig->tag_Config=calloc(1,sizeof(*secondaryCellGroup->mac_CellGroupConfig->tag_Config)); + secondaryCellGroup->mac_CellGroupConfig->tag_Config->tag_ToReleaseList = NULL; + secondaryCellGroup->mac_CellGroupConfig->tag_Config->tag_ToAddModList = calloc(1,sizeof(*secondaryCellGroup->mac_CellGroupConfig->tag_Config->tag_ToAddModList)); + struct NR_TAG *tag=calloc(1,sizeof(*tag)); + tag->tag_Id = 0; + tag->timeAlignmentTimer = NR_TimeAlignmentTimer_infinity; + ASN_SEQUENCE_ADD(&secondaryCellGroup->mac_CellGroupConfig->tag_Config->tag_ToAddModList->list,tag); + secondaryCellGroup->mac_CellGroupConfig->phr_Config = calloc(1,sizeof(*secondaryCellGroup->mac_CellGroupConfig->phr_Config)); + secondaryCellGroup->mac_CellGroupConfig->phr_Config->present = NR_SetupRelease_PHR_Config_PR_setup; + secondaryCellGroup->mac_CellGroupConfig->phr_Config->choice.setup = calloc(1,sizeof(*secondaryCellGroup->mac_CellGroupConfig->phr_Config->choice.setup)); + secondaryCellGroup->mac_CellGroupConfig->phr_Config->choice.setup->phr_PeriodicTimer = NR_PHR_Config__phr_PeriodicTimer_sf20; + secondaryCellGroup->mac_CellGroupConfig->phr_Config->choice.setup->phr_ProhibitTimer = NR_PHR_Config__phr_ProhibitTimer_sf0; + secondaryCellGroup->mac_CellGroupConfig->phr_Config->choice.setup->phr_Tx_PowerFactorChange = NR_PHR_Config__phr_Tx_PowerFactorChange_dB3; + secondaryCellGroup->mac_CellGroupConfig->phr_Config->choice.setup->multiplePHR=false; + secondaryCellGroup->mac_CellGroupConfig->phr_Config->choice.setup->dummy=false; + secondaryCellGroup->mac_CellGroupConfig->phr_Config->choice.setup->phr_Type2OtherCell = false; + secondaryCellGroup->mac_CellGroupConfig->phr_Config->choice.setup->phr_ModeOtherCG = NR_PHR_Config__phr_ModeOtherCG_real; + secondaryCellGroup->mac_CellGroupConfig->skipUplinkTxDynamic=false; + secondaryCellGroup->mac_CellGroupConfig->ext1 = NULL; + secondaryCellGroup->physicalCellGroupConfig = calloc(1,sizeof(*secondaryCellGroup->physicalCellGroupConfig)); + secondaryCellGroup->physicalCellGroupConfig->harq_ACK_SpatialBundlingPUCCH=NULL; + secondaryCellGroup->physicalCellGroupConfig->harq_ACK_SpatialBundlingPUSCH=NULL; + secondaryCellGroup->physicalCellGroupConfig->p_NR_FR1=calloc(1,sizeof(*secondaryCellGroup->physicalCellGroupConfig->p_NR_FR1)); + *secondaryCellGroup->physicalCellGroupConfig->p_NR_FR1=20; + secondaryCellGroup->physicalCellGroupConfig->pdsch_HARQ_ACK_Codebook=NR_PhysicalCellGroupConfig__pdsch_HARQ_ACK_Codebook_dynamic; + secondaryCellGroup->physicalCellGroupConfig->tpc_SRS_RNTI=NULL; + secondaryCellGroup->physicalCellGroupConfig->tpc_PUCCH_RNTI=NULL; + secondaryCellGroup->physicalCellGroupConfig->tpc_PUSCH_RNTI=NULL; + secondaryCellGroup->physicalCellGroupConfig->sp_CSI_RNTI=NULL; + secondaryCellGroup->physicalCellGroupConfig->cs_RNTI=NULL; + secondaryCellGroup->physicalCellGroupConfig->ext1=NULL; + secondaryCellGroup->spCellConfig = calloc(1,sizeof(*secondaryCellGroup->spCellConfig)); + secondaryCellGroup->spCellConfig->servCellIndex = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->servCellIndex)); + *secondaryCellGroup->spCellConfig->servCellIndex = servCellIndex; + secondaryCellGroup->spCellConfig->reconfigurationWithSync=calloc(1,sizeof(*secondaryCellGroup->spCellConfig->reconfigurationWithSync)); + secondaryCellGroup->spCellConfig->reconfigurationWithSync->spCellConfigCommon=servingcellconfigcommon; + secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity=(get_softmodem_params()->phy_test==1) ? 0x1234 : (taus()&0xffff); + secondaryCellGroup->spCellConfig->reconfigurationWithSync->t304=NR_ReconfigurationWithSync__t304_ms2000; + secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated = NULL; + secondaryCellGroup->spCellConfig->reconfigurationWithSync->ext1 = NULL; + /* contention free ra */ + secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated = calloc(1,sizeof(struct NR_ReconfigurationWithSync__rach_ConfigDedicated)); + secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->present= NR_ReconfigurationWithSync__rach_ConfigDedicated_PR_uplink; + secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink= calloc(1,sizeof(struct NR_RACH_ConfigDedicated)); + secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra= calloc(1,sizeof(struct NR_CFRA)); + secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->ra_Prioritization= NULL; + secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->occasions= calloc(1,sizeof(struct NR_CFRA__occasions)); + memcpy(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->occasions->rach_ConfigGeneric, + &servingcellconfigcommon->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric, sizeof(NR_RACH_ConfigGeneric_t)); + //secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->occasions->ssb_perRACH_Occasion= calloc(1,sizeof(long)); + //*secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->occasions->ssb_perRACH_Occasion = NR_CFRA__occasions__ssb_perRACH_Occasion_one; + secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->occasions->ssb_perRACH_Occasion= NULL; + secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.present = NR_CFRA__resources_PR_ssb; + secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb = calloc(1,sizeof(struct NR_CFRA__resources__ssb)); + secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ra_ssb_OccasionMaskIndex = 0; +//from NR_CSI_Reporting branch + struct NR_CFRA_SSB_Resource *ssbElem = calloc(1,sizeof(struct NR_CFRA_SSB_Resource)); + ssbElem->ssb = 0; + ssbElem->ra_PreambleIndex= 63; + ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem); + // + secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->ext1 = NULL; + secondaryCellGroup->spCellConfig->rlf_TimersAndConstants = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->rlf_TimersAndConstants)); + secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->present = NR_SetupRelease_RLF_TimersAndConstants_PR_setup; + secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup=calloc(1,sizeof(*secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup)); + secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup->t310 = NR_RLF_TimersAndConstants__t310_ms2000; + secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup->n310 = NR_RLF_TimersAndConstants__n310_n10; + secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup->n311 = NR_RLF_TimersAndConstants__n311_n1; + secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup->ext1 = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup->ext1)); + secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup->ext1->t311_v1530 = NR_RLF_TimersAndConstants__ext1__t311_v1530_ms30000; + secondaryCellGroup->spCellConfig->rlmInSyncOutOfSyncThreshold = NULL; + secondaryCellGroup->spCellConfig->spCellConfigDedicated = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated)); + secondaryCellGroup->spCellConfig->spCellConfigDedicated->tdd_UL_DL_ConfigurationDedicated = NULL; + secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP)); + secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdcch_Config=NULL; + secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config=calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config)); + secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->present = NR_SetupRelease_PDSCH_Config_PR_setup; + secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup = calloc(1, + sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup)); + secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dataScramblingIdentityPDSCH = NULL; + secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA = calloc(1, + sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA)); + secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->present= NR_SetupRelease_DMRS_DownlinkConfig_PR_setup; + secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup)); + + secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type=NULL; + secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->maxLength=NULL; + secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->scramblingID0=NULL; + secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->scramblingID1=NULL; + secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS=NULL; + + secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition)); + *secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0; + + + secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList=calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList)); +//NR_CSI_Reporting branch + int n_ssb = 0; + NR_TCI_State_t *tcic[8]; + for (int i=0;i<8;i++) { + if ((bitmap>>(7-i))&0x01){ + tcic[i]=calloc(1,sizeof(*tcic[i])); + tcic[i]->tci_StateId=n_ssb; + tcic[i]->qcl_Type1.cell=NULL; + tcic[i]->qcl_Type1.bwp_Id=calloc(1,sizeof(*tcic[i]->qcl_Type1.bwp_Id)); + *tcic[i]->qcl_Type1.bwp_Id=1; + tcic[i]->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_ssb; + tcic[i]->qcl_Type1.referenceSignal.choice.ssb = i; + tcic[i]->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeC; + ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcic[i]); + n_ssb++; + } + } + +// +#if 0 + + NR_TCI_State_t*tci0=calloc(1,sizeof(*tci0)); + tci0->tci_StateId=0; + tci0->qcl_Type1.cell=NULL; + tci0->qcl_Type1.bwp_Id=calloc(1,sizeof(*tci0->qcl_Type1.bwp_Id)); + *tci0->qcl_Type1.bwp_Id=1; + tci0->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs; + tci0->qcl_Type1.referenceSignal.choice.csi_rs = 2; + tci0->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA; + ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tci0); + + NR_TCI_State_t*tci1=calloc(1,sizeof(*tci1)); + tci1->tci_StateId=1; + tci1->qcl_Type1.cell=NULL; + tci1->qcl_Type1.bwp_Id=calloc(1,sizeof(*tci1->qcl_Type1.bwp_Id)); + *tci1->qcl_Type1.bwp_Id=1; + tci1->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs; + tci1->qcl_Type1.referenceSignal.choice.csi_rs = 6; + tci1->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA; + ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tci1); + + NR_TCI_State_t*tci2=calloc(1,sizeof(*tci2)); + tci2->tci_StateId=2; + tci2->qcl_Type1.cell=NULL; + tci2->qcl_Type1.bwp_Id=calloc(1,sizeof(*tci2->qcl_Type1.bwp_Id)); + *tci2->qcl_Type1.bwp_Id=1; + tci2->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs; + tci2->qcl_Type1.referenceSignal.choice.csi_rs = 10; + tci2->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA; + ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tci2); + + NR_TCI_State_t *tci3=calloc(1,sizeof(*tci3)); + tci3->tci_StateId=3; + tci3->qcl_Type1.cell=NULL; + tci3->qcl_Type1.bwp_Id=calloc(1,sizeof(*tci3->qcl_Type1.bwp_Id)); + *tci3->qcl_Type1.bwp_Id=1; + tci3->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs; + tci3->qcl_Type1.referenceSignal.choice.csi_rs = 14; + tci3->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA; + ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tci3); + + NR_TCI_State_t*tci4=calloc(1,sizeof(*tci4)); + tci4->tci_StateId=4; + tci4->qcl_Type1.cell=NULL; + tci4->qcl_Type1.bwp_Id=calloc(1,sizeof(*tci4->qcl_Type1.bwp_Id)); + *tci4->qcl_Type1.bwp_Id=1; + tci4->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs; + tci4->qcl_Type1.referenceSignal.choice.csi_rs = 18; + tci4->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA; + ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tci4); + + NR_TCI_State_t*tci5=calloc(1,sizeof(*tci5)); + tci5->tci_StateId=5; + tci5->qcl_Type1.cell=NULL; + tci5->qcl_Type1.bwp_Id=calloc(1,sizeof(*tci5->qcl_Type1.bwp_Id)); + *tci5->qcl_Type1.bwp_Id=1; + tci5->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs; + tci5->qcl_Type1.referenceSignal.choice.csi_rs = 22; + tci5->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA; + ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tci5); + + NR_TCI_State_t*tci6=calloc(1,sizeof(*tci6)); + tci6->tci_StateId=6; + tci6->qcl_Type1.cell=NULL; + tci6->qcl_Type1.bwp_Id=calloc(1,sizeof(*tci6->qcl_Type1.bwp_Id)); + *tci6->qcl_Type1.bwp_Id=1; + tci6->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs; + tci6->qcl_Type1.referenceSignal.choice.csi_rs = 26; + tci6->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA; + ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tci6); + + NR_TCI_State_t*tci7=calloc(1,sizeof(*tci7)); + tci7->tci_StateId=7; + tci7->qcl_Type1.cell=NULL; + tci7->qcl_Type1.bwp_Id=calloc(1,sizeof(*tci7->qcl_Type1.bwp_Id)); + *tci7->qcl_Type1.bwp_Id=1; + tci7->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs; + tci7->qcl_Type1.referenceSignal.choice.csi_rs = 30; + tci7->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA; + ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tci7); + +#endif + + secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToReleaseList=NULL; + secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->vrb_ToPRB_Interleaver=NULL; + secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->resourceAllocation=NR_PDSCH_Config__resourceAllocation_resourceAllocationType1; + secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->pdsch_TimeDomainAllocationList=NULL; + secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->pdsch_AggregationFactor=NULL; + secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->rateMatchPatternToAddModList=NULL; + secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->rateMatchPatternToReleaseList=NULL; + secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->rateMatchPatternGroup1=NULL; + secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->rateMatchPatternGroup2=NULL; + secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->rbg_Size=NR_PDSCH_Config__rbg_Size_config1; + secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->mcs_Table=NULL; + secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI)); + *secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI = NR_PDSCH_Config__maxNrofCodeWordsScheduledByDCI_n1; + secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->prb_BundlingType.present = NR_PDSCH_Config__prb_BundlingType_PR_staticBundling; + secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->prb_BundlingType.choice.staticBundling = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->prb_BundlingType.choice.staticBundling)); + secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->prb_BundlingType.choice.staticBundling->bundleSize = + calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->prb_BundlingType.choice.staticBundling->bundleSize)); + *secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->prb_BundlingType.choice.staticBundling->bundleSize = NR_PDSCH_Config__prb_BundlingType__staticBundling__bundleSize_wideband; + secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->zp_CSI_RS_ResourceToAddModList=NULL; + secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->zp_CSI_RS_ResourceToReleaseList=NULL; + secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->aperiodic_ZP_CSI_RS_ResourceSetsToAddModList=NULL; + secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->aperiodic_ZP_CSI_RS_ResourceSetsToReleaseList=NULL; + secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->sp_ZP_CSI_RS_ResourceSetsToAddModList=NULL; + secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->sp_ZP_CSI_RS_ResourceSetsToReleaseList=NULL; + secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->p_ZP_CSI_RS_ResourceSet=NULL; + secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->sps_Config = NULL; //calloc(1,sizeof(struct NR_SetupRelease_SPS_Config)); + + secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->radioLinkMonitoringConfig = NULL; +#if 0 + secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->radioLinkMonitoringConfig = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->radioLinkMonitoringConfig)); + secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->radioLinkMonitoringConfig->present = NR_SetupRelease_RadioLinkMonitoringConfig_PR_setup; + + secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->radioLinkMonitoringConfig->choice.setup = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->radioLinkMonitoringConfig->choice.setup)); + secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->radioLinkMonitoringConfig->choice.setup->failureDetectionResourcesToAddModList=NULL; + secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->radioLinkMonitoringConfig->choice.setup->failureDetectionResourcesToReleaseList=NULL; + secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->radioLinkMonitoringConfig->choice.setup->beamFailureInstanceMaxCount = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->radioLinkMonitoringConfig->choice.setup->beamFailureInstanceMaxCount)); + *secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->radioLinkMonitoringConfig->choice.setup->beamFailureInstanceMaxCount = NR_RadioLinkMonitoringConfig__beamFailureInstanceMaxCount_n3; + secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->radioLinkMonitoringConfig->choice.setup->beamFailureDetectionTimer = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->radioLinkMonitoringConfig->choice.setup->beamFailureDetectionTimer)); + *secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->radioLinkMonitoringConfig->choice.setup->beamFailureDetectionTimer = NR_RadioLinkMonitoringConfig__beamFailureDetectionTimer_pbfd2; +#endif + + secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToReleaseList= NULL; + secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList)); + + NR_BWP_Downlink_t *bwp=calloc(1,sizeof(*bwp)); + bwp->bwp_Id=1; + bwp->bwp_Common=calloc(1,sizeof(*bwp->bwp_Common)); + // copy common BWP size from initial BWP except for bandwdith + memcpy((void*)&bwp->bwp_Common->genericParameters, + &servingcellconfigcommon->downlinkConfigCommon->initialDownlinkBWP->genericParameters, + sizeof(bwp->bwp_Common->genericParameters)); + bwp->bwp_Common->genericParameters.locationAndBandwidth=PRBalloc_to_locationandbandwidth(servingcellconfigcommon->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth,0); + + + bwp->bwp_Common->pdcch_ConfigCommon=calloc(1,sizeof(*bwp->bwp_Common->pdcch_ConfigCommon)); + bwp->bwp_Common->pdcch_ConfigCommon->present = NR_SetupRelease_PDCCH_ConfigCommon_PR_setup; + bwp->bwp_Common->pdcch_ConfigCommon->choice.setup = calloc(1,sizeof(*bwp->bwp_Common->pdcch_ConfigCommon->choice.setup)); + bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->controlResourceSetZero=NULL; + bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonControlResourceSet=calloc(1,sizeof(*bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonControlResourceSet)); + + NR_ControlResourceSet_t *coreset = calloc(1,sizeof(*coreset)); + coreset->controlResourceSetId=1; + // frequencyDomainResources '11111111 11111111 00000000 00000000 00000000 00000'B, + coreset->frequencyDomainResources.buf = calloc(1,6); + coreset->frequencyDomainResources.buf[0] = 0xff; + coreset->frequencyDomainResources.buf[1] = 0xff; + coreset->frequencyDomainResources.buf[2] = 0; + coreset->frequencyDomainResources.buf[3] = 0; + coreset->frequencyDomainResources.buf[4] = 0; + coreset->frequencyDomainResources.buf[5] = 0; + coreset->frequencyDomainResources.size = 6; + coreset->frequencyDomainResources.bits_unused = 3; + coreset->duration=1; + coreset->cce_REG_MappingType.present = NR_ControlResourceSet__cce_REG_MappingType_PR_nonInterleaved; + coreset->precoderGranularity = NR_ControlResourceSet__precoderGranularity_sameAsREG_bundle; + + coreset->tci_StatesPDCCH_ToAddList=calloc(1,sizeof(*coreset->tci_StatesPDCCH_ToAddList)); + NR_TCI_StateId_t *tci[8]; + for (int i=0;i<8;i++) { + if ((bitmap>>(7-i))&0x01){//NR_CSI_Reporting + tci[i]=calloc(1,sizeof(*tci[i])); + *tci[i] = i; + ASN_SEQUENCE_ADD(&coreset->tci_StatesPDCCH_ToAddList->list,tci[i]); + } + } + coreset->tci_StatesPDCCH_ToReleaseList = NULL; + coreset->tci_PresentInDCI = NULL; + coreset->pdcch_DMRS_ScramblingID = NULL; + + bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonControlResourceSet = coreset; + + bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->searchSpaceZero=NULL; + bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList=NULL; + bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList=calloc(1,sizeof(*bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList)); + + NR_SearchSpace_t *ss=calloc(1,sizeof(*ss)); + ss->searchSpaceId = 1; + ss->controlResourceSetId=calloc(1,sizeof(*ss->controlResourceSetId)); + *ss->controlResourceSetId=1; + ss->monitoringSlotPeriodicityAndOffset = calloc(1,sizeof(*ss->monitoringSlotPeriodicityAndOffset)); + ss->monitoringSlotPeriodicityAndOffset->present = NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1; + ss->duration=NULL; + ss->monitoringSymbolsWithinSlot = calloc(1,sizeof(*ss->monitoringSymbolsWithinSlot)); + ss->monitoringSymbolsWithinSlot->buf = calloc(1,2); + // should be '1100 0000 0000 00'B (LSB first!), first two symols in slot, adjust if needed + ss->monitoringSymbolsWithinSlot->buf[1] = 0; + ss->monitoringSymbolsWithinSlot->buf[0] = (1<<7) | (1<<6); + ss->monitoringSymbolsWithinSlot->size = 2; + ss->monitoringSymbolsWithinSlot->bits_unused = 2; + ss->nrofCandidates = calloc(1,sizeof(*ss->nrofCandidates)); + ss->nrofCandidates->aggregationLevel1 = NR_SearchSpace__nrofCandidates__aggregationLevel1_n0; + ss->nrofCandidates->aggregationLevel2 = NR_SearchSpace__nrofCandidates__aggregationLevel2_n0; + ss->nrofCandidates->aggregationLevel4 = NR_SearchSpace__nrofCandidates__aggregationLevel4_n1; + ss->nrofCandidates->aggregationLevel8 = NR_SearchSpace__nrofCandidates__aggregationLevel8_n0; + ss->nrofCandidates->aggregationLevel16 = NR_SearchSpace__nrofCandidates__aggregationLevel16_n0; + ss->searchSpaceType = calloc(1,sizeof(*ss->searchSpaceType)); + ss->searchSpaceType->present = NR_SearchSpace__searchSpaceType_PR_common; + ss->searchSpaceType->choice.common=calloc(1,sizeof(*ss->searchSpaceType->choice.common)); + ss->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 = calloc(1,sizeof(*ss->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0)); + + ASN_SEQUENCE_ADD(&bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList->list,ss); + + + bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->searchSpaceSIB1=NULL; + bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->searchSpaceOtherSystemInformation=NULL; + bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->pagingSearchSpace=NULL; + bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->ra_SearchSpace=calloc(1,sizeof(*bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->ra_SearchSpace)); + *bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->ra_SearchSpace=1; + bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->ext1=NULL; + + bwp->bwp_Common->pdsch_ConfigCommon=calloc(1,sizeof(*bwp->bwp_Common->pdsch_ConfigCommon)); + bwp->bwp_Common->pdsch_ConfigCommon->present = NR_SetupRelease_PDSCH_ConfigCommon_PR_setup; + bwp->bwp_Common->pdsch_ConfigCommon->choice.setup = calloc(1,sizeof(*bwp->bwp_Common->pdsch_ConfigCommon->choice.setup)); + bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList = calloc(1,sizeof(*bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList)); + + // copy PDSCH TimeDomainResourceAllocation from InitialBWP + + NR_PDSCH_TimeDomainResourceAllocation_t *pdschi; + for (int i=0;idownlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.count;i++) { + pdschi= calloc(1,sizeof(*pdschi)); + AssertFatal(servingcellconfigcommon->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[i]->k0!=NULL,"element %d is null\n",i); + + pdschi->k0 = calloc(1,sizeof(*pdschi->k0)); + *pdschi->k0 = *servingcellconfigcommon->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[i]->k0; + pdschi->mappingType = servingcellconfigcommon->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[i]->mappingType; + pdschi->startSymbolAndLength = servingcellconfigcommon->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[i]->startSymbolAndLength; + ASN_SEQUENCE_ADD(&bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list,pdschi); + } + + bwp->bwp_Dedicated=calloc(1,sizeof(*bwp->bwp_Dedicated)); + + bwp->bwp_Dedicated->pdcch_Config=calloc(1,sizeof(*bwp->bwp_Dedicated->pdcch_Config)); + bwp->bwp_Dedicated->pdcch_Config->present = NR_SetupRelease_PDCCH_Config_PR_setup; + bwp->bwp_Dedicated->pdcch_Config->choice.setup = calloc(1,sizeof(*bwp->bwp_Dedicated->pdcch_Config->choice.setup)); + bwp->bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList = calloc(1,sizeof(*bwp->bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList)); + + ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList->list, + coreset); + + bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList = calloc(1,sizeof(*bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList)); + + NR_SearchSpace_t *ss2 = calloc(1,sizeof(*ss2)); + + ss2->searchSpaceId=2; + ss2->controlResourceSetId=calloc(1,sizeof(*ss2->controlResourceSetId)); + *ss2->controlResourceSetId=1; + ss2->monitoringSlotPeriodicityAndOffset=calloc(1,sizeof(*ss2->monitoringSlotPeriodicityAndOffset)); + ss2->monitoringSlotPeriodicityAndOffset->present = NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1; + ss2->monitoringSlotPeriodicityAndOffset->choice.sl1=(NULL_t)0; + ss2->duration=NULL; + ss2->monitoringSymbolsWithinSlot = calloc(1,sizeof(*ss2->monitoringSymbolsWithinSlot)); + ss2->monitoringSymbolsWithinSlot->buf = calloc(1,2); + ss2->monitoringSymbolsWithinSlot->size = 2; + ss2->monitoringSymbolsWithinSlot->bits_unused = 2; + ss2->monitoringSymbolsWithinSlot->buf[0]=0xc0; + ss2->monitoringSymbolsWithinSlot->buf[1]=0x0; + ss2->nrofCandidates=calloc(1,sizeof(*ss2->nrofCandidates)); + ss2->nrofCandidates->aggregationLevel1 = NR_SearchSpace__nrofCandidates__aggregationLevel1_n0; + ss2->nrofCandidates->aggregationLevel2 = NR_SearchSpace__nrofCandidates__aggregationLevel2_n0; + ss2->nrofCandidates->aggregationLevel4 = NR_SearchSpace__nrofCandidates__aggregationLevel4_n4; + ss2->nrofCandidates->aggregationLevel8 = NR_SearchSpace__nrofCandidates__aggregationLevel8_n0; + ss2->nrofCandidates->aggregationLevel16 = NR_SearchSpace__nrofCandidates__aggregationLevel16_n0; + ss2->searchSpaceType=calloc(1,sizeof(*ss2->searchSpaceType)); + ss2->searchSpaceType->present = NR_SearchSpace__searchSpaceType_PR_ue_Specific; + ss2->searchSpaceType->choice.ue_Specific = calloc(1,sizeof(*ss2->searchSpaceType->choice.ue_Specific)); + ss2->searchSpaceType->choice.ue_Specific->dci_Formats=NR_SearchSpace__searchSpaceType__ue_Specific__dci_Formats_formats0_1_And_1_1; + + ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list, + ss2); + + + bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToReleaseList = NULL; + + bwp->bwp_Dedicated->pdsch_Config = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config)); + + bwp->bwp_Dedicated->pdsch_Config->present = NR_SetupRelease_PDSCH_Config_PR_setup; + bwp->bwp_Dedicated->pdsch_Config->choice.setup = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup)); + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dataScramblingIdentityPDSCH = NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA)); + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->present= NR_SetupRelease_DMRS_DownlinkConfig_PR_setup; + + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup)); + + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->maxLength=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->scramblingID0=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->scramblingID1=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS=NULL; + + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition)); + *bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0; + +//NR_CSI_Reporting + //bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList=calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList)); +// +#if 0 + bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList=calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList)); + + NR_TCI_State_t*tcid0=calloc(1,sizeof(*tcid0)); + tcid0->tci_StateId=0; + tcid0->qcl_Type1.cell=NULL; + tcid0->qcl_Type1.bwp_Id=calloc(1,sizeof(*tcid0->qcl_Type1.bwp_Id)); + *tcid0->qcl_Type1.bwp_Id=1; + tcid0->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs; + tcid0->qcl_Type1.referenceSignal.choice.csi_rs = 2; + tcid0->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA; + ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcid0); + + NR_TCI_State_t*tcid1=calloc(1,sizeof(*tcid1)); + tcid1->tci_StateId=0; + tcid1->qcl_Type1.cell=NULL; + tcid1->qcl_Type1.bwp_Id=calloc(1,sizeof(*tcid1->qcl_Type1.bwp_Id)); + *tcid1->qcl_Type1.bwp_Id=1; + tcid1->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs; + tcid1->qcl_Type1.referenceSignal.choice.csi_rs = 6; + tcid1->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA; + ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcid1); + + NR_TCI_State_t*tcid2=calloc(1,sizeof(*tcid2)); + tcid2->tci_StateId=2; + tcid2->qcl_Type1.cell=NULL; + tcid2->qcl_Type1.bwp_Id=calloc(1,sizeof(*tcid2->qcl_Type1.bwp_Id)); + *tcid2->qcl_Type1.bwp_Id=1; + tcid2->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs; + tcid2->qcl_Type1.referenceSignal.choice.csi_rs = 10; + tcid2->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA; + ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcid2); + + NR_TCI_State_t*tcid3=calloc(1,sizeof(*tcid3)); + tcid3->tci_StateId=3; + tcid3->qcl_Type1.cell=NULL; + tcid3->qcl_Type1.bwp_Id=calloc(1,sizeof(*tcid3->qcl_Type1.bwp_Id)); + *tcid3->qcl_Type1.bwp_Id=1; + tcid3->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs; + tcid3->qcl_Type1.referenceSignal.choice.csi_rs = 14; + tcid3->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA; + ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcid3); + + NR_TCI_State_t*tcid4=calloc(1,sizeof(*tcid4)); + tcid4->tci_StateId=4; + tcid4->qcl_Type1.cell=NULL; + tcid4->qcl_Type1.bwp_Id=calloc(1,sizeof(*tcid4->qcl_Type1.bwp_Id)); + *tcid4->qcl_Type1.bwp_Id=1; + tcid4->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs; + tcid4->qcl_Type1.referenceSignal.choice.csi_rs = 18; + tcid4->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA; + ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcid4); + + NR_TCI_State_t*tcid5=calloc(1,sizeof(*tcid5)); + tcid5->tci_StateId=5; + tcid5->qcl_Type1.cell=NULL; + tcid5->qcl_Type1.bwp_Id=calloc(1,sizeof(*tcid5->qcl_Type1.bwp_Id)); + *tcid5->qcl_Type1.bwp_Id=1; + tcid5->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs; + tcid5->qcl_Type1.referenceSignal.choice.csi_rs = 22; + tcid5->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA; + ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcid5); + + NR_TCI_State_t*tcid6=calloc(1,sizeof(*tcid6)); + tcid6->tci_StateId=6; + tcid6->qcl_Type1.cell=NULL; + tcid6->qcl_Type1.bwp_Id=calloc(1,sizeof(*tcid6->qcl_Type1.bwp_Id)); + *tcid6->qcl_Type1.bwp_Id=1; + tcid6->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs; + tcid6->qcl_Type1.referenceSignal.choice.csi_rs = 26; + tcid6->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA; + ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcid6); + + NR_TCI_State_t*tcid7=calloc(1,sizeof(*tcid7)); + tcid7->tci_StateId=7; + tcid7->qcl_Type1.cell=NULL; + tcid7->qcl_Type1.bwp_Id=calloc(1,sizeof(*tcid7->qcl_Type1.bwp_Id)); + *tcid7->qcl_Type1.bwp_Id=1; + tcid7->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs; + tcid7->qcl_Type1.referenceSignal.choice.csi_rs = 30; + tcid7->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA; + ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcid7); +//NR_CSI_Reporting +#endif + + + n_ssb = 0; + NR_TCI_State_t *tcid[8]; + for (int i=0;i<8;i++) { + if ((bitmap>>(7-i))&0x01){ + tcid[i]=calloc(1,sizeof(*tcid[i])); + tcid[i]->tci_StateId=n_ssb; + tcid[i]->qcl_Type1.cell=NULL; + tcid[i]->qcl_Type1.bwp_Id=calloc(1,sizeof(*tcid[i]->qcl_Type1.bwp_Id)); + *tcid[i]->qcl_Type1.bwp_Id=1; + tcid[i]->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_ssb; + tcid[i]->qcl_Type1.referenceSignal.choice.ssb = i; + tcid[i]->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeC; + ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcid[i]); + n_ssb++; + } + } +// + + bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToReleaseList=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->vrb_ToPRB_Interleaver=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->resourceAllocation=NR_PDSCH_Config__resourceAllocation_resourceAllocationType1; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->pdsch_TimeDomainAllocationList=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->pdsch_AggregationFactor=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->rateMatchPatternToAddModList=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->rateMatchPatternToReleaseList=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->rateMatchPatternGroup1=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->rateMatchPatternGroup2=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->rbg_Size=NR_PDSCH_Config__rbg_Size_config1; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI)); + *bwp->bwp_Dedicated->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI = NR_PDSCH_Config__maxNrofCodeWordsScheduledByDCI_n1; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->prb_BundlingType.present = NR_PDSCH_Config__prb_BundlingType_PR_staticBundling; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->prb_BundlingType.choice.staticBundling = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->prb_BundlingType.choice.staticBundling)); + bwp->bwp_Dedicated->pdsch_Config->choice.setup->prb_BundlingType.choice.staticBundling->bundleSize = + calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->prb_BundlingType.choice.staticBundling->bundleSize)); + *bwp->bwp_Dedicated->pdsch_Config->choice.setup->prb_BundlingType.choice.staticBundling->bundleSize = NR_PDSCH_Config__prb_BundlingType__staticBundling__bundleSize_wideband; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->zp_CSI_RS_ResourceToAddModList=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->zp_CSI_RS_ResourceToReleaseList=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->aperiodic_ZP_CSI_RS_ResourceSetsToAddModList=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->aperiodic_ZP_CSI_RS_ResourceSetsToReleaseList=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->sp_ZP_CSI_RS_ResourceSetsToAddModList=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->sp_ZP_CSI_RS_ResourceSetsToReleaseList=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->p_ZP_CSI_RS_ResourceSet=NULL; + + bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToReleaseList=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->vrb_ToPRB_Interleaver=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->resourceAllocation=NR_PDSCH_Config__resourceAllocation_resourceAllocationType1; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->pdsch_TimeDomainAllocationList=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->pdsch_AggregationFactor=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->rateMatchPatternToAddModList=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->rateMatchPatternToReleaseList=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->rateMatchPatternGroup1=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->rateMatchPatternGroup2=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->rbg_Size=NR_PDSCH_Config__rbg_Size_config1; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI)); + *bwp->bwp_Dedicated->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI = NR_PDSCH_Config__maxNrofCodeWordsScheduledByDCI_n1; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->prb_BundlingType.present = NR_PDSCH_Config__prb_BundlingType_PR_staticBundling; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->prb_BundlingType.choice.staticBundling = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->prb_BundlingType.choice.staticBundling)); + bwp->bwp_Dedicated->pdsch_Config->choice.setup->prb_BundlingType.choice.staticBundling->bundleSize = + calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->prb_BundlingType.choice.staticBundling->bundleSize)); + *bwp->bwp_Dedicated->pdsch_Config->choice.setup->prb_BundlingType.choice.staticBundling->bundleSize = NR_PDSCH_Config__prb_BundlingType__staticBundling__bundleSize_wideband; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->zp_CSI_RS_ResourceToAddModList=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->zp_CSI_RS_ResourceToReleaseList=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->aperiodic_ZP_CSI_RS_ResourceSetsToAddModList=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->aperiodic_ZP_CSI_RS_ResourceSetsToReleaseList=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->sp_ZP_CSI_RS_ResourceSetsToAddModList=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->sp_ZP_CSI_RS_ResourceSetsToReleaseList=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->p_ZP_CSI_RS_ResourceSet=NULL; + bwp->bwp_Dedicated->sps_Config = NULL; //calloc(1,sizeof(struct NR_SetupRelease_SPS_Config)); + + bwp->bwp_Dedicated->radioLinkMonitoringConfig = NULL; +#if 0 + bwp->bwp_Dedicated->radioLinkMonitoringConfig = calloc(1,sizeof(*bwp->bwp_Dedicated->radioLinkMonitoringConfig)); + bwp->bwp_Dedicated->radioLinkMonitoringConfig->present = NR_SetupRelease_RadioLinkMonitoringConfig_PR_setup; + + bwp->bwp_Dedicated->radioLinkMonitoringConfig->choice.setup = calloc(1,sizeof(*bwp->bwp_Dedicated->radioLinkMonitoringConfig->choice.setup)); + bwp->bwp_Dedicated->radioLinkMonitoringConfig->choice.setup->failureDetectionResourcesToAddModList=NULL; + bwp->bwp_Dedicated->radioLinkMonitoringConfig->choice.setup->failureDetectionResourcesToReleaseList=NULL; + bwp->bwp_Dedicated->radioLinkMonitoringConfig->choice.setup->beamFailureInstanceMaxCount = calloc(1,sizeof(*bwp->bwp_Dedicated->radioLinkMonitoringConfig->choice.setup->beamFailureInstanceMaxCount)); + *bwp->bwp_Dedicated->radioLinkMonitoringConfig->choice.setup->beamFailureInstanceMaxCount = NR_RadioLinkMonitoringConfig__beamFailureInstanceMaxCount_n3; + bwp->bwp_Dedicated->radioLinkMonitoringConfig->choice.setup->beamFailureDetectionTimer = calloc(1,sizeof(*bwp->bwp_Dedicated->radioLinkMonitoringConfig->choice.setup->beamFailureDetectionTimer)); + *bwp->bwp_Dedicated->radioLinkMonitoringConfig->choice.setup->beamFailureDetectionTimer = NR_RadioLinkMonitoringConfig__beamFailureDetectionTimer_pbfd2; +#endif + + ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list,bwp); + + secondaryCellGroup->spCellConfig->spCellConfigDedicated->firstActiveDownlinkBWP_Id=calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->firstActiveDownlinkBWP_Id)); + + *secondaryCellGroup->spCellConfig->spCellConfigDedicated->firstActiveDownlinkBWP_Id=1; + secondaryCellGroup->spCellConfig->spCellConfigDedicated->bwp_InactivityTimer = NULL; + secondaryCellGroup->spCellConfig->spCellConfigDedicated->defaultDownlinkBWP_Id = NULL; + secondaryCellGroup->spCellConfig->spCellConfigDedicated->defaultDownlinkBWP_Id = calloc(1, sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->defaultDownlinkBWP_Id)); + *secondaryCellGroup->spCellConfig->spCellConfigDedicated->defaultDownlinkBWP_Id = 1; + secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig=calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig)); + + NR_BWP_UplinkDedicated_t *initialUplinkBWP = calloc(1,sizeof(*initialUplinkBWP)); + secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP = initialUplinkBWP; + initialUplinkBWP->pucch_Config = NULL; + initialUplinkBWP->pusch_Config = calloc(1,sizeof(*initialUplinkBWP->pusch_Config)); + initialUplinkBWP->pusch_Config->present = NR_SetupRelease_PUSCH_Config_PR_setup; + NR_PUSCH_Config_t *pusch_Config = calloc(1,sizeof(*pusch_Config)); + initialUplinkBWP->pusch_Config->choice.setup = pusch_Config; + pusch_Config->txConfig=calloc(1,sizeof(*pusch_Config->txConfig)); + *pusch_Config->txConfig= NR_PUSCH_Config__txConfig_codebook; + pusch_Config->dmrs_UplinkForPUSCH_MappingTypeA = NULL; + pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB = calloc(1,sizeof(*pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB)); + pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->present = NR_SetupRelease_DMRS_UplinkConfig_PR_setup; + pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup = calloc(1,sizeof(*pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup)); + NR_DMRS_UplinkConfig_t *NR_DMRS_UplinkConfig = pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup; + NR_DMRS_UplinkConfig->dmrs_Type = NULL; + NR_DMRS_UplinkConfig->dmrs_AdditionalPosition = calloc(1,sizeof(*NR_DMRS_UplinkConfig->dmrs_AdditionalPosition)); + *NR_DMRS_UplinkConfig->dmrs_AdditionalPosition = NR_DMRS_UplinkConfig__dmrs_AdditionalPosition_pos0; + NR_DMRS_UplinkConfig->phaseTrackingRS=NULL; + NR_DMRS_UplinkConfig->maxLength=NULL; + NR_DMRS_UplinkConfig->transformPrecodingDisabled = calloc(1,sizeof(*NR_DMRS_UplinkConfig->transformPrecodingDisabled)); + NR_DMRS_UplinkConfig->transformPrecodingDisabled->scramblingID0 = NULL; + NR_DMRS_UplinkConfig->transformPrecodingDisabled->scramblingID1 = NULL; + NR_DMRS_UplinkConfig->transformPrecodingEnabled = NULL; + pusch_Config->pusch_PowerControl = calloc(1,sizeof(*pusch_Config->pusch_PowerControl)); + pusch_Config->pusch_PowerControl->tpc_Accumulation = NULL; + pusch_Config->pusch_PowerControl->msg3_Alpha = calloc(1,sizeof(*pusch_Config->pusch_PowerControl->msg3_Alpha)); + *pusch_Config->pusch_PowerControl->msg3_Alpha = NR_Alpha_alpha1; + pusch_Config->pusch_PowerControl->p0_NominalWithoutGrant = NULL; + pusch_Config->pusch_PowerControl->p0_AlphaSets = calloc(1,sizeof(*pusch_Config->pusch_PowerControl->p0_AlphaSets)); + NR_P0_PUSCH_AlphaSet_t *aset = calloc(1,sizeof(*aset)); + aset->p0_PUSCH_AlphaSetId=0; + aset->p0=calloc(1,sizeof(*aset->p0)); + *aset->p0 = 0; + aset->alpha=calloc(1,sizeof(*aset->alpha)); + *aset->alpha=NR_Alpha_alpha1; + ASN_SEQUENCE_ADD(&pusch_Config->pusch_PowerControl->p0_AlphaSets->list,aset); + pusch_Config->pusch_PowerControl->pathlossReferenceRSToAddModList = NULL; + pusch_Config->pusch_PowerControl->pathlossReferenceRSToReleaseList = NULL; + pusch_Config->pusch_PowerControl->twoPUSCH_PC_AdjustmentStates = NULL; + pusch_Config->pusch_PowerControl->deltaMCS = NULL; + pusch_Config->pusch_PowerControl->sri_PUSCH_MappingToAddModList = NULL; + pusch_Config->pusch_PowerControl->sri_PUSCH_MappingToReleaseList = NULL; + pusch_Config->frequencyHopping=NULL; + pusch_Config->frequencyHoppingOffsetLists=NULL; + pusch_Config->resourceAllocation = NR_PUSCH_Config__resourceAllocation_resourceAllocationType1; + pusch_Config->pusch_TimeDomainAllocationList = NULL; + pusch_Config->pusch_AggregationFactor=NULL; + pusch_Config->mcs_Table=NULL; + pusch_Config->mcs_TableTransformPrecoder=NULL; + pusch_Config->transformPrecoder=calloc(1,sizeof(*pusch_Config->transformPrecoder)); + *pusch_Config->transformPrecoder = NR_PUSCH_Config__transformPrecoder_disabled; + pusch_Config->codebookSubset=calloc(1,sizeof(*pusch_Config->codebookSubset)); + *pusch_Config->codebookSubset = NR_PUSCH_Config__codebookSubset_nonCoherent; + pusch_Config->maxRank=calloc(1,sizeof(*pusch_Config->maxRank)); + *pusch_Config->maxRank= 1; + pusch_Config->rbg_Size=NULL; + pusch_Config->uci_OnPUSCH=NULL; + pusch_Config->tp_pi2BPSK=NULL; + + initialUplinkBWP->srs_Config = calloc(1,sizeof(*initialUplinkBWP->srs_Config)); + initialUplinkBWP->srs_Config->present = NR_SetupRelease_SRS_Config_PR_setup; + NR_SRS_Config_t *srs_Config = calloc(1,sizeof(*srs_Config)); + initialUplinkBWP->srs_Config->choice.setup=srs_Config; + srs_Config->srs_ResourceSetToReleaseList=NULL; + srs_Config->srs_ResourceSetToAddModList=calloc(1,sizeof(*srs_Config->srs_ResourceSetToAddModList)); + NR_SRS_ResourceSet_t *srs_resset0=calloc(1,sizeof(*srs_resset0)); + srs_resset0->srs_ResourceSetId = 0; + srs_resset0->srs_ResourceIdList=calloc(1,sizeof(*srs_resset0->srs_ResourceIdList)); + NR_SRS_ResourceId_t *srs_resset0_id=calloc(1,sizeof(*srs_resset0_id)); + *srs_resset0_id=0; + ASN_SEQUENCE_ADD(&srs_resset0->srs_ResourceIdList->list,srs_resset0_id); + srs_Config->srs_ResourceToReleaseList=NULL; + srs_resset0->resourceType.present = NR_SRS_ResourceSet__resourceType_PR_aperiodic; + srs_resset0->resourceType.choice.aperiodic = calloc(1,sizeof(*srs_resset0->resourceType.choice.aperiodic)); + srs_resset0->resourceType.choice.aperiodic->aperiodicSRS_ResourceTrigger=1; + srs_resset0->resourceType.choice.aperiodic->csi_RS=NULL; + srs_resset0->resourceType.choice.aperiodic->slotOffset= calloc(1,sizeof(*srs_resset0->resourceType.choice.aperiodic->slotOffset)); + *srs_resset0->resourceType.choice.aperiodic->slotOffset=2; + srs_resset0->resourceType.choice.aperiodic->ext1=NULL; + srs_resset0->usage=NR_SRS_ResourceSet__usage_codebook; + srs_resset0->alpha = calloc(1,sizeof(*srs_resset0->alpha)); + *srs_resset0->alpha = NR_Alpha_alpha1; + srs_resset0->p0=calloc(1,sizeof(*srs_resset0->p0)); + *srs_resset0->p0=-80; + srs_resset0->pathlossReferenceRS=NULL; + srs_resset0->srs_PowerControlAdjustmentStates=NULL; + ASN_SEQUENCE_ADD(&srs_Config->srs_ResourceSetToAddModList->list,srs_resset0); + srs_Config->srs_ResourceToReleaseList=NULL; + srs_Config->srs_ResourceToAddModList=calloc(1,sizeof(*srs_Config->srs_ResourceToAddModList)); + NR_SRS_Resource_t *srs_res0=calloc(1,sizeof(*srs_res0)); + srs_res0->srs_ResourceId=0; + srs_res0->nrofSRS_Ports=NR_SRS_Resource__nrofSRS_Ports_port1; + srs_res0->ptrs_PortIndex=NULL; + srs_res0->transmissionComb.present=NR_SRS_Resource__transmissionComb_PR_n2; + srs_res0->transmissionComb.choice.n2=calloc(1,sizeof(*srs_res0->transmissionComb.choice.n2)); + srs_res0->transmissionComb.choice.n2->combOffset_n2=0; + srs_res0->transmissionComb.choice.n2->cyclicShift_n2=0; + srs_res0->resourceMapping.startPosition=2; + srs_res0->resourceMapping.nrofSymbols=NR_SRS_Resource__resourceMapping__nrofSymbols_n1; + srs_res0->resourceMapping.repetitionFactor=NR_SRS_Resource__resourceMapping__repetitionFactor_n1; + srs_res0->freqDomainPosition=0; + srs_res0->freqDomainShift=0; + srs_res0->freqHopping.c_SRS = 0; + srs_res0->freqHopping.b_SRS=0; + srs_res0->freqHopping.b_hop=0; + srs_res0->groupOrSequenceHopping=NR_SRS_Resource__groupOrSequenceHopping_neither; + srs_res0->resourceType.present= NR_SRS_Resource__resourceType_PR_aperiodic; + srs_res0->resourceType.choice.aperiodic=calloc(1,sizeof(*srs_res0->resourceType.choice.aperiodic)); + srs_res0->sequenceId=40; + srs_res0->spatialRelationInfo=calloc(1,sizeof(*srs_res0->spatialRelationInfo)); + srs_res0->spatialRelationInfo->servingCellId=NULL; + srs_res0->spatialRelationInfo->referenceSignal.present=NR_SRS_SpatialRelationInfo__referenceSignal_PR_csi_RS_Index; + srs_res0->spatialRelationInfo->referenceSignal.choice.csi_RS_Index=0; + ASN_SEQUENCE_ADD(&srs_Config->srs_ResourceToAddModList->list,srs_res0); + + secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToReleaseList = NULL; + secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList)); + NR_BWP_Uplink_t *ubwp = calloc(1,sizeof(*ubwp)); + ubwp->bwp_Id=1; + ubwp->bwp_Common = calloc(1,sizeof(*ubwp->bwp_Common)); + // copy bwp_Common from Initial UL BWP except for bandwidth + memcpy((void*)&ubwp->bwp_Common->genericParameters, + (void*)&servingcellconfigcommon->uplinkConfigCommon->initialUplinkBWP->genericParameters, + sizeof(servingcellconfigcommon->uplinkConfigCommon->initialUplinkBWP->genericParameters)); + ubwp->bwp_Common->genericParameters.locationAndBandwidth=PRBalloc_to_locationandbandwidth(servingcellconfigcommon->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth,0); + + ubwp->bwp_Common->rach_ConfigCommon = servingcellconfigcommon->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon; + ubwp->bwp_Common->pusch_ConfigCommon = servingcellconfigcommon->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon; + ubwp->bwp_Common->pucch_ConfigCommon = servingcellconfigcommon->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon; + + ubwp->bwp_Dedicated = calloc(1,sizeof(*ubwp->bwp_Dedicated)); + ubwp->bwp_Dedicated->pucch_Config = calloc(1,sizeof(*ubwp->bwp_Dedicated->pucch_Config)); + ubwp->bwp_Dedicated->pucch_Config->present = NR_SetupRelease_PUCCH_Config_PR_setup; + NR_PUCCH_Config_t *pucch_Config = calloc(1,sizeof(*pucch_Config)); + ubwp->bwp_Dedicated->pucch_Config->choice.setup=pucch_Config; + pucch_Config->resourceSetToAddModList = calloc(1,sizeof(*pucch_Config->resourceSetToAddModList)); + pucch_Config->resourceSetToReleaseList = NULL; + NR_PUCCH_ResourceSet_t *pucchresset0=calloc(1,sizeof(*pucchresset0)); + NR_PUCCH_ResourceSet_t *pucchresset1=calloc(1,sizeof(*pucchresset1)); + pucchresset0->pucch_ResourceSetId = 0; + NR_PUCCH_ResourceId_t *pucchresset0id0=calloc(1,sizeof(*pucchresset0id0)); + NR_PUCCH_ResourceId_t *pucchresset0id1=calloc(1,sizeof(*pucchresset0id1)); + *pucchresset0id0=1; + ASN_SEQUENCE_ADD(&pucchresset0->resourceList.list,pucchresset0id0); + *pucchresset0id1=2; + ASN_SEQUENCE_ADD(&pucchresset0->resourceList.list,pucchresset0id1); + pucchresset0->maxPayloadMinus1=NULL; + + ASN_SEQUENCE_ADD(&pucch_Config->resourceSetToAddModList->list,pucchresset0); + + pucchresset1->pucch_ResourceSetId = 1; + NR_PUCCH_ResourceId_t *pucchresset1id0=calloc(1,sizeof(*pucchresset1id0)); + NR_PUCCH_ResourceId_t *pucchresset1id1=calloc(1,sizeof(*pucchresset1id1)); + *pucchresset1id0=3; + ASN_SEQUENCE_ADD(&pucchresset1->resourceList.list,pucchresset1id0); + *pucchresset1id1=4; + ASN_SEQUENCE_ADD(&pucchresset1->resourceList.list,pucchresset1id1); + pucchresset1->maxPayloadMinus1=NULL; + ASN_SEQUENCE_ADD(&pucch_Config->resourceSetToAddModList->list,pucchresset1); + + pucch_Config->resourceToAddModList = calloc(1,sizeof(*pucch_Config->resourceToAddModList)); + pucch_Config->resourceToReleaseList = NULL; + NR_PUCCH_Resource_t *pucchres0=calloc(1,sizeof(*pucchres0)); + NR_PUCCH_Resource_t *pucchres1=calloc(1,sizeof(*pucchres1)); + NR_PUCCH_Resource_t *pucchres2=calloc(1,sizeof(*pucchres2)); + NR_PUCCH_Resource_t *pucchres3=calloc(1,sizeof(*pucchres3)); + pucchres0->pucch_ResourceId=1; + pucchres0->startingPRB=48; + pucchres0->intraSlotFrequencyHopping=NULL; + pucchres0->secondHopPRB=NULL; + pucchres0->format.present= NR_PUCCH_Resource__format_PR_format0; + pucchres0->format.choice.format0=calloc(1,sizeof(*pucchres0->format.choice.format0)); + pucchres0->format.choice.format0->initialCyclicShift=0; + pucchres0->format.choice.format0->nrofSymbols=1; + pucchres0->format.choice.format0->startingSymbolIndex=13; + ASN_SEQUENCE_ADD(&pucch_Config->resourceToAddModList->list,pucchres0); + + pucchres1->pucch_ResourceId=2; + pucchres1->startingPRB=48; + pucchres1->intraSlotFrequencyHopping=NULL; + pucchres1->secondHopPRB=NULL; + pucchres1->format.present= NR_PUCCH_Resource__format_PR_format0; + pucchres1->format.choice.format0=calloc(1,sizeof(*pucchres1->format.choice.format0)); + pucchres1->format.choice.format0->initialCyclicShift=0; + pucchres1->format.choice.format0->nrofSymbols=1; + pucchres1->format.choice.format0->startingSymbolIndex=12; + ASN_SEQUENCE_ADD(&pucch_Config->resourceToAddModList->list,pucchres1); + + pucchres2->pucch_ResourceId=3; + pucchres2->startingPRB=40; + pucchres2->intraSlotFrequencyHopping=NULL; + pucchres2->secondHopPRB=NULL; + pucchres2->format.present= NR_PUCCH_Resource__format_PR_format2; + pucchres2->format.choice.format2=calloc(1,sizeof(*pucchres2->format.choice.format2)); + pucchres2->format.choice.format2->nrofPRBs=16; + pucchres2->format.choice.format2->nrofSymbols=1; + pucchres2->format.choice.format2->startingSymbolIndex=13; + ASN_SEQUENCE_ADD(&pucch_Config->resourceToAddModList->list,pucchres2); + + pucchres3->pucch_ResourceId=4; + pucchres3->startingPRB=40; + pucchres3->intraSlotFrequencyHopping=NULL; + pucchres3->secondHopPRB=NULL; + pucchres3->format.present= NR_PUCCH_Resource__format_PR_format2; + pucchres3->format.choice.format2=calloc(1,sizeof(*pucchres3->format.choice.format2)); + pucchres3->format.choice.format2->nrofPRBs=16; + pucchres3->format.choice.format2->nrofSymbols=1; + pucchres3->format.choice.format2->startingSymbolIndex=12; + ASN_SEQUENCE_ADD(&pucch_Config->resourceToAddModList->list,pucchres3); + + pucch_Config->format2=calloc(1,sizeof(*pucch_Config->format2)); + pucch_Config->format2->present=NR_SetupRelease_PUCCH_FormatConfig_PR_setup; + NR_PUCCH_FormatConfig_t *pucchfmt2 = calloc(1,sizeof(*pucchfmt2)); + pucch_Config->format2->choice.setup = pucchfmt2; + pucchfmt2->interslotFrequencyHopping=NULL; + pucchfmt2->additionalDMRS=NULL; + pucchfmt2->maxCodeRate=calloc(1,sizeof(*pucchfmt2->maxCodeRate)); + *pucchfmt2->maxCodeRate=NR_PUCCH_MaxCodeRate_zeroDot15; + pucchfmt2->nrofSlots=NULL; + pucchfmt2->pi2BPSK=NULL; + pucchfmt2->simultaneousHARQ_ACK_CSI=NULL; + pucch_Config->schedulingRequestResourceToAddModList=NULL; + pucch_Config->schedulingRequestResourceToReleaseList=NULL; + pucch_Config->multi_CSI_PUCCH_ResourceList=NULL; + pucch_Config->dl_DataToUL_ACK = calloc(1,sizeof(*pucch_Config->dl_DataToUL_ACK)); + long *delay[8]; + for (int i=0;i<8;i++) { + delay[i] = calloc(1,sizeof(*delay[i])); + *delay[i] = (i<6) ? (i+2) : 0; + ASN_SEQUENCE_ADD(&pucch_Config->dl_DataToUL_ACK->list,delay[i]); + } + pucch_Config->spatialRelationInfoToAddModList = calloc(1,sizeof(*pucch_Config->spatialRelationInfoToAddModList)); + NR_PUCCH_SpatialRelationInfo_t *pucchspatial = calloc(1,sizeof(*pucchspatial)); + pucchspatial->pucch_SpatialRelationInfoId = 1; + pucchspatial->servingCellId = NULL; + pucchspatial->referenceSignal.present = NR_PUCCH_SpatialRelationInfo__referenceSignal_PR_csi_RS_Index; + pucchspatial->referenceSignal.choice.csi_RS_Index = 0; + pucchspatial->pucch_PathlossReferenceRS_Id = 0; + pucchspatial->p0_PUCCH_Id = 1; + pucchspatial->closedLoopIndex = NR_PUCCH_SpatialRelationInfo__closedLoopIndex_i0; + ASN_SEQUENCE_ADD(&pucch_Config->spatialRelationInfoToAddModList->list,pucchspatial); + pucch_Config->spatialRelationInfoToReleaseList=NULL; + pucch_Config->pucch_PowerControl=calloc(1,sizeof(*pucch_Config->pucch_PowerControl)); + pucch_Config->pucch_PowerControl->deltaF_PUCCH_f0 = calloc(1,sizeof(*pucch_Config->pucch_PowerControl->deltaF_PUCCH_f0)); + *pucch_Config->pucch_PowerControl->deltaF_PUCCH_f0 = 0; + pucch_Config->pucch_PowerControl->deltaF_PUCCH_f1 = calloc(1,sizeof(*pucch_Config->pucch_PowerControl->deltaF_PUCCH_f1)); + *pucch_Config->pucch_PowerControl->deltaF_PUCCH_f1 = 0; + pucch_Config->pucch_PowerControl->deltaF_PUCCH_f2 = calloc(1,sizeof(*pucch_Config->pucch_PowerControl->deltaF_PUCCH_f2)); + *pucch_Config->pucch_PowerControl->deltaF_PUCCH_f2 = 0; + pucch_Config->pucch_PowerControl->deltaF_PUCCH_f3 = calloc(1,sizeof(*pucch_Config->pucch_PowerControl->deltaF_PUCCH_f3)); + *pucch_Config->pucch_PowerControl->deltaF_PUCCH_f3 = 0; + pucch_Config->pucch_PowerControl->deltaF_PUCCH_f4 = calloc(1,sizeof(*pucch_Config->pucch_PowerControl->deltaF_PUCCH_f4)); + *pucch_Config->pucch_PowerControl->deltaF_PUCCH_f4 = 0; + pucch_Config->pucch_PowerControl->p0_Set = calloc(1,sizeof(*pucch_Config->pucch_PowerControl->p0_Set)); + NR_P0_PUCCH_t *p00 = calloc(1,sizeof(*p00)); + p00->p0_PUCCH_Id=1; + p00->p0_PUCCH_Value = 0; + ASN_SEQUENCE_ADD(&pucch_Config->pucch_PowerControl->p0_Set->list,p00); + pucch_Config->pucch_PowerControl->pathlossReferenceRSs = NULL; + + // copy pusch_Config from dedicated initialBWP + ubwp->bwp_Dedicated->pusch_Config = calloc(1,sizeof(*ubwp->bwp_Dedicated->pusch_Config)); + ubwp->bwp_Dedicated->pusch_Config->present = NR_SetupRelease_PUSCH_Config_PR_setup; + ubwp->bwp_Dedicated->pusch_Config->choice.setup = pusch_Config; + + ubwp->bwp_Dedicated->configuredGrantConfig = NULL; + ubwp->bwp_Dedicated->srs_Config = calloc(1,sizeof(*ubwp->bwp_Dedicated->srs_Config)); + ubwp->bwp_Dedicated->srs_Config->present = NR_SetupRelease_SRS_Config_PR_setup; + ubwp->bwp_Dedicated->srs_Config->choice.setup = srs_Config; + + ubwp->bwp_Dedicated->beamFailureRecoveryConfig = NULL; + + ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list,ubwp); + + secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->firstActiveUplinkBWP_Id = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->firstActiveUplinkBWP_Id)); + *secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->firstActiveUplinkBWP_Id = 1; + + secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig)); + NR_PUSCH_ServingCellConfig_t *pusch_scc = calloc(1,sizeof(*pusch_scc)); + secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig->present = NR_SetupRelease_PUSCH_ServingCellConfig_PR_setup; + secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup = pusch_scc; + pusch_scc->codeBlockGroupTransmission = NULL; + pusch_scc->rateMatching = NULL; + pusch_scc->xOverhead = NULL; + pusch_scc->ext1=calloc(1,sizeof(*pusch_scc->ext1)); + pusch_scc->ext1->maxMIMO_Layers = calloc(1,sizeof(*pusch_scc->ext1->maxMIMO_Layers)); + *pusch_scc->ext1->maxMIMO_Layers = 1; + pusch_scc->ext1->processingType2Enabled = NULL; + + secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->carrierSwitching = NULL; + + secondaryCellGroup->spCellConfig->spCellConfigDedicated->supplementaryUplink=NULL; + + secondaryCellGroup->spCellConfig->spCellConfigDedicated->pdcch_ServingCellConfig=NULL; + + secondaryCellGroup->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig=calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig)); + NR_PDSCH_ServingCellConfig_t *pdsch_servingcellconfig = calloc(1,sizeof(*pdsch_servingcellconfig)); + secondaryCellGroup->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->present = NR_SetupRelease_PDSCH_ServingCellConfig_PR_setup; + secondaryCellGroup->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup = pdsch_servingcellconfig; + pdsch_servingcellconfig->codeBlockGroupTransmission = NULL; + pdsch_servingcellconfig->xOverhead = NULL; + pdsch_servingcellconfig->nrofHARQ_ProcessesForPDSCH = NULL; + pdsch_servingcellconfig->pucch_Cell= NULL; + pdsch_servingcellconfig->ext1=calloc(1,sizeof(*pdsch_servingcellconfig->ext1)); + pdsch_servingcellconfig->ext1->maxMIMO_Layers = calloc(1,sizeof(*pdsch_servingcellconfig->ext1->maxMIMO_Layers)); + *pdsch_servingcellconfig->ext1->maxMIMO_Layers = 2; + pdsch_servingcellconfig->ext1->processingType2Enabled = NULL; + + secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig=NULL; + secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig=calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig)); + secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->present = NR_SetupRelease_CSI_MeasConfig_PR_setup; + + NR_CSI_MeasConfig_t *csi_MeasConfig = calloc(1,sizeof(*csi_MeasConfig)); + secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup = csi_MeasConfig; + + csi_MeasConfig->csi_IM_ResourceToAddModList = NULL; + csi_MeasConfig->csi_IM_ResourceToReleaseList = NULL; + csi_MeasConfig->csi_IM_ResourceSetToAddModList = NULL; + csi_MeasConfig->csi_IM_ResourceSetToReleaseList = NULL; + csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList = NULL; + csi_MeasConfig->nzp_CSI_RS_ResourceSetToReleaseList = NULL; + csi_MeasConfig->nzp_CSI_RS_ResourceToAddModList = NULL; + + csi_MeasConfig->csi_SSB_ResourceSetToAddModList = calloc(1,sizeof(*csi_MeasConfig->csi_SSB_ResourceSetToAddModList)); + csi_MeasConfig->csi_SSB_ResourceSetToReleaseList = NULL; + + NR_CSI_SSB_ResourceSet_t *ssbresset0 = calloc(1,sizeof(*ssbresset0)); + ssbresset0->csi_SSB_ResourceSetId=0; + if ((bitmap>>7)&0x01){ + NR_SSB_Index_t *ssbresset00=calloc(1,sizeof(*ssbresset00)); + *ssbresset00=0; + ASN_SEQUENCE_ADD(&ssbresset0->csi_SSB_ResourceList.list,ssbresset00); + } + if ((bitmap>>6)&0x01) { + NR_SSB_Index_t *ssbresset01=calloc(1,sizeof(*ssbresset01)); + *ssbresset01=1; + ASN_SEQUENCE_ADD(&ssbresset0->csi_SSB_ResourceList.list,ssbresset01); + } + if ((bitmap>>5)&0x01) { + NR_SSB_Index_t *ssbresset02=calloc(1,sizeof(*ssbresset02)); + *ssbresset02=2; + ASN_SEQUENCE_ADD(&ssbresset0->csi_SSB_ResourceList.list,ssbresset02); + } + if ((bitmap>>4)&0x01) { + NR_SSB_Index_t *ssbresset03=calloc(1,sizeof(*ssbresset03)); + *ssbresset03=3; + ASN_SEQUENCE_ADD(&ssbresset0->csi_SSB_ResourceList.list,ssbresset03); + } + if ((bitmap>>3)&0x01) { + NR_SSB_Index_t *ssbresset04=calloc(1,sizeof(*ssbresset04)); + *ssbresset04=4; + ASN_SEQUENCE_ADD(&ssbresset0->csi_SSB_ResourceList.list,ssbresset04); + } + if ((bitmap>>2)&0x01) { + NR_SSB_Index_t *ssbresset05=calloc(1,sizeof(*ssbresset05)); + *ssbresset05=5; + ASN_SEQUENCE_ADD(&ssbresset0->csi_SSB_ResourceList.list,ssbresset05); + } + if ((bitmap>>1)&0x01) { + NR_SSB_Index_t *ssbresset06=calloc(1,sizeof(*ssbresset06)); + *ssbresset06=6; + ASN_SEQUENCE_ADD(&ssbresset0->csi_SSB_ResourceList.list,ssbresset06); + } + if ((bitmap)&0x01) { + NR_SSB_Index_t *ssbresset07=calloc(1,sizeof(*ssbresset07)); + *ssbresset07=7; + ASN_SEQUENCE_ADD(&ssbresset0->csi_SSB_ResourceList.list,ssbresset07); + } + ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list,ssbresset0); + + csi_MeasConfig->csi_ResourceConfigToAddModList = calloc(1,sizeof(*csi_MeasConfig->csi_ResourceConfigToAddModList)); + csi_MeasConfig->csi_ResourceConfigToReleaseList = NULL; + NR_CSI_ResourceConfig_t *csires0 = calloc(1,sizeof(*csires0)); + csires0->csi_ResourceConfigId=0; + csires0->csi_RS_ResourceSetList.present = NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB; + csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB = calloc(1,sizeof(*csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB)); + csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList = calloc(1,sizeof(*csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList)); + //For verification of CSI measurement adding the ssb resource set list + csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList = calloc(1,sizeof(*csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList));//NULL; + NR_NZP_CSI_RS_ResourceSetId_t *csires00 = calloc(1,sizeof(*csires00)); + //For verification of CSI measurment for SSB + NR_CSI_SSB_ResourceSetId_t *ssbres00 = calloc(1,sizeof(*ssbres00)); + *csires00 = 0; + *ssbres00 = 0; + ASN_SEQUENCE_ADD(&csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list,csires00); + ASN_SEQUENCE_ADD(&csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list,ssbres00); + csires0->bwp_Id = 1; + csires0->resourceType = NR_CSI_ResourceConfig__resourceType_periodic; + ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_ResourceConfigToAddModList->list,csires0); + + csi_MeasConfig->csi_ReportConfigToAddModList = calloc(1,sizeof(*csi_MeasConfig->csi_ReportConfigToAddModList)); + csi_MeasConfig->csi_ReportConfigToReleaseList = NULL; + NR_CSI_ReportConfig_t *csirep1 = calloc(1,sizeof(*csirep1)); + csirep1->reportConfigId=0; + csirep1->carrier=NULL; + csirep1->resourcesForChannelMeasurement=0;//initial_csi_index; Just for verification + csirep1->csi_IM_ResourcesForInterference=NULL; + csirep1->nzp_CSI_RS_ResourcesForInterference=NULL; + csirep1->reportConfigType.present = NR_CSI_ReportConfig__reportConfigType_PR_periodic; + csirep1->reportConfigType.choice.periodic = calloc(1,sizeof(*csirep1->reportConfigType.choice.periodic)); + csirep1->reportConfigType.choice.periodic->reportSlotConfig.present=NR_CSI_ReportPeriodicityAndOffset_PR_slots320; + csirep1->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320 = 49; + NR_PUCCH_CSI_Resource_t *pucchcsires1 = calloc(1,sizeof(*pucchcsires1)); + pucchcsires1->uplinkBandwidthPartId=1; + pucchcsires1->pucch_Resource=3;//4;//12; + ASN_SEQUENCE_ADD(&csirep1->reportConfigType.choice.periodic->pucch_CSI_ResourceList.list,pucchcsires1); + csirep1->reportQuantity.present = NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP; + csirep1->reportQuantity.choice.ssb_Index_RSRP=(NULL_t)0; + csirep1->reportFreqConfiguration = calloc(1,sizeof(*csirep1->reportFreqConfiguration)); + csirep1->reportFreqConfiguration->cqi_FormatIndicator=NR_CSI_ReportConfig__reportFreqConfiguration__cqi_FormatIndicator_widebandCQI; + csirep1->reportFreqConfiguration->pmi_FormatIndicator=NR_CSI_ReportConfig__reportFreqConfiguration__pmi_FormatIndicator_widebandPMI; + csirep1->reportFreqConfiguration->csi_ReportingBand=NULL; + csirep1->timeRestrictionForChannelMeasurements= NR_CSI_ReportConfig__timeRestrictionForChannelMeasurements_configured; + csirep1->timeRestrictionForInterferenceMeasurements=NR_CSI_ReportConfig__timeRestrictionForInterferenceMeasurements_configured; + csirep1->codebookConfig=calloc(1,sizeof(*csirep1->codebookConfig)); + csirep1->codebookConfig->codebookType.present = NR_CodebookConfig__codebookType_PR_type1; + csirep1->codebookConfig->codebookType.choice.type1 = calloc(1,sizeof(*csirep1->codebookConfig->codebookType.choice.type1)); + csirep1->codebookConfig->codebookType.choice.type1->subType.present=NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel; + csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel=calloc(1,sizeof(*csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel)); + csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.present=NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_two; + csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.two= + calloc(1,sizeof(*csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.two)); + csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.two->twoTX_CodebookSubsetRestriction.size=1; + csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.two->twoTX_CodebookSubsetRestriction.bits_unused=2; + csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.two->twoTX_CodebookSubsetRestriction.buf=malloc(1); + csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.two->twoTX_CodebookSubsetRestriction.buf[0]=0xfc; + //'111111'B + + + csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.size=1; + csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.bits_unused=0; + csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.buf=malloc(1); + csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.buf[0]=0xc0; //'00000011'B + + csirep1->codebookConfig->codebookType.choice.type1->codebookMode=1; + csirep1->dummy = NULL; + csirep1->groupBasedBeamReporting.present = NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled; + csirep1->groupBasedBeamReporting.choice.disabled=calloc(1,sizeof(*csirep1->groupBasedBeamReporting.choice.disabled)); + csirep1->groupBasedBeamReporting.choice.disabled->nrofReportedRS = calloc(1,sizeof(*csirep1->groupBasedBeamReporting.choice.disabled->nrofReportedRS)); + //*csirep1->groupBasedBeamReporting.choice.disabled->nrofReportedRS=NR_CSI_ReportConfig__groupBasedBeamReporting__disabled__nrofReportedRS_n2; + *csirep1->groupBasedBeamReporting.choice.disabled->nrofReportedRS=NR_CSI_ReportConfig__groupBasedBeamReporting__disabled__nrofReportedRS_n1; + // this corresponds to: + //if the UE is configured with the higher layer parameter groupBasedBeamReporting set to 'disabled', the UE is not required to update measurements for more than 64 CSI-RS and/or SSB resources, and the UE shall report in a single report nrofReportedRS (higher layer configured) different CRI or SSBRI for each report setting. + + csirep1->cqi_Table = calloc(1,sizeof(*csirep1->cqi_Table)); + *csirep1->cqi_Table = NR_CSI_ReportConfig__cqi_Table_table1; + csirep1->subbandSize = NR_CSI_ReportConfig__subbandSize_value1; + csirep1->non_PMI_PortIndication = NULL; + csirep1->ext1 = NULL; + + ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_ReportConfigToAddModList->list,csirep1); + + + secondaryCellGroup->spCellConfig->spCellConfigDedicated->sCellDeactivationTimer=NULL; + secondaryCellGroup->spCellConfig->spCellConfigDedicated->crossCarrierSchedulingConfig=NULL; + secondaryCellGroup->spCellConfig->spCellConfigDedicated->tag_Id=0; + secondaryCellGroup->spCellConfig->spCellConfigDedicated->dummy=NULL; + secondaryCellGroup->spCellConfig->spCellConfigDedicated->pathlossReferenceLinking=NULL; + secondaryCellGroup->spCellConfig->spCellConfigDedicated->servingCellMO=NULL; + +} + +#if 0 void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellconfigcommon, NR_CellGroupConfig_t *secondaryCellGroup, int scg_id, From 8c488bfdf8e2d3cbc92108f313d3d7cc38e3cabf Mon Sep 17 00:00:00 2001 From: "r.karey" Date: Wed, 2 Sep 2020 15:22:10 +0530 Subject: [PATCH 111/231] UCI bitlength calculation --- .../LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 16 ++++++++++++++ openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 22 +++++++++++++++++-- openair2/NR_PHY_INTERFACE/NR_IF_Module.c | 4 ++-- openair2/RRC/NR/rrc_gNB_reconfig.c | 1 - 4 files changed, 38 insertions(+), 5 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index 629b4dc7b0..a52b35450b 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -369,6 +369,7 @@ void handle_nr_uci_pucch_2_3_4(module_id_t mod_id, sub_frame_t slot, const nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_234) { + NR_CSI_MeasConfig_t *csi_MeasConfig = RC.nrmac[Mod_idP]->UE_list.secondaryCellGroup[UE_id]->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup; int UE_id = find_nr_UE_id(mod_id, uci_234->rnti); if (UE_id < 0) { LOG_E(MAC, "%s(): unknown RNTI %04x in PUCCH UCI\n", __func__, uci_234->rnti); @@ -413,6 +414,21 @@ void handle_nr_uci_pucch_2_3_4(module_id_t mod_id, handle_dl_harq(mod_id, UE_id, pid, uci_234->harq.harq_crc != 1 && acknack); } } + if ((uci_234->pduBitmap >> 1) & 0x01) { + int bwp_id =1; + NR_BWP_Uplink_t *ubwp=RC.nrmac[Mod_idP]->UE_list.secondaryCellGroup[UE_id]->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[bwp_id-1]; + NR_SubcarrierSpacing_t scs=ubwp->bwp_Common->genericParameters.subcarrierSpacing; + LOG_I(PHY,"SFN/SF:%d%d scs %ld \n", + UL_info->frame,UL_info->slot, + scs); + //API to parse the csi report and store it into sched_ctrl + extract_pucch_csi_report (csi_MeasConfig, uci_pdu, sched_ctrl,UL_info->frame, UL_info->slot, scs, UE_id, Mod_idP); + } + + if (uci_pdu -> pduBitmap & 0x08) { + ///Handle CSI Report 2 + } + } diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index c01cbfebc9..dae2469327 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -389,12 +389,14 @@ struct CRI_RI_LI_PMI_CQI { uint8_t pmi_x2; uint8_t cqi; }; + typedef struct CRI_SSB_RSRP { uint8_t nr_ssbri_cri; uint8_t CRI_SSBRI[MAX_NR_OF_REPORTED_RS]; uint8_t RSRP; uint8_t diff_RSRP[MAX_NR_OF_REPORTED_RS - 1]; } CRI_SSB_RSRP_t; + struct CSI_Report { NR_CSI_Report_Config_PR present; union Config_CSI_Report { @@ -409,6 +411,23 @@ typedef struct NR_UE_sr { bool ul_SR [MAX_SR_BITLEN]; } NR_UE_sr_t; +typedef struct { + uint8_t nb_ssbri_cri; + uint8_t cri_ssbri_bitlen; + uint8_t rsrp_bitlen; + uint8_t diff_rsrp_bitlen; +}CRI_SSBRI_RSRP_bitlen_t; + +#define MAX_CSI_RESOURCE_SET_IN_CSI_RESOURCE_CONFIG 16 +typedef struct nr_csi_report { + NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type; + long periodicity; + NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR CSI_Resource_type; + uint8_t nb_of_nzp_csi_report; + uint8_t nb_of_csi_ssb_report; + CRI_SSBRI_RSRP_bitlen_t CSI_report_bitlen[MAX_CSI_RESOURCE_SET_IN_CSI_RESOURCE_CONFIG]; +} nr_csi_report_t; + /*! As per the spec 38.212 and table: 6.3.1.1.2-12 in a single UCI sequence we can have multiple CSI_report the number of CSI_report will depend on number of CSI resource sets that are configured in CSI-ResourceConfig RRC IE From spec 38.331 from the IE CSI-ResourceConfig for SSB RSRP reporting we can configure only one resource set @@ -605,8 +624,7 @@ typedef struct { uint8_t tpc1; uint16_t ul_rssi; uint8_t current_harq_pid; - struct CSI_Report CSI_report[MAX_MOBILES_PER_GNB][MAX_CSI_RESOURCE_SET_IN_CSI_RESOURCE_CONFIG]; - NR_UE_sr_t sr_req; + struct CSI_Report CSI_report[MAX_CSI_RESOURCE_SET_IN_CSI_RESOURCE_CONFIG]; /// information about every HARQ process NR_UE_harq_t harq_processes[NR_MAX_NB_HARQ_PROCESSES]; /// HARQ processes that are free diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index 468e895fd9..ec4a7d0b73 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -90,7 +90,7 @@ void handle_nr_rach(NR_UL_IND_t *UL_info) { return -1; } - +#if 0 //!TODO : smae function can be written to handle csi_resources uint8_t get_ssb_resources (NR_CSI_MeasConfig_t *csi_MeasConfig, NR_CSI_ResourceConfigId_t csi_ResourceConfigId, @@ -308,7 +308,7 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, uint8_t diff_rsrp_idx = 0; uint8_t cri_ssbri_bitlen = UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.cri_ssbri_bitlen; - LOG_I(MAC,"csi_payload = %d, bitlen_ssbri = %d, nb_ssb_resource_set = %d,nb_ssb_resources = %d\n",payload_size, bitlen_ssbri, nb_ssb_resource_set,nb_ssb_resources); + LOG_I(MAC,"csi_payload = %d, bitlen_ssbri = %d, nb_ssb_resource_set = %d\n",payload_size, bitlen_ssbri, nb_ssb_resource_set); /*! As per the spec 38.212 and table: 6.3.1.1.2-12 in a single UCI sequence we can have multiple CSI_report * the number of CSI_report will depend on number of CSI resource sets that are configured in CSI-ResourceConfig RRC IE * From spec 38.331 from the IE CSI-ResourceConfig for SSB RSRP reporting we can configure only one resource set diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index 3317525fbc..a235729663 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -1236,7 +1236,6 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco csirep1->groupBasedBeamReporting.present = NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled; csirep1->groupBasedBeamReporting.choice.disabled=calloc(1,sizeof(*csirep1->groupBasedBeamReporting.choice.disabled)); csirep1->groupBasedBeamReporting.choice.disabled->nrofReportedRS = calloc(1,sizeof(*csirep1->groupBasedBeamReporting.choice.disabled->nrofReportedRS)); - //*csirep1->groupBasedBeamReporting.choice.disabled->nrofReportedRS=NR_CSI_ReportConfig__groupBasedBeamReporting__disabled__nrofReportedRS_n2; *csirep1->groupBasedBeamReporting.choice.disabled->nrofReportedRS=NR_CSI_ReportConfig__groupBasedBeamReporting__disabled__nrofReportedRS_n1; // this corresponds to: //if the UE is configured with the higher layer parameter groupBasedBeamReporting set to 'disabled', the UE is not required to update measurements for more than 64 CSI-RS and/or SSB resources, and the UE shall report in a single report nrofReportedRS (higher layer configured) different CRI or SSBRI for each report setting. From 83cff971298cbcd6379d6c9fd80b3af5eb7777ce Mon Sep 17 00:00:00 2001 From: "r.karey" Date: Mon, 7 Sep 2020 22:48:37 +0530 Subject: [PATCH 112/231] Changed periodicity calculation according to CSI_Reporting branch --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 7 +++---- openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 1 + 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index a52b35450b..f9b0d2a349 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -415,13 +415,12 @@ void handle_nr_uci_pucch_2_3_4(module_id_t mod_id, } } if ((uci_234->pduBitmap >> 1) & 0x01) { - int bwp_id =1; - NR_BWP_Uplink_t *ubwp=RC.nrmac[Mod_idP]->UE_list.secondaryCellGroup[UE_id]->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[bwp_id-1]; - NR_SubcarrierSpacing_t scs=ubwp->bwp_Common->genericParameters.subcarrierSpacing; + + NR_SubcarrierSpacing_t scs=*(RC.nrmac[Mod_idP]->common_channels->ServingCellConfigCommon->ssbSubcarrierSpacing); LOG_I(PHY,"SFN/SF:%d%d scs %ld \n", UL_info->frame,UL_info->slot, scs); - //API to parse the csi report and store it into sched_ctrl + //API to parse the csi report and store it into sched_ctrl extract_pucch_csi_report (csi_MeasConfig, uci_pdu, sched_ctrl,UL_info->frame, UL_info->slot, scs, UE_id, Mod_idP); } diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index dae2469327..f47f2d8444 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -422,6 +422,7 @@ typedef struct { typedef struct nr_csi_report { NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type; long periodicity; + uint16_t offset; NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR CSI_Resource_type; uint8_t nb_of_nzp_csi_report; uint8_t nb_of_csi_ssb_report; From 5d5d4a1099b1c93e43f42a08746ab50889fc903b Mon Sep 17 00:00:00 2001 From: "r.karey" Date: Wed, 16 Sep 2020 13:36:52 +0530 Subject: [PATCH 113/231] Bit length calculation for CRI-RSRP --- openair2/LAYER2/NR_MAC_gNB/config.c | 1 + 1 file changed, 1 insertion(+) diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 778402d34a..8370a0774d 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -336,6 +336,7 @@ void update_csi_bitlen (NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_list_t *UE_li NR_CSI_ReportPeriodicityAndOffset_PR p_and_o; NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type; NR_CSI_ResourceConfigId_t csi_ResourceConfigId; + struct NR_CSI_ResourceConfig__csi_RS_ResourceSetList__nzp_CSI_RS_SSB * nzp_CSI_RS_SSB = NULL; for (csi_report_id=0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++){ csi_ResourceConfigId=csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->resourcesForChannelMeasurement; From 8c9ec48457827d2a1c365c54f044ee669e3bf25a Mon Sep 17 00:00:00 2001 From: "r.karey" Date: Wed, 7 Oct 2020 11:00:30 +0530 Subject: [PATCH 114/231] CSI-RS reporting bitlength calculation for type1 single panel two CSI-RS ports --- openair2/LAYER2/NR_MAC_gNB/config.c | 1 - openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 22 ++++++++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 8370a0774d..778402d34a 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -336,7 +336,6 @@ void update_csi_bitlen (NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_list_t *UE_li NR_CSI_ReportPeriodicityAndOffset_PR p_and_o; NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type; NR_CSI_ResourceConfigId_t csi_ResourceConfigId; - struct NR_CSI_ResourceConfig__csi_RS_ResourceSetList__nzp_CSI_RS_SSB * nzp_CSI_RS_SSB = NULL; for (csi_report_id=0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++){ csi_ResourceConfigId=csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->resourcesForChannelMeasurement; diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index f47f2d8444..29ef5f8cfa 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -416,17 +416,27 @@ typedef struct { uint8_t cri_ssbri_bitlen; uint8_t rsrp_bitlen; uint8_t diff_rsrp_bitlen; -}CRI_SSBRI_RSRP_bitlen_t; +}L1_RSRP_bitlen_t; + +typedef struct{ + uint8_t cri_bitlen; + uint8_t ri_bitlen; + uint8_t li_bitlen; + uint8_t pmi_x1_bitlen; + uint8_t pmi_x2_bitlen; + uint8_t cqi_bitlen; +} CSI_Meas_bitlen_t; -#define MAX_CSI_RESOURCE_SET_IN_CSI_RESOURCE_CONFIG 16 typedef struct nr_csi_report { NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type; long periodicity; uint16_t offset; - NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR CSI_Resource_type; - uint8_t nb_of_nzp_csi_report; + long ** SSB_Index_list; + long ** CSI_Index_list; +// uint8_t nb_of_nzp_csi_report; uint8_t nb_of_csi_ssb_report; - CRI_SSBRI_RSRP_bitlen_t CSI_report_bitlen[MAX_CSI_RESOURCE_SET_IN_CSI_RESOURCE_CONFIG]; + L1_RSRP_bitlen_t CSI_report_bitlen; + CSI_Meas_bitlen_t csi_meas_bitlen; } nr_csi_report_t; /*! As per the spec 38.212 and table: 6.3.1.1.2-12 in a single UCI sequence we can have multiple CSI_report @@ -625,7 +635,7 @@ typedef struct { uint8_t tpc1; uint16_t ul_rssi; uint8_t current_harq_pid; - struct CSI_Report CSI_report[MAX_CSI_RESOURCE_SET_IN_CSI_RESOURCE_CONFIG]; + struct CSI_Report CSI_report[MAX_CSI_REPORTS]; /// information about every HARQ process NR_UE_harq_t harq_processes[NR_MAX_NB_HARQ_PROCESSES]; /// HARQ processes that are free From dc204e333c6c4fe320f70d37b1eb4b007d4dd142 Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Fri, 9 Oct 2020 15:26:15 +0200 Subject: [PATCH 115/231] remove log --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c | 1 - 1 file changed, 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 4ccbd7c8c6..9de04a4ffd 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -728,7 +728,6 @@ void nr_configure_pucch(nfapi_nr_pucch_pdu_t* pucch_pdu, } else N2 = N3; } - LOG_I(MAC, "UCI resource id = %ld\n", *resource_id); } AssertFatal(resource_id!=NULL,"Couldn-t find any matching PUCCH resource in the PUCCH resource sets"); From 207c0bd4a48f2b1a933b910a01581e178f97fc25 Mon Sep 17 00:00:00 2001 From: "r.karey" Date: Fri, 16 Oct 2020 18:21:12 +0530 Subject: [PATCH 116/231] Fixed the calculation of received csi payload size at MAC --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c | 1 - 1 file changed, 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 9de04a4ffd..845be51f58 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -766,7 +766,6 @@ void nr_configure_pucch(nfapi_nr_pucch_pdu_t* pucch_pdu, pucch_pdu->sr_flag = O_sr; break; case NR_PUCCH_Resource__format_PR_format2 : - LOG_I(MAC,"UCI format2 is being scheduled\n"); pucch_pdu->format_type = 2; pucch_pdu->nr_of_symbols = pucchres->format.choice.format2->nrofSymbols; pucch_pdu->start_symbol_index = pucchres->format.choice.format2->startingSymbolIndex; From 656d2abc7cfe86037f8191864500e38bb1ccfbc0 Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Mon, 2 Nov 2020 11:09:35 +0100 Subject: [PATCH 117/231] Remove PRACH logging nr_mac_common.c --- openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index 5d1b08bcf6..963692e41b 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -1396,19 +1396,17 @@ int get_nr_prach_info_from_index(uint8_t index, if (table_6_3_3_2_3_prachConfig_Index[index][1] != -1) format2 = (uint8_t) table_6_3_3_2_3_prachConfig_Index[index][1]; *format = ((uint8_t) table_6_3_3_2_3_prachConfig_Index[index][0]) | (format2<<8); - LOG_D(MAC,"Frame %d slot %d: Getting PRACH info from index %d (col 6 %lu) absoluteFrequencyPointA %u mu %u frame_type %u start_symbol %u N_t_slot %u N_dur %u N_RA_slot %u RA_sfn_index %u \n", - frame, - slot, - index, - table_6_3_3_2_3_prachConfig_Index[index][6], - pointa, - mu, - unpaired, - *start_symbol, - *N_t_slot, - *N_dur, - *N_RA_slot, - *RA_sfn_index); + LOG_D(MAC,"Frame %d slot %d: Getting PRACH info from index %d (col 6 %lu) absoluteFrequencyPointA %u mu %u frame_type %u start_symbol %u N_t_slot %u N_dur %u N_RA_slot %u RA_sfn_index %u \n", frame, + slot, + index, table_6_3_3_2_3_prachConfig_Index[index][6], + pointa, + mu, + unpaired, + *start_symbol, + *N_t_slot, + *N_dur, + *N_RA_slot, + *RA_sfn_index); } return 1; } From f344f69d1c7edcac03723472c1c7fd8310a06e42 Mon Sep 17 00:00:00 2001 From: Rangaswami Date: Mon, 10 Aug 2020 22:15:09 +0530 Subject: [PATCH 118/231] Initial commits for TCI and CSI reporting changes --- openair2/NR_PHY_INTERFACE/NR_IF_Module.c | 1 + 1 file changed, 1 insertion(+) diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index ec4a7d0b73..9d38f369d8 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -431,6 +431,7 @@ void handle_nr_uci(NR_UL_IND_t *UL_info) handle_nr_uci_pucch_0_1(mod_id, frame, slot, uci_pdu); break; } + case NFAPI_NR_UCI_FORMAT_2_3_4_PDU_TYPE: { const nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_pdu = &uci_list[i].pucch_pdu_format_2_3_4; handle_nr_uci_pucch_2_3_4(mod_id, frame, slot, uci_pdu); From 1dfec690f5b2c02e9d7c8e9bf963b35fd4776030 Mon Sep 17 00:00:00 2001 From: Rangaswami Date: Mon, 10 Aug 2020 22:15:09 +0530 Subject: [PATCH 119/231] Initial commits for TCI and CSI reporting changes --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index f9b0d2a349..f08ff4fbde 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -361,6 +361,9 @@ void handle_nr_uci_pucch_0_1(module_id_t mod_id, DevAssert(harq->is_waiting); handle_dl_harq(mod_id, UE_id, pid, harq_value == 1 && harq_confidence == 0); } + + if (((uci_01->pduBitmap >> 1) & 0x01)) { + nr_rx_acknack(NULL,uci_01,NULL,UL_info,sched_ctrl,stats); } } From 6a1a0e82579a4f34c7d21309e1d71fa761bf8c62 Mon Sep 17 00:00:00 2001 From: "vr.devendra" Date: Thu, 13 Aug 2020 12:07:53 +0530 Subject: [PATCH 120/231] updated TCI handling apis --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index 1161e79a31..8f45baeb02 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -441,7 +441,6 @@ void tci_handling(module_id_t Mod_idP, int UE_id, int CC_id, NR_UE_sched_ctrl_t }//tci_presentInDCI }//is-triggering_beam_switch }//tci handling - void clear_nr_nfapi_information(gNB_MAC_INST *gNB, int CC_idP, frame_t frameP, @@ -646,7 +645,6 @@ void schedule_nr_SRS(module_id_t module_idP, frame_t frameP, sub_frame_t subfram } */ - bool is_xlsch_in_slot(uint64_t bitmap, sub_frame_t slot) { return (bitmap >> slot) & 0x01; } From 802f69a57467f8b7f5b88041a22303bd73cc665b Mon Sep 17 00:00:00 2001 From: "r.karey" Date: Sat, 15 Aug 2020 11:48:49 +0530 Subject: [PATCH 121/231] Added more logs and fixed assertion --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c | 2 ++ openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 1 + 2 files changed, 3 insertions(+) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 845be51f58..4ccbd7c8c6 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -728,6 +728,7 @@ void nr_configure_pucch(nfapi_nr_pucch_pdu_t* pucch_pdu, } else N2 = N3; } + LOG_I(MAC, "UCI resource id = %ld\n", *resource_id); } AssertFatal(resource_id!=NULL,"Couldn-t find any matching PUCCH resource in the PUCCH resource sets"); @@ -766,6 +767,7 @@ void nr_configure_pucch(nfapi_nr_pucch_pdu_t* pucch_pdu, pucch_pdu->sr_flag = O_sr; break; case NR_PUCCH_Resource__format_PR_format2 : + LOG_I(MAC,"UCI format2 is being scheduled\n"); pucch_pdu->format_type = 2; pucch_pdu->nr_of_symbols = pucchres->format.choice.format2->nrofSymbols; pucch_pdu->start_symbol_index = pucchres->format.choice.format2->startingSymbolIndex; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index f08ff4fbde..31c72c1691 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -416,6 +416,7 @@ void handle_nr_uci_pucch_2_3_4(module_id_t mod_id, DevAssert(harq->is_waiting); handle_dl_harq(mod_id, UE_id, pid, uci_234->harq.harq_crc != 1 && acknack); } + nr_rx_acknack(NULL,NULL,uci_234,UL_info,sched_ctrl,stats); } if ((uci_234->pduBitmap >> 1) & 0x01) { From 3fa6b36ac34663be7bfdd56d59cfcf518483bb7b Mon Sep 17 00:00:00 2001 From: "r.karey" Date: Wed, 2 Sep 2020 15:22:10 +0530 Subject: [PATCH 122/231] UCI bitlength calculation --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 1 + openair2/NR_PHY_INTERFACE/NR_IF_Module.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index 8f45baeb02..dcf433b0a8 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -441,6 +441,7 @@ void tci_handling(module_id_t Mod_idP, int UE_id, int CC_id, NR_UE_sched_ctrl_t }//tci_presentInDCI }//is-triggering_beam_switch }//tci handling + void clear_nr_nfapi_information(gNB_MAC_INST *gNB, int CC_idP, frame_t frameP, diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index 9d38f369d8..630e15409b 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -274,7 +274,8 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_sched_ctrl_t *sched_ctrl, frame_t frame, slot_t slot, - NR_SubcarrierSpacing_t scs + NR_SubcarrierSpacing_t scs, int UE_id, + module_id_t Mod_idP ) { /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ uint8_t idx = 0; From befcb33d1b958b1cf105f1501401b7ab98b210bd Mon Sep 17 00:00:00 2001 From: "r.karey" Date: Mon, 7 Sep 2020 09:08:22 +0530 Subject: [PATCH 123/231] Modified bitlen calculation for ssbri --- openair2/LAYER2/NR_MAC_gNB/config.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 778402d34a..c2d645f797 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -428,10 +428,21 @@ void update_csi_bitlen (NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_list_t *UE_li if (csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_ResourceSetId == *(csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.array[0])) { ///For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 for spec 38.212 - nb_ssb_resources= csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_RS_Resources.list.count; - UE_list->csi_report_template[UE_id][csi_report_id].CSI_Index_list = csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_RS_Resources.list.array; - UE_list->csi_report_template[UE_id][csi_report_id].SSB_Index_list = NULL; - } + nb_ssb_resources= csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceList.list.count; + if (nb_ssb_resources) + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen =ceil(log2 (nb_ssb_resources)); + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].rsrp_bitlen = 7; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen =4; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP + else + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen =0; + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].rsrp_bitlen = 0; + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen =0; + + + LOG_I (MAC, "UCI: CSI_bit len : ssbri %d, rsrp: %d, diff_rsrp: %d", + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen, + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].rsrp_bitlen, + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen); break ; } } From 778dec66340941a0e787537f4b38398d7d25a5f7 Mon Sep 17 00:00:00 2001 From: "r.karey" Date: Mon, 7 Sep 2020 22:48:37 +0530 Subject: [PATCH 124/231] Changed periodicity calculation according to CSI_Reporting branch --- openair2/LAYER2/NR_MAC_gNB/config.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index c2d645f797..4378826fd5 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -334,7 +334,6 @@ void update_csi_bitlen (NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_list_t *UE_li uint8_t csi_ssb_idx =0; uint16_t period, offset; NR_CSI_ReportPeriodicityAndOffset_PR p_and_o; - NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type; NR_CSI_ResourceConfigId_t csi_ResourceConfigId; for (csi_report_id=0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++){ @@ -429,14 +428,16 @@ void update_csi_bitlen (NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_list_t *UE_li *(csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.array[0])) { ///For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 for spec 38.212 nb_ssb_resources= csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceList.list.count; - if (nb_ssb_resources) + if (nb_ssb_resources) { UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen =ceil(log2 (nb_ssb_resources)); UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].rsrp_bitlen = 7; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen =4; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP - else + } + else { UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen =0; UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].rsrp_bitlen = 0; UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen =0; + } LOG_I (MAC, "UCI: CSI_bit len : ssbri %d, rsrp: %d, diff_rsrp: %d", From c15855b9ab91351fae496916f707806fffe17de4 Mon Sep 17 00:00:00 2001 From: "r.karey" Date: Wed, 16 Sep 2020 13:36:52 +0530 Subject: [PATCH 125/231] Bit length calculation for CRI-RSRP --- openair2/LAYER2/NR_MAC_gNB/config.c | 263 ++++------------------------ 1 file changed, 30 insertions(+), 233 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 4378826fd5..28bc106e17 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -335,6 +335,7 @@ void update_csi_bitlen (NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_list_t *UE_li uint16_t period, offset; NR_CSI_ReportPeriodicityAndOffset_PR p_and_o; NR_CSI_ResourceConfigId_t csi_ResourceConfigId; + struct NR_CSI_ResourceConfig__csi_RS_ResourceSetList__nzp_CSI_RS_SSB * nzp_CSI_RS_SSB = NULL; for (csi_report_id=0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++){ csi_ResourceConfigId=csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->resourcesForChannelMeasurement; @@ -393,13 +394,23 @@ void update_csi_bitlen (NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_list_t *UE_li else { uint8_t nb_ssb_resources =0; //Finding the CSI_RS or SSB Resources - if ( NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type) { + UE_list->csi_report_template[UE_id][csi_report_id].CSI_Resource_type= csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.present; + if (NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB ==UE_list->csi_report_template[UE_id][csi_report_id].CSI_Resource_type){ + nzp_CSI_RS_SSB = csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB; + + UE_list->csi_report_template[UE_id][csi_report_id].nb_of_nzp_csi_report = nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList!=NULL ? nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.count:0; + UE_list->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report = nzp_CSI_RS_SSB->csi_SSB_ResourceSetList!=NULL ? nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.count:0; + } + + if ( NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == UE_list->csi_report_template[UE_id][csi_report_id].reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == UE_list->csi_report_template[UE_id][csi_report_id].reportQuantity_type) { + //if (0 != UE_list->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report) + uint8_t nb_ssb_resources =0; if (NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled == csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->groupBasedBeamReporting.present ) { if (NULL != csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->groupBasedBeamReporting.choice.disabled->nrofReportedRS) - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.nb_ssbri_cri = *(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->groupBasedBeamReporting.choice.disabled->nrofReportedRS)+1; + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].nb_ssbri_cri = *(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->groupBasedBeamReporting.choice.disabled->nrofReportedRS)+1; else /*! From Spec 38.331 * nrofReportedRS @@ -407,257 +418,43 @@ void update_csi_bitlen (NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_list_t *UE_li * capability. FFS: The signaling mechanism for the gNB to select a subset of N beams for the UE to measure and report. * When the field is absent the UE applies the value 1 */ - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.nb_ssbri_cri= 1; + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].nb_ssbri_cri= 1; }else - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.nb_ssbri_cri= 2; + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].nb_ssbri_cri= 2; if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == UE_list->csi_report_template[UE_id][csi_report_id].reportQuantity_type) { for ( csi_ssb_idx = 0; csi_ssb_idx < csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.count; csi_ssb_idx++) { if (csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceSetId == - *(csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.array[0])){ ///We can configure only one SSB resource set from spec 38.331 IE CSI-ResourceConfig + *(csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.array[0])) ///We can configure only one SSB resource set from spec 38.331 IE CSI-ResourceConfig nb_ssb_resources= csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceList.list.count; - UE_list->csi_report_template[UE_id][csi_report_id].SSB_Index_list = csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceList.list.array; - UE_list->csi_report_template[UE_id][csi_report_id].CSI_Index_list = NULL; - } break ; } } else /*if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == UE_list->csi_report_template[UE_id][csi_report_id].reportQuantity_type)*/{ - for ( csi_ssb_idx = 0; csi_ssb_idx < csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.count; csi_ssb_idx++) { + for ( csi_ssb_idx = 0; csi_ssb_idx < csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.count; csi_ssb_idx++) { if (csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_ResourceSetId == - *(csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.array[0])) { ///For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 for spec 38.212 + *(csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.array[0])) ///For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 for spec 38.212 - nb_ssb_resources= csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceList.list.count; - if (nb_ssb_resources) { - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen =ceil(log2 (nb_ssb_resources)); - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].rsrp_bitlen = 7; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen =4; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP - } - else { - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen =0; - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].rsrp_bitlen = 0; - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen =0; - } - - - LOG_I (MAC, "UCI: CSI_bit len : ssbri %d, rsrp: %d, diff_rsrp: %d", - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen, - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].rsrp_bitlen, - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen); + nb_ssb_resources= csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_RS_Resources.list.count; break ; } } if (nb_ssb_resources) { - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.cri_ssbri_bitlen =ceil(log2 (nb_ssb_resources)); - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.rsrp_bitlen = 7; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.diff_rsrp_bitlen =4; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen =ceil(log2 (nb_ssb_resources)); + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].rsrp_bitlen = 7; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen =4; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP } else { - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.cri_ssbri_bitlen =0; - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.rsrp_bitlen = 0; - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.diff_rsrp_bitlen =0; + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen =0; + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].rsrp_bitlen = 0; + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen =0; } LOG_I (MAC, "UCI: CSI_bit len : ssbri %d, rsrp: %d, diff_rsrp: %d", - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.cri_ssbri_bitlen, - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.rsrp_bitlen, - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.diff_rsrp_bitlen); - } - - uint8_t ri_restriction; - uint8_t ri_bitlen; - uint8_t nb_allowed_ri; - uint8_t max_ri; - - if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI==reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_CQI==reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_i1_CQI==reportQuantity_type|| - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_i1==reportQuantity_type){ - - for ( csi_ssb_idx = 0; csi_ssb_idx < csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.count; csi_ssb_idx++) { - if (csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_ResourceSetId == - *(csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.array[0])) { ///For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 for spec 38.212 - - nb_ssb_resources= csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_RS_Resources.list.count; - UE_list->csi_report_template[UE_id][csi_report_id].CSI_Index_list = csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_RS_Resources.list.array; - UE_list->csi_report_template[UE_id][csi_report_id].SSB_Index_list = NULL; - } - break ; - } - UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.cri_bitlen=ceil(log2 (nb_ssb_resources)); - - if (NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel== - csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.present){ - - switch (RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts) { - case 1:; - UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.ri_bitlen=0; - break; - case 2: - /* From Spec 38.212 - * If the higher layer parameter nrofCQIsPerReport=1, nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator - * values in the 4 LSBs of the higher layer parameter typeI-SinglePanel-ri-Restriction according to Subclause 5.2.2.2.1 [6, - * TS 38.214]; otherwise nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator values according to Subclause - * 5.2.2.2.1 [6, TS 38.214]. - * - * But from Current RRC ASN structures nrofCQIsPerReport is not present. Present a dummy variable is present so using it to - * calculate RI for antennas equal or more than two. - * */ - AssertFatal (NULL!=csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->dummy, "nrofCQIsPerReport is not present"); - - ri_restriction = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.buf[0]; - if (0==*(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->dummy)){ /* Replace dummy with the nrofCQIsPerReport from the CSIreport - config when equalent ASN structure present */ - nb_allowed_ri = number_of_bits_set((ri_restriction & 0xf0), &max_ri); - ri_bitlen = ceil(log2(nb_allowed_ri)); - } - else{ - nb_allowed_ri = number_of_bits_set(ri_restriction, &max_ri); - ri_bitlen = ceil(log2(nb_allowed_ri)); - } - ri_bitlen = ri_bitlen<1?ri_bitlen:1; //from the spec 38.212 and table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel - UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.ri_bitlen=ri_bitlen; - break; - case 4: - AssertFatal (NULL!=csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->dummy, "nrofCQIsPerReport is not present"); - - ri_restriction = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.buf[0]; - if (0==*(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->dummy)){ /* Replace dummy with the nrofCQIsPerReport from the CSIreport - config when equalent ASN structure present */ - nb_allowed_ri = number_of_bits_set((ri_restriction & 0xf0), &max_ri); - ri_bitlen = ceil(log2(nb_allowed_ri)); - } - else{ - nb_allowed_ri = number_of_bits_set(ri_restriction,&max_ri); - ri_bitlen = ceil(log2(nb_allowed_ri)); - } - ri_bitlen = ri_bitlen<2?ri_bitlen:2; //from the spec 38.212 and table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel - UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.ri_bitlen=ri_bitlen; - break; - case 6: - case 8: - AssertFatal (NULL!=csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->dummy, "nrofCQIsPerReport is not present"); - - ri_restriction = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.buf[0]; - if (0==*(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->dummy)){ /* Replace dummy with the nrofCQIsPerReport from the CSIreport - config when equalent ASN structure present */ - nb_allowed_ri = number_of_bits_set((ri_restriction & 0xf0),&max_ri); - ri_bitlen = ceil(log2(nb_allowed_ri)); - } - else{ - nb_allowed_ri = number_of_bits_set(ri_restriction, &max_ri); - ri_bitlen = ceil(log2(nb_allowed_ri)); - } - //ri_bitlen = ri_bitlen<1?ri_bitlen:1; //from the spec 38.212 and table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel - UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.ri_bitlen=ri_bitlen; - break; - default: - //UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.ri_bitlen=0; - AssertFatal(RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts>8,"Number of antennas %d are out of range", RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts); - break; - } - } - UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.li_bitlen=0; - UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.cqi_bitlen=0; - UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.pmi_x1_bitlen=0; - UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.pmi_x2_bitlen=0; - } - - if( NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI==reportQuantity_type ){ - if (NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel== - csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.present){ - - switch (RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts) { - case 1:; - UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.li_bitlen=0; - break; - case 2: - case 4: - case 6: - case 8: - /* From Spec 38.212 - * If the higher layer parameter nrofCQIsPerReport=1, nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator - * values in the 4 LSBs of the higher layer parameter typeI-SinglePanel-ri-Restriction according to Subclause 5.2.2.2.1 [6, - * TS 38.214]; otherwise nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator values according to Subclause - * 5.2.2.2.1 [6, TS 38.214]. - * - * But from Current RRC ASN structures nrofCQIsPerReport is not present. Present a dummy variable is present so using it to - * calculate RI for antennas equal or more than two. - * */ - //! TODO: The bit length of LI is as follows LI = log2(RI), Need to confirm wheather we should consider maximum RI can be reported from ri_restricted - // or we should consider reported RI. If we need to consider reported RI for calculating LI bit length then we need to modify the code. - UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.li_bitlen=ceil(log2(max_ri))<2?ceil(log2(max_ri)):2; - break; - default: - AssertFatal(RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts>8,"Number of antennas %d are out of range", RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts); - break; - } - } - } - - if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI==reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_CQI==reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_i1_CQI==reportQuantity_type){ - - - switch (RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts){ - case 1:; - case 2: - case 4: - case 6: - case 8: - /* From Spec 38.212 - * If the higher layer parameter nrofCQIsPerReport=1, nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator - * values in the 4 LSBs of the higher layer parameter typeI-SinglePanel-ri-Restriction according to Subclause 5.2.2.2.1 [6, - * TS 38.214]; otherwise nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator values according to Subclause - * 5.2.2.2.1 [6, TS 38.214]. - * - * But from Current RRC ASN structures nrofCQIsPerReport is not present. Present a dummy variable is present so using it to - * calculate RI for antennas equal or more than two. - * */ - - if (max_ri > 4 && max_ri < 8){ - if (NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel== - csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.present){ - if (NR_CSI_ReportConfig__reportFreqConfiguration__cqi_FormatIndicator_widebandCQI==csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportFreqConfiguration->cqi_FormatIndicator) - UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.cqi_bitlen = 8; - else - UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.cqi_bitlen = 4; - } - }else{ //This condition will work even for type1-multipanel. - if (NR_CSI_ReportConfig__reportFreqConfiguration__cqi_FormatIndicator_widebandCQI==csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportFreqConfiguration->cqi_FormatIndicator) - UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.cqi_bitlen = 4; - else - UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.cqi_bitlen = 2; - } - break; - default: - AssertFatal(RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts>8,"Number of antennas %d are out of range", RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts); - break; - } - - } - - if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI==reportQuantity_type){ - if (NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel== - csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.present){ - switch (csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.present){ - case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_two: - if (max_ri ==1) - UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.pmi_x1_bitlen = 2; - else if (max_ri ==2) - UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.pmi_x1_bitlen = 1; - break; - default: - AssertFatal(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.present!=NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_two, - "Not handled Yet %d", csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.present); - break; - } - } - } + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen, + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].rsrp_bitlen, + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen); + } break; } } From dbe30e81f6f216d64bcc98e93884b8e4aacfd079 Mon Sep 17 00:00:00 2001 From: "r.karey" Date: Wed, 7 Oct 2020 11:00:30 +0530 Subject: [PATCH 126/231] CSI-RS reporting bitlength calculation for type1 single panel two CSI-RS ports --- openair2/LAYER2/NR_MAC_gNB/config.c | 247 ++++++++++++++++++++++++---- 1 file changed, 219 insertions(+), 28 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 28bc106e17..3efde856f0 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -334,8 +334,8 @@ void update_csi_bitlen (NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_list_t *UE_li uint8_t csi_ssb_idx =0; uint16_t period, offset; NR_CSI_ReportPeriodicityAndOffset_PR p_and_o; + NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type; NR_CSI_ResourceConfigId_t csi_ResourceConfigId; - struct NR_CSI_ResourceConfig__csi_RS_ResourceSetList__nzp_CSI_RS_SSB * nzp_CSI_RS_SSB = NULL; for (csi_report_id=0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++){ csi_ResourceConfigId=csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->resourcesForChannelMeasurement; @@ -394,23 +394,13 @@ void update_csi_bitlen (NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_list_t *UE_li else { uint8_t nb_ssb_resources =0; //Finding the CSI_RS or SSB Resources - UE_list->csi_report_template[UE_id][csi_report_id].CSI_Resource_type= csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.present; - if (NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB ==UE_list->csi_report_template[UE_id][csi_report_id].CSI_Resource_type){ - nzp_CSI_RS_SSB = csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB; - - UE_list->csi_report_template[UE_id][csi_report_id].nb_of_nzp_csi_report = nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList!=NULL ? nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.count:0; - UE_list->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report = nzp_CSI_RS_SSB->csi_SSB_ResourceSetList!=NULL ? nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.count:0; - } - - if ( NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == UE_list->csi_report_template[UE_id][csi_report_id].reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == UE_list->csi_report_template[UE_id][csi_report_id].reportQuantity_type) { - //if (0 != UE_list->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report) - uint8_t nb_ssb_resources =0; + if ( NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type) { if (NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled == csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->groupBasedBeamReporting.present ) { if (NULL != csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->groupBasedBeamReporting.choice.disabled->nrofReportedRS) - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].nb_ssbri_cri = *(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->groupBasedBeamReporting.choice.disabled->nrofReportedRS)+1; + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.nb_ssbri_cri = *(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->groupBasedBeamReporting.choice.disabled->nrofReportedRS)+1; else /*! From Spec 38.331 * nrofReportedRS @@ -418,43 +408,244 @@ void update_csi_bitlen (NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_list_t *UE_li * capability. FFS: The signaling mechanism for the gNB to select a subset of N beams for the UE to measure and report. * When the field is absent the UE applies the value 1 */ - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].nb_ssbri_cri= 1; + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.nb_ssbri_cri= 1; }else - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].nb_ssbri_cri= 2; + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.nb_ssbri_cri= 2; if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == UE_list->csi_report_template[UE_id][csi_report_id].reportQuantity_type) { for ( csi_ssb_idx = 0; csi_ssb_idx < csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.count; csi_ssb_idx++) { if (csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceSetId == - *(csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.array[0])) ///We can configure only one SSB resource set from spec 38.331 IE CSI-ResourceConfig + *(csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.array[0])){ ///We can configure only one SSB resource set from spec 38.331 IE CSI-ResourceConfig nb_ssb_resources= csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceList.list.count; + UE_list->csi_report_template[UE_id][csi_report_id].SSB_Index_list = csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceList.list.array; + UE_list->csi_report_template[UE_id][csi_report_id].CSI_Index_list = NULL; + } break ; } } else /*if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == UE_list->csi_report_template[UE_id][csi_report_id].reportQuantity_type)*/{ for ( csi_ssb_idx = 0; csi_ssb_idx < csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.count; csi_ssb_idx++) { if (csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_ResourceSetId == - *(csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.array[0])) ///For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 for spec 38.212 + *(csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.array[0])) { ///For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 for spec 38.212 nb_ssb_resources= csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_RS_Resources.list.count; + UE_list->csi_report_template[UE_id][csi_report_id].CSI_Index_list = csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_RS_Resources.list.array; + UE_list->csi_report_template[UE_id][csi_report_id].SSB_Index_list = NULL; + } break ; } } if (nb_ssb_resources) { - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen =ceil(log2 (nb_ssb_resources)); - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].rsrp_bitlen = 7; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen =4; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.cri_ssbri_bitlen =ceil(log2 (nb_ssb_resources)); + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.rsrp_bitlen = 7; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.diff_rsrp_bitlen =4; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP } else { - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen =0; - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].rsrp_bitlen = 0; - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen =0; + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.cri_ssbri_bitlen =0; + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.rsrp_bitlen = 0; + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.diff_rsrp_bitlen =0; } LOG_I (MAC, "UCI: CSI_bit len : ssbri %d, rsrp: %d, diff_rsrp: %d", - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen, - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].rsrp_bitlen, - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen); - } + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.cri_ssbri_bitlen, + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.rsrp_bitlen, + UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.diff_rsrp_bitlen); + } + + uint8_t ri_restriction; + uint8_t ri_bitlen; + uint8_t nb_allowed_ri; + uint8_t max_ri; + + if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI == reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI==reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_CQI==reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_i1_CQI==reportQuantity_type|| + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_i1==reportQuantity_type){ + + for ( csi_ssb_idx = 0; csi_ssb_idx < csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.count; csi_ssb_idx++) { + if (csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_ResourceSetId == + *(csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.array[0])) { ///For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 for spec 38.212 + + nb_ssb_resources= csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_RS_Resources.list.count; + UE_list->csi_report_template[UE_id][csi_report_id].CSI_Index_list = csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_RS_Resources.list.array; + UE_list->csi_report_template[UE_id][csi_report_id].SSB_Index_list = NULL; + } + break ; + } + UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.cri_bitlen=ceil(log2 (nb_ssb_resources)); + + if (NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel== + csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.present){ + + switch (RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts) { + case 1:; + UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.ri_bitlen=0; + break; + case 2: + /* From Spec 38.212 + * If the higher layer parameter nrofCQIsPerReport=1, nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator + * values in the 4 LSBs of the higher layer parameter typeI-SinglePanel-ri-Restriction according to Subclause 5.2.2.2.1 [6, + * TS 38.214]; otherwise nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator values according to Subclause + * 5.2.2.2.1 [6, TS 38.214]. + * + * But from Current RRC ASN structures nrofCQIsPerReport is not present. Present a dummy variable is present so using it to + * calculate RI for antennas equal or more than two. + * */ + AssertFatal (NULL!=csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->dummy, "nrofCQIsPerReport is not present"); + + ri_restriction = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.buf[0]; + if (0==*(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->dummy)){ /* Replace dummy with the nrofCQIsPerReport from the CSIreport + config when equalent ASN structure present */ + nb_allowed_ri = number_of_bits_set((ri_restriction & 0xf0), &max_ri); + ri_bitlen = ceil(log2(nb_allowed_ri)); + } + else{ + nb_allowed_ri = number_of_bits_set(ri_restriction, &max_ri); + ri_bitlen = ceil(log2(nb_allowed_ri)); + } + ri_bitlen = ri_bitlen<1?ri_bitlen:1; //from the spec 38.212 and table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel + UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.ri_bitlen=ri_bitlen; + break; + case 4: + AssertFatal (NULL!=csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->dummy, "nrofCQIsPerReport is not present"); + + ri_restriction = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.buf[0]; + if (0==*(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->dummy)){ /* Replace dummy with the nrofCQIsPerReport from the CSIreport + config when equalent ASN structure present */ + nb_allowed_ri = number_of_bits_set((ri_restriction & 0xf0), &max_ri); + ri_bitlen = ceil(log2(nb_allowed_ri)); + } + else{ + nb_allowed_ri = number_of_bits_set(ri_restriction,&max_ri); + ri_bitlen = ceil(log2(nb_allowed_ri)); + } + ri_bitlen = ri_bitlen<2?ri_bitlen:2; //from the spec 38.212 and table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel + UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.ri_bitlen=ri_bitlen; + break; + case 6: + case 8: + AssertFatal (NULL!=csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->dummy, "nrofCQIsPerReport is not present"); + + ri_restriction = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.buf[0]; + if (0==*(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->dummy)){ /* Replace dummy with the nrofCQIsPerReport from the CSIreport + config when equalent ASN structure present */ + nb_allowed_ri = number_of_bits_set((ri_restriction & 0xf0),&max_ri); + ri_bitlen = ceil(log2(nb_allowed_ri)); + } + else{ + nb_allowed_ri = number_of_bits_set(ri_restriction, &max_ri); + ri_bitlen = ceil(log2(nb_allowed_ri)); + } + //ri_bitlen = ri_bitlen<1?ri_bitlen:1; //from the spec 38.212 and table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel + UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.ri_bitlen=ri_bitlen; + break; + default: + //UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.ri_bitlen=0; + AssertFatal(RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts>8,"Number of antennas %d are out of range", RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts); + break; + } + } + UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.li_bitlen=0; + UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.cqi_bitlen=0; + UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.pmi_x1_bitlen=0; + UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.pmi_x2_bitlen=0; + } + + if( NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI==reportQuantity_type ){ + if (NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel== + csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.present){ + + switch (RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts) { + case 1:; + UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.li_bitlen=0; + break; + case 2: + case 4: + case 6: + case 8: + /* From Spec 38.212 + * If the higher layer parameter nrofCQIsPerReport=1, nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator + * values in the 4 LSBs of the higher layer parameter typeI-SinglePanel-ri-Restriction according to Subclause 5.2.2.2.1 [6, + * TS 38.214]; otherwise nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator values according to Subclause + * 5.2.2.2.1 [6, TS 38.214]. + * + * But from Current RRC ASN structures nrofCQIsPerReport is not present. Present a dummy variable is present so using it to + * calculate RI for antennas equal or more than two. + * */ + //! TODO: The bit length of LI is as follows LI = log2(RI), Need to confirm wheather we should consider maximum RI can be reported from ri_restricted + // or we should consider reported RI. If we need to consider reported RI for calculating LI bit length then we need to modify the code. + UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.li_bitlen=ceil(log2(max_ri))<2?ceil(log2(max_ri)):2; + break; + default: + AssertFatal(RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts>8,"Number of antennas %d are out of range", RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts); + break; + } + } + } + + if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI == reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI==reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_CQI==reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_i1_CQI==reportQuantity_type){ + + + switch (RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts){ + case 1:; + case 2: + case 4: + case 6: + case 8: + /* From Spec 38.212 + * If the higher layer parameter nrofCQIsPerReport=1, nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator + * values in the 4 LSBs of the higher layer parameter typeI-SinglePanel-ri-Restriction according to Subclause 5.2.2.2.1 [6, + * TS 38.214]; otherwise nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator values according to Subclause + * 5.2.2.2.1 [6, TS 38.214]. + * + * But from Current RRC ASN structures nrofCQIsPerReport is not present. Present a dummy variable is present so using it to + * calculate RI for antennas equal or more than two. + * */ + + if (max_ri > 4 && max_ri < 8){ + if (NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel== + csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.present){ + if (NR_CSI_ReportConfig__reportFreqConfiguration__cqi_FormatIndicator_widebandCQI==csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportFreqConfiguration->cqi_FormatIndicator) + UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.cqi_bitlen = 8; + else + UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.cqi_bitlen = 4; + } + }else{ //This condition will work even for type1-multipanel. + if (NR_CSI_ReportConfig__reportFreqConfiguration__cqi_FormatIndicator_widebandCQI==csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportFreqConfiguration->cqi_FormatIndicator) + UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.cqi_bitlen = 4; + else + UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.cqi_bitlen = 2; + } + break; + default: + AssertFatal(RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts>8,"Number of antennas %d are out of range", RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts); + break; + } + + } + + if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI == reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI==reportQuantity_type){ + if (NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel== + csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.present){ + switch (csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.present){ + case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_two: + if (max_ri ==1) + UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.pmi_x1_bitlen = 2; + else if (max_ri ==2) + UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.pmi_x1_bitlen = 1; + break; + default: + AssertFatal(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.present!=NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_two, + "Not handled Yet %d", csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.present); + break; + } + } + } break; } } From e746ee5e96d58210ba0d682c0ae4d19eabf2a8d3 Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Thu, 8 Oct 2020 15:32:41 +0200 Subject: [PATCH 127/231] make ue and physim compile again --- openair1/SIMULATION/NR_PHY/prachsim.c | 2 ++ openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/openair1/SIMULATION/NR_PHY/prachsim.c b/openair1/SIMULATION/NR_PHY/prachsim.c index c90bcf1395..d7dfcb71fa 100644 --- a/openair1/SIMULATION/NR_PHY/prachsim.c +++ b/openair1/SIMULATION/NR_PHY/prachsim.c @@ -167,6 +167,8 @@ int main(int argc, char **argv){ int prachOccasion = 0; double DS_TDL = .03; NB_UE_INST=1; + uint16_t RA_sfn_index = -1; + uint8_t N_RA_slot,config_period = 1; // int8_t interf1=-19,interf2=-19; // uint8_t abstraction_flag=0,calibration_flag=0; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index ac3a4e77d2..fbdc6cb519 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -190,6 +190,7 @@ void find_SSB_and_RO_available(module_id_t module_idP) { // prach is scheduled according to configuration index and tables 6.3.3.2.2 to 6.3.3.2.4 get_nr_prach_occasion_info_from_index(config_index, +<<<<<<< HEAD scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA, mu, cc->frame_type, @@ -246,6 +247,7 @@ void schedule_nr_prach(module_id_t module_idP, frame_t frameP, sub_frame_t slotP nfapi_nr_config_request_scf_t *cfg = &RC.nrmac[module_idP]->config[0]; if (is_nr_UL_slot(scc,slotP)) { +<<<<<<< HEAD uint8_t config_index = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.prach_ConfigurationIndex; uint8_t mu,N_dur,N_t_slot,start_symbol = 0,N_RA_slot; uint16_t RA_sfn_index = -1; From 827fcb2d300b27d97bbfb0f2e83cd6ab6470b5c8 Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Fri, 9 Oct 2020 15:26:15 +0200 Subject: [PATCH 128/231] remove log --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c | 1 - 1 file changed, 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 4ccbd7c8c6..9de04a4ffd 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -728,7 +728,6 @@ void nr_configure_pucch(nfapi_nr_pucch_pdu_t* pucch_pdu, } else N2 = N3; } - LOG_I(MAC, "UCI resource id = %ld\n", *resource_id); } AssertFatal(resource_id!=NULL,"Couldn-t find any matching PUCCH resource in the PUCCH resource sets"); From c779ca120f0734018baf87f0e4acff75dbb2ddcb Mon Sep 17 00:00:00 2001 From: "r.karey" Date: Fri, 16 Oct 2020 18:21:12 +0530 Subject: [PATCH 129/231] Fixed the calculation of received csi payload size at MAC --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c | 1 - 1 file changed, 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 9de04a4ffd..845be51f58 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -766,7 +766,6 @@ void nr_configure_pucch(nfapi_nr_pucch_pdu_t* pucch_pdu, pucch_pdu->sr_flag = O_sr; break; case NR_PUCCH_Resource__format_PR_format2 : - LOG_I(MAC,"UCI format2 is being scheduled\n"); pucch_pdu->format_type = 2; pucch_pdu->nr_of_symbols = pucchres->format.choice.format2->nrofSymbols; pucch_pdu->start_symbol_index = pucchres->format.choice.format2->startingSymbolIndex; From 8c923c9796888fc64356301a1c47b0808a36b4ec Mon Sep 17 00:00:00 2001 From: Rangaswami Date: Wed, 21 Oct 2020 10:29:42 +0530 Subject: [PATCH 130/231] Fixed the segemntation fault and added CSI bitlength in uci_pdu --- openair2/NR_PHY_INTERFACE/NR_IF_Module.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index 630e15409b..b23318f6e1 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -277,9 +277,10 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, NR_SubcarrierSpacing_t scs, int UE_id, module_id_t Mod_idP ) { + /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ uint8_t idx = 0; - uint8_t payload_size = ceil((double)uci_pdu->csi_part1.csi_part1_bit_len/8); + uint8_t payload_size = ceil(((double)uci_pdu->csi_part1.csi_part1_bit_len)/8); uint8_t *payload = calloc (payload_size, sizeof(uint8_t)); NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type = NR_CSI_ReportConfig__reportQuantity_PR_NOTHING; NR_UE_list_t *UE_list = &(RC.nrmac[Mod_idP]->UE_list); @@ -288,10 +289,10 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, memcpy ( payload, uci_pdu->csi_part1.csi_part1_payload, payload_size); + UE_list->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report = 0; for ( csi_report_id =0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++ ) { //Assuming in periodic reporting for one slot can be configured with only one CSI-ReportConfig // if (csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.present == NR_CSI_ReportConfig__reportConfigType_PR_periodic) { - //considering 30khz scs and //Has to implement according to reportSlotConfig type periodicity = UE_list->csi_report_template[UE_id][csi_report_id].periodicity; LOG_I(PHY,"SFN/SF:%d%d \n", frame,slot); From ee7b48ee0192cd8913e45e76ae88574a405f2106 Mon Sep 17 00:00:00 2001 From: "p.shashikala" Date: Mon, 2 Nov 2020 12:09:14 +0545 Subject: [PATCH 131/231] CSI payload bits inversion issue --- openair2/NR_PHY_INTERFACE/NR_IF_Module.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index b23318f6e1..2f75cc93cd 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -288,6 +288,8 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, uint8_t csi_report_id = 0; memcpy ( payload, uci_pdu->csi_part1.csi_part1_payload, payload_size); + + reverse_n_bits(payload, uci_pdu->csi_part1.csi_part1_bit_len); UE_list->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report = 0; for ( csi_report_id =0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++ ) { @@ -353,7 +355,7 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, *payload >>= 4; } UE_list->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report++; - LOG_I(MAC,"csi_payload = %d, rsrp = %d\n",payload_size, sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP); + LOG_I(MAC,"csi_payload size = %d, rsrp_id = %d\n",payload_size, sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP); } } From 5c35c9fba2cd18074fd568d7fdd3f9515ecdb749 Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Tue, 3 Nov 2020 10:20:45 +0100 Subject: [PATCH 132/231] bugix for cri-rsrp in bitlen computation --- openair2/LAYER2/NR_MAC_gNB/config.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 3efde856f0..778402d34a 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -424,7 +424,7 @@ void update_csi_bitlen (NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_list_t *UE_li break ; } } else /*if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == UE_list->csi_report_template[UE_id][csi_report_id].reportQuantity_type)*/{ - for ( csi_ssb_idx = 0; csi_ssb_idx < csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.count; csi_ssb_idx++) { + for ( csi_ssb_idx = 0; csi_ssb_idx < csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.count; csi_ssb_idx++) { if (csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_ResourceSetId == *(csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.array[0])) { ///For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 for spec 38.212 From dfa39d54417ab5a9548c2c4f6846eb13d528da31 Mon Sep 17 00:00:00 2001 From: Rangaswami Date: Wed, 4 Nov 2020 14:14:01 +0530 Subject: [PATCH 133/231] fixed CSI payload issue with multiple SSBs --- openair2/NR_PHY_INTERFACE/NR_IF_Module.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index 2f75cc93cd..2ac16d82e8 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -289,7 +289,6 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, memcpy ( payload, uci_pdu->csi_part1.csi_part1_payload, payload_size); - reverse_n_bits(payload, uci_pdu->csi_part1.csi_part1_bit_len); UE_list->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report = 0; for ( csi_report_id =0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++ ) { @@ -335,8 +334,10 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri = UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.nb_ssbri_cri; for (csi_ssb_idx = 0; csi_ssb_idx < sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri ; csi_ssb_idx++) { - if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type) + if(cri_ssbri_bitlen > 1) + reverse_n_bits(payload, cri_ssbri_bitlen); + if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type) sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx] = *(UE_list->csi_report_template[UE_id][csi_report_id].SSB_Index_list[cri_ssbri_bitlen>0?((*payload)&~(~1<<(cri_ssbri_bitlen-1))):cri_ssbri_bitlen]); else @@ -344,13 +345,15 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, *(UE_list->csi_report_template[UE_id][csi_report_id].CSI_Index_list[cri_ssbri_bitlen>0?((*payload)&~(~1<<(cri_ssbri_bitlen-1))):cri_ssbri_bitlen]); *payload >>= cri_ssbri_bitlen; - LOG_I(PHY,"SSB_index = %d",sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx]); + LOG_I(PHY,"SSB_index = %d",sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx]); } - + + reverse_n_bits(payload, 7); sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP = (*payload) & 0x7f; *payload >>= 7; for ( diff_rsrp_idx =0; diff_rsrp_idx < sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri - 1; diff_rsrp_idx++ ) { + reverse_n_bits(payload,4); sched_ctrl->CSI_report[idx].choice.ssb_cri_report.diff_RSRP[diff_rsrp_idx] = (*payload) & 0x0f; *payload >>= 4; } From 898f75205953d205b37ba6ca632f511e4412cb96 Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Fri, 20 Nov 2020 10:22:10 +0100 Subject: [PATCH 134/231] uci mac functions in a new file --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 405 ++------ .../NR_MAC_gNB/gNB_scheduler_primitives.c | 70 ++ .../LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 887 ++++++++++++++++-- 3 files changed, 954 insertions(+), 408 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index dcf433b0a8..46ec88ca2b 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -56,141 +56,6 @@ uint16_t nr_pdcch_order_table[6] = { 31, 31, 511, 2047, 2047, 8191 }; -#define MAX_SSB_SCHED 8 -#define L1_RSRP_HYSTERIS 10 //considering 10 dBm as hysterisis for avoiding frequent SSB Beam Switching. !Fixme provide exact value if any -//#define L1_DIFF_RSRP_STEP_SIZE 2 -#define MAX_NUM_SSB 128 -#define MIN_RSRP_VALUE -141 -//Measured RSRP Values Table 10.1.16.1-1 from 36.133 -//Stored all the upper limits[Max RSRP Value of corresponding index] -//stored -1 for invalid values -int L1_SSB_CSI_RSRP_measReport_mapping_38133_10_1_6_1_1[128] = { - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, //0 - 9 - -1, -1, -1, -1, -1, -1, -140, -139, -138, -137, //10 - 19 - -136, -135, -134, -133, -132, -131, -130, -129, -128, -127, //20 - 29 - -126, -125, -124, -123, -122, -121, -120, -119, -118, -117, //30 - 39 - -116, -115, -114, -113, -112, -111, -110, -109, -108, -107, //40 - 49 - -106, -105, -104, -103, -102, -101, -100, -99, -98, -97, //50 - 59 - -96, -95, -94, -93, -92, -91, -90, -89, -88, -87, //60 - 69 - -86, -85, -84, -83, -82, -81, -80, -79, -78, -77, //70 - 79 - -76, -75, -74, -73, -72, -71, -70, -69, -68, -67, //80 - 89 - -66, -65, -64, -63, -62, -61, -60, -59, -58, -57, //90 - 99 - -56, -55, -54, -53, -52, -51, -50, -49, -48, -47, //100 - 109 - -46, -45, -44, -44, -1, -1, -1, -1, -1, -1, //110 - 119 - -1, -1, -1, -1, -1, -1, -1, -1//120 - 127 - }; - -//Differential RSRP values Table 10.1.6.1-2 from 36.133 -//Stored the upper limits[MAX RSRP Value] -int diff_rsrp_ssb_csi_meas_10_1_6_1_2[16] = { - 0, -2, -4, -6, -8, -10, -12, -14, -16, -18, //0 - 9 - -20, -22, -24, -26, -28, -30 //10 - 15 -}; - - -//returns the measured RSRP value (upper limit) -int get_measured_rsrp(uint8_t index) { - //if index is invalid returning minimum rsrp -140 - if((index >= 0 && index <= 15) || index >= 114) - return MIN_RSRP_VALUE; - - return L1_SSB_CSI_RSRP_measReport_mapping_38133_10_1_6_1_1[index]; -} - -//returns the differential RSRP value (upper limit) -int get_diff_rsrp(uint8_t index, int strongest_rsrp) { - if(strongest_rsrp != -1) { - return strongest_rsrp + diff_rsrp_ssb_csi_meas_10_1_6_1_2[index]; - } else - return MIN_RSRP_VALUE; -} - -int checkTargetSSBInFirst64TCIStates_pdschConfig(int ssb_index_t, int Mod_idP, int UE_id) { - NR_UE_list_t *UE_list = &RC.nrmac[Mod_idP]->UE_list; - NR_CellGroupConfig_t *secondaryCellGroup = UE_list->secondaryCellGroup[UE_id] ; - int nb_tci_states = secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list.count; - NR_TCI_State_t *tci =NULL; - int i; - - for(i=0; ispCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list.array[i]; - - if(tci != NULL) { - if(tci->qcl_Type1.referenceSignal.present == NR_QCL_Info__referenceSignal_PR_ssb) { - if(tci->qcl_Type1.referenceSignal.choice.ssb == ssb_index_t) - return tci->tci_StateId; // returned TCI state ID - } - // if type2 is configured - else if(tci->qcl_Type2 != NULL && tci->qcl_Type2->referenceSignal.present == NR_QCL_Info__referenceSignal_PR_ssb) { - if(tci->qcl_Type2->referenceSignal.choice.ssb == ssb_index_t) - return tci->tci_StateId; // returned TCI state ID - } else LOG_I(MAC,"SSB index is not found in first 64 TCI states of TCI_statestoAddModList[%d]", i); - } - } - - // tci state not identified in first 64 TCI States of PDSCH Config - return -1; -} - -int checkTargetSSBInTCIStates_pdcchConfig(int ssb_index_t, int Mod_idP, int UE_id) { - NR_UE_list_t *UE_list = &RC.nrmac[Mod_idP]->UE_list; - NR_CellGroupConfig_t *secondaryCellGroup = UE_list->secondaryCellGroup[UE_id] ; - int nb_tci_states = secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list.count; - NR_TCI_State_t *tci =NULL; - NR_TCI_StateId_t *tci_id = NULL; - int bwp_id = 1; - NR_BWP_Downlink_t *bwp = secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1]; - NR_ControlResourceSet_t *coreset = bwp->bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList->list.array[bwp_id-1]; - int i; - int flag = 0; - int tci_stateID = -1; - - for(i=0; ispCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list.array[i]; - - if(tci != NULL && tci->qcl_Type1.referenceSignal.present == NR_QCL_Info__referenceSignal_PR_ssb) { - if(tci->qcl_Type1.referenceSignal.choice.ssb == ssb_index_t) { - flag = 1; - tci_stateID = tci->tci_StateId; - break; - } else if(tci->qcl_Type2 != NULL && tci->qcl_Type2->referenceSignal.present == NR_QCL_Info__referenceSignal_PR_ssb) { - flag = 1; - tci_stateID = tci->tci_StateId; - break; - } - } - - if(flag != 0 && tci_stateID != -1 && coreset != NULL) { - for(i=0; i<64 && itci_StatesPDCCH_ToAddList->list.count; i++) { - tci_id = coreset->tci_StatesPDCCH_ToAddList->list.array[i]; - - if(tci_id != NULL && *tci_id == tci_stateID) - return tci_stateID; - } - } - } - - // Need to implement once configuration is received - return -1; -} - -int ssb_index_sorted[MAX_NUM_SSB] = {0}; -int ssb_rsrp_sorted[MAX_NUM_SSB] = {0}; -//Sorts ssb_index and ssb_rsrp array data and keeps in ssb_index_sorted and -//ssb_rsrp_sorted respectively -void ssb_rsrp_sort(int *ssb_index, int *ssb_rsrp) { - int i, j; - - for(i = 0; *(ssb_index+i) != 0; i++) { - for(j = i; *(ssb_index+j) != 0; j++) { - if(*(ssb_rsrp+j) >= *(ssb_rsrp+i)) { - ssb_index_sorted[i] = *(ssb_index+j); - ssb_rsrp_sorted[i] = *(ssb_rsrp+j); - } - } - } -} - void clear_mac_stats(gNB_MAC_INST *gNB) { memset((void*)gNB->UE_info.mac_stats,0,MAX_MOBILES_PER_GNB*sizeof(NR_mac_stats_t)); } @@ -224,223 +89,6 @@ void dump_mac_stats(gNB_MAC_INST *gNB) } } -//identifies the target SSB Beam index -//keeps the required date for PDCCH and PDSCH TCI state activation/deactivation CE consutruction globally -//handles triggering of PDCCH and PDSCH MAC CEs -void tci_handling(module_id_t Mod_idP, int UE_id, int CC_id, NR_UE_sched_ctrl_t *sched_ctrl, frame_t frame, slot_t slot) { - - int strongest_ssb_rsrp = 0; - int cqi_idx = 0; - int curr_ssb_beam_index = 0; //ToDo: yet to know how to identify the serving ssb beam index - uint8_t target_ssb_beam_index = curr_ssb_beam_index; - //uint8_t max_reported_RSRP = 16; - //int serving_SSB_Beam_RSRP; - uint8_t is_triggering_ssb_beam_switch =0; - uint8_t ssb_idx = 0; - int pdsch_bwp_id =0; - int ssb_index[MAX_NUM_SSB] = {0}; - int ssb_rsrp[MAX_NUM_SSB] = {0}; - uint8_t idx = 0; - int bwp_id = 1; - NR_UE_list_t *UE_list = &RC.nrmac[Mod_idP]->UE_list; - //NR_COMMON_channels_t *cc = RC.nrmac[Mod_idP]->common_channels; - NR_CellGroupConfig_t *secondaryCellGroup = UE_list->secondaryCellGroup[UE_id]; - NR_BWP_Downlink_t *bwp = secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1]; - //NR_CSI_MeasConfig_t *csi_MeasConfig = UE_list->secondaryCellGroup[UE_id]->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup; - //bwp indicator - int n_dl_bwp = secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count; - uint8_t nr_ssbri_cri = 0; - uint8_t nb_of_csi_ssb_report = UE_list->csi_report_template[UE_id][cqi_idx].nb_of_csi_ssb_report; - //uint8_t bitlen_ssbri = log (nb_of_csi_ssb_report)/log (2); - //uint8_t max_rsrp_reported = -1; - int better_rsrp_reported = -140-(-0); /*minimum_measured_RSRP_value - minimum_differntail_RSRP_value*///considering the minimum RSRP value as better RSRP initially - uint8_t diff_rsrp_idx = 0; - uint8_t i, j; - - if (n_dl_bwp < 4) - pdsch_bwp_id = bwp_id; - else - pdsch_bwp_id = bwp_id - 1; // as per table 7.3.1.1.2-1 in 38.212 - - /*Example: - CRI_SSBRI: 1 2 3 4| 5 6 7 8| 9 10 1 2| - nb_of_csi_ssb_report = 3 //3 sets as above - nr_ssbri_cri = 4 //each set has 4 elements - storing ssb indexes in ssb_index array as ssb_index[0] = 1 .. ssb_index[4] = 5 - ssb_rsrp[0] = strongest rsrp in first set, ssb_rsrp[4] = strongest rsrp in second set, .. - idx: resource set index - */ - - //for all reported SSB - for (idx = 0; idx < nb_of_csi_ssb_report; idx++) { - nr_ssbri_cri = sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri; - //if group based beam Reporting is disabled - /*if(NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled == - csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.present ) {*/ - //extracting the ssb indexes - for (ssb_idx = 0; ssb_idx < nr_ssbri_cri; ssb_idx++) { - ssb_index[idx * nb_of_csi_ssb_report + ssb_idx] = sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI[ssb_idx]; - } - - //if strongest measured RSRP is configured - strongest_ssb_rsrp = get_measured_rsrp(sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP); - ssb_rsrp[idx * nb_of_csi_ssb_report] = strongest_ssb_rsrp; - LOG_I(MAC,"ssb_rsrp = %d\n",strongest_ssb_rsrp); - - //if current ssb rsrp is greater than better rsrp - if(ssb_rsrp[idx * nb_of_csi_ssb_report] > better_rsrp_reported) { - better_rsrp_reported = ssb_rsrp[idx * nb_of_csi_ssb_report]; - target_ssb_beam_index = idx * nb_of_csi_ssb_report; - } - - for(diff_rsrp_idx =1; diff_rsrp_idx < nr_ssbri_cri; diff_rsrp_idx++) { - ssb_rsrp[idx * nb_of_csi_ssb_report + diff_rsrp_idx] = get_diff_rsrp(sched_ctrl->CSI_report[idx].choice.ssb_cri_report.diff_RSRP[diff_rsrp_idx-1], strongest_ssb_rsrp); - - //if current reported rsrp is greater than better rsrp - if(ssb_rsrp[idx * nb_of_csi_ssb_report + diff_rsrp_idx] > better_rsrp_reported) { - better_rsrp_reported = ssb_rsrp[idx * nb_of_csi_ssb_report + diff_rsrp_idx]; - target_ssb_beam_index = idx * nb_of_csi_ssb_report + diff_rsrp_idx; - } - } -#if 0 - //} - //if group based beam reporting is enabled - else if (NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled != - csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.present ) { - //extracting the ssb indexes - //for group based reporting only 2 SSB RS are reported, 38.331 - for (ssb_idx = 0; ssb_idx < 2; ssb_idx++) { - ssb_index[idx * nb_of_csi_ssb_report + ssb_idx] = sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.CRI_SSBRI[ssb_idx]; - } - - strongest_ssb_rsrp = get_measured_rsrp(sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.RSRP); - ssb_rsrp[idx * nb_of_csi_ssb_report] = strongest_ssb_rsrp; - - if(ssb_rsrp[idx * nb_of_csi_ssb_report] > better_rsrp_reported) { - better_rsrp_reported = ssb_rsrp[idx * nb_of_csi_ssb_report]; - target_ssb_beam_index = idx * nb_of_csi_ssb_report; - } - - ssb_rsrp[idx * nb_of_csi_ssb_report + 1] = get_diff_rsrp(sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.diff_RSRP[diff_rsrp_idx], strongest_ssb_rsrp); - - if(ssb_rsrp[idx * nb_of_csi_ssb_report + 1] > better_rsrp_reported) { - better_rsrp_reported = ssb_rsrp[idx * nb_of_csi_ssb_report + 1]; - target_ssb_beam_index = idx * nb_of_csi_ssb_report + 1; - } - } -#endif - } - - - if(ssb_index[target_ssb_beam_index] != ssb_index[curr_ssb_beam_index] && ssb_rsrp[target_ssb_beam_index] > ssb_rsrp[curr_ssb_beam_index]) { - if( ssb_rsrp[target_ssb_beam_index] - ssb_rsrp[curr_ssb_beam_index] > L1_RSRP_HYSTERIS) { - is_triggering_ssb_beam_switch = 1; - LOG_I(MAC, "Triggering ssb beam switching using tci\n"); - } - } - - if(is_triggering_ssb_beam_switch) { - //filling pdcch tci state activativation mac ce structure fields - sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.is_scheduled = 1; - //OAI currently focusing on Non CA usecase hence 0 is considered as serving - //cell id - sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.servingCellId = 0; //0 for PCell as 38.331 v15.9.0 page 353 //serving cell id for which this MAC CE applies - sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.coresetId = 0; //coreset id for which the TCI State id is being indicated - - /* 38.321 v15.8.0 page 66 - TCI State ID: This field indicates the TCI state identified by TCI-StateId as specified in TS 38.331 [5] applicable - to the Control Resource Set identified by CORESET ID field. - If the field of CORESET ID is set to 0, - this field indicates a TCI-StateId for a TCI state of the first 64 TCI-states configured by tci-States-ToAddModList and tciStates-ToReleaseList in the PDSCH-Config in the active BWP. - If the field of CORESET ID is set to the other value than 0, - this field indicates a TCI-StateId configured by tci-StatesPDCCH-ToAddList and tciStatesPDCCH-ToReleaseList in the controlResourceSet identified by the indicated CORESET ID. - The length of the field is 7 bits - */ - if(sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.coresetId == 0) { - int tci_state_id = checkTargetSSBInFirst64TCIStates_pdschConfig(ssb_index[target_ssb_beam_index], Mod_idP, UE_id); - - if( tci_state_id != -1) - sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.tciStateId = tci_state_id; - else { - //identify the best beam within first 64 TCI States of PDSCH - //Config TCI-states-to-addModList - int flag = 0; - - for(i =0; ssb_index_sorted[i]!=0; i++) { - tci_state_id = checkTargetSSBInFirst64TCIStates_pdschConfig(ssb_index_sorted[i], Mod_idP, UE_id) ; - - if(tci_state_id != -1 && ssb_rsrp_sorted[i] > ssb_rsrp[curr_ssb_beam_index] && ssb_rsrp_sorted[i] - ssb_rsrp[curr_ssb_beam_index] > L1_RSRP_HYSTERIS) { - sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.tciStateId = tci_state_id; - flag = 1; - break; - } - } - - if(flag == 0 || ssb_rsrp_sorted[i] < ssb_rsrp[curr_ssb_beam_index] || ssb_rsrp_sorted[i] - ssb_rsrp[curr_ssb_beam_index] < L1_RSRP_HYSTERIS) { - sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.is_scheduled = 0; - } - } - } else { - int tci_state_id = checkTargetSSBInTCIStates_pdcchConfig(ssb_index[target_ssb_beam_index], Mod_idP, UE_id); - - if (tci_state_id !=-1) - sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.tciStateId = tci_state_id; - else { - //identify the best beam within CORESET/PDCCH - ////Config TCI-states-to-addModList - int flag = 0; - - for(i =0; ssb_index_sorted[i]!=0; i++) { - tci_state_id = checkTargetSSBInTCIStates_pdcchConfig(ssb_index_sorted[i], Mod_idP, UE_id); - - if( tci_state_id != -1 && ssb_rsrp_sorted[i] > ssb_rsrp[curr_ssb_beam_index] && ssb_rsrp_sorted[i] - ssb_rsrp[curr_ssb_beam_index] > L1_RSRP_HYSTERIS) { - sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.tciStateId = tci_state_id; - flag = 1; - break; - } - } - - if(flag == 0 || ssb_rsrp_sorted[i] < ssb_rsrp[curr_ssb_beam_index] || ssb_rsrp_sorted[i] - ssb_rsrp[curr_ssb_beam_index] < L1_RSRP_HYSTERIS) { - sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.is_scheduled = 0; - } - } - } - - sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.tci_present_inDCI = bwp->bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList->list.array[bwp_id-1]->tci_PresentInDCI; - - //filling pdsch tci state activation deactivation mac ce structure fields - if(sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.tci_present_inDCI) { - sched_ctrl->UE_mac_ce_ctrl.pdsch_TCI_States_ActDeact.is_scheduled = 1; - /* - Serving Cell ID: This field indicates the identity of the Serving Cell for which the MAC CE applies - Considering only PCell exists. Serving cell index of PCell is always 0, hence configuring 0 - */ - sched_ctrl->UE_mac_ce_ctrl.pdsch_TCI_States_ActDeact.servingCellId = 0; - /* - BWP ID: This field indicates a DL BWP for which the MAC CE applies as the codepoint of the DCI bandwidth - part indicator field as specified in TS 38.212 - */ - sched_ctrl->UE_mac_ce_ctrl.pdsch_TCI_States_ActDeact.bwpId = pdsch_bwp_id; - - /* - * TODO ssb_rsrp_sort() API yet to code to find 8 best beams, rrc configuration - * is required - */ - for(i = 0; i<8; i++) { - sched_ctrl->UE_mac_ce_ctrl.pdsch_TCI_States_ActDeact.tciStateActDeact[i] = i; - } - - sched_ctrl->UE_mac_ce_ctrl.pdsch_TCI_States_ActDeact.highestTciStateActivated = 8; - - for(i = 0, j =0; iUE_mac_ce_ctrl.pdsch_TCI_States_ActDeact.tciStateActDeact[i]) { - sched_ctrl->UE_mac_ce_ctrl.pdsch_TCI_States_ActDeact.codepoint[j] = i; - j++; - } - } - }//tci_presentInDCI - }//is-triggering_beam_switch -}//tci handling void clear_nr_nfapi_information(gNB_MAC_INST *gNB, int CC_idP, @@ -645,6 +293,59 @@ void schedule_nr_SRS(module_id_t module_idP, frame_t frameP, sub_frame_t subfram } } */ +/* +void copy_nr_ulreq(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) +{ + int CC_id; + gNB_MAC_INST *mac = RC.nrmac[module_idP]; + + for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { + + nfapi_ul_config_request_t *ul_req = &mac->UL_tti_req[CC_id]; + + *ul_req = *ul_req_tmp; + + // Restore the pointer + ul_req->ul_config_request_body.ul_config_pdu_list = ul_req_pdu; + ul_req->sfn_sf = (frameP<<7) + slotP; + ul_req_tmp->ul_config_request_body.number_of_pdus = 0; + + if (ul_req->ul_config_request_body.number_of_pdus>0) + { + LOG_D(PHY, "%s() active NOW (frameP:%d slotP:%d) pdus:%d\n", __FUNCTION__, frameP, slotP, ul_req->ul_config_request_body.number_of_pdus); + } + + memcpy((void*)ul_req->ul_config_request_body.ul_config_pdu_list, + (void*)ul_req_tmp->ul_config_request_body.ul_config_pdu_list, + ul_req->ul_config_request_body.number_of_pdus*sizeof(nfapi_ul_config_request_pdu_t)); + } +} +*/ + + +void nr_schedule_pusch(int Mod_idP, + int UE_id, + int num_slots_per_tdd, + int ul_slots, + frame_t frameP, + sub_frame_t slotP) { + + nfapi_nr_ul_tti_request_t *UL_tti_req = &RC.nrmac[Mod_idP]->UL_tti_req[0]; + NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; + int k = slotP + ul_slots - num_slots_per_tdd; + NR_sched_pusch *pusch = &UE_info->UE_sched_ctrl[UE_id].sched_pusch[k]; + if ((pusch->active == true) && (frameP == pusch->frame) && (slotP == pusch->slot)) { + UL_tti_req->SFN = pusch->frame; + UL_tti_req->Slot = pusch->slot; + UL_tti_req->pdus_list[UL_tti_req->n_pdus].pdu_type = NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE; + UL_tti_req->pdus_list[UL_tti_req->n_pdus].pdu_size = sizeof(nfapi_nr_pusch_pdu_t); + UL_tti_req->pdus_list[UL_tti_req->n_pdus].pusch_pdu = pusch->pusch_pdu; + UL_tti_req->n_pdus+=1; + memset((void *) &UE_info->UE_sched_ctrl[UE_id].sched_pusch[k], + 0, sizeof(NR_sched_pusch)); + } +} + bool is_xlsch_in_slot(uint64_t bitmap, sub_frame_t slot) { return (bitmap >> slot) & 0x01; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 845be51f58..7a39514531 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -1830,6 +1830,76 @@ bool find_free_CCE(module_id_t module_id, return true; } +int checkTargetSSBInFirst64TCIStates_pdschConfig(int ssb_index_t, int Mod_idP, int UE_id) { + NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; + NR_CellGroupConfig_t *secondaryCellGroup = UE_info->secondaryCellGroup[UE_id] ; + int nb_tci_states = secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list.count; + NR_TCI_State_t *tci =NULL; + int i; + + for(i=0; ispCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list.array[i]; + + if(tci != NULL) { + if(tci->qcl_Type1.referenceSignal.present == NR_QCL_Info__referenceSignal_PR_ssb) { + if(tci->qcl_Type1.referenceSignal.choice.ssb == ssb_index_t) + return tci->tci_StateId; // returned TCI state ID + } + // if type2 is configured + else if(tci->qcl_Type2 != NULL && tci->qcl_Type2->referenceSignal.present == NR_QCL_Info__referenceSignal_PR_ssb) { + if(tci->qcl_Type2->referenceSignal.choice.ssb == ssb_index_t) + return tci->tci_StateId; // returned TCI state ID + } else LOG_I(MAC,"SSB index is not found in first 64 TCI states of TCI_statestoAddModList[%d]", i); + } + } + + // tci state not identified in first 64 TCI States of PDSCH Config + return -1; +} + + +int checkTargetSSBInTCIStates_pdcchConfig(int ssb_index_t, int Mod_idP, int UE_id) { + NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; + NR_CellGroupConfig_t *secondaryCellGroup = UE_info->secondaryCellGroup[UE_id] ; + int nb_tci_states = secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list.count; + NR_TCI_State_t *tci =NULL; + NR_TCI_StateId_t *tci_id = NULL; + int bwp_id = 1; + NR_BWP_Downlink_t *bwp = secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1]; + NR_ControlResourceSet_t *coreset = bwp->bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList->list.array[bwp_id-1]; + int i; + int flag = 0; + int tci_stateID = -1; + + for(i=0; ispCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list.array[i]; + + if(tci != NULL && tci->qcl_Type1.referenceSignal.present == NR_QCL_Info__referenceSignal_PR_ssb) { + if(tci->qcl_Type1.referenceSignal.choice.ssb == ssb_index_t) { + flag = 1; + tci_stateID = tci->tci_StateId; + break; + } else if(tci->qcl_Type2 != NULL && tci->qcl_Type2->referenceSignal.present == NR_QCL_Info__referenceSignal_PR_ssb) { + flag = 1; + tci_stateID = tci->tci_StateId; + break; + } + } + + if(flag != 0 && tci_stateID != -1 && coreset != NULL) { + for(i=0; i<64 && itci_StatesPDCCH_ToAddList->list.count; i++) { + tci_id = coreset->tci_StatesPDCCH_ToAddList->list.array[i]; + + if(tci_id != NULL && *tci_id == tci_stateID) + return tci_stateID; + } + } + } + + // Need to implement once configuration is received + return -1; +} + /*void fill_nfapi_coresets_and_searchspaces(NR_CellGroupConfig_t *cg, nfapi_nr_coreset_t *coreset, nfapi_nr_search_space_t *search_space) { diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index 31c72c1691..38a0d46f20 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -80,6 +80,56 @@ void nr_fill_nfapi_pucch(module_id_t mod_id, pucch->sr_flag); } +#define MIN_RSRP_VALUE -141 +#define MAX_NUM_SSB 128 +#define MAX_SSB_SCHED 8 +#define L1_RSRP_HYSTERIS 10 //considering 10 dBm as hysterisis for avoiding frequent SSB Beam Switching. !Fixme provide exact value if any +//#define L1_DIFF_RSRP_STEP_SIZE 2 + +int ssb_index_sorted[MAX_NUM_SSB] = {0}; +int ssb_rsrp_sorted[MAX_NUM_SSB] = {0}; +//Sorts ssb_index and ssb_rsrp array data and keeps in ssb_index_sorted and +//ssb_rsrp_sorted respectively +void ssb_rsrp_sort(int *ssb_index, int *ssb_rsrp) { + int i, j; + + for(i = 0; *(ssb_index+i) != 0; i++) { + for(j = i; *(ssb_index+j) != 0; j++) { + if(*(ssb_rsrp+j) >= *(ssb_rsrp+i)) { + ssb_index_sorted[i] = *(ssb_index+j); + ssb_rsrp_sorted[i] = *(ssb_rsrp+j); + } + } + } +} + +//Measured RSRP Values Table 10.1.16.1-1 from 36.133 +//Stored all the upper limits[Max RSRP Value of corresponding index] +//stored -1 for invalid values +int L1_SSB_CSI_RSRP_measReport_mapping_38133_10_1_6_1_1[128] = { + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, //0 - 9 + -1, -1, -1, -1, -1, -1, -140, -139, -138, -137, //10 - 19 + -136, -135, -134, -133, -132, -131, -130, -129, -128, -127, //20 - 29 + -126, -125, -124, -123, -122, -121, -120, -119, -118, -117, //30 - 39 + -116, -115, -114, -113, -112, -111, -110, -109, -108, -107, //40 - 49 + -106, -105, -104, -103, -102, -101, -100, -99, -98, -97, //50 - 59 + -96, -95, -94, -93, -92, -91, -90, -89, -88, -87, //60 - 69 + -86, -85, -84, -83, -82, -81, -80, -79, -78, -77, //70 - 79 + -76, -75, -74, -73, -72, -71, -70, -69, -68, -67, //80 - 89 + -66, -65, -64, -63, -62, -61, -60, -59, -58, -57, //90 - 99 + -56, -55, -54, -53, -52, -51, -50, -49, -48, -47, //100 - 109 + -46, -45, -44, -44, -1, -1, -1, -1, -1, -1, //110 - 119 + -1, -1, -1, -1, -1, -1, -1, -1//120 - 127 + }; + +//Differential RSRP values Table 10.1.6.1-2 from 36.133 +//Stored the upper limits[MAX RSRP Value] +int diff_rsrp_ssb_csi_meas_10_1_6_1_2[16] = { + 0, -2, -4, -6, -8, -10, -12, -14, -16, -18, //0 - 9 + -20, -22, -24, -26, -28, -30 //10 - 15 +}; + + void nr_schedule_pucch(int Mod_idP, frame_t frameP, sub_frame_t slotP) { @@ -106,74 +156,299 @@ void nr_schedule_pucch(int Mod_idP, } +//! Calculating number of bits set +uint8_t number_of_bits_set (uint8_t buf,uint8_t * max_ri){ + uint8_t nb_of_bits_set = 0; + uint8_t mask = 0xff; + uint8_t index = 0; + + for (index=7; (buf & mask) && (index>=0) ; index--){ + if (buf & (1<>=1; + } + *max_ri = 8-index; + return nb_of_bits_set; +} + + //!TODO : same function can be written to handle csi_resources -void compute_csi_bitlen (NR_CellGroupConfig_t *secondaryCellGroup, NR_UE_info_t *UE_info, int UE_id) { +void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_info, int UE_id, module_id_t Mod_idP){ uint8_t csi_report_id = 0; uint8_t csi_resourceidx =0; uint8_t csi_ssb_idx =0; - - NR_CSI_MeasConfig_t *csi_MeasConfig = secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup; + NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type; NR_CSI_ResourceConfigId_t csi_ResourceConfigId; + for (csi_report_id=0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++){ csi_ResourceConfigId=csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->resourcesForChannelMeasurement; - UE_info->csi_report_template[UE_id][csi_report_id].reportQuantity_type = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportQuantity.present; + reportQuantity_type = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportQuantity.present; + UE_info->csi_report_template[UE_id][csi_report_id].reportQuantity_type = reportQuantity_type; for ( csi_resourceidx = 0; csi_resourceidx < csi_MeasConfig->csi_ResourceConfigToAddModList->list.count; csi_resourceidx++) { - if ( csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_ResourceConfigId != csi_ResourceConfigId) - continue; + if ( csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_ResourceConfigId != csi_ResourceConfigId) + continue; else { - //Finding the CSI_RS or SSB Resources - UE_info->csi_report_template[UE_id][csi_report_id].CSI_Resource_type= csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.present; - if (NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB ==UE_info->csi_report_template[UE_id][csi_report_id].CSI_Resource_type){ - struct NR_CSI_ResourceConfig__csi_RS_ResourceSetList__nzp_CSI_RS_SSB * nzp_CSI_RS_SSB = csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB; + uint8_t nb_ssb_resources =0; + //Finding the CSI_RS or SSB Resources + if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type) { - UE_info->csi_report_template[UE_id][csi_report_id].nb_of_nzp_csi_report = nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList!=NULL ? nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.count:0; - UE_info->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report = nzp_CSI_RS_SSB->csi_SSB_ResourceSetList!=NULL ? nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.count:0; + if (NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled == + csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->groupBasedBeamReporting.present ) { + if (NULL != csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->groupBasedBeamReporting.choice.disabled->nrofReportedRS) + UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.nb_ssbri_cri = *(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->groupBasedBeamReporting.choice.disabled->nrofReportedRS)+1; + else + /*! From Spec 38.331 + * nrofReportedRS + * The number (N) of measured RS resources to be reported per report setting in a non-group-based report. N <= N_max, where N_max is either 2 or 4 depending on UE + * capability. FFS: The signaling mechanism for the gNB to select a subset of N beams for the UE to measure and report. + * When the field is absent the UE applies the value 1 + */ + UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.nb_ssbri_cri= 1; + }else + UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.nb_ssbri_cri= 2; + + if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == UE_info->csi_report_template[UE_id][csi_report_id].reportQuantity_type) { + for ( csi_ssb_idx = 0; csi_ssb_idx < csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.count; csi_ssb_idx++) { + if (csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceSetId == + *(csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.array[0])){ + + ///We can configure only one SSB resource set from spec 38.331 IE CSI-ResourceConfig + nb_ssb_resources= csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceList.list.count; + UE_info->csi_report_template[UE_id][csi_report_id].SSB_Index_list = csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceList.list.array; + UE_info->csi_report_template[UE_id][csi_report_id].CSI_Index_list = NULL; + } + break; + } + } else /*if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == UE_info->csi_report_template[UE_id][csi_report_id].reportQuantity_type)*/{ + for ( csi_ssb_idx = 0; csi_ssb_idx < csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.count; csi_ssb_idx++) { + if (csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_ResourceSetId == + *(csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.array[0])) { + + ///For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 for spec 38.212 + nb_ssb_resources= csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_RS_Resources.list.count; + UE_info->csi_report_template[UE_id][csi_report_id].CSI_Index_list = csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_RS_Resources.list.array; + UE_info->csi_report_template[UE_id][csi_report_id].SSB_Index_list = NULL; + } + break; + } + } + + if (nb_ssb_resources) { + UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.cri_ssbri_bitlen =ceil(log2 (nb_ssb_resources)); + UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.rsrp_bitlen = 7; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP + UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.diff_rsrp_bitlen =4; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP + } else { + UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.cri_ssbri_bitlen =0; + UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.rsrp_bitlen = 0; + UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.diff_rsrp_bitlen =0; + } + + LOG_I (MAC, "UCI: CSI_bit len : ssbri %d, rsrp: %d, diff_rsrp: %d", + UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.cri_ssbri_bitlen, + UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.rsrp_bitlen, + UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.diff_rsrp_bitlen); } - if (0 != UE_info->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report){ - uint8_t nb_ssb_resources =0; + uint8_t ri_restriction; + uint8_t ri_bitlen; + uint8_t nb_allowed_ri; + uint8_t max_ri; + + if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI == reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI==reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_CQI==reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_i1_CQI==reportQuantity_type|| + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_i1==reportQuantity_type){ + for ( csi_ssb_idx = 0; csi_ssb_idx < csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.count; csi_ssb_idx++) { - if (csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceSetId == - *(csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.array[0])) { - ///We can configure only one SSB resource set from spec 38.331 IE CSI-ResourceConfig - if (NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled == - csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->groupBasedBeamReporting.present ) { - if (NULL != csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->groupBasedBeamReporting.choice.disabled->nrofReportedRS) - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].nb_ssbri_cri = *(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->groupBasedBeamReporting.choice.disabled->nrofReportedRS)+1; - else - /*! From Spec 38.331 - * nrofReportedRS - * The number (N) of measured RS resources to be reported per report setting in a non-group-based report. N <= N_max, where N_max is either 2 or 4 depending on UE - * capability. FFS: The signaling mechanism for the gNB to select a subset of N beams for the UE to measure and report. - * When the field is absent the UE applies the value 1 - */ - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].nb_ssbri_cri= 1; - } else - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].nb_ssbri_cri= 2; + if (csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_ResourceSetId == + *(csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.array[0])) { ///For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 for spec 38.212 - nb_ssb_resources= csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceList.list.count; - if (nb_ssb_resources){ - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen =ceil(log2 (nb_ssb_resources)); - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].rsrp_bitlen = 7; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen =4; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP - } - else{ - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen =0; - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].rsrp_bitlen = 0; - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen =0; - } + nb_ssb_resources= csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_RS_Resources.list.count; + UE_info->csi_report_template[UE_id][csi_report_id].CSI_Index_list = csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_RS_Resources.list.array; + UE_info->csi_report_template[UE_id][csi_report_id].SSB_Index_list = NULL; + } + break; + } + UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.cri_bitlen=ceil(log2 (nb_ssb_resources)); - LOG_I (MAC, "UCI: CSI_bit len : ssbri %d, rsrp: %d, diff_rsrp: %d\n", - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen, - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].rsrp_bitlen, - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen); - break ; + if (NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel== + csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.present){ + + switch (RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts) { + case 1:; + UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.ri_bitlen=0; + break; + case 2: + /* From Spec 38.212 + * If the higher layer parameter nrofCQIsPerReport=1, nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator + * values in the 4 LSBs of the higher layer parameter typeI-SinglePanel-ri-Restriction according to Subclause 5.2.2.2.1 [6, + * TS 38.214]; otherwise nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator values according to Subclause + * 5.2.2.2.1 [6, TS 38.214]. + * + * But from Current RRC ASN structures nrofCQIsPerReport is not present. Present a dummy variable is present so using it to + * calculate RI for antennas equal or more than two. + * */ + AssertFatal (NULL!=csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->dummy, "nrofCQIsPerReport is not present"); + + ri_restriction = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.buf[0]; + + /* Replace dummy with the nrofCQIsPerReport from the CSIreport + config when equalent ASN structure present */ + if (0==*(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->dummy)){ + nb_allowed_ri = number_of_bits_set((ri_restriction & 0xf0), &max_ri); + ri_bitlen = ceil(log2(nb_allowed_ri)); + } + else{ + nb_allowed_ri = number_of_bits_set(ri_restriction, &max_ri); + ri_bitlen = ceil(log2(nb_allowed_ri)); + } + ri_bitlen = ri_bitlen<1?ri_bitlen:1; //from the spec 38.212 and table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel + UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.ri_bitlen=ri_bitlen; + break; + case 4: + AssertFatal (NULL!=csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->dummy, "nrofCQIsPerReport is not present"); + + ri_restriction = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.buf[0]; + + /* Replace dummy with the nrofCQIsPerReport from the CSIreport + config when equalent ASN structure present */ + if (0==*(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->dummy)){ + nb_allowed_ri = number_of_bits_set((ri_restriction & 0xf0), &max_ri); + ri_bitlen = ceil(log2(nb_allowed_ri)); + } + else{ + nb_allowed_ri = number_of_bits_set(ri_restriction,&max_ri); + ri_bitlen = ceil(log2(nb_allowed_ri)); + } + ri_bitlen = ri_bitlen<2?ri_bitlen:2; //from the spec 38.212 and table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel + UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.ri_bitlen=ri_bitlen; + break; + case 6: + case 8: + AssertFatal (NULL!=csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->dummy, "nrofCQIsPerReport is not present"); + + ri_restriction = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.buf[0]; + + /* Replace dummy with the nrofCQIsPerReport from the CSIreport + config when equalent ASN structure present */ + if (0==*(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->dummy)){ + nb_allowed_ri = number_of_bits_set((ri_restriction & 0xf0),&max_ri); + ri_bitlen = ceil(log2(nb_allowed_ri)); + } + else{ + nb_allowed_ri = number_of_bits_set(ri_restriction, &max_ri); + ri_bitlen = ceil(log2(nb_allowed_ri)); + } + //ri_bitlen = ri_bitlen<1?ri_bitlen:1; //from the spec 38.212 and table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel + UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.ri_bitlen=ri_bitlen; + break; + default: + //UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.ri_bitlen=0; + AssertFatal(RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts>8,"Number of antennas %d are out of range", RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts); + } + } + UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.li_bitlen=0; + UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.cqi_bitlen=0; + UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.pmi_x1_bitlen=0; + UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.pmi_x2_bitlen=0; + } + + if( NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI==reportQuantity_type ){ + if (NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel== + csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.present){ + + switch (RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts) { + case 1:; + UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.li_bitlen=0; + break; + case 2: + case 4: + case 6: + case 8: + /* From Spec 38.212 + * If the higher layer parameter nrofCQIsPerReport=1, nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator + * values in the 4 LSBs of the higher layer parameter typeI-SinglePanel-ri-Restriction according to Subclause 5.2.2.2.1 [6, + * TS 38.214]; otherwise nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator values according to Subclause + * 5.2.2.2.1 [6, TS 38.214]. + * + * But from Current RRC ASN structures nrofCQIsPerReport is not present. Present a dummy variable is present so using it to + * calculate RI for antennas equal or more than two. + * */ + //! TODO: The bit length of LI is as follows LI = log2(RI), Need to confirm wheather we should consider maximum RI can be reported from ri_restricted + // or we should consider reported RI. If we need to consider reported RI for calculating LI bit length then we need to modify the code. + UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.li_bitlen=ceil(log2(max_ri))<2?ceil(log2(max_ri)):2; + break; + default: + AssertFatal(RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts>8,"Number of antennas %d are out of range", RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts); + } + } + } + + if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI == reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI==reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_CQI==reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_i1_CQI==reportQuantity_type){ + + switch (RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts){ + case 1: + case 2: + case 4: + case 6: + case 8: + /* From Spec 38.212 + * If the higher layer parameter nrofCQIsPerReport=1, nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator + * values in the 4 LSBs of the higher layer parameter typeI-SinglePanel-ri-Restriction according to Subclause 5.2.2.2.1 [6, + * TS 38.214]; otherwise nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator values according to Subclause + * 5.2.2.2.1 [6, TS 38.214]. + * + * But from Current RRC ASN structures nrofCQIsPerReport is not present. Present a dummy variable is present so using it to + * calculate RI for antennas equal or more than two. + * */ + + if (max_ri > 4 && max_ri < 8){ + if (NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel== + csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.present){ + if (NR_CSI_ReportConfig__reportFreqConfiguration__cqi_FormatIndicator_widebandCQI== + csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportFreqConfiguration->cqi_FormatIndicator) + UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.cqi_bitlen = 8; + else + UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.cqi_bitlen = 4; + } + }else{ //This condition will work even for type1-multipanel. + if (NR_CSI_ReportConfig__reportFreqConfiguration__cqi_FormatIndicator_widebandCQI== + csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportFreqConfiguration->cqi_FormatIndicator) + UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.cqi_bitlen = 4; + else + UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.cqi_bitlen = 2; + } + break; + default: + AssertFatal(RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts>8,"Number of antennas %d are out of range", RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts); + } + } + if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI == reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI==reportQuantity_type){ + if (NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel== + csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.present){ + switch (csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.present){ + case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_two: + if (max_ri ==1) + UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.pmi_x1_bitlen = 2; + else if (max_ri ==2) + UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.pmi_x1_bitlen = 1; + break; + default: + AssertFatal(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.present!= + NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_two, + "Not handled Yet %d", csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.present); + break; } } } - if (0 != UE_info->csi_report_template[UE_id][csi_report_id].nb_of_nzp_csi_report) - AssertFatal(1==0,"Currently configuring only SSB beamreporting."); break; } } @@ -181,12 +456,27 @@ void compute_csi_bitlen (NR_CellGroupConfig_t *secondaryCellGroup, NR_UE_info_t } -uint16_t nr_get_csi_bitlen(const nr_csi_report_t *csi_report) -{ - const CRI_SSBRI_RSRP_bitlen_t *bitlen = &csi_report->CSI_report_bitlen[0]; - return bitlen->cri_ssbri_bitlen * bitlen->nb_ssbri_cri - + bitlen->rsrp_bitlen - + bitlen->diff_rsrp_bitlen * (bitlen->nb_ssbri_cri - 1) * csi_report->nb_of_csi_ssb_report; +uint16_t nr_get_csi_bitlen(int Mod_idP, + int UE_id, + uint8_t csi_report_id) { + + uint16_t csi_bitlen =0; + NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; + L1_RSRP_bitlen_t * CSI_report_bitlen = NULL; + CSI_Meas_bitlen_t * csi_meas_bitlen = NULL; + + if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP==UE_info->csi_report_template[UE_id][csi_report_id].reportQuantity_type|| + NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP==UE_info->csi_report_template[UE_id][csi_report_id].reportQuantity_type){ + CSI_report_bitlen = &(UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen); //This might need to be moodif for Aperiodic CSI-RS measurements + csi_bitlen+= ((CSI_report_bitlen->cri_ssbri_bitlen * CSI_report_bitlen->nb_ssbri_cri) + + CSI_report_bitlen->rsrp_bitlen +(CSI_report_bitlen->diff_rsrp_bitlen * + (CSI_report_bitlen->nb_ssbri_cri -1 )));//*UE_info->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report); + } else{ + csi_meas_bitlen = &(UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen); //This might need to be moodif for Aperiodic CSI-RS measurements + csi_bitlen+= (csi_meas_bitlen->cri_bitlen +csi_meas_bitlen->ri_bitlen+csi_meas_bitlen->li_bitlen+csi_meas_bitlen->cqi_bitlen+csi_meas_bitlen->pmi_x1_bitlen+csi_meas_bitlen->pmi_x2_bitlen); + } + + return csi_bitlen; } @@ -431,7 +721,99 @@ void handle_nr_uci_pucch_2_3_4(module_id_t mod_id, if (uci_pdu -> pduBitmap & 0x08) { ///Handle CSI Report 2 } +} +void nr_rx_acknack(nfapi_nr_uci_pusch_pdu_t *uci_pusch, + nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_01, + nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_234, + NR_UL_IND_t *UL_info, NR_UE_sched_ctrl_t *sched_ctrl, NR_mac_stats_t *stats) { + + // TODO + int max_harq_rounds = 4; // TODO define macro + + if (uci_01 != NULL) { + // handle harq + int harq_idx_s = 0; + + // iterate over received harq bits + for (int harq_bit = 0; harq_bit < uci_01->harq->num_harq; harq_bit++) { + // search for the right harq process + for (int harq_idx = harq_idx_s; harq_idx < NR_MAX_NB_HARQ_PROCESSES; harq_idx++) { + // if the gNB received ack with a good confidence + if ((UL_info->slot-1) == sched_ctrl->harq_processes[harq_idx].feedback_slot) { + if ((uci_01->harq->harq_list[harq_bit].harq_value == 1) && + (uci_01->harq->harq_confidence_level == 0)) { + // toggle NDI and reset round + sched_ctrl->harq_processes[harq_idx].ndi ^= 1; + sched_ctrl->harq_processes[harq_idx].round = 0; + } + else + sched_ctrl->harq_processes[harq_idx].round++; + sched_ctrl->harq_processes[harq_idx].is_waiting = 0; + harq_idx_s = harq_idx + 1; + // if the max harq rounds was reached + if (sched_ctrl->harq_processes[harq_idx].round == max_harq_rounds) { + sched_ctrl->harq_processes[harq_idx].ndi ^= 1; + sched_ctrl->harq_processes[harq_idx].round = 0; + stats->dlsch_errors++; + } + break; + } + // if feedback slot processing is aborted + else if (((UL_info->slot-1) > sched_ctrl->harq_processes[harq_idx].feedback_slot) && + (sched_ctrl->harq_processes[harq_idx].is_waiting)) { + sched_ctrl->harq_processes[harq_idx].round++; + if (sched_ctrl->harq_processes[harq_idx].round == max_harq_rounds) { + sched_ctrl->harq_processes[harq_idx].ndi ^= 1; + sched_ctrl->harq_processes[harq_idx].round = 0; + } + sched_ctrl->harq_processes[harq_idx].is_waiting = 0; + } + } + } + } + + if (uci_234 != NULL) { + int harq_idx_s = 0; + int acknack; + + // iterate over received harq bits + for (int harq_bit = 0; harq_bit < uci_234->harq.harq_bit_len; harq_bit++) { + acknack = ((uci_234->harq.harq_payload[harq_bit>>3])>>harq_bit)&0x01; + for (int harq_idx = harq_idx_s; harq_idx < NR_MAX_NB_HARQ_PROCESSES-1; harq_idx++) { + // if the gNB received ack with a good confidence or if the max harq rounds was reached + if ((UL_info->slot-1) == sched_ctrl->harq_processes[harq_idx].feedback_slot) { + // TODO add some confidence level for when there is no CRC + if ((uci_234->harq.harq_crc != 1) && acknack) { + // toggle NDI and reset round + sched_ctrl->harq_processes[harq_idx].ndi ^= 1; + sched_ctrl->harq_processes[harq_idx].round = 0; + } + else + sched_ctrl->harq_processes[harq_idx].round++; + sched_ctrl->harq_processes[harq_idx].is_waiting = 0; + harq_idx_s = harq_idx + 1; + // if the max harq rounds was reached + if (sched_ctrl->harq_processes[harq_idx].round == max_harq_rounds) { + sched_ctrl->harq_processes[harq_idx].ndi ^= 1; + sched_ctrl->harq_processes[harq_idx].round = 0; + stats->dlsch_errors++; + } + break; + } + // if feedback slot processing is aborted + else if (((UL_info->slot-1) > sched_ctrl->harq_processes[harq_idx].feedback_slot) && + (sched_ctrl->harq_processes[harq_idx].is_waiting)) { + sched_ctrl->harq_processes[harq_idx].round++; + if (sched_ctrl->harq_processes[harq_idx].round == max_harq_rounds) { + sched_ctrl->harq_processes[harq_idx].ndi ^= 1; + sched_ctrl->harq_processes[harq_idx].round = 0; + } + sched_ctrl->harq_processes[harq_idx].is_waiting = 0; + } + } + } + } } @@ -762,5 +1144,398 @@ uint16_t compute_pucch_prb_size(uint8_t format, else{ AssertFatal(1==0,"Not yet implemented"); } - } + + +//identifies the target SSB Beam index +//keeps the required date for PDCCH and PDSCH TCI state activation/deactivation CE consutruction globally +//handles triggering of PDCCH and PDSCH MAC CEs +void tci_handling(module_id_t Mod_idP, int UE_id, int CC_id, NR_UE_sched_ctrl_t *sched_ctrl, frame_t frame, slot_t slot) { + + int strongest_ssb_rsrp = 0; + int cqi_idx = 0; + int curr_ssb_beam_index = 0; //ToDo: yet to know how to identify the serving ssb beam index + uint8_t target_ssb_beam_index = curr_ssb_beam_index; + //uint8_t max_reported_RSRP = 16; + //int serving_SSB_Beam_RSRP; + uint8_t is_triggering_ssb_beam_switch =0; + uint8_t ssb_idx = 0; + int pdsch_bwp_id =0; + int ssb_index[MAX_NUM_SSB] = {0}; + int ssb_rsrp[MAX_NUM_SSB] = {0}; + uint8_t idx = 0; + int bwp_id = 1; + NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; + //NR_COMMON_channels_t *cc = RC.nrmac[Mod_idP]->common_channels; + NR_CellGroupConfig_t *secondaryCellGroup = UE_info->secondaryCellGroup[UE_id]; + NR_BWP_Downlink_t *bwp = secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1]; + //NR_CSI_MeasConfig_t *csi_MeasConfig = UE_info->secondaryCellGroup[UE_id]->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup; + //bwp indicator + int n_dl_bwp = secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count; + uint8_t nr_ssbri_cri = 0; + uint8_t nb_of_csi_ssb_report = UE_info->csi_report_template[UE_id][cqi_idx].nb_of_csi_ssb_report; + //uint8_t bitlen_ssbri = log (nb_of_csi_ssb_report)/log (2); + //uint8_t max_rsrp_reported = -1; + int better_rsrp_reported = -140-(-0); /*minimum_measured_RSRP_value - minimum_differntail_RSRP_value*///considering the minimum RSRP value as better RSRP initially + uint8_t diff_rsrp_idx = 0; + uint8_t i, j; + + if (n_dl_bwp < 4) + pdsch_bwp_id = bwp_id; + else + pdsch_bwp_id = bwp_id - 1; // as per table 7.3.1.1.2-1 in 38.212 + + /*Example: + CRI_SSBRI: 1 2 3 4| 5 6 7 8| 9 10 1 2| + nb_of_csi_ssb_report = 3 //3 sets as above + nr_ssbri_cri = 4 //each set has 4 elements + storing ssb indexes in ssb_index array as ssb_index[0] = 1 .. ssb_index[4] = 5 + ssb_rsrp[0] = strongest rsrp in first set, ssb_rsrp[4] = strongest rsrp in second set, .. + idx: resource set index + */ + + //for all reported SSB + for (idx = 0; idx < nb_of_csi_ssb_report; idx++) { + nr_ssbri_cri = sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri; + //if group based beam Reporting is disabled + /*if(NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled == + csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.present ) {*/ + //extracting the ssb indexes + for (ssb_idx = 0; ssb_idx < nr_ssbri_cri; ssb_idx++) { + ssb_index[idx * nb_of_csi_ssb_report + ssb_idx] = sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI[ssb_idx]; + } + + //if strongest measured RSRP is configured + strongest_ssb_rsrp = get_measured_rsrp(sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP); + ssb_rsrp[idx * nb_of_csi_ssb_report] = strongest_ssb_rsrp; + LOG_I(MAC,"ssb_rsrp = %d\n",strongest_ssb_rsrp); + + //if current ssb rsrp is greater than better rsrp + if(ssb_rsrp[idx * nb_of_csi_ssb_report] > better_rsrp_reported) { + better_rsrp_reported = ssb_rsrp[idx * nb_of_csi_ssb_report]; + target_ssb_beam_index = idx * nb_of_csi_ssb_report; + } + + for(diff_rsrp_idx =1; diff_rsrp_idx < nr_ssbri_cri; diff_rsrp_idx++) { + ssb_rsrp[idx * nb_of_csi_ssb_report + diff_rsrp_idx] = get_diff_rsrp(sched_ctrl->CSI_report[idx].choice.ssb_cri_report.diff_RSRP[diff_rsrp_idx-1], strongest_ssb_rsrp); + + //if current reported rsrp is greater than better rsrp + if(ssb_rsrp[idx * nb_of_csi_ssb_report + diff_rsrp_idx] > better_rsrp_reported) { + better_rsrp_reported = ssb_rsrp[idx * nb_of_csi_ssb_report + diff_rsrp_idx]; + target_ssb_beam_index = idx * nb_of_csi_ssb_report + diff_rsrp_idx; + } + } +#if 0 + //} + //if group based beam reporting is enabled + else if (NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled != + csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.present ) { + //extracting the ssb indexes + //for group based reporting only 2 SSB RS are reported, 38.331 + for (ssb_idx = 0; ssb_idx < 2; ssb_idx++) { + ssb_index[idx * nb_of_csi_ssb_report + ssb_idx] = sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.CRI_SSBRI[ssb_idx]; + } + + strongest_ssb_rsrp = get_measured_rsrp(sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.RSRP); + ssb_rsrp[idx * nb_of_csi_ssb_report] = strongest_ssb_rsrp; + + if(ssb_rsrp[idx * nb_of_csi_ssb_report] > better_rsrp_reported) { + better_rsrp_reported = ssb_rsrp[idx * nb_of_csi_ssb_report]; + target_ssb_beam_index = idx * nb_of_csi_ssb_report; + } + + ssb_rsrp[idx * nb_of_csi_ssb_report + 1] = get_diff_rsrp(sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.diff_RSRP[diff_rsrp_idx], strongest_ssb_rsrp); + + if(ssb_rsrp[idx * nb_of_csi_ssb_report + 1] > better_rsrp_reported) { + better_rsrp_reported = ssb_rsrp[idx * nb_of_csi_ssb_report + 1]; + target_ssb_beam_index = idx * nb_of_csi_ssb_report + 1; + } + } +#endif + } + + + if(ssb_index[target_ssb_beam_index] != ssb_index[curr_ssb_beam_index] && ssb_rsrp[target_ssb_beam_index] > ssb_rsrp[curr_ssb_beam_index]) { + if( ssb_rsrp[target_ssb_beam_index] - ssb_rsrp[curr_ssb_beam_index] > L1_RSRP_HYSTERIS) { + is_triggering_ssb_beam_switch = 1; + LOG_I(MAC, "Triggering ssb beam switching using tci\n"); + } + } + + if(is_triggering_ssb_beam_switch) { + //filling pdcch tci state activativation mac ce structure fields + sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.is_scheduled = 1; + //OAI currently focusing on Non CA usecase hence 0 is considered as serving + //cell id + sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.servingCellId = 0; //0 for PCell as 38.331 v15.9.0 page 353 //serving cell id for which this MAC CE applies + sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.coresetId = 0; //coreset id for which the TCI State id is being indicated + + /* 38.321 v15.8.0 page 66 + TCI State ID: This field indicates the TCI state identified by TCI-StateId as specified in TS 38.331 [5] applicable + to the Control Resource Set identified by CORESET ID field. + If the field of CORESET ID is set to 0, + this field indicates a TCI-StateId for a TCI state of the first 64 TCI-states configured by tci-States-ToAddModList and tciStates-ToReleaseList in the PDSCH-Config in the active BWP. + If the field of CORESET ID is set to the other value than 0, + this field indicates a TCI-StateId configured by tci-StatesPDCCH-ToAddList and tciStatesPDCCH-ToReleaseList in the controlResourceSet identified by the indicated CORESET ID. + The length of the field is 7 bits + */ + if(sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.coresetId == 0) { + int tci_state_id = checkTargetSSBInFirst64TCIStates_pdschConfig(ssb_index[target_ssb_beam_index], Mod_idP, UE_id); + + if( tci_state_id != -1) + sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.tciStateId = tci_state_id; + else { + //identify the best beam within first 64 TCI States of PDSCH + //Config TCI-states-to-addModList + int flag = 0; + + for(i =0; ssb_index_sorted[i]!=0; i++) { + tci_state_id = checkTargetSSBInFirst64TCIStates_pdschConfig(ssb_index_sorted[i], Mod_idP, UE_id) ; + + if(tci_state_id != -1 && ssb_rsrp_sorted[i] > ssb_rsrp[curr_ssb_beam_index] && ssb_rsrp_sorted[i] - ssb_rsrp[curr_ssb_beam_index] > L1_RSRP_HYSTERIS) { + sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.tciStateId = tci_state_id; + flag = 1; + break; + } + } + + if(flag == 0 || ssb_rsrp_sorted[i] < ssb_rsrp[curr_ssb_beam_index] || ssb_rsrp_sorted[i] - ssb_rsrp[curr_ssb_beam_index] < L1_RSRP_HYSTERIS) { + sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.is_scheduled = 0; + } + } + } else { + int tci_state_id = checkTargetSSBInTCIStates_pdcchConfig(ssb_index[target_ssb_beam_index], Mod_idP, UE_id); + + if (tci_state_id !=-1) + sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.tciStateId = tci_state_id; + else { + //identify the best beam within CORESET/PDCCH + ////Config TCI-states-to-addModList + int flag = 0; + + for(i =0; ssb_index_sorted[i]!=0; i++) { + tci_state_id = checkTargetSSBInTCIStates_pdcchConfig(ssb_index_sorted[i], Mod_idP, UE_id); + + if( tci_state_id != -1 && ssb_rsrp_sorted[i] > ssb_rsrp[curr_ssb_beam_index] && ssb_rsrp_sorted[i] - ssb_rsrp[curr_ssb_beam_index] > L1_RSRP_HYSTERIS) { + sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.tciStateId = tci_state_id; + flag = 1; + break; + } + } + + if(flag == 0 || ssb_rsrp_sorted[i] < ssb_rsrp[curr_ssb_beam_index] || ssb_rsrp_sorted[i] - ssb_rsrp[curr_ssb_beam_index] < L1_RSRP_HYSTERIS) { + sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.is_scheduled = 0; + } + } + } + + sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.tci_present_inDCI = bwp->bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList->list.array[bwp_id-1]->tci_PresentInDCI; + + //filling pdsch tci state activation deactivation mac ce structure fields + if(sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.tci_present_inDCI) { + sched_ctrl->UE_mac_ce_ctrl.pdsch_TCI_States_ActDeact.is_scheduled = 1; + /* + Serving Cell ID: This field indicates the identity of the Serving Cell for which the MAC CE applies + Considering only PCell exists. Serving cell index of PCell is always 0, hence configuring 0 + */ + sched_ctrl->UE_mac_ce_ctrl.pdsch_TCI_States_ActDeact.servingCellId = 0; + /* + BWP ID: This field indicates a DL BWP for which the MAC CE applies as the codepoint of the DCI bandwidth + part indicator field as specified in TS 38.212 + */ + sched_ctrl->UE_mac_ce_ctrl.pdsch_TCI_States_ActDeact.bwpId = pdsch_bwp_id; + + /* + * TODO ssb_rsrp_sort() API yet to code to find 8 best beams, rrc configuration + * is required + */ + for(i = 0; i<8; i++) { + sched_ctrl->UE_mac_ce_ctrl.pdsch_TCI_States_ActDeact.tciStateActDeact[i] = i; + } + + sched_ctrl->UE_mac_ce_ctrl.pdsch_TCI_States_ActDeact.highestTciStateActivated = 8; + + for(i = 0, j =0; iUE_mac_ce_ctrl.pdsch_TCI_States_ActDeact.tciStateActDeact[i]) { + sched_ctrl->UE_mac_ce_ctrl.pdsch_TCI_States_ActDeact.codepoint[j] = i; + j++; + } + } + }//tci_presentInDCI + }//is-triggering_beam_switch +}//tci handling + + +//returns the measured RSRP value (upper limit) +int get_measured_rsrp(uint8_t index) { + //if index is invalid returning minimum rsrp -140 + if((index >= 0 && index <= 15) || index >= 114) + return MIN_RSRP_VALUE; + + return L1_SSB_CSI_RSRP_measReport_mapping_38133_10_1_6_1_1[index]; +} + + +//returns the differential RSRP value (upper limit) +int get_diff_rsrp(uint8_t index, int strongest_rsrp) { + if(strongest_rsrp != -1) { + return strongest_rsrp + diff_rsrp_ssb_csi_meas_10_1_6_1_2[index]; + } else + return MIN_RSRP_VALUE; +} + + +void reverse_n_bits(uint8_t *value, uint16_t bitlen) { + uint16_t j; + uint8_t i; + for(j = bitlen - 1,i = 0; j > i; j--, i++) { + if(((*value>>j)&1) != ((*value>>i)&1)) { + *value ^= (1<csi_part1.csi_part1_bit_len)/8); + uint8_t *payload = calloc (payload_size, sizeof(uint8_t)); + NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type = NR_CSI_ReportConfig__reportQuantity_PR_NOTHING; + NR_UE_info_t *UE_info = &(RC.nrmac[Mod_idP]->UE_info); + uint8_t csi_report_id = 0; + + memcpy ( payload, uci_pdu->csi_part1.csi_part1_payload, payload_size); + + + UE_info->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report = 0; + for ( csi_report_id =0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++ ) { + //Assuming in periodic reporting for one slot can be configured with only one CSI-ReportConfig + // if (csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.present == NR_CSI_ReportConfig__reportConfigType_PR_periodic) { + //Has to implement according to reportSlotConfig type + /*reportQuantity must be considered according to the current scheduled + CSI-ReportConfig if multiple CSI-ReportConfigs present*/ + reportQuantity_type = UE_info->csi_report_template[UE_id][csi_report_id].reportQuantity_type; + LOG_I(PHY,"SFN/SF:%d%d reportQuantity type = %d\n",frame,slot,reportQuantity_type); + + if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == reportQuantity_type) { + uint8_t csi_ssb_idx = 0; + uint8_t diff_rsrp_idx = 0; + uint8_t cri_ssbri_bitlen = UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.cri_ssbri_bitlen; + + /*! As per the spec 38.212 and table: 6.3.1.1.2-12 in a single UCI sequence we can have multiple CSI_report + * the number of CSI_report will depend on number of CSI resource sets that are configured in CSI-ResourceConfig RRC IE + * From spec 38.331 from the IE CSI-ResourceConfig for SSB RSRP reporting we can configure only one resource set + * From spec 38.214 section 5.2.1.2 For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 + */ + + /** from 38.214 sec 5.2.1.4.2 + - if the UE is configured with the higher layer parameter groupBasedBeamReporting set to 'disabled', the UE is + not required to update measurements for more than 64 CSI-RS and/or SSB resources, and the UE shall report in + a single report nrofReportedRS (higher layer configured) different CRI or SSBRI for each report setting + + - if the UE is configured with the higher layer parameter groupBasedBeamReporting set to 'enabled', the UE is not + required to update measurements for more than 64 CSI-RS and/or SSB resources, and the UE shall report in a + single reporting instance two different CRI or SSBRI for each report setting, where CSI-RS and/or SSB + resources can be received simultaneously by the UE either with a single spatial domain receive filter, or with + multiple simultaneous spatial domain receive filter + */ + + idx = 0; //Since for SSB RSRP reporting in RRC can configure only one ssb resource set per one report config + sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri = UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.nb_ssbri_cri; + + for (csi_ssb_idx = 0; csi_ssb_idx < sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri ; csi_ssb_idx++) { + if(cri_ssbri_bitlen > 1) + reverse_n_bits(payload, cri_ssbri_bitlen); + + if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type) + sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx] = + *(UE_info->csi_report_template[UE_id][csi_report_id].SSB_Index_list[cri_ssbri_bitlen>0?((*payload)&~(~1<<(cri_ssbri_bitlen-1))):cri_ssbri_bitlen]); + else + sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx] = + *(UE_info->csi_report_template[UE_id][csi_report_id].CSI_Index_list[cri_ssbri_bitlen>0?((*payload)&~(~1<<(cri_ssbri_bitlen-1))):cri_ssbri_bitlen]); + + *payload >>= cri_ssbri_bitlen; + LOG_I(PHY,"SSB_index = %d",sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx]); + } + + reverse_n_bits(payload, 7); + sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP = (*payload) & 0x7f; + *payload >>= 7; + + for ( diff_rsrp_idx =0; diff_rsrp_idx < sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri - 1; diff_rsrp_idx++ ) { + reverse_n_bits(payload,4); + sched_ctrl->CSI_report[idx].choice.ssb_cri_report.diff_RSRP[diff_rsrp_idx] = (*payload) & 0x0f; + *payload >>= 4; + } + UE_info->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report++; + LOG_I(MAC,"csi_payload size = %d, rsrp_id = %d\n",payload_size, sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP); + } + } + + if ( !(reportQuantity_type)) + AssertFatal(reportQuantity_type, "reportQuantity is not configured"); + + +#if 0 + + if ( NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI == reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_i1 == reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_i1_CQI == reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_CQI == reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI== reportQuantity_type) { + // Handling of extracting cri + sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report.cri = calloc ( 1, ceil(bitlen_cri/8)); + *(sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report.cri) = *((uint32_t *)payload) & ~(~1<<(bitlen_cri-1)); + *payload >>= bitlen_cri; + + if ( 1 == RC.nrrrc[gnb_mod_idP]->carrier.pdsch_AntennaPorts ) { + /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ + sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report->ri = NULL; + } else { + //Handling for the ri for multiple csi ports + } + } + + if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI== reportQuantity_type) { + if ( 1 == RC.nrrrc[gnb_mod_idP]->carrier.pdsch_AntennaPorts ) + /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ + sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report->li = NULL; + else { + //Handle for li for multiple CSI ports + } + } + + //TODO: check for zero padding if available shift payload to the number of zero padding bits + + if ( NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI == reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI== reportQuantity_type) { + if ( 1 == RC.nrrrc[gnb_mod_idP]->carrier.pdsch_AntennaPorts ) { + /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ + sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report->pmi_x1 = NULL; + sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report->pmi_x2 = NULL; + } + } + + if ( NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI == reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_i1_CQI == reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_CQI == reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI== reportQuantity_type) { + /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ + *(sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report->cqi) = *(payload) & 0x0f; + *(payload) >>= 4; + } + +#endif +} + + +>>>>>>> uci mac functions in a new file From 17f830e587f003bc299c6ce152d57e9aa68fbd40 Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Fri, 20 Nov 2020 14:06:56 +0100 Subject: [PATCH 135/231] revert to old rrc csi confriguration --- openair2/RRC/NR/rrc_gNB_reconfig.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index a235729663..8cec354eba 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -1173,15 +1173,14 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco csires0->csi_ResourceConfigId=0; csires0->csi_RS_ResourceSetList.present = NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB; csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB = calloc(1,sizeof(*csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB)); - csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList = calloc(1,sizeof(*csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList)); - //For verification of CSI measurement adding the ssb resource set list + csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList = NULL; //calloc(1,sizeof(*csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList)); csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList = calloc(1,sizeof(*csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList));//NULL; - NR_NZP_CSI_RS_ResourceSetId_t *csires00 = calloc(1,sizeof(*csires00)); + //NR_NZP_CSI_RS_ResourceSetId_t *csires00 = calloc(1,sizeof(*csires00)); //For verification of CSI measurment for SSB NR_CSI_SSB_ResourceSetId_t *ssbres00 = calloc(1,sizeof(*ssbres00)); - *csires00 = 0; + //*csires00 = 0; *ssbres00 = 0; - ASN_SEQUENCE_ADD(&csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list,csires00); + //ASN_SEQUENCE_ADD(&csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list,csires00); ASN_SEQUENCE_ADD(&csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list,ssbres00); csires0->bwp_Id = 1; csires0->resourceType = NR_CSI_ResourceConfig__resourceType_periodic; From cfdfd789b0124102d02db332bba759bdd7fc493d Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Fri, 20 Nov 2020 14:33:21 +0100 Subject: [PATCH 136/231] some code cleanup in csi_bitlen --- .../LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 65 +++++++++---------- 1 file changed, 30 insertions(+), 35 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index 38a0d46f20..4bfb34f5f8 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -182,12 +182,14 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in NR_CSI_ResourceConfigId_t csi_ResourceConfigId; for (csi_report_id=0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++){ - csi_ResourceConfigId=csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->resourcesForChannelMeasurement; - reportQuantity_type = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportQuantity.present; + struct NR_CSI_ReportConfig *csi_reportconfig = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]; + csi_ResourceConfigId=csi_reportconfig->resourcesForChannelMeasurement; + reportQuantity_type = csi_reportconfig->reportQuantity.present; UE_info->csi_report_template[UE_id][csi_report_id].reportQuantity_type = reportQuantity_type; for ( csi_resourceidx = 0; csi_resourceidx < csi_MeasConfig->csi_ResourceConfigToAddModList->list.count; csi_resourceidx++) { - if ( csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_ResourceConfigId != csi_ResourceConfigId) + struct NR_CSI_ResourceConfig *csi_resourceconfig = csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]; + if ( csi_resourceconfig->csi_ResourceConfigId != csi_ResourceConfigId) continue; else { uint8_t nb_ssb_resources =0; @@ -195,10 +197,9 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == reportQuantity_type || NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type) { - if (NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled == - csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->groupBasedBeamReporting.present ) { - if (NULL != csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->groupBasedBeamReporting.choice.disabled->nrofReportedRS) - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.nb_ssbri_cri = *(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->groupBasedBeamReporting.choice.disabled->nrofReportedRS)+1; + if (NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled == csi_reportconfig->groupBasedBeamReporting.present) { + if (NULL != csi_reportconfig->groupBasedBeamReporting.choice.disabled->nrofReportedRS) + UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.nb_ssbri_cri = *(csi_reportconfig->groupBasedBeamReporting.choice.disabled->nrofReportedRS)+1; else /*! From Spec 38.331 * nrofReportedRS @@ -213,7 +214,7 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == UE_info->csi_report_template[UE_id][csi_report_id].reportQuantity_type) { for ( csi_ssb_idx = 0; csi_ssb_idx < csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.count; csi_ssb_idx++) { if (csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceSetId == - *(csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.array[0])){ + *(csi_resourceconfig->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.array[0])){ ///We can configure only one SSB resource set from spec 38.331 IE CSI-ResourceConfig nb_ssb_resources= csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceList.list.count; @@ -225,7 +226,7 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in } else /*if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == UE_info->csi_report_template[UE_id][csi_report_id].reportQuantity_type)*/{ for ( csi_ssb_idx = 0; csi_ssb_idx < csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.count; csi_ssb_idx++) { if (csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_ResourceSetId == - *(csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.array[0])) { + *(csi_resourceconfig->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.array[0])) { ///For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 for spec 38.212 nb_ssb_resources= csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_RS_Resources.list.count; @@ -265,8 +266,8 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in for ( csi_ssb_idx = 0; csi_ssb_idx < csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.count; csi_ssb_idx++) { if (csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_ResourceSetId == - *(csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.array[0])) { ///For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 for spec 38.212 - + *(csi_resourceconfig->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.array[0])) { + ///For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 for spec 38.212 nb_ssb_resources= csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_RS_Resources.list.count; UE_info->csi_report_template[UE_id][csi_report_id].CSI_Index_list = csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_RS_Resources.list.array; UE_info->csi_report_template[UE_id][csi_report_id].SSB_Index_list = NULL; @@ -275,8 +276,7 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in } UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.cri_bitlen=ceil(log2 (nb_ssb_resources)); - if (NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel== - csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.present){ + if (NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel==csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.present){ switch (RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts) { case 1:; @@ -292,13 +292,13 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in * But from Current RRC ASN structures nrofCQIsPerReport is not present. Present a dummy variable is present so using it to * calculate RI for antennas equal or more than two. * */ - AssertFatal (NULL!=csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->dummy, "nrofCQIsPerReport is not present"); + AssertFatal (NULL!=csi_reportconfig->dummy, "nrofCQIsPerReport is not present"); - ri_restriction = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.buf[0]; + ri_restriction = csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.buf[0]; /* Replace dummy with the nrofCQIsPerReport from the CSIreport config when equalent ASN structure present */ - if (0==*(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->dummy)){ + if (0==*(csi_reportconfig->dummy)){ nb_allowed_ri = number_of_bits_set((ri_restriction & 0xf0), &max_ri); ri_bitlen = ceil(log2(nb_allowed_ri)); } @@ -310,13 +310,13 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.ri_bitlen=ri_bitlen; break; case 4: - AssertFatal (NULL!=csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->dummy, "nrofCQIsPerReport is not present"); + AssertFatal (NULL!=csi_reportconfig->dummy, "nrofCQIsPerReport is not present"); - ri_restriction = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.buf[0]; + ri_restriction = csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.buf[0]; /* Replace dummy with the nrofCQIsPerReport from the CSIreport config when equalent ASN structure present */ - if (0==*(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->dummy)){ + if (0==*(csi_reportconfig->dummy)){ nb_allowed_ri = number_of_bits_set((ri_restriction & 0xf0), &max_ri); ri_bitlen = ceil(log2(nb_allowed_ri)); } @@ -329,13 +329,13 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in break; case 6: case 8: - AssertFatal (NULL!=csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->dummy, "nrofCQIsPerReport is not present"); + AssertFatal (NULL!=csi_reportconfig->dummy, "nrofCQIsPerReport is not present"); - ri_restriction = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.buf[0]; + ri_restriction = csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.buf[0]; /* Replace dummy with the nrofCQIsPerReport from the CSIreport config when equalent ASN structure present */ - if (0==*(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->dummy)){ + if (0==*(csi_reportconfig->dummy)){ nb_allowed_ri = number_of_bits_set((ri_restriction & 0xf0),&max_ri); ri_bitlen = ceil(log2(nb_allowed_ri)); } @@ -358,8 +358,7 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in } if( NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI==reportQuantity_type ){ - if (NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel== - csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.present){ + if (NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel==csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.present){ switch (RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts) { case 1:; @@ -410,17 +409,14 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in * */ if (max_ri > 4 && max_ri < 8){ - if (NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel== - csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.present){ - if (NR_CSI_ReportConfig__reportFreqConfiguration__cqi_FormatIndicator_widebandCQI== - csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportFreqConfiguration->cqi_FormatIndicator) + if (NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel==csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.present){ + if (NR_CSI_ReportConfig__reportFreqConfiguration__cqi_FormatIndicator_widebandCQI==csi_reportconfig->reportFreqConfiguration->cqi_FormatIndicator) UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.cqi_bitlen = 8; else UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.cqi_bitlen = 4; } }else{ //This condition will work even for type1-multipanel. - if (NR_CSI_ReportConfig__reportFreqConfiguration__cqi_FormatIndicator_widebandCQI== - csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportFreqConfiguration->cqi_FormatIndicator) + if (NR_CSI_ReportConfig__reportFreqConfiguration__cqi_FormatIndicator_widebandCQI==csi_reportconfig->reportFreqConfiguration->cqi_FormatIndicator) UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.cqi_bitlen = 4; else UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.cqi_bitlen = 2; @@ -432,9 +428,8 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in } if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI == reportQuantity_type || NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI==reportQuantity_type){ - if (NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel== - csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.present){ - switch (csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.present){ + if (NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel==csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.present){ + switch (csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.present){ case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_two: if (max_ri ==1) UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.pmi_x1_bitlen = 2; @@ -442,9 +437,9 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.pmi_x1_bitlen = 1; break; default: - AssertFatal(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.present!= + AssertFatal(csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.present!= NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_two, - "Not handled Yet %d", csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.present); + "Not handled Yet %d", csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.present); break; } } From 2e17bd241f10fa60ed7a6046431d04f5cdccd17c Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Mon, 23 Nov 2020 11:05:33 +0100 Subject: [PATCH 137/231] bugfix in pucch_rx --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index 4bfb34f5f8..e2a4b84512 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -1459,7 +1459,7 @@ void extract_pucch_csi_report (NR_CSI_MeasConfig_t *csi_MeasConfig, *(UE_info->csi_report_template[UE_id][csi_report_id].CSI_Index_list[cri_ssbri_bitlen>0?((*payload)&~(~1<<(cri_ssbri_bitlen-1))):cri_ssbri_bitlen]); *payload >>= cri_ssbri_bitlen; - LOG_I(PHY,"SSB_index = %d",sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx]); + LOG_I(PHY,"SSB_index = %d\n",sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx]); } reverse_n_bits(payload, 7); From 27cfdd497488d46ce1649cc4370e122c6135569e Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Thu, 26 Nov 2020 11:38:31 +0100 Subject: [PATCH 138/231] some cleanup --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index e2a4b84512..6a7ba8d4cb 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -247,7 +247,7 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.diff_rsrp_bitlen =0; } - LOG_I (MAC, "UCI: CSI_bit len : ssbri %d, rsrp: %d, diff_rsrp: %d", + LOG_I (MAC, "UCI: CSI_bit len : ssbri %d, rsrp: %d, diff_rsrp: %d\n", UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.cri_ssbri_bitlen, UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.rsrp_bitlen, UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.diff_rsrp_bitlen); From e7036385224c5e7c67481029556583a2e26f1913 Mon Sep 17 00:00:00 2001 From: "r.karey" Date: Sun, 13 Dec 2020 13:39:41 +0530 Subject: [PATCH 139/231] fixed memory leaks --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 18 +++++++++++++++++- openair2/NR_PHY_INTERFACE/NR_IF_Module.c | 8 ++------ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index 6a7ba8d4cb..a7e051f674 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -673,6 +673,19 @@ void handle_nr_uci_pucch_2_3_4(module_id_t mod_id, NR_ServingCellConfigCommon_t *scc = RC.nrmac[mod_id]->common_channels->ServingCellConfigCommon; const int num_slots = nr_slots_per_frame[*scc->ssbSubcarrierSpacing]; + if ( uci_234 -> pduBitmap & 0x01 ) { + ///Handle SR PDU + uint8_t sr_id = 0; + + for (sr_id = 0; sr_id < uci_234->sr.sr_bit_len; sr_id++) { + sched_ctrl->sr_req.ul_SR[sr_id] = uci_234->sr.sr_payload & 1; + uci_234->sr.sr_payload >>= 1; + } + + sched_ctrl->sr_req.nr_of_srs = uci_234->sr.sr_bit_len; + } + // TODO + int max_harq_rounds = 4; // TODO define macro if ((uci_234->pduBitmap >> 1) & 0x01) { // iterate over received harq bits for (int harq_bit = 0; harq_bit < uci_234->harq.harq_bit_len; harq_bit++) { @@ -711,6 +724,8 @@ void handle_nr_uci_pucch_2_3_4(module_id_t mod_id, scs); //API to parse the csi report and store it into sched_ctrl extract_pucch_csi_report (csi_MeasConfig, uci_pdu, sched_ctrl,UL_info->frame, UL_info->slot, scs, UE_id, Mod_idP); + //TCI handling function + tci_handling(Mod_idP, UE_id, UL_info->CC_id, sched_ctrl, UL_info->frame, UL_info->slot); } if (uci_pdu -> pduBitmap & 0x08) { @@ -1479,7 +1494,8 @@ void extract_pucch_csi_report (NR_CSI_MeasConfig_t *csi_MeasConfig, if ( !(reportQuantity_type)) AssertFatal(reportQuantity_type, "reportQuantity is not configured"); - + free(payload); + payload = NULL; #if 0 if ( NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI == reportQuantity_type || diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index 2ac16d82e8..3f811afea7 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -132,16 +132,12 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ uint8_t idx = 0; - uint8_t payload_size = ceil(((double)uci_pdu->csi_part1.csi_part1_bit_len)/8); - uint8_t *payload = calloc (payload_size, sizeof(uint8_t)); + uint8_t *payload = uci_pdu->csi_part1.csi_part1_payload; NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type = NR_CSI_ReportConfig__reportQuantity_PR_NOTHING; NR_UE_list_t *UE_list = &(RC.nrmac[Mod_idP]->UE_list); long periodicity; uint8_t csi_report_id = 0; - memcpy ( payload, uci_pdu->csi_part1.csi_part1_payload, payload_size); - - UE_list->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report = 0; for ( csi_report_id =0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++ ) { //Assuming in periodic reporting for one slot can be configured with only one CSI-ReportConfig @@ -209,7 +205,7 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, *payload >>= 4; } UE_list->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report++; - LOG_I(MAC,"csi_payload size = %d, rsrp_id = %d\n",payload_size, sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP); + LOG_I(MAC," rsrp_id = %d\n", sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP); } } From 0a0a5e48c3accfaa06eef1781fca2a9bca3dc56e Mon Sep 17 00:00:00 2001 From: "k.ramya" Date: Fri, 18 Dec 2020 04:11:26 +0530 Subject: [PATCH 140/231] code rearrangement --- openair2/LAYER2/NR_MAC_gNB/config.c | 4 +- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 6 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 28 +- openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 6 +- openair2/NR_PHY_INTERFACE/NR_IF_Module.c | 5 +- openair2/RRC/NR/rrc_gNB_reconfig.c | 258 +++++++++--------- 6 files changed, 160 insertions(+), 147 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 778402d34a..bf912f97c6 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -651,7 +651,7 @@ void update_csi_bitlen (NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_list_t *UE_li } } } - +#endif extern uint16_t sl_ahead; int rrc_mac_config_req_gNB(module_id_t Mod_idP, @@ -780,7 +780,7 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, UE_info->secondaryCellGroup[UE_id] = secondaryCellGroup; LOG_I(PHY,"Modified UE_id %d/%x with secondaryCellGroup\n",UE_id,rnti); } - update_csi_bitlen (secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup, UE_list, UE_id, Mod_idP); + //update_csi_bitlen (secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup, UE_list, UE_id, Mod_idP); } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_OUT); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index 46ec88ca2b..1e45adf48b 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -322,7 +322,7 @@ void copy_nr_ulreq(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) } */ - +/* void nr_schedule_pusch(int Mod_idP, int UE_id, int num_slots_per_tdd, @@ -333,7 +333,7 @@ void nr_schedule_pusch(int Mod_idP, nfapi_nr_ul_tti_request_t *UL_tti_req = &RC.nrmac[Mod_idP]->UL_tti_req[0]; NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; int k = slotP + ul_slots - num_slots_per_tdd; - NR_sched_pusch *pusch = &UE_info->UE_sched_ctrl[UE_id].sched_pusch[k]; + NR_sched_pusch_t *pusch = &UE_info->UE_sched_ctrl[UE_id].sched_pusch[k]; if ((pusch->active == true) && (frameP == pusch->frame) && (slotP == pusch->slot)) { UL_tti_req->SFN = pusch->frame; UL_tti_req->Slot = pusch->slot; @@ -345,7 +345,7 @@ void nr_schedule_pusch(int Mod_idP, 0, sizeof(NR_sched_pusch)); } } - +*/ bool is_xlsch_in_slot(uint64_t bitmap, sub_frame_t slot) { return (bitmap >> slot) & 0x01; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index a7e051f674..09ae7689e9 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -86,6 +86,11 @@ void nr_fill_nfapi_pucch(module_id_t mod_id, #define L1_RSRP_HYSTERIS 10 //considering 10 dBm as hysterisis for avoiding frequent SSB Beam Switching. !Fixme provide exact value if any //#define L1_DIFF_RSRP_STEP_SIZE 2 +void nr_rx_acknack(nfapi_nr_uci_pusch_pdu_t *uci_pusch, + nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_01, + nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_234, + NR_UL_IND_t *UL_info, NR_UE_sched_ctrl_t *sched_ctrl, NR_mac_stats_t *stats); + int ssb_index_sorted[MAX_NUM_SSB] = {0}; int ssb_rsrp_sorted[MAX_NUM_SSB] = {0}; //Sorts ssb_index and ssb_rsrp array data and keeps in ssb_index_sorted and @@ -600,7 +605,8 @@ static void handle_dl_harq(module_id_t mod_id, void handle_nr_uci_pucch_0_1(module_id_t mod_id, frame_t frame, sub_frame_t slot, - const nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_01) + const nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_01, + NR_UL_IND_t *UL_info) { int UE_id = find_nr_UE_id(mod_id, uci_01->rnti); if (UE_id < 0) { @@ -648,21 +654,22 @@ void handle_nr_uci_pucch_0_1(module_id_t mod_id, } if (((uci_01->pduBitmap >> 1) & 0x01)) { - nr_rx_acknack(NULL,uci_01,NULL,UL_info,sched_ctrl,stats); + nr_rx_acknack(NULL,uci_01,NULL,UL_info,sched_ctrl,&UE_info->mac_stats[0]); } } void handle_nr_uci_pucch_2_3_4(module_id_t mod_id, frame_t frame, sub_frame_t slot, - const nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_234) + const nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_234, + NR_UL_IND_t *UL_info) { - NR_CSI_MeasConfig_t *csi_MeasConfig = RC.nrmac[Mod_idP]->UE_list.secondaryCellGroup[UE_id]->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup; int UE_id = find_nr_UE_id(mod_id, uci_234->rnti); if (UE_id < 0) { LOG_E(MAC, "%s(): unknown RNTI %04x in PUCCH UCI\n", __func__, uci_234->rnti); return; } + NR_CSI_MeasConfig_t *csi_MeasConfig = RC.nrmac[mod_id]->UE_info.secondaryCellGroup[UE_id]->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup; NR_UE_info_t *UE_info = &RC.nrmac[mod_id]->UE_info; NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; @@ -678,8 +685,8 @@ void handle_nr_uci_pucch_2_3_4(module_id_t mod_id, uint8_t sr_id = 0; for (sr_id = 0; sr_id < uci_234->sr.sr_bit_len; sr_id++) { - sched_ctrl->sr_req.ul_SR[sr_id] = uci_234->sr.sr_payload & 1; - uci_234->sr.sr_payload >>= 1; + sched_ctrl->sr_req.ul_SR[sr_id] = *(uci_234->sr.sr_payload) & 1; + *(uci_234->sr.sr_payload) >>= 1; } sched_ctrl->sr_req.nr_of_srs = uci_234->sr.sr_bit_len; @@ -718,17 +725,17 @@ void handle_nr_uci_pucch_2_3_4(module_id_t mod_id, } if ((uci_234->pduBitmap >> 1) & 0x01) { - NR_SubcarrierSpacing_t scs=*(RC.nrmac[Mod_idP]->common_channels->ServingCellConfigCommon->ssbSubcarrierSpacing); + NR_SubcarrierSpacing_t scs=*(RC.nrmac[mod_id]->common_channels->ServingCellConfigCommon->ssbSubcarrierSpacing); LOG_I(PHY,"SFN/SF:%d%d scs %ld \n", UL_info->frame,UL_info->slot, scs); //API to parse the csi report and store it into sched_ctrl - extract_pucch_csi_report (csi_MeasConfig, uci_pdu, sched_ctrl,UL_info->frame, UL_info->slot, scs, UE_id, Mod_idP); + extract_pucch_csi_report (csi_MeasConfig, uci_234, sched_ctrl,UL_info->frame, UL_info->slot, scs, UE_id, mod_id); //TCI handling function - tci_handling(Mod_idP, UE_id, UL_info->CC_id, sched_ctrl, UL_info->frame, UL_info->slot); + tci_handling(mod_id, UE_id, UL_info->CC_id, sched_ctrl, UL_info->frame, UL_info->slot); } - if (uci_pdu -> pduBitmap & 0x08) { + if (uci_234 -> pduBitmap & 0x08) { ///Handle CSI Report 2 } } @@ -1549,4 +1556,3 @@ void extract_pucch_csi_report (NR_CSI_MeasConfig_t *csi_MeasConfig, } ->>>>>>> uci mac functions in a new file diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index a9a0e4a1c2..dde4c3c713 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -162,11 +162,13 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP, void handle_nr_uci_pucch_0_1(module_id_t mod_id, frame_t frame, sub_frame_t slot, - const nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_01); + const nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_01, + NR_UL_IND_t *UL_info); void handle_nr_uci_pucch_2_3_4(module_id_t mod_id, frame_t frame, sub_frame_t slot, - const nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_234); + const nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_234, + NR_UL_IND_t *UL_info); void config_uldci(const NR_BWP_Uplink_t *ubwp, diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index 3f811afea7..8ff10db318 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -421,7 +421,6 @@ void handle_nr_uci(NR_UL_IND_t *UL_info) const sub_frame_t slot = UL_info->slot; int num_ucis = UL_info->uci_ind.num_ucis; nfapi_nr_uci_t *uci_list = UL_info->uci_ind.uci_list; - uint8_t UE_id = 0; for (int i = 0; i < num_ucis; i++) { switch (uci_list[i].pdu_type) { @@ -431,13 +430,13 @@ void handle_nr_uci(NR_UL_IND_t *UL_info) case NFAPI_NR_UCI_FORMAT_0_1_PDU_TYPE: { const nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_pdu = &uci_list[i].pucch_pdu_format_0_1; - handle_nr_uci_pucch_0_1(mod_id, frame, slot, uci_pdu); + handle_nr_uci_pucch_0_1(mod_id, frame, slot, uci_pdu, UL_info); break; } case NFAPI_NR_UCI_FORMAT_2_3_4_PDU_TYPE: { const nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_pdu = &uci_list[i].pucch_pdu_format_2_3_4; - handle_nr_uci_pucch_2_3_4(mod_id, frame, slot, uci_pdu); + handle_nr_uci_pucch_2_3_4(mod_id, frame, slot, uci_pdu, UL_info); break; } } diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index 8cec354eba..0bd72fbd51 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -151,47 +151,33 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco AssertFatal(servingcellconfigcommon!=NULL,"servingcellconfigcommon is null\n"); AssertFatal(secondaryCellGroup!=NULL,"secondaryCellGroup is null\n"); - if(servingcellconfigcommon->ssb_PositionsInBurst->present !=2) - AssertFatal(1==0,"Currenrly implemented only for medium size SSB bitmap\n"); - uint8_t bitmap = servingcellconfigcommon->ssb_PositionsInBurst->choice.mediumBitmap.buf[0]; + uint64_t bitmap=0; + switch (servingcellconfigcommon->ssb_PositionsInBurst->present) { + case 1 : + bitmap = ((uint64_t) servingcellconfigcommon->ssb_PositionsInBurst->choice.shortBitmap.buf[0])<<56; + break; + case 2 : + bitmap = ((uint64_t) servingcellconfigcommon->ssb_PositionsInBurst->choice.mediumBitmap.buf[0])<<56; + break; + case 3 : + for (int i=0; i<8; i++) { + bitmap |= (((uint64_t) servingcellconfigcommon->ssb_PositionsInBurst->choice.longBitmap.buf[i])<<((7-i)*8)); + } + break; + default: + AssertFatal(1==0,"SSB bitmap size value %d undefined (allowed values 1,2,3) \n", servingcellconfigcommon->ssb_PositionsInBurst->present); + } memset(secondaryCellGroup,0,sizeof(NR_CellGroupConfig_t)); secondaryCellGroup->cellGroupId = scg_id; NR_RLC_BearerConfig_t *RLC_BearerConfig = calloc(1,sizeof(*RLC_BearerConfig)); - RLC_BearerConfig->logicalChannelIdentity = 4; - RLC_BearerConfig->servedRadioBearer = calloc(1,sizeof(*RLC_BearerConfig->servedRadioBearer)); - RLC_BearerConfig->servedRadioBearer->present = NR_RLC_BearerConfig__servedRadioBearer_PR_drb_Identity; - RLC_BearerConfig->servedRadioBearer->choice.drb_Identity=1; - RLC_BearerConfig->reestablishRLC=calloc(1,sizeof(*RLC_BearerConfig->reestablishRLC)); - *RLC_BearerConfig->reestablishRLC=NR_RLC_BearerConfig__reestablishRLC_true; - RLC_BearerConfig->rlc_Config=calloc(1,sizeof(*RLC_BearerConfig->rlc_Config)); - RLC_BearerConfig->rlc_Config->present = NR_RLC_Config_PR_am; - RLC_BearerConfig->rlc_Config->choice.am = calloc(1,sizeof(*RLC_BearerConfig->rlc_Config->choice.am)); - RLC_BearerConfig->rlc_Config->choice.am->ul_AM_RLC.sn_FieldLength = calloc(1,sizeof(*RLC_BearerConfig->rlc_Config->choice.am->ul_AM_RLC.sn_FieldLength)); - *RLC_BearerConfig->rlc_Config->choice.am->ul_AM_RLC.sn_FieldLength = NR_SN_FieldLengthAM_size18; - RLC_BearerConfig->rlc_Config->choice.am->ul_AM_RLC.t_PollRetransmit = NR_T_PollRetransmit_ms45; - RLC_BearerConfig->rlc_Config->choice.am->ul_AM_RLC.pollPDU = NR_PollPDU_p64; - RLC_BearerConfig->rlc_Config->choice.am->ul_AM_RLC.pollByte = NR_PollByte_kB500; - RLC_BearerConfig->rlc_Config->choice.am->ul_AM_RLC.maxRetxThreshold = NR_UL_AM_RLC__maxRetxThreshold_t32; - RLC_BearerConfig->rlc_Config->choice.am->dl_AM_RLC.sn_FieldLength = calloc(1,sizeof(*RLC_BearerConfig->rlc_Config->choice.am->dl_AM_RLC.sn_FieldLength)); - *RLC_BearerConfig->rlc_Config->choice.am->dl_AM_RLC.sn_FieldLength = NR_SN_FieldLengthAM_size18; - RLC_BearerConfig->rlc_Config->choice.am->dl_AM_RLC.t_Reassembly = NR_T_Reassembly_ms15; - RLC_BearerConfig->rlc_Config->choice.am->dl_AM_RLC.t_StatusProhibit = NR_T_StatusProhibit_ms15; - RLC_BearerConfig->mac_LogicalChannelConfig = calloc(1,sizeof(*RLC_BearerConfig->mac_LogicalChannelConfig)); - RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters = calloc(1,sizeof(*RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters)); - RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters->priority = 1; - RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters->prioritisedBitRate = NR_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; - RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters->bucketSizeDuration = NR_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; - RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters->allowedServingCells = NULL; - RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters->allowedSCS_List = NULL; - RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters->maxPUSCH_Duration = NULL; - RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters->configuredGrantType1Allowed = NULL; - RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters->logicalChannelGroup = calloc(1,sizeof(*RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters->logicalChannelGroup)); - *RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters->logicalChannelGroup = 1; - RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters->schedulingRequestID = NULL; - RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters->logicalChannelSR_Mask = false; - RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters->logicalChannelSR_DelayTimerApplied = false; - RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters->bitRateQueryProhibitTimer = NULL; + nr_rlc_bearer_init(RLC_BearerConfig); + if (get_softmodem_params()->do_ra) + nr_drb_config(RLC_BearerConfig->rlc_Config, NR_RLC_Config_PR_um_Bi_Directional); + else + nr_drb_config(RLC_BearerConfig->rlc_Config, NR_RLC_Config_PR_am); + nr_rlc_bearer_init_ul_spec(RLC_BearerConfig->mac_LogicalChannelConfig); + secondaryCellGroup->rlc_BearerToAddModList = calloc(1,sizeof(*secondaryCellGroup->rlc_BearerToAddModList)); ASN_SEQUENCE_ADD(&secondaryCellGroup->rlc_BearerToAddModList->list, RLC_BearerConfig); secondaryCellGroup->mac_CellGroupConfig=calloc(1,sizeof(*secondaryCellGroup->mac_CellGroupConfig)); @@ -249,18 +235,46 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->occasions= calloc(1,sizeof(struct NR_CFRA__occasions)); memcpy(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->occasions->rach_ConfigGeneric, &servingcellconfigcommon->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric, sizeof(NR_RACH_ConfigGeneric_t)); - //secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->occasions->ssb_perRACH_Occasion= calloc(1,sizeof(long)); - //*secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->occasions->ssb_perRACH_Occasion = NR_CFRA__occasions__ssb_perRACH_Occasion_one; - secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->occasions->ssb_perRACH_Occasion= NULL; + secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->occasions->ssb_perRACH_Occasion= calloc(1,sizeof(long)); + *secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->occasions->ssb_perRACH_Occasion = NR_CFRA__occasions__ssb_perRACH_Occasion_one; secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.present = NR_CFRA__resources_PR_ssb; secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb = calloc(1,sizeof(struct NR_CFRA__resources__ssb)); secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ra_ssb_OccasionMaskIndex = 0; -//from NR_CSI_Reporting branch - struct NR_CFRA_SSB_Resource *ssbElem = calloc(1,sizeof(struct NR_CFRA_SSB_Resource)); - ssbElem->ssb = 0; - ssbElem->ra_PreambleIndex= 63; - ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem); - // + struct NR_CFRA_SSB_Resource *ssbElem[8]; + ssbElem[0] = calloc(1,sizeof(struct NR_CFRA_SSB_Resource)); + ssbElem[0]->ssb = 0; + ssbElem[0]->ra_PreambleIndex = 63; + ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem[0]); +#if 0 + ssbElem[1] = calloc(1,sizeof(struct NR_CFRA_SSB_Resource)); + ssbElem[1]->ssb = 1; + ssbElem[1]->ra_PreambleIndex = 62; + ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem[1]); + ssbElem[2] = calloc(1,sizeof(struct NR_CFRA_SSB_Resource)); + ssbElem[2]->ssb = 2; + ssbElem[2]->ra_PreambleIndex = 63; + ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem[2]); + ssbElem[3] = calloc(1,sizeof(struct NR_CFRA_SSB_Resource)); + ssbElem[3]->ssb = 3; + ssbElem[3]->ra_PreambleIndex = 63; + ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem[3]); + ssbElem[4] = calloc(1,sizeof(struct NR_CFRA_SSB_Resource)); + ssbElem[4]->ssb = 4; + ssbElem[4]->ra_PreambleIndex = 63; + ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem[4]); + ssbElem[5] = calloc(1,sizeof(struct NR_CFRA_SSB_Resource)); + ssbElem[5]->ssb = 5; + ssbElem[5]->ra_PreambleIndex = 63; + ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem[5]); + ssbElem[6] = calloc(1,sizeof(struct NR_CFRA_SSB_Resource)); + ssbElem[6]->ssb = 6; + ssbElem[6]->ra_PreambleIndex = 63; + ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem[6]); + ssbElem[7] = calloc(1,sizeof(struct NR_CFRA_SSB_Resource)); + ssbElem[7]->ssb = 7; + ssbElem[7]->ra_PreambleIndex = 63; + ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem[7]); +#endif secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->ext1 = NULL; secondaryCellGroup->spCellConfig->rlf_TimersAndConstants = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->rlf_TimersAndConstants)); secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->present = NR_SetupRelease_RLF_TimersAndConstants_PR_setup; @@ -269,7 +283,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup->n310 = NR_RLF_TimersAndConstants__n310_n10; secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup->n311 = NR_RLF_TimersAndConstants__n311_n1; secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup->ext1 = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup->ext1)); - secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup->ext1->t311_v1530 = NR_RLF_TimersAndConstants__ext1__t311_v1530_ms30000; + secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup->ext1->t311 = NR_RLF_TimersAndConstants__ext1__t311_ms30000; secondaryCellGroup->spCellConfig->rlmInSyncOutOfSyncThreshold = NULL; secondaryCellGroup->spCellConfig->spCellConfigDedicated = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated)); secondaryCellGroup->spCellConfig->spCellConfigDedicated->tdd_UL_DL_ConfigurationDedicated = NULL; @@ -296,11 +310,11 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList=calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList)); -//NR_CSI_Reporting branch + int n_ssb = 0; - NR_TCI_State_t *tcic[8]; - for (int i=0;i<8;i++) { - if ((bitmap>>(7-i))&0x01){ + NR_TCI_State_t *tcic[64]; + for (int i=0;i<64;i++) { + if ((bitmap>>(63-i))&0x01){ tcic[i]=calloc(1,sizeof(*tcic[i])); tcic[i]->tci_StateId=n_ssb; tcic[i]->qcl_Type1.cell=NULL; @@ -314,7 +328,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco } } -// + #if 0 NR_TCI_State_t*tci0=calloc(1,sizeof(*tci0)); @@ -409,7 +423,12 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->rateMatchPatternGroup1=NULL; secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->rateMatchPatternGroup2=NULL; secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->rbg_Size=NR_PDSCH_Config__rbg_Size_config1; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->mcs_Table=NULL; + if (!get_softmodem_params()->use_256qam_table) { + secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->mcs_Table=NULL; + } else { + secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->mcs_Table = calloc(1, sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->mcs_Table)); + *secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->mcs_Table = NR_PDSCH_Config__mcs_Table_qam256; + } secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI)); *secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI = NR_PDSCH_Config__maxNrofCodeWordsScheduledByDCI_n1; secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->prb_BundlingType.present = NR_PDSCH_Config__prb_BundlingType_PR_staticBundling; @@ -459,12 +478,21 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->controlResourceSetZero=NULL; bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonControlResourceSet=calloc(1,sizeof(*bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonControlResourceSet)); + int curr_bwp = NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth,275); + NR_ControlResourceSet_t *coreset = calloc(1,sizeof(*coreset)); coreset->controlResourceSetId=1; - // frequencyDomainResources '11111111 11111111 00000000 00000000 00000000 00000'B, + // frequency domain resources depends on BWP size + // options are 24, 48 or 96 coreset->frequencyDomainResources.buf = calloc(1,6); - coreset->frequencyDomainResources.buf[0] = 0xff; - coreset->frequencyDomainResources.buf[1] = 0xff; + if (curr_bwp < 48) + coreset->frequencyDomainResources.buf[0] = 0xf0; + else + coreset->frequencyDomainResources.buf[0] = 0xff; + if (curr_bwp < 96) + coreset->frequencyDomainResources.buf[1] = 0; + else + coreset->frequencyDomainResources.buf[1] = 0xff; coreset->frequencyDomainResources.buf[2] = 0; coreset->frequencyDomainResources.buf[3] = 0; coreset->frequencyDomainResources.buf[4] = 0; @@ -476,9 +504,9 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco coreset->precoderGranularity = NR_ControlResourceSet__precoderGranularity_sameAsREG_bundle; coreset->tci_StatesPDCCH_ToAddList=calloc(1,sizeof(*coreset->tci_StatesPDCCH_ToAddList)); - NR_TCI_StateId_t *tci[8]; - for (int i=0;i<8;i++) { - if ((bitmap>>(7-i))&0x01){//NR_CSI_Reporting + NR_TCI_StateId_t *tci[64]; + for (int i=0;i<64;i++) { + if ((bitmap>>(63-i))&0x01){ tci[i]=calloc(1,sizeof(*tci[i])); *tci[i] = i; ASN_SEQUENCE_ADD(&coreset->tci_StatesPDCCH_ToAddList->list,tci[i]); @@ -578,7 +606,12 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco ss2->nrofCandidates=calloc(1,sizeof(*ss2->nrofCandidates)); ss2->nrofCandidates->aggregationLevel1 = NR_SearchSpace__nrofCandidates__aggregationLevel1_n0; ss2->nrofCandidates->aggregationLevel2 = NR_SearchSpace__nrofCandidates__aggregationLevel2_n0; - ss2->nrofCandidates->aggregationLevel4 = NR_SearchSpace__nrofCandidates__aggregationLevel4_n4; + if (curr_bwp < 48) + ss2->nrofCandidates->aggregationLevel4 = NR_SearchSpace__nrofCandidates__aggregationLevel4_n1; + else if (curr_bwp < 96) + ss2->nrofCandidates->aggregationLevel4 = NR_SearchSpace__nrofCandidates__aggregationLevel4_n2; + else + ss2->nrofCandidates->aggregationLevel4 = NR_SearchSpace__nrofCandidates__aggregationLevel4_n4; ss2->nrofCandidates->aggregationLevel8 = NR_SearchSpace__nrofCandidates__aggregationLevel8_n0; ss2->nrofCandidates->aggregationLevel16 = NR_SearchSpace__nrofCandidates__aggregationLevel16_n0; ss2->searchSpaceType=calloc(1,sizeof(*ss2->searchSpaceType)); @@ -611,10 +644,9 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition)); *bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0; -//NR_CSI_Reporting //bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList=NULL; bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList=calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList)); -// + #if 0 bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList=calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList)); @@ -697,14 +729,13 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco tcid7->qcl_Type1.referenceSignal.choice.csi_rs = 30; tcid7->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA; ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcid7); -//NR_CSI_Reporting #endif n_ssb = 0; - NR_TCI_State_t *tcid[8]; - for (int i=0;i<8;i++) { - if ((bitmap>>(7-i))&0x01){ + NR_TCI_State_t *tcid[64]; + for (int i=0;i<64;i++) { + if ((bitmap>>(63-i))&0x01){ tcid[i]=calloc(1,sizeof(*tcid[i])); tcid[i]->tci_StateId=n_ssb; tcid[i]->qcl_Type1.cell=NULL; @@ -717,7 +748,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco n_ssb++; } } -// + bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToReleaseList=NULL; bwp->bwp_Dedicated->pdsch_Config->choice.setup->vrb_ToPRB_Interleaver=NULL; @@ -729,7 +760,12 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco bwp->bwp_Dedicated->pdsch_Config->choice.setup->rateMatchPatternGroup1=NULL; bwp->bwp_Dedicated->pdsch_Config->choice.setup->rateMatchPatternGroup2=NULL; bwp->bwp_Dedicated->pdsch_Config->choice.setup->rbg_Size=NR_PDSCH_Config__rbg_Size_config1; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table=NULL; + if (!get_softmodem_params()->use_256qam_table) { + bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table=NULL; + } else { + bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table = calloc(1, sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table)); + *bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table = NR_PDSCH_Config__mcs_Table_qam256; + } bwp->bwp_Dedicated->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI)); *bwp->bwp_Dedicated->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI = NR_PDSCH_Config__maxNrofCodeWordsScheduledByDCI_n1; bwp->bwp_Dedicated->pdsch_Config->choice.setup->prb_BundlingType.present = NR_PDSCH_Config__prb_BundlingType_PR_staticBundling; @@ -755,7 +791,12 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco bwp->bwp_Dedicated->pdsch_Config->choice.setup->rateMatchPatternGroup1=NULL; bwp->bwp_Dedicated->pdsch_Config->choice.setup->rateMatchPatternGroup2=NULL; bwp->bwp_Dedicated->pdsch_Config->choice.setup->rbg_Size=NR_PDSCH_Config__rbg_Size_config1; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table=NULL; + if (!get_softmodem_params()->use_256qam_table) { + bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table=NULL; + } else { + bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table = calloc(1, sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table)); + *bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table = NR_PDSCH_Config__mcs_Table_qam256; + } bwp->bwp_Dedicated->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI)); *bwp->bwp_Dedicated->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI = NR_PDSCH_Config__maxNrofCodeWordsScheduledByDCI_n1; bwp->bwp_Dedicated->pdsch_Config->choice.setup->prb_BundlingType.present = NR_PDSCH_Config__prb_BundlingType_PR_staticBundling; @@ -943,7 +984,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco ASN_SEQUENCE_ADD(&pucchresset0->resourceList.list,pucchresset0id0); *pucchresset0id1=2; ASN_SEQUENCE_ADD(&pucchresset0->resourceList.list,pucchresset0id1); - pucchresset0->maxPayloadMinus1=NULL; + pucchresset0->maxPayloadSize=NULL; ASN_SEQUENCE_ADD(&pucch_Config->resourceSetToAddModList->list,pucchresset0); @@ -954,7 +995,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco ASN_SEQUENCE_ADD(&pucchresset1->resourceList.list,pucchresset1id0); *pucchresset1id1=4; ASN_SEQUENCE_ADD(&pucchresset1->resourceList.list,pucchresset1id1); - pucchresset1->maxPayloadMinus1=NULL; + pucchresset1->maxPayloadSize=NULL; ASN_SEQUENCE_ADD(&pucch_Config->resourceSetToAddModList->list,pucchresset1); pucch_Config->resourceToAddModList = calloc(1,sizeof(*pucch_Config->resourceToAddModList)); @@ -964,7 +1005,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco NR_PUCCH_Resource_t *pucchres2=calloc(1,sizeof(*pucchres2)); NR_PUCCH_Resource_t *pucchres3=calloc(1,sizeof(*pucchres3)); pucchres0->pucch_ResourceId=1; - pucchres0->startingPRB=48; + pucchres0->startingPRB=8; pucchres0->intraSlotFrequencyHopping=NULL; pucchres0->secondHopPRB=NULL; pucchres0->format.present= NR_PUCCH_Resource__format_PR_format0; @@ -975,7 +1016,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco ASN_SEQUENCE_ADD(&pucch_Config->resourceToAddModList->list,pucchres0); pucchres1->pucch_ResourceId=2; - pucchres1->startingPRB=48; + pucchres1->startingPRB=8; pucchres1->intraSlotFrequencyHopping=NULL; pucchres1->secondHopPRB=NULL; pucchres1->format.present= NR_PUCCH_Resource__format_PR_format0; @@ -986,23 +1027,23 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco ASN_SEQUENCE_ADD(&pucch_Config->resourceToAddModList->list,pucchres1); pucchres2->pucch_ResourceId=3; - pucchres2->startingPRB=40; + pucchres2->startingPRB=0; pucchres2->intraSlotFrequencyHopping=NULL; pucchres2->secondHopPRB=NULL; pucchres2->format.present= NR_PUCCH_Resource__format_PR_format2; pucchres2->format.choice.format2=calloc(1,sizeof(*pucchres2->format.choice.format2)); - pucchres2->format.choice.format2->nrofPRBs=16; + pucchres2->format.choice.format2->nrofPRBs=8; pucchres2->format.choice.format2->nrofSymbols=1; pucchres2->format.choice.format2->startingSymbolIndex=13; ASN_SEQUENCE_ADD(&pucch_Config->resourceToAddModList->list,pucchres2); pucchres3->pucch_ResourceId=4; - pucchres3->startingPRB=40; + pucchres3->startingPRB=0; pucchres3->intraSlotFrequencyHopping=NULL; pucchres3->secondHopPRB=NULL; pucchres3->format.present= NR_PUCCH_Resource__format_PR_format2; pucchres3->format.choice.format2=calloc(1,sizeof(*pucchres3->format.choice.format2)); - pucchres3->format.choice.format2->nrofPRBs=16; + pucchres3->format.choice.format2->nrofPRBs=8; pucchres3->format.choice.format2->nrofSymbols=1; pucchres3->format.choice.format2->startingSymbolIndex=12; ASN_SEQUENCE_ADD(&pucch_Config->resourceToAddModList->list,pucchres3); @@ -1014,7 +1055,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco pucchfmt2->interslotFrequencyHopping=NULL; pucchfmt2->additionalDMRS=NULL; pucchfmt2->maxCodeRate=calloc(1,sizeof(*pucchfmt2->maxCodeRate)); - *pucchfmt2->maxCodeRate=NR_PUCCH_MaxCodeRate_zeroDot15; + *pucchfmt2->maxCodeRate=NR_PUCCH_MaxCodeRate_zeroDot25; pucchfmt2->nrofSlots=NULL; pucchfmt2->pi2BPSK=NULL; pucchfmt2->simultaneousHARQ_ACK_CSI=NULL; @@ -1125,45 +1166,14 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco NR_CSI_SSB_ResourceSet_t *ssbresset0 = calloc(1,sizeof(*ssbresset0)); ssbresset0->csi_SSB_ResourceSetId=0; - if ((bitmap>>7)&0x01){ - NR_SSB_Index_t *ssbresset00=calloc(1,sizeof(*ssbresset00)); - *ssbresset00=0; - ASN_SEQUENCE_ADD(&ssbresset0->csi_SSB_ResourceList.list,ssbresset00); - } - if ((bitmap>>6)&0x01) { - NR_SSB_Index_t *ssbresset01=calloc(1,sizeof(*ssbresset01)); - *ssbresset01=1; - ASN_SEQUENCE_ADD(&ssbresset0->csi_SSB_ResourceList.list,ssbresset01); - } - if ((bitmap>>5)&0x01) { - NR_SSB_Index_t *ssbresset02=calloc(1,sizeof(*ssbresset02)); - *ssbresset02=2; - ASN_SEQUENCE_ADD(&ssbresset0->csi_SSB_ResourceList.list,ssbresset02); - } - if ((bitmap>>4)&0x01) { - NR_SSB_Index_t *ssbresset03=calloc(1,sizeof(*ssbresset03)); - *ssbresset03=3; - ASN_SEQUENCE_ADD(&ssbresset0->csi_SSB_ResourceList.list,ssbresset03); - } - if ((bitmap>>3)&0x01) { - NR_SSB_Index_t *ssbresset04=calloc(1,sizeof(*ssbresset04)); - *ssbresset04=4; - ASN_SEQUENCE_ADD(&ssbresset0->csi_SSB_ResourceList.list,ssbresset04); - } - if ((bitmap>>2)&0x01) { - NR_SSB_Index_t *ssbresset05=calloc(1,sizeof(*ssbresset05)); - *ssbresset05=5; - ASN_SEQUENCE_ADD(&ssbresset0->csi_SSB_ResourceList.list,ssbresset05); - } - if ((bitmap>>1)&0x01) { - NR_SSB_Index_t *ssbresset06=calloc(1,sizeof(*ssbresset06)); - *ssbresset06=6; - ASN_SEQUENCE_ADD(&ssbresset0->csi_SSB_ResourceList.list,ssbresset06); - } - if ((bitmap)&0x01) { - NR_SSB_Index_t *ssbresset07=calloc(1,sizeof(*ssbresset07)); - *ssbresset07=7; - ASN_SEQUENCE_ADD(&ssbresset0->csi_SSB_ResourceList.list,ssbresset07); + + NR_SSB_Index_t *ssbresset[64]; + for (int i=0;i<64;i++) { + if ((bitmap>>(63-i))&0x01){ + ssbresset[i]=calloc(1,sizeof(*ssbresset[i])); + *ssbresset[i] = i; + ASN_SEQUENCE_ADD(&ssbresset0->csi_SSB_ResourceList.list,ssbresset[i]); + } } ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list,ssbresset0); @@ -1173,14 +1183,10 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco csires0->csi_ResourceConfigId=0; csires0->csi_RS_ResourceSetList.present = NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB; csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB = calloc(1,sizeof(*csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB)); - csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList = NULL; //calloc(1,sizeof(*csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList)); - csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList = calloc(1,sizeof(*csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList));//NULL; - //NR_NZP_CSI_RS_ResourceSetId_t *csires00 = calloc(1,sizeof(*csires00)); - //For verification of CSI measurment for SSB + csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList = NULL; + csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList = calloc(1,sizeof(*csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList)); NR_CSI_SSB_ResourceSetId_t *ssbres00 = calloc(1,sizeof(*ssbres00)); - //*csires00 = 0; *ssbres00 = 0; - //ASN_SEQUENCE_ADD(&csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list,csires00); ASN_SEQUENCE_ADD(&csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list,ssbres00); csires0->bwp_Id = 1; csires0->resourceType = NR_CSI_ResourceConfig__resourceType_periodic; @@ -1191,7 +1197,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco NR_CSI_ReportConfig_t *csirep1 = calloc(1,sizeof(*csirep1)); csirep1->reportConfigId=0; csirep1->carrier=NULL; - csirep1->resourcesForChannelMeasurement=0;//initial_csi_index; Just for verification + csirep1->resourcesForChannelMeasurement=0; csirep1->csi_IM_ResourcesForInterference=NULL; csirep1->nzp_CSI_RS_ResourcesForInterference=NULL; csirep1->reportConfigType.present = NR_CSI_ReportConfig__reportConfigType_PR_periodic; @@ -1200,7 +1206,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco csirep1->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320 = 49; NR_PUCCH_CSI_Resource_t *pucchcsires1 = calloc(1,sizeof(*pucchcsires1)); pucchcsires1->uplinkBandwidthPartId=1; - pucchcsires1->pucch_Resource=3;//4;//12; + pucchcsires1->pucch_Resource=3; ASN_SEQUENCE_ADD(&csirep1->reportConfigType.choice.periodic->pucch_CSI_ResourceList.list,pucchcsires1); csirep1->reportQuantity.present = NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP; csirep1->reportQuantity.choice.ssb_Index_RSRP=(NULL_t)0; @@ -1247,7 +1253,6 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_ReportConfigToAddModList->list,csirep1); - secondaryCellGroup->spCellConfig->spCellConfigDedicated->sCellDeactivationTimer=NULL; secondaryCellGroup->spCellConfig->spCellConfigDedicated->crossCarrierSchedulingConfig=NULL; secondaryCellGroup->spCellConfig->spCellConfigDedicated->tag_Id=0; @@ -2528,3 +2533,4 @@ void rrc_config_dl_ptrs_params(NR_BWP_Downlink_t *bwp, int *ptrsNrb, int *ptrsMc *bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->resourceElementOffset = *reOffset; } #endif + From 0e61b612ba3d30b36e4455bfc053bedb5bf8ccba Mon Sep 17 00:00:00 2001 From: rangaswamy Date: Fri, 22 Jan 2021 10:09:48 +0530 Subject: [PATCH 141/231] fixed warnings --- openair2/LAYER2/NR_MAC_gNB/config.c | 37 +- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 2 - .../LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 18 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 4 +- openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 4 +- openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 109 ------ openair2/NR_PHY_INTERFACE/NR_IF_Module.c | 336 ------------------ 7 files changed, 29 insertions(+), 481 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index bf912f97c6..253dc686d8 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -310,23 +310,7 @@ void config_common(int Mod_idP, int pdsch_AntennaPorts, NR_ServingCellConfigComm } } - -//! Calculating number of bits set -uint8_t number_of_bits_set (uint8_t buf,uint8_t * max_ri){ - uint8_t nb_of_bits_set = 0; - uint8_t mask = 0xff; - uint8_t index = 0; - - for (index=7; (buf & mask) && (index>=0) ; index--){ - if (buf & (1<>=1; - } - *max_ri = 8-index; - return nb_of_bits_set; -} - +#if 0 //!TODO : smae function can be written to handle csi_resources void update_csi_bitlen (NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_list_t *UE_list, int UE_id, module_id_t Mod_idP) { uint8_t csi_report_id = 0; @@ -341,6 +325,8 @@ void update_csi_bitlen (NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_list_t *UE_li csi_ResourceConfigId=csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->resourcesForChannelMeasurement; reportQuantity_type = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportQuantity.present; UE_list->csi_report_template[UE_id][csi_report_id].reportQuantity_type = reportQuantity_type; + p_and_o = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.choice.periodic->reportSlotConfig.present; + switch(p_and_o){ case NR_CSI_ReportPeriodicityAndOffset_PR_slots4: period = 4; @@ -734,11 +720,24 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, if (secondaryCellGroup) { - RC.nrmac[Mod_idP]->secondaryCellGroupCommon = secondaryCellGroup; - NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; if (add_ue == 1 && get_softmodem_params()->phy_test) { const int UE_id = add_new_nr_ue(Mod_idP, rnti, secondaryCellGroup); + UE_info->secondaryCellGroup[UE_id] = secondaryCellGroup; + compute_csi_bitlen (secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup, UE_info, UE_id, Mod_idP); + struct NR_ServingCellConfig__downlinkBWP_ToAddModList *bwpList = + secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList; + AssertFatal(bwpList->list.count == 1, + "downlinkBWP_ToAddModList has %d BWP!\n", + bwpList->list.count); + const int bwp_id = 1; + UE_info->UE_sched_ctrl[UE_id].active_bwp = bwpList->list.array[bwp_id - 1]; + struct NR_UplinkConfig__uplinkBWP_ToAddModList *ubwpList = + secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList; + AssertFatal(ubwpList->list.count == 1, + "uplinkBWP_ToAddModList has %d BWP!\n", + ubwpList->list.count); + UE_info->UE_sched_ctrl[UE_id].active_ubwp = ubwpList->list.array[bwp_id - 1]; LOG_I(PHY,"Added new UE_id %d/%x with initial secondaryCellGroup\n",UE_id,rnti); } else if (add_ue == 1 && !get_softmodem_params()->phy_test) { const int CC_id = 0; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index fbdc6cb519..ac3a4e77d2 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -190,7 +190,6 @@ void find_SSB_and_RO_available(module_id_t module_idP) { // prach is scheduled according to configuration index and tables 6.3.3.2.2 to 6.3.3.2.4 get_nr_prach_occasion_info_from_index(config_index, -<<<<<<< HEAD scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA, mu, cc->frame_type, @@ -247,7 +246,6 @@ void schedule_nr_prach(module_id_t module_idP, frame_t frameP, sub_frame_t slotP nfapi_nr_config_request_scf_t *cfg = &RC.nrmac[module_idP]->config[0]; if (is_nr_UL_slot(scc,slotP)) { -<<<<<<< HEAD uint8_t config_index = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.prach_ConfigurationIndex; uint8_t mu,N_dur,N_t_slot,start_symbol = 0,N_RA_slot; uint16_t RA_sfn_index = -1; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index 09ae7689e9..bb7be52af6 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -87,8 +87,8 @@ void nr_fill_nfapi_pucch(module_id_t mod_id, //#define L1_DIFF_RSRP_STEP_SIZE 2 void nr_rx_acknack(nfapi_nr_uci_pusch_pdu_t *uci_pusch, - nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_01, - nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_234, + const nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_01, + const nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_234, NR_UL_IND_t *UL_info, NR_UE_sched_ctrl_t *sched_ctrl, NR_mac_stats_t *stats); int ssb_index_sorted[MAX_NUM_SSB] = {0}; @@ -692,7 +692,6 @@ void handle_nr_uci_pucch_2_3_4(module_id_t mod_id, sched_ctrl->sr_req.nr_of_srs = uci_234->sr.sr_bit_len; } // TODO - int max_harq_rounds = 4; // TODO define macro if ((uci_234->pduBitmap >> 1) & 0x01) { // iterate over received harq bits for (int harq_bit = 0; harq_bit < uci_234->harq.harq_bit_len; harq_bit++) { @@ -741,8 +740,8 @@ void handle_nr_uci_pucch_2_3_4(module_id_t mod_id, } void nr_rx_acknack(nfapi_nr_uci_pusch_pdu_t *uci_pusch, - nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_01, - nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_234, + const nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_01, + const nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_234, NR_UL_IND_t *UL_info, NR_UE_sched_ctrl_t *sched_ctrl, NR_mac_stats_t *stats) { // TODO @@ -1414,7 +1413,7 @@ void reverse_n_bits(uint8_t *value, uint16_t bitlen) { } void extract_pucch_csi_report (NR_CSI_MeasConfig_t *csi_MeasConfig, - nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_pdu, + const nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_pdu, NR_UE_sched_ctrl_t *sched_ctrl, frame_t frame, slot_t slot, @@ -1424,14 +1423,11 @@ void extract_pucch_csi_report (NR_CSI_MeasConfig_t *csi_MeasConfig, /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ uint8_t idx = 0; uint8_t payload_size = ceil(((double)uci_pdu->csi_part1.csi_part1_bit_len)/8); - uint8_t *payload = calloc (payload_size, sizeof(uint8_t)); + uint8_t *payload = uci_pdu->csi_part1.csi_part1_payload; NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type = NR_CSI_ReportConfig__reportQuantity_PR_NOTHING; NR_UE_info_t *UE_info = &(RC.nrmac[Mod_idP]->UE_info); uint8_t csi_report_id = 0; - memcpy ( payload, uci_pdu->csi_part1.csi_part1_payload, payload_size); - - UE_info->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report = 0; for ( csi_report_id =0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++ ) { //Assuming in periodic reporting for one slot can be configured with only one CSI-ReportConfig @@ -1501,8 +1497,6 @@ void extract_pucch_csi_report (NR_CSI_MeasConfig_t *csi_MeasConfig, if ( !(reportQuantity_type)) AssertFatal(reportQuantity_type, "reportQuantity is not configured"); - free(payload); - payload = NULL; #if 0 if ( NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI == reportQuantity_type || diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 938ba17165..027fac773a 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -474,6 +474,8 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, continue; } const int UE_id = add_new_nr_ue(gnb_mod_idP, ra->rnti, ra->secondaryCellGroup); + UE_info->secondaryCellGroup[UE_id] = ra->secondaryCellGroup; + compute_csi_bitlen (ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup, UE_info, UE_id, gnb_mod_idP); UE_info->UE_beam_index[UE_id] = ra->beam_id; LOG_I(MAC, "[gNB %d][RAPROC] PUSCH with TC_RNTI %x received correctly, " @@ -1132,4 +1134,4 @@ void nr_schedule_ulsch(module_id_t module_id, memset(sched_pusch, 0, sizeof(*sched_pusch)); } -} \ No newline at end of file +} diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index dde4c3c713..24a93040c4 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -205,7 +205,7 @@ int get_measured_rsrp(uint8_t index); int get_diff_rsrp(uint8_t index, int strongest_rsrp); void extract_pucch_csi_report (NR_CSI_MeasConfig_t *csi_MeasConfig, - nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_pdu, + const nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_pdu, NR_UE_sched_ctrl_t *sched_ctrl, frame_t frame, slot_t slot, @@ -346,7 +346,7 @@ uint16_t compute_pucch_prb_size(uint8_t format, uint8_t n_symb, uint8_t n_re_ctrl); -void compute_csi_bitlen (NR_CellGroupConfig_t *secondaryCellGroup, NR_UE_info_t *UE_info, int UE_id); +void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_info, int UE_id, module_id_t Mod_idP); int get_dlscs(nfapi_nr_config_request_t *cfg); diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 29ef5f8cfa..a21b2fdb46 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -469,115 +469,6 @@ typedef struct NR_UE_ul_harq { NR_sched_pusch_t sched_pusch; } NR_UE_ul_harq_t; - -typedef struct { - uint8_t nb_ssbri_cri; - uint8_t cri_ssbri_bitlen; - uint8_t rsrp_bitlen; - uint8_t diff_rsrp_bitlen; -}L1_RSRP_bitlen_t; - -typedef struct{ - uint8_t cri_bitlen; - uint8_t ri_bitlen; - uint8_t li_bitlen; - uint8_t pmi_x1_bitlen; - uint8_t pmi_x2_bitlen; - uint8_t cqi_bitlen; -} CSI_Meas_bitlen_t; - - -#define MAX_CSI_RESOURCE_SET_IN_CSI_RESOURCE_CONFIG 16 -typedef struct nr_csi_report { - NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type; - NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR CSI_Resource_type; - uint8_t nb_of_nzp_csi_report; - uint8_t nb_of_csi_ssb_report; - L1_RSRP_bitlen_t CSI_report_bitlen; - CSI_Meas_bitlen_t csi_meas_bitlen; -} nr_csi_report_t; - -//! fixme : need to enhace for the multiple TB CQI report - - -// -/*! As per spec 38.214 section 5.2.1.4.2 - * - if the UE is configured with the higher layer parameter groupBasedBeamReporting set to 'disabled', the UE shall report in - a single report nrofReportedRS (higher layer configured) different CRI or SSBRI for each report setting. - * - if the UE is configured with the higher layer parameter groupBasedBeamReporting set to 'enabled', the UE shall report in a - single reporting instance two different CRI or SSBRI for each report setting, where CSI-RS and/or SSB - resources can be received simultaneously by the UE either with a single spatial domain receive filter, or with - multiple simultaneous spatial domain receive filter -*/ -#define MAX_NR_OF_REPORTED_RS 4 - -typedef enum NR_CSI_Report_Config { - CSI_Report_PR_cri_ri_li_pmi_cqi_report, - CSI_Report_PR_ssb_cri_report -} NR_CSI_Report_Config_PR; -struct CRI_RI_LI_PMI_CQI { - uint8_t cri; - uint8_t ri; - uint8_t li; - uint8_t pmi_x1; - uint8_t pmi_x2; - uint8_t cqi; -}; - -typedef struct CRI_SSB_RSRP { - uint8_t nr_ssbri_cri; - uint8_t CRI_SSBRI[MAX_NR_OF_REPORTED_RS]; - uint8_t RSRP; - uint8_t diff_RSRP[MAX_NR_OF_REPORTED_RS - 1]; -} CRI_SSB_RSRP_t; - -struct CSI_Report { - NR_CSI_Report_Config_PR present; - union Config_CSI_Report { - struct CRI_RI_LI_PMI_CQI cri_ri_li_pmi_cqi_report; - struct CRI_SSB_RSRP ssb_cri_report; - } choice; -}; - -#define MAX_SR_BITLEN 8 -typedef struct NR_UE_sr { - uint8_t nr_of_srs; - bool ul_SR [MAX_SR_BITLEN]; -} NR_UE_sr_t; - -typedef struct { - uint8_t nb_ssbri_cri; - uint8_t cri_ssbri_bitlen; - uint8_t rsrp_bitlen; - uint8_t diff_rsrp_bitlen; -}L1_RSRP_bitlen_t; - -typedef struct{ - uint8_t cri_bitlen; - uint8_t ri_bitlen; - uint8_t li_bitlen; - uint8_t pmi_x1_bitlen; - uint8_t pmi_x2_bitlen; - uint8_t cqi_bitlen; -} CSI_Meas_bitlen_t; - -typedef struct nr_csi_report { - NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type; - long periodicity; - uint16_t offset; - long ** SSB_Index_list; - long ** CSI_Index_list; -// uint8_t nb_of_nzp_csi_report; - uint8_t nb_of_csi_ssb_report; - L1_RSRP_bitlen_t CSI_report_bitlen; - CSI_Meas_bitlen_t csi_meas_bitlen; -} nr_csi_report_t; - -/*! As per the spec 38.212 and table: 6.3.1.1.2-12 in a single UCI sequence we can have multiple CSI_report - the number of CSI_report will depend on number of CSI resource sets that are configured in CSI-ResourceConfig RRC IE - From spec 38.331 from the IE CSI-ResourceConfig for SSB RSRP reporting we can configure only one resource set - From spec 38.214 section 5.2.1.2 For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 - */ /*! \brief scheduling control information set through an API */ #define MAX_CSI_REPORTS 48 typedef struct { diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index 8ff10db318..a7ca7909bf 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -77,342 +77,6 @@ void handle_nr_rach(NR_UL_IND_t *UL_info) { } } - else if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == reportQuantity_type) - *nb_resource_sets=csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[idx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.count; - - } else { - //TODO: find the CSI_RS IM resources - } - } else { - AssertFatal(csi_ResourceConfigId, "csi_ResourceConfigId is not configured"); - } - } - - return -1; -} -#if 0 -//!TODO : smae function can be written to handle csi_resources -uint8_t get_ssb_resources (NR_CSI_MeasConfig_t *csi_MeasConfig, - NR_CSI_ResourceConfigId_t csi_ResourceConfigId, - NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type, - uint8_t *nb_resource_sets) { - uint8_t idx = 0; - uint8_t csi_ssb_idx =0; - - for ( idx = 0; idx < csi_MeasConfig->csi_ResourceConfigToAddModList->list.count; idx++) { - if ( csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[idx]->csi_ResourceConfigId == csi_ResourceConfigId) { - //Finding the CSI_RS or SSB Resources - if ( csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[idx]->csi_RS_ResourceSetList.present == NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB) { - - if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type ){ - *nb_resource_sets=csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[idx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.count; - - for ( csi_ssb_idx = 0; csi_ssb_idx < csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.count; csi_ssb_idx++) { - if (csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceSetId == - *(csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[idx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.array[0])) { - return csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceList.list.count; - } else { - //handle error condition - AssertFatal(csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceSetId, "csi_SSB_ResourcesSetId is not configured"); - } - } - } - - else if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == reportQuantity_type) - *nb_resource_sets=csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[idx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.count; - -void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, - nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_pdu, - NR_UE_sched_ctrl_t *sched_ctrl, - frame_t frame, - slot_t slot, - NR_SubcarrierSpacing_t scs, int UE_id, - module_id_t Mod_idP - ) { - - /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ - uint8_t idx = 0; - uint8_t *payload = uci_pdu->csi_part1.csi_part1_payload; - NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type = NR_CSI_ReportConfig__reportQuantity_PR_NOTHING; - NR_UE_list_t *UE_list = &(RC.nrmac[Mod_idP]->UE_list); - long periodicity; - uint8_t csi_report_id = 0; - - UE_list->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report = 0; - for ( csi_report_id =0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++ ) { - //Assuming in periodic reporting for one slot can be configured with only one CSI-ReportConfig - // if (csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.present == NR_CSI_ReportConfig__reportConfigType_PR_periodic) { - //Has to implement according to reportSlotConfig type - periodicity = UE_list->csi_report_template[UE_id][csi_report_id].periodicity; - LOG_I(PHY,"SFN/SF:%d%d \n", frame,slot); - /* if (((NR_SubcarrierSpacing_kHz30 == scs) && (((((frame & 0xf)+1)*20 + slot) & periodicity) == periodicity)) - ||((NR_SubcarrierSpacing_kHz120 == scs)&&(((((frame & 0xf)+1)*80 + slot) & periodicity) == periodicity))) {*/ - if (((slots_per_frame[scs]*frame + slot -UE_list->csi_report_template[UE_id][csi_report_id].offset)%periodicity)!=0) - continue; - - reportQuantity_type = UE_list->csi_report_template[UE_id][csi_report_id].reportQuantity_type; - LOG_I(PHY,"SFN/SF:%d%d reportQuantity type = %d\n",frame,slot,reportQuantity_type); - - if ( NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == reportQuantity_type) { - uint8_t csi_ssb_idx = 0; - uint8_t diff_rsrp_idx = 0; - uint8_t cri_ssbri_bitlen = UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.cri_ssbri_bitlen; - - /*! As per the spec 38.212 and table: 6.3.1.1.2-12 in a single UCI sequence we can have multiple CSI_report - * the number of CSI_report will depend on number of CSI resource sets that are configured in CSI-ResourceConfig RRC IE - * From spec 38.331 from the IE CSI-ResourceConfig for SSB RSRP reporting we can configure only one resource set - * From spec 38.214 section 5.2.1.2 For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 - */ - - /** from 38.214 sec 5.2.1.4.2 - - if the UE is configured with the higher layer parameter groupBasedBeamReporting set to 'disabled', the UE is - not required to update measurements for more than 64 CSI-RS and/or SSB resources, and the UE shall report in - a single report nrofReportedRS (higher layer configured) different CRI or SSBRI for each report setting - - - if the UE is configured with the higher layer parameter groupBasedBeamReporting set to 'enabled', the UE is not - required to update measurements for more than 64 CSI-RS and/or SSB resources, and the UE shall report in a - single reporting instance two different CRI or SSBRI for each report setting, where CSI-RS and/or SSB - resources can be received simultaneously by the UE either with a single spatial domain receive filter, or with - multiple simultaneous spatial domain receive filter - */ - - idx = 0; //Since for SSB RSRP reporting in RRC can configure only one ssb resource set per one report config - sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri = UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.nb_ssbri_cri; - - for (csi_ssb_idx = 0; csi_ssb_idx < sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri ; csi_ssb_idx++) { - if(cri_ssbri_bitlen > 1) - reverse_n_bits(payload, cri_ssbri_bitlen); - - if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type) - sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx] = - *(UE_list->csi_report_template[UE_id][csi_report_id].SSB_Index_list[cri_ssbri_bitlen>0?((*payload)&~(~1<<(cri_ssbri_bitlen-1))):cri_ssbri_bitlen]); - else - sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx] = - *(UE_list->csi_report_template[UE_id][csi_report_id].CSI_Index_list[cri_ssbri_bitlen>0?((*payload)&~(~1<<(cri_ssbri_bitlen-1))):cri_ssbri_bitlen]); - - *payload >>= cri_ssbri_bitlen; - LOG_I(PHY,"SSB_index = %d",sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx]); - } - - reverse_n_bits(payload, 7); - sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP = (*payload) & 0x7f; - *payload >>= 7; - - for ( diff_rsrp_idx =0; diff_rsrp_idx < sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri - 1; diff_rsrp_idx++ ) { - reverse_n_bits(payload,4); - sched_ctrl->CSI_report[idx].choice.ssb_cri_report.diff_RSRP[diff_rsrp_idx] = (*payload) & 0x0f; - *payload >>= 4; - } - UE_list->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report++; - LOG_I(MAC," rsrp_id = %d\n", sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP); - } - } - - if ( !(reportQuantity_type)) - AssertFatal(reportQuantity_type, "reportQuantity is not configured"); - - -#if 0 - - if ( NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_i1 == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_i1_CQI == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_CQI == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI== reportQuantity_type) { - // Handling of extracting cri - sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report.cri = calloc ( 1, ceil(bitlen_cri/8)); - *(sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report.cri) = *((uint32_t *)payload) & ~(~1<<(bitlen_cri-1)); - *payload >>= bitlen_cri; - - if ( 1 == RC.nrrrc[gnb_mod_idP]->carrier.pdsch_AntennaPorts ) { - /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ - sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report->ri = NULL; - } else { - //Handling for the ri for multiple csi ports - } - } - - if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI== reportQuantity_type) { - if ( 1 == RC.nrrrc[gnb_mod_idP]->carrier.pdsch_AntennaPorts ) - /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ - sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report->li = NULL; - else { - //Handle for li for multiple CSI ports - } - } - - //TODO: check for zero padding if available shift payload to the number of zero padding bits - - if ( NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI== reportQuantity_type) { - if ( 1 == RC.nrrrc[gnb_mod_idP]->carrier.pdsch_AntennaPorts ) { - /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ - sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report->pmi_x1 = NULL; - sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report->pmi_x2 = NULL; - } - } - - if ( NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_i1_CQI == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_CQI == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI== reportQuantity_type) { - /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ - *(sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report->cqi) = *(payload) & 0x0f; - *(payload) >>= 4; - } - -#endif -} - -void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, - nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_pdu, - NR_UE_sched_ctrl_t *sched_ctrl, - frame_t frame, - slot_t slot, - NR_SubcarrierSpacing_t scs, int UE_id, - module_id_t Mod_idP - ) { - - /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ - uint8_t idx = 0; - uint8_t payload_size = ceil(((double)uci_pdu->csi_part1.csi_part1_bit_len)/8); - uint8_t *payload = calloc (payload_size, sizeof(uint8_t)); - NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type = NR_CSI_ReportConfig__reportQuantity_PR_NOTHING; - NR_UE_list_t *UE_list = &(RC.nrmac[Mod_idP]->UE_list); - long periodicity; - uint8_t csi_report_id = 0; - - memcpy ( payload, uci_pdu->csi_part1.csi_part1_payload, payload_size); - - - UE_list->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report = 0; - for ( csi_report_id =0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++ ) { - //Assuming in periodic reporting for one slot can be configured with only one CSI-ReportConfig - // if (csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.present == NR_CSI_ReportConfig__reportConfigType_PR_periodic) { - //Has to implement according to reportSlotConfig type - periodicity = UE_list->csi_report_template[UE_id][csi_report_id].periodicity; - LOG_I(PHY,"SFN/SF:%d%d \n", frame,slot); - /* if (((NR_SubcarrierSpacing_kHz30 == scs) && (((((frame & 0xf)+1)*20 + slot) & periodicity) == periodicity)) - ||((NR_SubcarrierSpacing_kHz120 == scs)&&(((((frame & 0xf)+1)*80 + slot) & periodicity) == periodicity))) {*/ - if (((slots_per_frame[scs]*frame + slot -UE_list->csi_report_template[UE_id][csi_report_id].offset)%periodicity)!=0) - continue; - - reportQuantity_type = UE_list->csi_report_template[UE_id][csi_report_id].reportQuantity_type; - LOG_I(PHY,"SFN/SF:%d%d reportQuantity type = %d\n",frame,slot,reportQuantity_type); - - if ( NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == reportQuantity_type) { - uint8_t csi_ssb_idx = 0; - uint8_t diff_rsrp_idx = 0; - uint8_t cri_ssbri_bitlen = UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.cri_ssbri_bitlen; - - LOG_I(MAC,"csi_payload = %d, bitlen_ssbri = %d, nb_ssb_resource_set = %d\n",payload_size, bitlen_ssbri, nb_ssb_resource_set); - /*! As per the spec 38.212 and table: 6.3.1.1.2-12 in a single UCI sequence we can have multiple CSI_report - * the number of CSI_report will depend on number of CSI resource sets that are configured in CSI-ResourceConfig RRC IE - * From spec 38.331 from the IE CSI-ResourceConfig for SSB RSRP reporting we can configure only one resource set - * From spec 38.214 section 5.2.1.2 For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 - */ - - /** from 38.214 sec 5.2.1.4.2 - - if the UE is configured with the higher layer parameter groupBasedBeamReporting set to 'disabled', the UE is - not required to update measurements for more than 64 CSI-RS and/or SSB resources, and the UE shall report in - a single report nrofReportedRS (higher layer configured) different CRI or SSBRI for each report setting - - - if the UE is configured with the higher layer parameter groupBasedBeamReporting set to 'enabled', the UE is not - required to update measurements for more than 64 CSI-RS and/or SSB resources, and the UE shall report in a - single reporting instance two different CRI or SSBRI for each report setting, where CSI-RS and/or SSB - resources can be received simultaneously by the UE either with a single spatial domain receive filter, or with - multiple simultaneous spatial domain receive filter - */ - - idx = 0; //Since for SSB RSRP reporting in RRC can configure only one ssb resource set per one report config - sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri = UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.nb_ssbri_cri; - - for (csi_ssb_idx = 0; csi_ssb_idx < sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri ; csi_ssb_idx++) { - if(cri_ssbri_bitlen > 1) - reverse_n_bits(payload, cri_ssbri_bitlen); - - if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type) - sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx] = - *(UE_list->csi_report_template[UE_id][csi_report_id].SSB_Index_list[cri_ssbri_bitlen>0?((*payload)&~(~1<<(cri_ssbri_bitlen-1))):cri_ssbri_bitlen]); - else - sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx] = - *(UE_list->csi_report_template[UE_id][csi_report_id].CSI_Index_list[cri_ssbri_bitlen>0?((*payload)&~(~1<<(cri_ssbri_bitlen-1))):cri_ssbri_bitlen]); - - *payload >>= cri_ssbri_bitlen; - LOG_I(PHY,"SSB_index = %d",sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx]); - } - - reverse_n_bits(payload, 7); - sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP = (*payload) & 0x7f; - *payload >>= 7; - - for ( diff_rsrp_idx =0; diff_rsrp_idx < sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri - 1; diff_rsrp_idx++ ) { - reverse_n_bits(payload,4); - sched_ctrl->CSI_report[idx].choice.ssb_cri_report.diff_RSRP[diff_rsrp_idx] = (*payload) & 0x0f; - *payload >>= 4; - } - UE_list->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report++; - LOG_I(MAC,"csi_payload size = %d, rsrp_id = %d\n",payload_size, sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP); - } - } - - if ( !(reportQuantity_type)) - AssertFatal(reportQuantity_type, "reportQuantity is not configured"); - - -#if 0 - - if ( NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_i1 == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_i1_CQI == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_CQI == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI== reportQuantity_type) { - // Handling of extracting cri - sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report.cri = calloc ( 1, ceil(bitlen_cri/8)); - *(sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report.cri) = *((uint32_t *)payload) & ~(~1<<(bitlen_cri-1)); - *payload >>= bitlen_cri; - - if ( 1 == RC.nrrrc[gnb_mod_idP]->carrier.pdsch_AntennaPorts ) { - /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ - sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report->ri = NULL; - } else { - //Handling for the ri for multiple csi ports - } - } - - if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI== reportQuantity_type) { - if ( 1 == RC.nrrrc[gnb_mod_idP]->carrier.pdsch_AntennaPorts ) - /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ - sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report->li = NULL; - else { - //Handle for li for multiple CSI ports - } - } - - //TODO: check for zero padding if available shift payload to the number of zero padding bits - - if ( NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI== reportQuantity_type) { - if ( 1 == RC.nrrrc[gnb_mod_idP]->carrier.pdsch_AntennaPorts ) { - /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ - sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report->pmi_x1 = NULL; - sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report->pmi_x2 = NULL; - } - } - - if ( NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_i1_CQI == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_CQI == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI== reportQuantity_type) { - /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ - *(sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report->cqi) = *(payload) & 0x0f; - *(payload) >>= 4; - } - -#endif -} void handle_nr_uci(NR_UL_IND_t *UL_info) { From e914cb28a6dd97205768d859577531711503ee33 Mon Sep 17 00:00:00 2001 From: guhan Date: Wed, 3 Feb 2021 22:35:52 +0530 Subject: [PATCH 142/231] Fixed some warnings --- openair1/SIMULATION/NR_PHY/prachsim.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/openair1/SIMULATION/NR_PHY/prachsim.c b/openair1/SIMULATION/NR_PHY/prachsim.c index d7dfcb71fa..c90bcf1395 100644 --- a/openair1/SIMULATION/NR_PHY/prachsim.c +++ b/openair1/SIMULATION/NR_PHY/prachsim.c @@ -167,8 +167,6 @@ int main(int argc, char **argv){ int prachOccasion = 0; double DS_TDL = .03; NB_UE_INST=1; - uint16_t RA_sfn_index = -1; - uint8_t N_RA_slot,config_period = 1; // int8_t interf1=-19,interf2=-19; // uint8_t abstraction_flag=0,calibration_flag=0; From 5d4f8151815d6564b4bfd48f6ab86f24797e658b Mon Sep 17 00:00:00 2001 From: guhan Date: Mon, 8 Feb 2021 15:41:00 +0530 Subject: [PATCH 143/231] Removed dead code --- openair2/LAYER2/NR_MAC_gNB/config.c | 329 ----- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 53 - .../LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 98 +- openair2/RRC/NR/rrc_gNB_reconfig.c | 1246 ----------------- 4 files changed, 5 insertions(+), 1721 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 253dc686d8..b675c5b670 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -310,334 +310,6 @@ void config_common(int Mod_idP, int pdsch_AntennaPorts, NR_ServingCellConfigComm } } -#if 0 -//!TODO : smae function can be written to handle csi_resources -void update_csi_bitlen (NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_list_t *UE_list, int UE_id, module_id_t Mod_idP) { - uint8_t csi_report_id = 0; - uint8_t csi_resourceidx =0; - uint8_t csi_ssb_idx =0; - uint16_t period, offset; - NR_CSI_ReportPeriodicityAndOffset_PR p_and_o; - NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type; - NR_CSI_ResourceConfigId_t csi_ResourceConfigId; - - for (csi_report_id=0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++){ - csi_ResourceConfigId=csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->resourcesForChannelMeasurement; - reportQuantity_type = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportQuantity.present; - UE_list->csi_report_template[UE_id][csi_report_id].reportQuantity_type = reportQuantity_type; - p_and_o = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.choice.periodic->reportSlotConfig.present; - - switch(p_and_o){ - case NR_CSI_ReportPeriodicityAndOffset_PR_slots4: - period = 4; - offset = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.choice.periodic->reportSlotConfig.choice.slots4; - break; - case NR_CSI_ReportPeriodicityAndOffset_PR_slots5: - period = 5; - offset = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.choice.periodic->reportSlotConfig.choice.slots5; - break; - case NR_CSI_ReportPeriodicityAndOffset_PR_slots8: - period = 8; - offset = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.choice.periodic->reportSlotConfig.choice.slots8; - break; - case NR_CSI_ReportPeriodicityAndOffset_PR_slots10: - period = 10; - offset = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.choice.periodic->reportSlotConfig.choice.slots10; - break; - case NR_CSI_ReportPeriodicityAndOffset_PR_slots16: - period = 16; - offset = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.choice.periodic->reportSlotConfig.choice.slots16; - break; - case NR_CSI_ReportPeriodicityAndOffset_PR_slots20: - period = 20; - offset = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.choice.periodic->reportSlotConfig.choice.slots20; - break; - case NR_CSI_ReportPeriodicityAndOffset_PR_slots40: - period = 40; - offset = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.choice.periodic->reportSlotConfig.choice.slots40; - break; - case NR_CSI_ReportPeriodicityAndOffset_PR_slots80: - period = 80; - offset = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.choice.periodic->reportSlotConfig.choice.slots80; - break; - case NR_CSI_ReportPeriodicityAndOffset_PR_slots160: - period = 160; - offset = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.choice.periodic->reportSlotConfig.choice.slots160; - break; - case NR_CSI_ReportPeriodicityAndOffset_PR_slots320: - period = 320; - offset = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320; - break; - default: - AssertFatal(1==0,"No periodicity and offset resource found in CSI report"); - } - UE_list->csi_report_template[UE_id][csi_report_id].periodicity=period; - UE_list->csi_report_template[UE_id][csi_report_id].offset=offset; - - for ( csi_resourceidx = 0; csi_resourceidx < csi_MeasConfig->csi_ResourceConfigToAddModList->list.count; csi_resourceidx++) { - if ( csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_ResourceConfigId != csi_ResourceConfigId) - continue; - else { - uint8_t nb_ssb_resources =0; - //Finding the CSI_RS or SSB Resources - if ( NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type) { - - if (NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled == - csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->groupBasedBeamReporting.present ) { - if (NULL != csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->groupBasedBeamReporting.choice.disabled->nrofReportedRS) - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.nb_ssbri_cri = *(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->groupBasedBeamReporting.choice.disabled->nrofReportedRS)+1; - else - /*! From Spec 38.331 - * nrofReportedRS - * The number (N) of measured RS resources to be reported per report setting in a non-group-based report. N <= N_max, where N_max is either 2 or 4 depending on UE - * capability. FFS: The signaling mechanism for the gNB to select a subset of N beams for the UE to measure and report. - * When the field is absent the UE applies the value 1 - */ - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.nb_ssbri_cri= 1; - }else - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.nb_ssbri_cri= 2; - - if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == UE_list->csi_report_template[UE_id][csi_report_id].reportQuantity_type) { - for ( csi_ssb_idx = 0; csi_ssb_idx < csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.count; csi_ssb_idx++) { - if (csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceSetId == - *(csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.array[0])){ ///We can configure only one SSB resource set from spec 38.331 IE CSI-ResourceConfig - - nb_ssb_resources= csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceList.list.count; - UE_list->csi_report_template[UE_id][csi_report_id].SSB_Index_list = csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceList.list.array; - UE_list->csi_report_template[UE_id][csi_report_id].CSI_Index_list = NULL; - } - break ; - } - } else /*if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == UE_list->csi_report_template[UE_id][csi_report_id].reportQuantity_type)*/{ - for ( csi_ssb_idx = 0; csi_ssb_idx < csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.count; csi_ssb_idx++) { - if (csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_ResourceSetId == - *(csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.array[0])) { ///For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 for spec 38.212 - - nb_ssb_resources= csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_RS_Resources.list.count; - UE_list->csi_report_template[UE_id][csi_report_id].CSI_Index_list = csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_RS_Resources.list.array; - UE_list->csi_report_template[UE_id][csi_report_id].SSB_Index_list = NULL; - } - break ; - } - } - - if (nb_ssb_resources) { - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.cri_ssbri_bitlen =ceil(log2 (nb_ssb_resources)); - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.rsrp_bitlen = 7; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.diff_rsrp_bitlen =4; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP - } else { - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.cri_ssbri_bitlen =0; - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.rsrp_bitlen = 0; - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.diff_rsrp_bitlen =0; - } - - LOG_I (MAC, "UCI: CSI_bit len : ssbri %d, rsrp: %d, diff_rsrp: %d", - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.cri_ssbri_bitlen, - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.rsrp_bitlen, - UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.diff_rsrp_bitlen); - } - - uint8_t ri_restriction; - uint8_t ri_bitlen; - uint8_t nb_allowed_ri; - uint8_t max_ri; - - if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI==reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_CQI==reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_i1_CQI==reportQuantity_type|| - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_i1==reportQuantity_type){ - - for ( csi_ssb_idx = 0; csi_ssb_idx < csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.count; csi_ssb_idx++) { - if (csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_ResourceSetId == - *(csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.array[0])) { ///For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 for spec 38.212 - - nb_ssb_resources= csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_RS_Resources.list.count; - UE_list->csi_report_template[UE_id][csi_report_id].CSI_Index_list = csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_RS_Resources.list.array; - UE_list->csi_report_template[UE_id][csi_report_id].SSB_Index_list = NULL; - } - break ; - } - UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.cri_bitlen=ceil(log2 (nb_ssb_resources)); - - if (NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel== - csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.present){ - - switch (RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts) { - case 1:; - UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.ri_bitlen=0; - break; - case 2: - /* From Spec 38.212 - * If the higher layer parameter nrofCQIsPerReport=1, nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator - * values in the 4 LSBs of the higher layer parameter typeI-SinglePanel-ri-Restriction according to Subclause 5.2.2.2.1 [6, - * TS 38.214]; otherwise nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator values according to Subclause - * 5.2.2.2.1 [6, TS 38.214]. - * - * But from Current RRC ASN structures nrofCQIsPerReport is not present. Present a dummy variable is present so using it to - * calculate RI for antennas equal or more than two. - * */ - AssertFatal (NULL!=csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->dummy, "nrofCQIsPerReport is not present"); - - ri_restriction = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.buf[0]; - if (0==*(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->dummy)){ /* Replace dummy with the nrofCQIsPerReport from the CSIreport - config when equalent ASN structure present */ - nb_allowed_ri = number_of_bits_set((ri_restriction & 0xf0), &max_ri); - ri_bitlen = ceil(log2(nb_allowed_ri)); - } - else{ - nb_allowed_ri = number_of_bits_set(ri_restriction, &max_ri); - ri_bitlen = ceil(log2(nb_allowed_ri)); - } - ri_bitlen = ri_bitlen<1?ri_bitlen:1; //from the spec 38.212 and table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel - UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.ri_bitlen=ri_bitlen; - break; - case 4: - AssertFatal (NULL!=csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->dummy, "nrofCQIsPerReport is not present"); - - ri_restriction = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.buf[0]; - if (0==*(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->dummy)){ /* Replace dummy with the nrofCQIsPerReport from the CSIreport - config when equalent ASN structure present */ - nb_allowed_ri = number_of_bits_set((ri_restriction & 0xf0), &max_ri); - ri_bitlen = ceil(log2(nb_allowed_ri)); - } - else{ - nb_allowed_ri = number_of_bits_set(ri_restriction,&max_ri); - ri_bitlen = ceil(log2(nb_allowed_ri)); - } - ri_bitlen = ri_bitlen<2?ri_bitlen:2; //from the spec 38.212 and table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel - UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.ri_bitlen=ri_bitlen; - break; - case 6: - case 8: - AssertFatal (NULL!=csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->dummy, "nrofCQIsPerReport is not present"); - - ri_restriction = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.buf[0]; - if (0==*(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->dummy)){ /* Replace dummy with the nrofCQIsPerReport from the CSIreport - config when equalent ASN structure present */ - nb_allowed_ri = number_of_bits_set((ri_restriction & 0xf0),&max_ri); - ri_bitlen = ceil(log2(nb_allowed_ri)); - } - else{ - nb_allowed_ri = number_of_bits_set(ri_restriction, &max_ri); - ri_bitlen = ceil(log2(nb_allowed_ri)); - } - //ri_bitlen = ri_bitlen<1?ri_bitlen:1; //from the spec 38.212 and table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel - UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.ri_bitlen=ri_bitlen; - break; - default: - //UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.ri_bitlen=0; - AssertFatal(RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts>8,"Number of antennas %d are out of range", RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts); - break; - } - } - UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.li_bitlen=0; - UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.cqi_bitlen=0; - UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.pmi_x1_bitlen=0; - UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.pmi_x2_bitlen=0; - } - - if( NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI==reportQuantity_type ){ - if (NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel== - csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.present){ - - switch (RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts) { - case 1:; - UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.li_bitlen=0; - break; - case 2: - case 4: - case 6: - case 8: - /* From Spec 38.212 - * If the higher layer parameter nrofCQIsPerReport=1, nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator - * values in the 4 LSBs of the higher layer parameter typeI-SinglePanel-ri-Restriction according to Subclause 5.2.2.2.1 [6, - * TS 38.214]; otherwise nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator values according to Subclause - * 5.2.2.2.1 [6, TS 38.214]. - * - * But from Current RRC ASN structures nrofCQIsPerReport is not present. Present a dummy variable is present so using it to - * calculate RI for antennas equal or more than two. - * */ - //! TODO: The bit length of LI is as follows LI = log2(RI), Need to confirm wheather we should consider maximum RI can be reported from ri_restricted - // or we should consider reported RI. If we need to consider reported RI for calculating LI bit length then we need to modify the code. - UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.li_bitlen=ceil(log2(max_ri))<2?ceil(log2(max_ri)):2; - break; - default: - AssertFatal(RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts>8,"Number of antennas %d are out of range", RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts); - break; - } - } - } - - if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI==reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_CQI==reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_i1_CQI==reportQuantity_type){ - - - switch (RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts){ - case 1:; - case 2: - case 4: - case 6: - case 8: - /* From Spec 38.212 - * If the higher layer parameter nrofCQIsPerReport=1, nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator - * values in the 4 LSBs of the higher layer parameter typeI-SinglePanel-ri-Restriction according to Subclause 5.2.2.2.1 [6, - * TS 38.214]; otherwise nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator values according to Subclause - * 5.2.2.2.1 [6, TS 38.214]. - * - * But from Current RRC ASN structures nrofCQIsPerReport is not present. Present a dummy variable is present so using it to - * calculate RI for antennas equal or more than two. - * */ - - if (max_ri > 4 && max_ri < 8){ - if (NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel== - csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.present){ - if (NR_CSI_ReportConfig__reportFreqConfiguration__cqi_FormatIndicator_widebandCQI==csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportFreqConfiguration->cqi_FormatIndicator) - UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.cqi_bitlen = 8; - else - UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.cqi_bitlen = 4; - } - }else{ //This condition will work even for type1-multipanel. - if (NR_CSI_ReportConfig__reportFreqConfiguration__cqi_FormatIndicator_widebandCQI==csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportFreqConfiguration->cqi_FormatIndicator) - UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.cqi_bitlen = 4; - else - UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.cqi_bitlen = 2; - } - break; - default: - AssertFatal(RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts>8,"Number of antennas %d are out of range", RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts); - break; - } - - } - - if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI==reportQuantity_type){ - if (NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel== - csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.present){ - switch (csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.present){ - case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_two: - if (max_ri ==1) - UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.pmi_x1_bitlen = 2; - else if (max_ri ==2) - UE_list->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.pmi_x1_bitlen = 1; - break; - default: - AssertFatal(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.present!=NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_two, - "Not handled Yet %d", csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.present); - break; - } - } - } - break; - } - } - } -} -#endif extern uint16_t sl_ahead; int rrc_mac_config_req_gNB(module_id_t Mod_idP, @@ -779,7 +451,6 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, UE_info->secondaryCellGroup[UE_id] = secondaryCellGroup; LOG_I(PHY,"Modified UE_id %d/%x with secondaryCellGroup\n",UE_id,rnti); } - //update_csi_bitlen (secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup, UE_list, UE_id, Mod_idP); } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_OUT); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index 1e45adf48b..b7c654c4f7 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -293,59 +293,6 @@ void schedule_nr_SRS(module_id_t module_idP, frame_t frameP, sub_frame_t subfram } } */ -/* -void copy_nr_ulreq(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) -{ - int CC_id; - gNB_MAC_INST *mac = RC.nrmac[module_idP]; - - for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { - - nfapi_ul_config_request_t *ul_req = &mac->UL_tti_req[CC_id]; - - *ul_req = *ul_req_tmp; - - // Restore the pointer - ul_req->ul_config_request_body.ul_config_pdu_list = ul_req_pdu; - ul_req->sfn_sf = (frameP<<7) + slotP; - ul_req_tmp->ul_config_request_body.number_of_pdus = 0; - - if (ul_req->ul_config_request_body.number_of_pdus>0) - { - LOG_D(PHY, "%s() active NOW (frameP:%d slotP:%d) pdus:%d\n", __FUNCTION__, frameP, slotP, ul_req->ul_config_request_body.number_of_pdus); - } - - memcpy((void*)ul_req->ul_config_request_body.ul_config_pdu_list, - (void*)ul_req_tmp->ul_config_request_body.ul_config_pdu_list, - ul_req->ul_config_request_body.number_of_pdus*sizeof(nfapi_ul_config_request_pdu_t)); - } -} -*/ - -/* -void nr_schedule_pusch(int Mod_idP, - int UE_id, - int num_slots_per_tdd, - int ul_slots, - frame_t frameP, - sub_frame_t slotP) { - - nfapi_nr_ul_tti_request_t *UL_tti_req = &RC.nrmac[Mod_idP]->UL_tti_req[0]; - NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; - int k = slotP + ul_slots - num_slots_per_tdd; - NR_sched_pusch_t *pusch = &UE_info->UE_sched_ctrl[UE_id].sched_pusch[k]; - if ((pusch->active == true) && (frameP == pusch->frame) && (slotP == pusch->slot)) { - UL_tti_req->SFN = pusch->frame; - UL_tti_req->Slot = pusch->slot; - UL_tti_req->pdus_list[UL_tti_req->n_pdus].pdu_type = NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE; - UL_tti_req->pdus_list[UL_tti_req->n_pdus].pdu_size = sizeof(nfapi_nr_pusch_pdu_t); - UL_tti_req->pdus_list[UL_tti_req->n_pdus].pusch_pdu = pusch->pusch_pdu; - UL_tti_req->n_pdus+=1; - memset((void *) &UE_info->UE_sched_ctrl[UE_id].sched_pusch[k], - 0, sizeof(NR_sched_pusch)); - } -} -*/ bool is_xlsch_in_slot(uint64_t bitmap, sub_frame_t slot) { return (bitmap >> slot) & 0x01; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index bb7be52af6..39b6bcc46c 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -1172,8 +1172,6 @@ void tci_handling(module_id_t Mod_idP, int UE_id, int CC_id, NR_UE_sched_ctrl_t int cqi_idx = 0; int curr_ssb_beam_index = 0; //ToDo: yet to know how to identify the serving ssb beam index uint8_t target_ssb_beam_index = curr_ssb_beam_index; - //uint8_t max_reported_RSRP = 16; - //int serving_SSB_Beam_RSRP; uint8_t is_triggering_ssb_beam_switch =0; uint8_t ssb_idx = 0; int pdsch_bwp_id =0; @@ -1182,16 +1180,12 @@ void tci_handling(module_id_t Mod_idP, int UE_id, int CC_id, NR_UE_sched_ctrl_t uint8_t idx = 0; int bwp_id = 1; NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; - //NR_COMMON_channels_t *cc = RC.nrmac[Mod_idP]->common_channels; NR_CellGroupConfig_t *secondaryCellGroup = UE_info->secondaryCellGroup[UE_id]; NR_BWP_Downlink_t *bwp = secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1]; - //NR_CSI_MeasConfig_t *csi_MeasConfig = UE_info->secondaryCellGroup[UE_id]->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup; //bwp indicator int n_dl_bwp = secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count; uint8_t nr_ssbri_cri = 0; uint8_t nb_of_csi_ssb_report = UE_info->csi_report_template[UE_id][cqi_idx].nb_of_csi_ssb_report; - //uint8_t bitlen_ssbri = log (nb_of_csi_ssb_report)/log (2); - //uint8_t max_rsrp_reported = -1; int better_rsrp_reported = -140-(-0); /*minimum_measured_RSRP_value - minimum_differntail_RSRP_value*///considering the minimum RSRP value as better RSRP initially uint8_t diff_rsrp_idx = 0; uint8_t i, j; @@ -1213,9 +1207,6 @@ void tci_handling(module_id_t Mod_idP, int UE_id, int CC_id, NR_UE_sched_ctrl_t //for all reported SSB for (idx = 0; idx < nb_of_csi_ssb_report; idx++) { nr_ssbri_cri = sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri; - //if group based beam Reporting is disabled - /*if(NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled == - csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.present ) {*/ //extracting the ssb indexes for (ssb_idx = 0; ssb_idx < nr_ssbri_cri; ssb_idx++) { ssb_index[idx * nb_of_csi_ssb_report + ssb_idx] = sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI[ssb_idx]; @@ -1224,7 +1215,7 @@ void tci_handling(module_id_t Mod_idP, int UE_id, int CC_id, NR_UE_sched_ctrl_t //if strongest measured RSRP is configured strongest_ssb_rsrp = get_measured_rsrp(sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP); ssb_rsrp[idx * nb_of_csi_ssb_report] = strongest_ssb_rsrp; - LOG_I(MAC,"ssb_rsrp = %d\n",strongest_ssb_rsrp); + LOG_D(MAC,"ssb_rsrp = %d\n",strongest_ssb_rsrp); //if current ssb rsrp is greater than better rsrp if(ssb_rsrp[idx * nb_of_csi_ssb_report] > better_rsrp_reported) { @@ -1241,40 +1232,13 @@ void tci_handling(module_id_t Mod_idP, int UE_id, int CC_id, NR_UE_sched_ctrl_t target_ssb_beam_index = idx * nb_of_csi_ssb_report + diff_rsrp_idx; } } -#if 0 - //} - //if group based beam reporting is enabled - else if (NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled != - csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.present ) { - //extracting the ssb indexes - //for group based reporting only 2 SSB RS are reported, 38.331 - for (ssb_idx = 0; ssb_idx < 2; ssb_idx++) { - ssb_index[idx * nb_of_csi_ssb_report + ssb_idx] = sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.CRI_SSBRI[ssb_idx]; - } - - strongest_ssb_rsrp = get_measured_rsrp(sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.RSRP); - ssb_rsrp[idx * nb_of_csi_ssb_report] = strongest_ssb_rsrp; - - if(ssb_rsrp[idx * nb_of_csi_ssb_report] > better_rsrp_reported) { - better_rsrp_reported = ssb_rsrp[idx * nb_of_csi_ssb_report]; - target_ssb_beam_index = idx * nb_of_csi_ssb_report; - } - - ssb_rsrp[idx * nb_of_csi_ssb_report + 1] = get_diff_rsrp(sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.diff_RSRP[diff_rsrp_idx], strongest_ssb_rsrp); - - if(ssb_rsrp[idx * nb_of_csi_ssb_report + 1] > better_rsrp_reported) { - better_rsrp_reported = ssb_rsrp[idx * nb_of_csi_ssb_report + 1]; - target_ssb_beam_index = idx * nb_of_csi_ssb_report + 1; - } - } -#endif } if(ssb_index[target_ssb_beam_index] != ssb_index[curr_ssb_beam_index] && ssb_rsrp[target_ssb_beam_index] > ssb_rsrp[curr_ssb_beam_index]) { if( ssb_rsrp[target_ssb_beam_index] - ssb_rsrp[curr_ssb_beam_index] > L1_RSRP_HYSTERIS) { is_triggering_ssb_beam_switch = 1; - LOG_I(MAC, "Triggering ssb beam switching using tci\n"); + LOG_D(MAC, "Triggering ssb beam switching using tci\n"); } } @@ -1430,13 +1394,11 @@ void extract_pucch_csi_report (NR_CSI_MeasConfig_t *csi_MeasConfig, UE_info->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report = 0; for ( csi_report_id =0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++ ) { - //Assuming in periodic reporting for one slot can be configured with only one CSI-ReportConfig - // if (csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.present == NR_CSI_ReportConfig__reportConfigType_PR_periodic) { //Has to implement according to reportSlotConfig type /*reportQuantity must be considered according to the current scheduled CSI-ReportConfig if multiple CSI-ReportConfigs present*/ reportQuantity_type = UE_info->csi_report_template[UE_id][csi_report_id].reportQuantity_type; - LOG_I(PHY,"SFN/SF:%d%d reportQuantity type = %d\n",frame,slot,reportQuantity_type); + LOG_D(PHY,"SFN/SF:%d%d reportQuantity type = %d\n",frame,slot,reportQuantity_type); if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type || NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == reportQuantity_type) { @@ -1477,7 +1439,7 @@ void extract_pucch_csi_report (NR_CSI_MeasConfig_t *csi_MeasConfig, *(UE_info->csi_report_template[UE_id][csi_report_id].CSI_Index_list[cri_ssbri_bitlen>0?((*payload)&~(~1<<(cri_ssbri_bitlen-1))):cri_ssbri_bitlen]); *payload >>= cri_ssbri_bitlen; - LOG_I(PHY,"SSB_index = %d\n",sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx]); + LOG_D(PHY,"SSB_index = %d\n",sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx]); } reverse_n_bits(payload, 7); @@ -1490,63 +1452,13 @@ void extract_pucch_csi_report (NR_CSI_MeasConfig_t *csi_MeasConfig, *payload >>= 4; } UE_info->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report++; - LOG_I(MAC,"csi_payload size = %d, rsrp_id = %d\n",payload_size, sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP); + LOG_D(MAC,"csi_payload size = %d, rsrp_id = %d\n",payload_size, sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP); } } if ( !(reportQuantity_type)) AssertFatal(reportQuantity_type, "reportQuantity is not configured"); -#if 0 - - if ( NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_i1 == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_i1_CQI == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_CQI == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI== reportQuantity_type) { - // Handling of extracting cri - sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report.cri = calloc ( 1, ceil(bitlen_cri/8)); - *(sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report.cri) = *((uint32_t *)payload) & ~(~1<<(bitlen_cri-1)); - *payload >>= bitlen_cri; - - if ( 1 == RC.nrrrc[gnb_mod_idP]->carrier.pdsch_AntennaPorts ) { - /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ - sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report->ri = NULL; - } else { - //Handling for the ri for multiple csi ports - } - } - - if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI== reportQuantity_type) { - if ( 1 == RC.nrrrc[gnb_mod_idP]->carrier.pdsch_AntennaPorts ) - /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ - sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report->li = NULL; - else { - //Handle for li for multiple CSI ports - } - } - - //TODO: check for zero padding if available shift payload to the number of zero padding bits - - if ( NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI== reportQuantity_type) { - if ( 1 == RC.nrrrc[gnb_mod_idP]->carrier.pdsch_AntennaPorts ) { - /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ - sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report->pmi_x1 = NULL; - sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report->pmi_x2 = NULL; - } - } - - if ( NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_i1_CQI == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_CQI == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI== reportQuantity_type) { - /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ - *(sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report->cqi) = *(payload) & 0x0f; - *(payload) >>= 4; - } - -#endif } diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index 0bd72fbd51..f63ba8911a 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -644,94 +644,8 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition)); *bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0; - //bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList=NULL; bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList=calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList)); -#if 0 - bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList=calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList)); - - NR_TCI_State_t*tcid0=calloc(1,sizeof(*tcid0)); - tcid0->tci_StateId=0; - tcid0->qcl_Type1.cell=NULL; - tcid0->qcl_Type1.bwp_Id=calloc(1,sizeof(*tcid0->qcl_Type1.bwp_Id)); - *tcid0->qcl_Type1.bwp_Id=1; - tcid0->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs; - tcid0->qcl_Type1.referenceSignal.choice.csi_rs = 2; - tcid0->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA; - ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcid0); - - NR_TCI_State_t*tcid1=calloc(1,sizeof(*tcid1)); - tcid1->tci_StateId=0; - tcid1->qcl_Type1.cell=NULL; - tcid1->qcl_Type1.bwp_Id=calloc(1,sizeof(*tcid1->qcl_Type1.bwp_Id)); - *tcid1->qcl_Type1.bwp_Id=1; - tcid1->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs; - tcid1->qcl_Type1.referenceSignal.choice.csi_rs = 6; - tcid1->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA; - ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcid1); - - NR_TCI_State_t*tcid2=calloc(1,sizeof(*tcid2)); - tcid2->tci_StateId=2; - tcid2->qcl_Type1.cell=NULL; - tcid2->qcl_Type1.bwp_Id=calloc(1,sizeof(*tcid2->qcl_Type1.bwp_Id)); - *tcid2->qcl_Type1.bwp_Id=1; - tcid2->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs; - tcid2->qcl_Type1.referenceSignal.choice.csi_rs = 10; - tcid2->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA; - ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcid2); - - NR_TCI_State_t*tcid3=calloc(1,sizeof(*tcid3)); - tcid3->tci_StateId=3; - tcid3->qcl_Type1.cell=NULL; - tcid3->qcl_Type1.bwp_Id=calloc(1,sizeof(*tcid3->qcl_Type1.bwp_Id)); - *tcid3->qcl_Type1.bwp_Id=1; - tcid3->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs; - tcid3->qcl_Type1.referenceSignal.choice.csi_rs = 14; - tcid3->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA; - ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcid3); - - NR_TCI_State_t*tcid4=calloc(1,sizeof(*tcid4)); - tcid4->tci_StateId=4; - tcid4->qcl_Type1.cell=NULL; - tcid4->qcl_Type1.bwp_Id=calloc(1,sizeof(*tcid4->qcl_Type1.bwp_Id)); - *tcid4->qcl_Type1.bwp_Id=1; - tcid4->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs; - tcid4->qcl_Type1.referenceSignal.choice.csi_rs = 18; - tcid4->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA; - ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcid4); - - NR_TCI_State_t*tcid5=calloc(1,sizeof(*tcid5)); - tcid5->tci_StateId=5; - tcid5->qcl_Type1.cell=NULL; - tcid5->qcl_Type1.bwp_Id=calloc(1,sizeof(*tcid5->qcl_Type1.bwp_Id)); - *tcid5->qcl_Type1.bwp_Id=1; - tcid5->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs; - tcid5->qcl_Type1.referenceSignal.choice.csi_rs = 22; - tcid5->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA; - ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcid5); - - NR_TCI_State_t*tcid6=calloc(1,sizeof(*tcid6)); - tcid6->tci_StateId=6; - tcid6->qcl_Type1.cell=NULL; - tcid6->qcl_Type1.bwp_Id=calloc(1,sizeof(*tcid6->qcl_Type1.bwp_Id)); - *tcid6->qcl_Type1.bwp_Id=1; - tcid6->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs; - tcid6->qcl_Type1.referenceSignal.choice.csi_rs = 26; - tcid6->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA; - ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcid6); - - NR_TCI_State_t*tcid7=calloc(1,sizeof(*tcid7)); - tcid7->tci_StateId=7; - tcid7->qcl_Type1.cell=NULL; - tcid7->qcl_Type1.bwp_Id=calloc(1,sizeof(*tcid7->qcl_Type1.bwp_Id)); - *tcid7->qcl_Type1.bwp_Id=1; - tcid7->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs; - tcid7->qcl_Type1.referenceSignal.choice.csi_rs = 30; - tcid7->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA; - ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcid7); -#endif - - n_ssb = 0; NR_TCI_State_t *tcid[64]; for (int i=0;i<64;i++) { @@ -1262,1166 +1176,6 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco } -#if 0 -void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellconfigcommon, - NR_CellGroupConfig_t *secondaryCellGroup, - int scg_id, - int servCellIndex, - int n_physical_antenna_ports, - int initial_csi_index) { - AssertFatal(servingcellconfigcommon!=NULL,"servingcellconfigcommon is null\n"); - AssertFatal(secondaryCellGroup!=NULL,"secondaryCellGroup is null\n"); - - uint64_t bitmap=0; - switch (servingcellconfigcommon->ssb_PositionsInBurst->present) { - case 1 : - bitmap = ((uint64_t) servingcellconfigcommon->ssb_PositionsInBurst->choice.shortBitmap.buf[0])<<56; - break; - case 2 : - bitmap = ((uint64_t) servingcellconfigcommon->ssb_PositionsInBurst->choice.mediumBitmap.buf[0])<<56; - break; - case 3 : - for (int i=0; i<8; i++) { - bitmap |= (((uint64_t) servingcellconfigcommon->ssb_PositionsInBurst->choice.longBitmap.buf[i])<<((7-i)*8)); - } - break; - default: - AssertFatal(1==0,"SSB bitmap size value %d undefined (allowed values 1,2,3) \n", servingcellconfigcommon->ssb_PositionsInBurst->present); - } - - memset(secondaryCellGroup,0,sizeof(NR_CellGroupConfig_t)); - secondaryCellGroup->cellGroupId = scg_id; - NR_RLC_BearerConfig_t *RLC_BearerConfig = calloc(1,sizeof(*RLC_BearerConfig)); - nr_rlc_bearer_init(RLC_BearerConfig); - if (get_softmodem_params()->do_ra) - nr_drb_config(RLC_BearerConfig->rlc_Config, NR_RLC_Config_PR_um_Bi_Directional); - else - nr_drb_config(RLC_BearerConfig->rlc_Config, NR_RLC_Config_PR_am); - nr_rlc_bearer_init_ul_spec(RLC_BearerConfig->mac_LogicalChannelConfig); - - secondaryCellGroup->rlc_BearerToAddModList = calloc(1,sizeof(*secondaryCellGroup->rlc_BearerToAddModList)); - ASN_SEQUENCE_ADD(&secondaryCellGroup->rlc_BearerToAddModList->list, RLC_BearerConfig); - secondaryCellGroup->mac_CellGroupConfig=calloc(1,sizeof(*secondaryCellGroup->mac_CellGroupConfig)); - secondaryCellGroup->mac_CellGroupConfig->drx_Config = NULL; - secondaryCellGroup->mac_CellGroupConfig->schedulingRequestConfig = NULL; - secondaryCellGroup->mac_CellGroupConfig->bsr_Config=calloc(1,sizeof(*secondaryCellGroup->mac_CellGroupConfig->bsr_Config)); - secondaryCellGroup->mac_CellGroupConfig->bsr_Config->periodicBSR_Timer = NR_BSR_Config__periodicBSR_Timer_sf80; - secondaryCellGroup->mac_CellGroupConfig->bsr_Config->retxBSR_Timer = NR_BSR_Config__retxBSR_Timer_sf320; - secondaryCellGroup->mac_CellGroupConfig->tag_Config=calloc(1,sizeof(*secondaryCellGroup->mac_CellGroupConfig->tag_Config)); - secondaryCellGroup->mac_CellGroupConfig->tag_Config->tag_ToReleaseList = NULL; - secondaryCellGroup->mac_CellGroupConfig->tag_Config->tag_ToAddModList = calloc(1,sizeof(*secondaryCellGroup->mac_CellGroupConfig->tag_Config->tag_ToAddModList)); - struct NR_TAG *tag=calloc(1,sizeof(*tag)); - tag->tag_Id = 0; - tag->timeAlignmentTimer = NR_TimeAlignmentTimer_infinity; - ASN_SEQUENCE_ADD(&secondaryCellGroup->mac_CellGroupConfig->tag_Config->tag_ToAddModList->list,tag); - secondaryCellGroup->mac_CellGroupConfig->phr_Config = calloc(1,sizeof(*secondaryCellGroup->mac_CellGroupConfig->phr_Config)); - secondaryCellGroup->mac_CellGroupConfig->phr_Config->present = NR_SetupRelease_PHR_Config_PR_setup; - secondaryCellGroup->mac_CellGroupConfig->phr_Config->choice.setup = calloc(1,sizeof(*secondaryCellGroup->mac_CellGroupConfig->phr_Config->choice.setup)); - secondaryCellGroup->mac_CellGroupConfig->phr_Config->choice.setup->phr_PeriodicTimer = NR_PHR_Config__phr_PeriodicTimer_sf20; - secondaryCellGroup->mac_CellGroupConfig->phr_Config->choice.setup->phr_ProhibitTimer = NR_PHR_Config__phr_ProhibitTimer_sf0; - secondaryCellGroup->mac_CellGroupConfig->phr_Config->choice.setup->phr_Tx_PowerFactorChange = NR_PHR_Config__phr_Tx_PowerFactorChange_dB3; - secondaryCellGroup->mac_CellGroupConfig->phr_Config->choice.setup->multiplePHR=false; - secondaryCellGroup->mac_CellGroupConfig->phr_Config->choice.setup->dummy=false; - secondaryCellGroup->mac_CellGroupConfig->phr_Config->choice.setup->phr_Type2OtherCell = false; - secondaryCellGroup->mac_CellGroupConfig->phr_Config->choice.setup->phr_ModeOtherCG = NR_PHR_Config__phr_ModeOtherCG_real; - secondaryCellGroup->mac_CellGroupConfig->skipUplinkTxDynamic=false; - secondaryCellGroup->mac_CellGroupConfig->ext1 = NULL; - secondaryCellGroup->physicalCellGroupConfig = calloc(1,sizeof(*secondaryCellGroup->physicalCellGroupConfig)); - secondaryCellGroup->physicalCellGroupConfig->harq_ACK_SpatialBundlingPUCCH=NULL; - secondaryCellGroup->physicalCellGroupConfig->harq_ACK_SpatialBundlingPUSCH=NULL; - secondaryCellGroup->physicalCellGroupConfig->p_NR_FR1=calloc(1,sizeof(*secondaryCellGroup->physicalCellGroupConfig->p_NR_FR1)); - *secondaryCellGroup->physicalCellGroupConfig->p_NR_FR1=20; - secondaryCellGroup->physicalCellGroupConfig->pdsch_HARQ_ACK_Codebook=NR_PhysicalCellGroupConfig__pdsch_HARQ_ACK_Codebook_dynamic; - secondaryCellGroup->physicalCellGroupConfig->tpc_SRS_RNTI=NULL; - secondaryCellGroup->physicalCellGroupConfig->tpc_PUCCH_RNTI=NULL; - secondaryCellGroup->physicalCellGroupConfig->tpc_PUSCH_RNTI=NULL; - secondaryCellGroup->physicalCellGroupConfig->sp_CSI_RNTI=NULL; - secondaryCellGroup->physicalCellGroupConfig->cs_RNTI=NULL; - secondaryCellGroup->physicalCellGroupConfig->ext1=NULL; - secondaryCellGroup->spCellConfig = calloc(1,sizeof(*secondaryCellGroup->spCellConfig)); - secondaryCellGroup->spCellConfig->servCellIndex = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->servCellIndex)); - *secondaryCellGroup->spCellConfig->servCellIndex = servCellIndex; - secondaryCellGroup->spCellConfig->reconfigurationWithSync=calloc(1,sizeof(*secondaryCellGroup->spCellConfig->reconfigurationWithSync)); - secondaryCellGroup->spCellConfig->reconfigurationWithSync->spCellConfigCommon=servingcellconfigcommon; - secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity=(get_softmodem_params()->phy_test==1) ? 0x1234 : (taus()&0xffff); - secondaryCellGroup->spCellConfig->reconfigurationWithSync->t304=NR_ReconfigurationWithSync__t304_ms2000; - secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated = NULL; - secondaryCellGroup->spCellConfig->reconfigurationWithSync->ext1 = NULL; - /* contention free ra */ - secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated = calloc(1,sizeof(struct NR_ReconfigurationWithSync__rach_ConfigDedicated)); - secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->present= NR_ReconfigurationWithSync__rach_ConfigDedicated_PR_uplink; - secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink= calloc(1,sizeof(struct NR_RACH_ConfigDedicated)); - secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra= calloc(1,sizeof(struct NR_CFRA)); - secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->ra_Prioritization= NULL; - secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->occasions= calloc(1,sizeof(struct NR_CFRA__occasions)); - memcpy(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->occasions->rach_ConfigGeneric, - &servingcellconfigcommon->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric, sizeof(NR_RACH_ConfigGeneric_t)); - secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->occasions->ssb_perRACH_Occasion= calloc(1,sizeof(long)); - *secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->occasions->ssb_perRACH_Occasion = NR_CFRA__occasions__ssb_perRACH_Occasion_one; - secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.present = NR_CFRA__resources_PR_ssb; - secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb = calloc(1,sizeof(struct NR_CFRA__resources__ssb)); - secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ra_ssb_OccasionMaskIndex = 0; - struct NR_CFRA_SSB_Resource *ssbElem[8]; - ssbElem[0] = calloc(1,sizeof(struct NR_CFRA_SSB_Resource)); - ssbElem[0]->ssb = 0; - ssbElem[0]->ra_PreambleIndex = 63; - ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem[0]); -#if 0 - ssbElem[1] = calloc(1,sizeof(struct NR_CFRA_SSB_Resource)); - ssbElem[1]->ssb = 1; - ssbElem[1]->ra_PreambleIndex = 62; - ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem[1]); - ssbElem[2] = calloc(1,sizeof(struct NR_CFRA_SSB_Resource)); - ssbElem[2]->ssb = 2; - ssbElem[2]->ra_PreambleIndex = 63; - ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem[2]); - ssbElem[3] = calloc(1,sizeof(struct NR_CFRA_SSB_Resource)); - ssbElem[3]->ssb = 3; - ssbElem[3]->ra_PreambleIndex = 63; - ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem[3]); - ssbElem[4] = calloc(1,sizeof(struct NR_CFRA_SSB_Resource)); - ssbElem[4]->ssb = 4; - ssbElem[4]->ra_PreambleIndex = 63; - ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem[4]); - ssbElem[5] = calloc(1,sizeof(struct NR_CFRA_SSB_Resource)); - ssbElem[5]->ssb = 5; - ssbElem[5]->ra_PreambleIndex = 63; - ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem[5]); - ssbElem[6] = calloc(1,sizeof(struct NR_CFRA_SSB_Resource)); - ssbElem[6]->ssb = 6; - ssbElem[6]->ra_PreambleIndex = 63; - ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem[6]); - ssbElem[7] = calloc(1,sizeof(struct NR_CFRA_SSB_Resource)); - ssbElem[7]->ssb = 7; - ssbElem[7]->ra_PreambleIndex = 63; - ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem[7]); -#endif - secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->ext1 = NULL; - secondaryCellGroup->spCellConfig->rlf_TimersAndConstants = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->rlf_TimersAndConstants)); - secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->present = NR_SetupRelease_RLF_TimersAndConstants_PR_setup; - secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup=calloc(1,sizeof(*secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup)); - secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup->t310 = NR_RLF_TimersAndConstants__t310_ms2000; - secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup->n310 = NR_RLF_TimersAndConstants__n310_n10; - secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup->n311 = NR_RLF_TimersAndConstants__n311_n1; - secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup->ext1 = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup->ext1)); - secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup->ext1->t311 = NR_RLF_TimersAndConstants__ext1__t311_ms30000; - secondaryCellGroup->spCellConfig->rlmInSyncOutOfSyncThreshold = NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated)); - secondaryCellGroup->spCellConfig->spCellConfigDedicated->tdd_UL_DL_ConfigurationDedicated = NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP)); - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdcch_Config=NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config=calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config)); - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->present = NR_SetupRelease_PDSCH_Config_PR_setup; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup = calloc(1, - sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup)); - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dataScramblingIdentityPDSCH = NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA = calloc(1, - sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA)); - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->present= NR_SetupRelease_DMRS_DownlinkConfig_PR_setup; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup)); - - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type=NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->maxLength=NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->scramblingID0=NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->scramblingID1=NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS=NULL; - - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition)); - *secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0; - - - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList=calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList)); - - int n_ssb = 0; - NR_TCI_State_t *tcic[64]; - for (int i=0;i<64;i++) { - if ((bitmap>>(63-i))&0x01){ - tcic[i]=calloc(1,sizeof(*tcic[i])); - tcic[i]->tci_StateId=n_ssb; - tcic[i]->qcl_Type1.cell=NULL; - tcic[i]->qcl_Type1.bwp_Id=calloc(1,sizeof(*tcic[i]->qcl_Type1.bwp_Id)); - *tcic[i]->qcl_Type1.bwp_Id=1; - tcic[i]->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_ssb; - tcic[i]->qcl_Type1.referenceSignal.choice.ssb = i; - tcic[i]->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeC; - ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcic[i]); - n_ssb++; - } - } - - -#if 0 - - NR_TCI_State_t*tci0=calloc(1,sizeof(*tci0)); - tci0->tci_StateId=0; - tci0->qcl_Type1.cell=NULL; - tci0->qcl_Type1.bwp_Id=calloc(1,sizeof(*tci0->qcl_Type1.bwp_Id)); - *tci0->qcl_Type1.bwp_Id=1; - tci0->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs; - tci0->qcl_Type1.referenceSignal.choice.csi_rs = 2; - tci0->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA; - ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tci0); - - NR_TCI_State_t*tci1=calloc(1,sizeof(*tci1)); - tci1->tci_StateId=1; - tci1->qcl_Type1.cell=NULL; - tci1->qcl_Type1.bwp_Id=calloc(1,sizeof(*tci1->qcl_Type1.bwp_Id)); - *tci1->qcl_Type1.bwp_Id=1; - tci1->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs; - tci1->qcl_Type1.referenceSignal.choice.csi_rs = 6; - tci1->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA; - ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tci1); - - NR_TCI_State_t*tci2=calloc(1,sizeof(*tci2)); - tci2->tci_StateId=2; - tci2->qcl_Type1.cell=NULL; - tci2->qcl_Type1.bwp_Id=calloc(1,sizeof(*tci2->qcl_Type1.bwp_Id)); - *tci2->qcl_Type1.bwp_Id=1; - tci2->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs; - tci2->qcl_Type1.referenceSignal.choice.csi_rs = 10; - tci2->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA; - ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tci2); - - NR_TCI_State_t *tci3=calloc(1,sizeof(*tci3)); - tci3->tci_StateId=3; - tci3->qcl_Type1.cell=NULL; - tci3->qcl_Type1.bwp_Id=calloc(1,sizeof(*tci3->qcl_Type1.bwp_Id)); - *tci3->qcl_Type1.bwp_Id=1; - tci3->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs; - tci3->qcl_Type1.referenceSignal.choice.csi_rs = 14; - tci3->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA; - ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tci3); - - NR_TCI_State_t*tci4=calloc(1,sizeof(*tci4)); - tci4->tci_StateId=4; - tci4->qcl_Type1.cell=NULL; - tci4->qcl_Type1.bwp_Id=calloc(1,sizeof(*tci4->qcl_Type1.bwp_Id)); - *tci4->qcl_Type1.bwp_Id=1; - tci4->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs; - tci4->qcl_Type1.referenceSignal.choice.csi_rs = 18; - tci4->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA; - ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tci4); - - NR_TCI_State_t*tci5=calloc(1,sizeof(*tci5)); - tci5->tci_StateId=5; - tci5->qcl_Type1.cell=NULL; - tci5->qcl_Type1.bwp_Id=calloc(1,sizeof(*tci5->qcl_Type1.bwp_Id)); - *tci5->qcl_Type1.bwp_Id=1; - tci5->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs; - tci5->qcl_Type1.referenceSignal.choice.csi_rs = 22; - tci5->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA; - ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tci5); - - NR_TCI_State_t*tci6=calloc(1,sizeof(*tci6)); - tci6->tci_StateId=6; - tci6->qcl_Type1.cell=NULL; - tci6->qcl_Type1.bwp_Id=calloc(1,sizeof(*tci6->qcl_Type1.bwp_Id)); - *tci6->qcl_Type1.bwp_Id=1; - tci6->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs; - tci6->qcl_Type1.referenceSignal.choice.csi_rs = 26; - tci6->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA; - ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tci6); - - NR_TCI_State_t*tci7=calloc(1,sizeof(*tci7)); - tci7->tci_StateId=7; - tci7->qcl_Type1.cell=NULL; - tci7->qcl_Type1.bwp_Id=calloc(1,sizeof(*tci7->qcl_Type1.bwp_Id)); - *tci7->qcl_Type1.bwp_Id=1; - tci7->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs; - tci7->qcl_Type1.referenceSignal.choice.csi_rs = 30; - tci7->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA; - ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tci7); - -#endif - - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToReleaseList=NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->vrb_ToPRB_Interleaver=NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->resourceAllocation=NR_PDSCH_Config__resourceAllocation_resourceAllocationType1; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->pdsch_TimeDomainAllocationList=NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->pdsch_AggregationFactor=NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->rateMatchPatternToAddModList=NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->rateMatchPatternToReleaseList=NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->rateMatchPatternGroup1=NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->rateMatchPatternGroup2=NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->rbg_Size=NR_PDSCH_Config__rbg_Size_config1; - if (!get_softmodem_params()->use_256qam_table) { - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->mcs_Table=NULL; - } else { - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->mcs_Table = calloc(1, sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->mcs_Table)); - *secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->mcs_Table = NR_PDSCH_Config__mcs_Table_qam256; - } - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI)); - *secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI = NR_PDSCH_Config__maxNrofCodeWordsScheduledByDCI_n1; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->prb_BundlingType.present = NR_PDSCH_Config__prb_BundlingType_PR_staticBundling; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->prb_BundlingType.choice.staticBundling = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->prb_BundlingType.choice.staticBundling)); - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->prb_BundlingType.choice.staticBundling->bundleSize = - calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->prb_BundlingType.choice.staticBundling->bundleSize)); - *secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->prb_BundlingType.choice.staticBundling->bundleSize = NR_PDSCH_Config__prb_BundlingType__staticBundling__bundleSize_wideband; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->zp_CSI_RS_ResourceToAddModList=NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->zp_CSI_RS_ResourceToReleaseList=NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->aperiodic_ZP_CSI_RS_ResourceSetsToAddModList=NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->aperiodic_ZP_CSI_RS_ResourceSetsToReleaseList=NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->sp_ZP_CSI_RS_ResourceSetsToAddModList=NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->sp_ZP_CSI_RS_ResourceSetsToReleaseList=NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->p_ZP_CSI_RS_ResourceSet=NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->sps_Config = NULL; //calloc(1,sizeof(struct NR_SetupRelease_SPS_Config)); - - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->radioLinkMonitoringConfig = NULL; -#if 0 - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->radioLinkMonitoringConfig = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->radioLinkMonitoringConfig)); - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->radioLinkMonitoringConfig->present = NR_SetupRelease_RadioLinkMonitoringConfig_PR_setup; - - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->radioLinkMonitoringConfig->choice.setup = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->radioLinkMonitoringConfig->choice.setup)); - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->radioLinkMonitoringConfig->choice.setup->failureDetectionResourcesToAddModList=NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->radioLinkMonitoringConfig->choice.setup->failureDetectionResourcesToReleaseList=NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->radioLinkMonitoringConfig->choice.setup->beamFailureInstanceMaxCount = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->radioLinkMonitoringConfig->choice.setup->beamFailureInstanceMaxCount)); - *secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->radioLinkMonitoringConfig->choice.setup->beamFailureInstanceMaxCount = NR_RadioLinkMonitoringConfig__beamFailureInstanceMaxCount_n3; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->radioLinkMonitoringConfig->choice.setup->beamFailureDetectionTimer = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->radioLinkMonitoringConfig->choice.setup->beamFailureDetectionTimer)); - *secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->radioLinkMonitoringConfig->choice.setup->beamFailureDetectionTimer = NR_RadioLinkMonitoringConfig__beamFailureDetectionTimer_pbfd2; -#endif - - secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToReleaseList= NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList)); - - NR_BWP_Downlink_t *bwp=calloc(1,sizeof(*bwp)); - bwp->bwp_Id=1; - bwp->bwp_Common=calloc(1,sizeof(*bwp->bwp_Common)); - // copy common BWP size from initial BWP except for bandwdith - memcpy((void*)&bwp->bwp_Common->genericParameters, - &servingcellconfigcommon->downlinkConfigCommon->initialDownlinkBWP->genericParameters, - sizeof(bwp->bwp_Common->genericParameters)); - bwp->bwp_Common->genericParameters.locationAndBandwidth=PRBalloc_to_locationandbandwidth(servingcellconfigcommon->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth,0); - - - bwp->bwp_Common->pdcch_ConfigCommon=calloc(1,sizeof(*bwp->bwp_Common->pdcch_ConfigCommon)); - bwp->bwp_Common->pdcch_ConfigCommon->present = NR_SetupRelease_PDCCH_ConfigCommon_PR_setup; - bwp->bwp_Common->pdcch_ConfigCommon->choice.setup = calloc(1,sizeof(*bwp->bwp_Common->pdcch_ConfigCommon->choice.setup)); - bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->controlResourceSetZero=NULL; - bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonControlResourceSet=calloc(1,sizeof(*bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonControlResourceSet)); - - int curr_bwp = NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth,275); - - NR_ControlResourceSet_t *coreset = calloc(1,sizeof(*coreset)); - coreset->controlResourceSetId=1; - // frequency domain resources depends on BWP size - // options are 24, 48 or 96 - coreset->frequencyDomainResources.buf = calloc(1,6); - if (curr_bwp < 48) - coreset->frequencyDomainResources.buf[0] = 0xf0; - else - coreset->frequencyDomainResources.buf[0] = 0xff; - if (curr_bwp < 96) - coreset->frequencyDomainResources.buf[1] = 0; - else - coreset->frequencyDomainResources.buf[1] = 0xff; - coreset->frequencyDomainResources.buf[2] = 0; - coreset->frequencyDomainResources.buf[3] = 0; - coreset->frequencyDomainResources.buf[4] = 0; - coreset->frequencyDomainResources.buf[5] = 0; - coreset->frequencyDomainResources.size = 6; - coreset->frequencyDomainResources.bits_unused = 3; - coreset->duration=1; - coreset->cce_REG_MappingType.present = NR_ControlResourceSet__cce_REG_MappingType_PR_nonInterleaved; - coreset->precoderGranularity = NR_ControlResourceSet__precoderGranularity_sameAsREG_bundle; - - coreset->tci_StatesPDCCH_ToAddList=calloc(1,sizeof(*coreset->tci_StatesPDCCH_ToAddList)); - NR_TCI_StateId_t *tci[64]; - for (int i=0;i<64;i++) { - if ((bitmap>>(63-i))&0x01){ - tci[i]=calloc(1,sizeof(*tci[i])); - *tci[i] = i; - ASN_SEQUENCE_ADD(&coreset->tci_StatesPDCCH_ToAddList->list,tci[i]); - } - } - coreset->tci_StatesPDCCH_ToReleaseList = NULL; - coreset->tci_PresentInDCI = NULL; - coreset->pdcch_DMRS_ScramblingID = NULL; - - bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonControlResourceSet = coreset; - - bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->searchSpaceZero=NULL; - bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList=NULL; - bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList=calloc(1,sizeof(*bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList)); - - NR_SearchSpace_t *ss=calloc(1,sizeof(*ss)); - ss->searchSpaceId = 1; - ss->controlResourceSetId=calloc(1,sizeof(*ss->controlResourceSetId)); - *ss->controlResourceSetId=1; - ss->monitoringSlotPeriodicityAndOffset = calloc(1,sizeof(*ss->monitoringSlotPeriodicityAndOffset)); - ss->monitoringSlotPeriodicityAndOffset->present = NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1; - ss->duration=NULL; - ss->monitoringSymbolsWithinSlot = calloc(1,sizeof(*ss->monitoringSymbolsWithinSlot)); - ss->monitoringSymbolsWithinSlot->buf = calloc(1,2); - // should be '1100 0000 0000 00'B (LSB first!), first two symols in slot, adjust if needed - ss->monitoringSymbolsWithinSlot->buf[1] = 0; - ss->monitoringSymbolsWithinSlot->buf[0] = (1<<7) | (1<<6); - ss->monitoringSymbolsWithinSlot->size = 2; - ss->monitoringSymbolsWithinSlot->bits_unused = 2; - ss->nrofCandidates = calloc(1,sizeof(*ss->nrofCandidates)); - ss->nrofCandidates->aggregationLevel1 = NR_SearchSpace__nrofCandidates__aggregationLevel1_n0; - ss->nrofCandidates->aggregationLevel2 = NR_SearchSpace__nrofCandidates__aggregationLevel2_n0; - ss->nrofCandidates->aggregationLevel4 = NR_SearchSpace__nrofCandidates__aggregationLevel4_n1; - ss->nrofCandidates->aggregationLevel8 = NR_SearchSpace__nrofCandidates__aggregationLevel8_n0; - ss->nrofCandidates->aggregationLevel16 = NR_SearchSpace__nrofCandidates__aggregationLevel16_n0; - ss->searchSpaceType = calloc(1,sizeof(*ss->searchSpaceType)); - ss->searchSpaceType->present = NR_SearchSpace__searchSpaceType_PR_common; - ss->searchSpaceType->choice.common=calloc(1,sizeof(*ss->searchSpaceType->choice.common)); - ss->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 = calloc(1,sizeof(*ss->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0)); - - ASN_SEQUENCE_ADD(&bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList->list,ss); - - - bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->searchSpaceSIB1=calloc(1,sizeof(*bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->searchSpaceSIB1)); - *bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->searchSpaceSIB1=0; - bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->searchSpaceOtherSystemInformation=NULL; - bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->pagingSearchSpace=NULL; - bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->ra_SearchSpace=calloc(1,sizeof(*bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->ra_SearchSpace)); - *bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->ra_SearchSpace=1; - bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->ext1=NULL; - - bwp->bwp_Common->pdsch_ConfigCommon=calloc(1,sizeof(*bwp->bwp_Common->pdsch_ConfigCommon)); - bwp->bwp_Common->pdsch_ConfigCommon->present = NR_SetupRelease_PDSCH_ConfigCommon_PR_setup; - bwp->bwp_Common->pdsch_ConfigCommon->choice.setup = calloc(1,sizeof(*bwp->bwp_Common->pdsch_ConfigCommon->choice.setup)); - bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList = calloc(1,sizeof(*bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList)); - - // copy PDSCH TimeDomainResourceAllocation from InitialBWP - - NR_PDSCH_TimeDomainResourceAllocation_t *pdschi; - for (int i=0;idownlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.count;i++) { - pdschi= calloc(1,sizeof(*pdschi)); - AssertFatal(servingcellconfigcommon->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[i]->k0!=NULL,"element %d is null\n",i); - - pdschi->k0 = calloc(1,sizeof(*pdschi->k0)); - *pdschi->k0 = *servingcellconfigcommon->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[i]->k0; - pdschi->mappingType = servingcellconfigcommon->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[i]->mappingType; - pdschi->startSymbolAndLength = servingcellconfigcommon->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[i]->startSymbolAndLength; - ASN_SEQUENCE_ADD(&bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list,pdschi); - } - - bwp->bwp_Dedicated=calloc(1,sizeof(*bwp->bwp_Dedicated)); - - bwp->bwp_Dedicated->pdcch_Config=calloc(1,sizeof(*bwp->bwp_Dedicated->pdcch_Config)); - bwp->bwp_Dedicated->pdcch_Config->present = NR_SetupRelease_PDCCH_Config_PR_setup; - bwp->bwp_Dedicated->pdcch_Config->choice.setup = calloc(1,sizeof(*bwp->bwp_Dedicated->pdcch_Config->choice.setup)); - bwp->bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList = calloc(1,sizeof(*bwp->bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList)); - - ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList->list, - coreset); - - bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList = calloc(1,sizeof(*bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList)); - - NR_SearchSpace_t *ss2 = calloc(1,sizeof(*ss2)); - - ss2->searchSpaceId=2; - ss2->controlResourceSetId=calloc(1,sizeof(*ss2->controlResourceSetId)); - *ss2->controlResourceSetId=1; - ss2->monitoringSlotPeriodicityAndOffset=calloc(1,sizeof(*ss2->monitoringSlotPeriodicityAndOffset)); - ss2->monitoringSlotPeriodicityAndOffset->present = NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1; - ss2->monitoringSlotPeriodicityAndOffset->choice.sl1=(NULL_t)0; - ss2->duration=NULL; - ss2->monitoringSymbolsWithinSlot = calloc(1,sizeof(*ss2->monitoringSymbolsWithinSlot)); - ss2->monitoringSymbolsWithinSlot->buf = calloc(1,2); - ss2->monitoringSymbolsWithinSlot->size = 2; - ss2->monitoringSymbolsWithinSlot->bits_unused = 2; - ss2->monitoringSymbolsWithinSlot->buf[0]=0xc0; - ss2->monitoringSymbolsWithinSlot->buf[1]=0x0; - ss2->nrofCandidates=calloc(1,sizeof(*ss2->nrofCandidates)); - ss2->nrofCandidates->aggregationLevel1 = NR_SearchSpace__nrofCandidates__aggregationLevel1_n0; - ss2->nrofCandidates->aggregationLevel2 = NR_SearchSpace__nrofCandidates__aggregationLevel2_n0; - if (curr_bwp < 48) - ss2->nrofCandidates->aggregationLevel4 = NR_SearchSpace__nrofCandidates__aggregationLevel4_n1; - else if (curr_bwp < 96) - ss2->nrofCandidates->aggregationLevel4 = NR_SearchSpace__nrofCandidates__aggregationLevel4_n2; - else - ss2->nrofCandidates->aggregationLevel4 = NR_SearchSpace__nrofCandidates__aggregationLevel4_n4; - ss2->nrofCandidates->aggregationLevel8 = NR_SearchSpace__nrofCandidates__aggregationLevel8_n0; - ss2->nrofCandidates->aggregationLevel16 = NR_SearchSpace__nrofCandidates__aggregationLevel16_n0; - ss2->searchSpaceType=calloc(1,sizeof(*ss2->searchSpaceType)); - ss2->searchSpaceType->present = NR_SearchSpace__searchSpaceType_PR_ue_Specific; - ss2->searchSpaceType->choice.ue_Specific = calloc(1,sizeof(*ss2->searchSpaceType->choice.ue_Specific)); - ss2->searchSpaceType->choice.ue_Specific->dci_Formats=NR_SearchSpace__searchSpaceType__ue_Specific__dci_Formats_formats0_1_And_1_1; - - ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list, - ss2); - - - bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToReleaseList = NULL; - - bwp->bwp_Dedicated->pdsch_Config = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config)); - - bwp->bwp_Dedicated->pdsch_Config->present = NR_SetupRelease_PDSCH_Config_PR_setup; - bwp->bwp_Dedicated->pdsch_Config->choice.setup = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup)); - bwp->bwp_Dedicated->pdsch_Config->choice.setup->dataScramblingIdentityPDSCH = NULL; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA)); - bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->present= NR_SetupRelease_DMRS_DownlinkConfig_PR_setup; - - bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup)); - - bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type=NULL; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->maxLength=NULL; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->scramblingID0=NULL; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->scramblingID1=NULL; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS=NULL; - - bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition)); - *bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0; - - //bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList=NULL; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList=calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList)); - -#if 0 - bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList=calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList)); - - NR_TCI_State_t*tcid0=calloc(1,sizeof(*tcid0)); - tcid0->tci_StateId=0; - tcid0->qcl_Type1.cell=NULL; - tcid0->qcl_Type1.bwp_Id=calloc(1,sizeof(*tcid0->qcl_Type1.bwp_Id)); - *tcid0->qcl_Type1.bwp_Id=1; - tcid0->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs; - tcid0->qcl_Type1.referenceSignal.choice.csi_rs = 2; - tcid0->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA; - ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcid0); - - NR_TCI_State_t*tcid1=calloc(1,sizeof(*tcid1)); - tcid1->tci_StateId=0; - tcid1->qcl_Type1.cell=NULL; - tcid1->qcl_Type1.bwp_Id=calloc(1,sizeof(*tcid1->qcl_Type1.bwp_Id)); - *tcid1->qcl_Type1.bwp_Id=1; - tcid1->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs; - tcid1->qcl_Type1.referenceSignal.choice.csi_rs = 6; - tcid1->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA; - ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcid1); - - NR_TCI_State_t*tcid2=calloc(1,sizeof(*tcid2)); - tcid2->tci_StateId=2; - tcid2->qcl_Type1.cell=NULL; - tcid2->qcl_Type1.bwp_Id=calloc(1,sizeof(*tcid2->qcl_Type1.bwp_Id)); - *tcid2->qcl_Type1.bwp_Id=1; - tcid2->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs; - tcid2->qcl_Type1.referenceSignal.choice.csi_rs = 10; - tcid2->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA; - ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcid2); - - NR_TCI_State_t*tcid3=calloc(1,sizeof(*tcid3)); - tcid3->tci_StateId=3; - tcid3->qcl_Type1.cell=NULL; - tcid3->qcl_Type1.bwp_Id=calloc(1,sizeof(*tcid3->qcl_Type1.bwp_Id)); - *tcid3->qcl_Type1.bwp_Id=1; - tcid3->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs; - tcid3->qcl_Type1.referenceSignal.choice.csi_rs = 14; - tcid3->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA; - ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcid3); - - NR_TCI_State_t*tcid4=calloc(1,sizeof(*tcid4)); - tcid4->tci_StateId=4; - tcid4->qcl_Type1.cell=NULL; - tcid4->qcl_Type1.bwp_Id=calloc(1,sizeof(*tcid4->qcl_Type1.bwp_Id)); - *tcid4->qcl_Type1.bwp_Id=1; - tcid4->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs; - tcid4->qcl_Type1.referenceSignal.choice.csi_rs = 18; - tcid4->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA; - ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcid4); - - NR_TCI_State_t*tcid5=calloc(1,sizeof(*tcid5)); - tcid5->tci_StateId=5; - tcid5->qcl_Type1.cell=NULL; - tcid5->qcl_Type1.bwp_Id=calloc(1,sizeof(*tcid5->qcl_Type1.bwp_Id)); - *tcid5->qcl_Type1.bwp_Id=1; - tcid5->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs; - tcid5->qcl_Type1.referenceSignal.choice.csi_rs = 22; - tcid5->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA; - ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcid5); - - NR_TCI_State_t*tcid6=calloc(1,sizeof(*tcid6)); - tcid6->tci_StateId=6; - tcid6->qcl_Type1.cell=NULL; - tcid6->qcl_Type1.bwp_Id=calloc(1,sizeof(*tcid6->qcl_Type1.bwp_Id)); - *tcid6->qcl_Type1.bwp_Id=1; - tcid6->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs; - tcid6->qcl_Type1.referenceSignal.choice.csi_rs = 26; - tcid6->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA; - ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcid6); - - NR_TCI_State_t*tcid7=calloc(1,sizeof(*tcid7)); - tcid7->tci_StateId=7; - tcid7->qcl_Type1.cell=NULL; - tcid7->qcl_Type1.bwp_Id=calloc(1,sizeof(*tcid7->qcl_Type1.bwp_Id)); - *tcid7->qcl_Type1.bwp_Id=1; - tcid7->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs; - tcid7->qcl_Type1.referenceSignal.choice.csi_rs = 30; - tcid7->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA; - ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcid7); -#endif - - - n_ssb = 0; - NR_TCI_State_t *tcid[64]; - for (int i=0;i<64;i++) { - if ((bitmap>>(63-i))&0x01){ - tcid[i]=calloc(1,sizeof(*tcid[i])); - tcid[i]->tci_StateId=n_ssb; - tcid[i]->qcl_Type1.cell=NULL; - tcid[i]->qcl_Type1.bwp_Id=calloc(1,sizeof(*tcid[i]->qcl_Type1.bwp_Id)); - *tcid[i]->qcl_Type1.bwp_Id=1; - tcid[i]->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_ssb; - tcid[i]->qcl_Type1.referenceSignal.choice.ssb = i; - tcid[i]->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeC; - ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcid[i]); - n_ssb++; - } - } - - - bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToReleaseList=NULL; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->vrb_ToPRB_Interleaver=NULL; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->resourceAllocation=NR_PDSCH_Config__resourceAllocation_resourceAllocationType1; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->pdsch_TimeDomainAllocationList=NULL; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->pdsch_AggregationFactor=NULL; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->rateMatchPatternToAddModList=NULL; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->rateMatchPatternToReleaseList=NULL; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->rateMatchPatternGroup1=NULL; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->rateMatchPatternGroup2=NULL; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->rbg_Size=NR_PDSCH_Config__rbg_Size_config1; - if (!get_softmodem_params()->use_256qam_table) { - bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table=NULL; - } else { - bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table = calloc(1, sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table)); - *bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table = NR_PDSCH_Config__mcs_Table_qam256; - } - bwp->bwp_Dedicated->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI)); - *bwp->bwp_Dedicated->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI = NR_PDSCH_Config__maxNrofCodeWordsScheduledByDCI_n1; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->prb_BundlingType.present = NR_PDSCH_Config__prb_BundlingType_PR_staticBundling; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->prb_BundlingType.choice.staticBundling = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->prb_BundlingType.choice.staticBundling)); - bwp->bwp_Dedicated->pdsch_Config->choice.setup->prb_BundlingType.choice.staticBundling->bundleSize = - calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->prb_BundlingType.choice.staticBundling->bundleSize)); - *bwp->bwp_Dedicated->pdsch_Config->choice.setup->prb_BundlingType.choice.staticBundling->bundleSize = NR_PDSCH_Config__prb_BundlingType__staticBundling__bundleSize_wideband; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->zp_CSI_RS_ResourceToAddModList=NULL; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->zp_CSI_RS_ResourceToReleaseList=NULL; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->aperiodic_ZP_CSI_RS_ResourceSetsToAddModList=NULL; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->aperiodic_ZP_CSI_RS_ResourceSetsToReleaseList=NULL; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->sp_ZP_CSI_RS_ResourceSetsToAddModList=NULL; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->sp_ZP_CSI_RS_ResourceSetsToReleaseList=NULL; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->p_ZP_CSI_RS_ResourceSet=NULL; - - bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToReleaseList=NULL; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->vrb_ToPRB_Interleaver=NULL; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->resourceAllocation=NR_PDSCH_Config__resourceAllocation_resourceAllocationType1; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->pdsch_TimeDomainAllocationList=NULL; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->pdsch_AggregationFactor=NULL; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->rateMatchPatternToAddModList=NULL; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->rateMatchPatternToReleaseList=NULL; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->rateMatchPatternGroup1=NULL; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->rateMatchPatternGroup2=NULL; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->rbg_Size=NR_PDSCH_Config__rbg_Size_config1; - if (!get_softmodem_params()->use_256qam_table) { - bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table=NULL; - } else { - bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table = calloc(1, sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table)); - *bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table = NR_PDSCH_Config__mcs_Table_qam256; - } - bwp->bwp_Dedicated->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI)); - *bwp->bwp_Dedicated->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI = NR_PDSCH_Config__maxNrofCodeWordsScheduledByDCI_n1; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->prb_BundlingType.present = NR_PDSCH_Config__prb_BundlingType_PR_staticBundling; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->prb_BundlingType.choice.staticBundling = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->prb_BundlingType.choice.staticBundling)); - bwp->bwp_Dedicated->pdsch_Config->choice.setup->prb_BundlingType.choice.staticBundling->bundleSize = - calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->prb_BundlingType.choice.staticBundling->bundleSize)); - *bwp->bwp_Dedicated->pdsch_Config->choice.setup->prb_BundlingType.choice.staticBundling->bundleSize = NR_PDSCH_Config__prb_BundlingType__staticBundling__bundleSize_wideband; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->zp_CSI_RS_ResourceToAddModList=NULL; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->zp_CSI_RS_ResourceToReleaseList=NULL; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->aperiodic_ZP_CSI_RS_ResourceSetsToAddModList=NULL; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->aperiodic_ZP_CSI_RS_ResourceSetsToReleaseList=NULL; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->sp_ZP_CSI_RS_ResourceSetsToAddModList=NULL; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->sp_ZP_CSI_RS_ResourceSetsToReleaseList=NULL; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->p_ZP_CSI_RS_ResourceSet=NULL; - bwp->bwp_Dedicated->sps_Config = NULL; //calloc(1,sizeof(struct NR_SetupRelease_SPS_Config)); - - bwp->bwp_Dedicated->radioLinkMonitoringConfig = NULL; -#if 0 - bwp->bwp_Dedicated->radioLinkMonitoringConfig = calloc(1,sizeof(*bwp->bwp_Dedicated->radioLinkMonitoringConfig)); - bwp->bwp_Dedicated->radioLinkMonitoringConfig->present = NR_SetupRelease_RadioLinkMonitoringConfig_PR_setup; - - bwp->bwp_Dedicated->radioLinkMonitoringConfig->choice.setup = calloc(1,sizeof(*bwp->bwp_Dedicated->radioLinkMonitoringConfig->choice.setup)); - bwp->bwp_Dedicated->radioLinkMonitoringConfig->choice.setup->failureDetectionResourcesToAddModList=NULL; - bwp->bwp_Dedicated->radioLinkMonitoringConfig->choice.setup->failureDetectionResourcesToReleaseList=NULL; - bwp->bwp_Dedicated->radioLinkMonitoringConfig->choice.setup->beamFailureInstanceMaxCount = calloc(1,sizeof(*bwp->bwp_Dedicated->radioLinkMonitoringConfig->choice.setup->beamFailureInstanceMaxCount)); - *bwp->bwp_Dedicated->radioLinkMonitoringConfig->choice.setup->beamFailureInstanceMaxCount = NR_RadioLinkMonitoringConfig__beamFailureInstanceMaxCount_n3; - bwp->bwp_Dedicated->radioLinkMonitoringConfig->choice.setup->beamFailureDetectionTimer = calloc(1,sizeof(*bwp->bwp_Dedicated->radioLinkMonitoringConfig->choice.setup->beamFailureDetectionTimer)); - *bwp->bwp_Dedicated->radioLinkMonitoringConfig->choice.setup->beamFailureDetectionTimer = NR_RadioLinkMonitoringConfig__beamFailureDetectionTimer_pbfd2; -#endif - - ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list,bwp); - - secondaryCellGroup->spCellConfig->spCellConfigDedicated->firstActiveDownlinkBWP_Id=calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->firstActiveDownlinkBWP_Id)); - - *secondaryCellGroup->spCellConfig->spCellConfigDedicated->firstActiveDownlinkBWP_Id=1; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->bwp_InactivityTimer = NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->defaultDownlinkBWP_Id = NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->defaultDownlinkBWP_Id = calloc(1, sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->defaultDownlinkBWP_Id)); - *secondaryCellGroup->spCellConfig->spCellConfigDedicated->defaultDownlinkBWP_Id = 1; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig=calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig)); - - NR_BWP_UplinkDedicated_t *initialUplinkBWP = calloc(1,sizeof(*initialUplinkBWP)); - secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP = initialUplinkBWP; - initialUplinkBWP->pucch_Config = NULL; - initialUplinkBWP->pusch_Config = calloc(1,sizeof(*initialUplinkBWP->pusch_Config)); - initialUplinkBWP->pusch_Config->present = NR_SetupRelease_PUSCH_Config_PR_setup; - NR_PUSCH_Config_t *pusch_Config = calloc(1,sizeof(*pusch_Config)); - initialUplinkBWP->pusch_Config->choice.setup = pusch_Config; - pusch_Config->txConfig=calloc(1,sizeof(*pusch_Config->txConfig)); - *pusch_Config->txConfig= NR_PUSCH_Config__txConfig_codebook; - pusch_Config->dmrs_UplinkForPUSCH_MappingTypeA = NULL; - pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB = calloc(1,sizeof(*pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB)); - pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->present = NR_SetupRelease_DMRS_UplinkConfig_PR_setup; - pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup = calloc(1,sizeof(*pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup)); - NR_DMRS_UplinkConfig_t *NR_DMRS_UplinkConfig = pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup; - NR_DMRS_UplinkConfig->dmrs_Type = NULL; - NR_DMRS_UplinkConfig->dmrs_AdditionalPosition = calloc(1,sizeof(*NR_DMRS_UplinkConfig->dmrs_AdditionalPosition)); - *NR_DMRS_UplinkConfig->dmrs_AdditionalPosition = NR_DMRS_UplinkConfig__dmrs_AdditionalPosition_pos0; - NR_DMRS_UplinkConfig->phaseTrackingRS=NULL; - NR_DMRS_UplinkConfig->maxLength=NULL; - NR_DMRS_UplinkConfig->transformPrecodingDisabled = calloc(1,sizeof(*NR_DMRS_UplinkConfig->transformPrecodingDisabled)); - NR_DMRS_UplinkConfig->transformPrecodingDisabled->scramblingID0 = NULL; - NR_DMRS_UplinkConfig->transformPrecodingDisabled->scramblingID1 = NULL; - NR_DMRS_UplinkConfig->transformPrecodingEnabled = NULL; - pusch_Config->pusch_PowerControl = calloc(1,sizeof(*pusch_Config->pusch_PowerControl)); - pusch_Config->pusch_PowerControl->tpc_Accumulation = NULL; - pusch_Config->pusch_PowerControl->msg3_Alpha = calloc(1,sizeof(*pusch_Config->pusch_PowerControl->msg3_Alpha)); - *pusch_Config->pusch_PowerControl->msg3_Alpha = NR_Alpha_alpha1; - pusch_Config->pusch_PowerControl->p0_NominalWithoutGrant = NULL; - pusch_Config->pusch_PowerControl->p0_AlphaSets = calloc(1,sizeof(*pusch_Config->pusch_PowerControl->p0_AlphaSets)); - NR_P0_PUSCH_AlphaSet_t *aset = calloc(1,sizeof(*aset)); - aset->p0_PUSCH_AlphaSetId=0; - aset->p0=calloc(1,sizeof(*aset->p0)); - *aset->p0 = 0; - aset->alpha=calloc(1,sizeof(*aset->alpha)); - *aset->alpha=NR_Alpha_alpha1; - ASN_SEQUENCE_ADD(&pusch_Config->pusch_PowerControl->p0_AlphaSets->list,aset); - pusch_Config->pusch_PowerControl->pathlossReferenceRSToAddModList = NULL; - pusch_Config->pusch_PowerControl->pathlossReferenceRSToReleaseList = NULL; - pusch_Config->pusch_PowerControl->twoPUSCH_PC_AdjustmentStates = NULL; - pusch_Config->pusch_PowerControl->deltaMCS = NULL; - pusch_Config->pusch_PowerControl->sri_PUSCH_MappingToAddModList = NULL; - pusch_Config->pusch_PowerControl->sri_PUSCH_MappingToReleaseList = NULL; - pusch_Config->frequencyHopping=NULL; - pusch_Config->frequencyHoppingOffsetLists=NULL; - pusch_Config->resourceAllocation = NR_PUSCH_Config__resourceAllocation_resourceAllocationType1; - pusch_Config->pusch_TimeDomainAllocationList = NULL; - pusch_Config->pusch_AggregationFactor=NULL; - pusch_Config->mcs_Table=NULL; - pusch_Config->mcs_TableTransformPrecoder=NULL; - pusch_Config->transformPrecoder= NULL; - /* if msg3_transformprecoding is set in conf file - pusch config should not disable it */ - if (servingcellconfigcommon->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg3_transformPrecoder == NULL) { - pusch_Config->transformPrecoder=calloc(1,sizeof(*pusch_Config->transformPrecoder)); - *pusch_Config->transformPrecoder = NR_PUSCH_Config__transformPrecoder_disabled; - } - pusch_Config->codebookSubset=calloc(1,sizeof(*pusch_Config->codebookSubset)); - *pusch_Config->codebookSubset = NR_PUSCH_Config__codebookSubset_nonCoherent; - pusch_Config->maxRank=calloc(1,sizeof(*pusch_Config->maxRank)); - *pusch_Config->maxRank= 1; - pusch_Config->rbg_Size=NULL; - pusch_Config->uci_OnPUSCH=NULL; - pusch_Config->tp_pi2BPSK=NULL; - - /*------------------------------TRANSFORM PRECODING- -----------------------------------------------------------------------*/ - - uint8_t transform_precoding = NR_PUSCH_Config__transformPrecoder_disabled; - - // TBD: configure this from .conf file, Dedicated params cannot yet be configured in .conf file. - // Enable this to test transform precoding enabled from dedicated config. - /*if (pusch_Config->transformPrecoder == NULL) - pusch_Config->transformPrecoder=calloc(1,sizeof(*pusch_Config->transformPrecoder)); - - *pusch_Config->transformPrecoder = NR_PUSCH_Config__transformPrecoder_enabled; */ - // END ------- - - if (pusch_Config->transformPrecoder == NULL) { - if (servingcellconfigcommon->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg3_transformPrecoder != NULL) - transform_precoding = NR_PUSCH_Config__transformPrecoder_enabled; - } - else - transform_precoding = *pusch_Config->transformPrecoder; - - - if (transform_precoding == NR_PUSCH_Config__transformPrecoder_enabled ) { - /* Enable DMRS uplink config for transform precoding enabled */ - NR_DMRS_UplinkConfig->transformPrecodingEnabled = calloc(1,sizeof(*NR_DMRS_UplinkConfig->transformPrecodingEnabled)); - NR_DMRS_UplinkConfig->transformPrecodingEnabled->nPUSCH_Identity = NULL; - NR_DMRS_UplinkConfig->transformPrecodingEnabled->sequenceGroupHopping = NULL; - NR_DMRS_UplinkConfig->transformPrecodingEnabled->sequenceHopping = NULL; - NR_DMRS_UplinkConfig->transformPrecodingEnabled->ext1 = NULL; - - LOG_I(RRC,"TRANSFORM PRECODING ENABLED......\n"); - - } - /*----------------------------------------------------------------------------------------------------------------------------*/ - - initialUplinkBWP->srs_Config = calloc(1,sizeof(*initialUplinkBWP->srs_Config)); - initialUplinkBWP->srs_Config->present = NR_SetupRelease_SRS_Config_PR_setup; - NR_SRS_Config_t *srs_Config = calloc(1,sizeof(*srs_Config)); - initialUplinkBWP->srs_Config->choice.setup=srs_Config; - srs_Config->srs_ResourceSetToReleaseList=NULL; - srs_Config->srs_ResourceSetToAddModList=calloc(1,sizeof(*srs_Config->srs_ResourceSetToAddModList)); - NR_SRS_ResourceSet_t *srs_resset0=calloc(1,sizeof(*srs_resset0)); - srs_resset0->srs_ResourceSetId = 0; - srs_resset0->srs_ResourceIdList=calloc(1,sizeof(*srs_resset0->srs_ResourceIdList)); - NR_SRS_ResourceId_t *srs_resset0_id=calloc(1,sizeof(*srs_resset0_id)); - *srs_resset0_id=0; - ASN_SEQUENCE_ADD(&srs_resset0->srs_ResourceIdList->list,srs_resset0_id); - srs_Config->srs_ResourceToReleaseList=NULL; - srs_resset0->resourceType.present = NR_SRS_ResourceSet__resourceType_PR_aperiodic; - srs_resset0->resourceType.choice.aperiodic = calloc(1,sizeof(*srs_resset0->resourceType.choice.aperiodic)); - srs_resset0->resourceType.choice.aperiodic->aperiodicSRS_ResourceTrigger=1; - srs_resset0->resourceType.choice.aperiodic->csi_RS=NULL; - srs_resset0->resourceType.choice.aperiodic->slotOffset= calloc(1,sizeof(*srs_resset0->resourceType.choice.aperiodic->slotOffset)); - *srs_resset0->resourceType.choice.aperiodic->slotOffset=2; - srs_resset0->resourceType.choice.aperiodic->ext1=NULL; - srs_resset0->usage=NR_SRS_ResourceSet__usage_codebook; - srs_resset0->alpha = calloc(1,sizeof(*srs_resset0->alpha)); - *srs_resset0->alpha = NR_Alpha_alpha1; - srs_resset0->p0=calloc(1,sizeof(*srs_resset0->p0)); - *srs_resset0->p0=-80; - srs_resset0->pathlossReferenceRS=NULL; - srs_resset0->srs_PowerControlAdjustmentStates=NULL; - ASN_SEQUENCE_ADD(&srs_Config->srs_ResourceSetToAddModList->list,srs_resset0); - srs_Config->srs_ResourceToReleaseList=NULL; - srs_Config->srs_ResourceToAddModList=calloc(1,sizeof(*srs_Config->srs_ResourceToAddModList)); - NR_SRS_Resource_t *srs_res0=calloc(1,sizeof(*srs_res0)); - srs_res0->srs_ResourceId=0; - srs_res0->nrofSRS_Ports=NR_SRS_Resource__nrofSRS_Ports_port1; - srs_res0->ptrs_PortIndex=NULL; - srs_res0->transmissionComb.present=NR_SRS_Resource__transmissionComb_PR_n2; - srs_res0->transmissionComb.choice.n2=calloc(1,sizeof(*srs_res0->transmissionComb.choice.n2)); - srs_res0->transmissionComb.choice.n2->combOffset_n2=0; - srs_res0->transmissionComb.choice.n2->cyclicShift_n2=0; - srs_res0->resourceMapping.startPosition=2; - srs_res0->resourceMapping.nrofSymbols=NR_SRS_Resource__resourceMapping__nrofSymbols_n1; - srs_res0->resourceMapping.repetitionFactor=NR_SRS_Resource__resourceMapping__repetitionFactor_n1; - srs_res0->freqDomainPosition=0; - srs_res0->freqDomainShift=0; - srs_res0->freqHopping.c_SRS = 0; - srs_res0->freqHopping.b_SRS=0; - srs_res0->freqHopping.b_hop=0; - srs_res0->groupOrSequenceHopping=NR_SRS_Resource__groupOrSequenceHopping_neither; - srs_res0->resourceType.present= NR_SRS_Resource__resourceType_PR_aperiodic; - srs_res0->resourceType.choice.aperiodic=calloc(1,sizeof(*srs_res0->resourceType.choice.aperiodic)); - srs_res0->sequenceId=40; - srs_res0->spatialRelationInfo=calloc(1,sizeof(*srs_res0->spatialRelationInfo)); - srs_res0->spatialRelationInfo->servingCellId=NULL; - srs_res0->spatialRelationInfo->referenceSignal.present=NR_SRS_SpatialRelationInfo__referenceSignal_PR_csi_RS_Index; - srs_res0->spatialRelationInfo->referenceSignal.choice.csi_RS_Index=0; - ASN_SEQUENCE_ADD(&srs_Config->srs_ResourceToAddModList->list,srs_res0); - - secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToReleaseList = NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList)); - NR_BWP_Uplink_t *ubwp = calloc(1,sizeof(*ubwp)); - ubwp->bwp_Id=1; - ubwp->bwp_Common = calloc(1,sizeof(*ubwp->bwp_Common)); - // copy bwp_Common from Initial UL BWP except for bandwidth - memcpy((void*)&ubwp->bwp_Common->genericParameters, - (void*)&servingcellconfigcommon->uplinkConfigCommon->initialUplinkBWP->genericParameters, - sizeof(servingcellconfigcommon->uplinkConfigCommon->initialUplinkBWP->genericParameters)); - ubwp->bwp_Common->genericParameters.locationAndBandwidth=PRBalloc_to_locationandbandwidth(servingcellconfigcommon->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth,0); - - ubwp->bwp_Common->rach_ConfigCommon = servingcellconfigcommon->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon; - ubwp->bwp_Common->pusch_ConfigCommon = servingcellconfigcommon->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon; - ubwp->bwp_Common->pucch_ConfigCommon = servingcellconfigcommon->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon; - - ubwp->bwp_Dedicated = calloc(1,sizeof(*ubwp->bwp_Dedicated)); - ubwp->bwp_Dedicated->pucch_Config = calloc(1,sizeof(*ubwp->bwp_Dedicated->pucch_Config)); - ubwp->bwp_Dedicated->pucch_Config->present = NR_SetupRelease_PUCCH_Config_PR_setup; - NR_PUCCH_Config_t *pucch_Config = calloc(1,sizeof(*pucch_Config)); - ubwp->bwp_Dedicated->pucch_Config->choice.setup=pucch_Config; - pucch_Config->resourceSetToAddModList = calloc(1,sizeof(*pucch_Config->resourceSetToAddModList)); - pucch_Config->resourceSetToReleaseList = NULL; - NR_PUCCH_ResourceSet_t *pucchresset0=calloc(1,sizeof(*pucchresset0)); - NR_PUCCH_ResourceSet_t *pucchresset1=calloc(1,sizeof(*pucchresset1)); - pucchresset0->pucch_ResourceSetId = 0; - NR_PUCCH_ResourceId_t *pucchresset0id0=calloc(1,sizeof(*pucchresset0id0)); - NR_PUCCH_ResourceId_t *pucchresset0id1=calloc(1,sizeof(*pucchresset0id1)); - *pucchresset0id0=1; - ASN_SEQUENCE_ADD(&pucchresset0->resourceList.list,pucchresset0id0); - *pucchresset0id1=2; - ASN_SEQUENCE_ADD(&pucchresset0->resourceList.list,pucchresset0id1); - pucchresset0->maxPayloadSize=NULL; - - ASN_SEQUENCE_ADD(&pucch_Config->resourceSetToAddModList->list,pucchresset0); - - pucchresset1->pucch_ResourceSetId = 1; - NR_PUCCH_ResourceId_t *pucchresset1id0=calloc(1,sizeof(*pucchresset1id0)); - NR_PUCCH_ResourceId_t *pucchresset1id1=calloc(1,sizeof(*pucchresset1id1)); - *pucchresset1id0=3; - ASN_SEQUENCE_ADD(&pucchresset1->resourceList.list,pucchresset1id0); - *pucchresset1id1=4; - ASN_SEQUENCE_ADD(&pucchresset1->resourceList.list,pucchresset1id1); - pucchresset1->maxPayloadSize=NULL; - ASN_SEQUENCE_ADD(&pucch_Config->resourceSetToAddModList->list,pucchresset1); - - pucch_Config->resourceToAddModList = calloc(1,sizeof(*pucch_Config->resourceToAddModList)); - pucch_Config->resourceToReleaseList = NULL; - NR_PUCCH_Resource_t *pucchres0=calloc(1,sizeof(*pucchres0)); - NR_PUCCH_Resource_t *pucchres1=calloc(1,sizeof(*pucchres1)); - NR_PUCCH_Resource_t *pucchres2=calloc(1,sizeof(*pucchres2)); - NR_PUCCH_Resource_t *pucchres3=calloc(1,sizeof(*pucchres3)); - pucchres0->pucch_ResourceId=1; - pucchres0->startingPRB=8; - pucchres0->intraSlotFrequencyHopping=NULL; - pucchres0->secondHopPRB=NULL; - pucchres0->format.present= NR_PUCCH_Resource__format_PR_format0; - pucchres0->format.choice.format0=calloc(1,sizeof(*pucchres0->format.choice.format0)); - pucchres0->format.choice.format0->initialCyclicShift=0; - pucchres0->format.choice.format0->nrofSymbols=1; - pucchres0->format.choice.format0->startingSymbolIndex=13; - ASN_SEQUENCE_ADD(&pucch_Config->resourceToAddModList->list,pucchres0); - - pucchres1->pucch_ResourceId=2; - pucchres1->startingPRB=8; - pucchres1->intraSlotFrequencyHopping=NULL; - pucchres1->secondHopPRB=NULL; - pucchres1->format.present= NR_PUCCH_Resource__format_PR_format0; - pucchres1->format.choice.format0=calloc(1,sizeof(*pucchres1->format.choice.format0)); - pucchres1->format.choice.format0->initialCyclicShift=0; - pucchres1->format.choice.format0->nrofSymbols=1; - pucchres1->format.choice.format0->startingSymbolIndex=12; - ASN_SEQUENCE_ADD(&pucch_Config->resourceToAddModList->list,pucchres1); - - pucchres2->pucch_ResourceId=3; - pucchres2->startingPRB=0; - pucchres2->intraSlotFrequencyHopping=NULL; - pucchres2->secondHopPRB=NULL; - pucchres2->format.present= NR_PUCCH_Resource__format_PR_format2; - pucchres2->format.choice.format2=calloc(1,sizeof(*pucchres2->format.choice.format2)); - pucchres2->format.choice.format2->nrofPRBs=8; - pucchres2->format.choice.format2->nrofSymbols=1; - pucchres2->format.choice.format2->startingSymbolIndex=13; - ASN_SEQUENCE_ADD(&pucch_Config->resourceToAddModList->list,pucchres2); - - pucchres3->pucch_ResourceId=4; - pucchres3->startingPRB=0; - pucchres3->intraSlotFrequencyHopping=NULL; - pucchres3->secondHopPRB=NULL; - pucchres3->format.present= NR_PUCCH_Resource__format_PR_format2; - pucchres3->format.choice.format2=calloc(1,sizeof(*pucchres3->format.choice.format2)); - pucchres3->format.choice.format2->nrofPRBs=8; - pucchres3->format.choice.format2->nrofSymbols=1; - pucchres3->format.choice.format2->startingSymbolIndex=12; - ASN_SEQUENCE_ADD(&pucch_Config->resourceToAddModList->list,pucchres3); - - pucch_Config->format2=calloc(1,sizeof(*pucch_Config->format2)); - pucch_Config->format2->present=NR_SetupRelease_PUCCH_FormatConfig_PR_setup; - NR_PUCCH_FormatConfig_t *pucchfmt2 = calloc(1,sizeof(*pucchfmt2)); - pucch_Config->format2->choice.setup = pucchfmt2; - pucchfmt2->interslotFrequencyHopping=NULL; - pucchfmt2->additionalDMRS=NULL; - pucchfmt2->maxCodeRate=calloc(1,sizeof(*pucchfmt2->maxCodeRate)); - *pucchfmt2->maxCodeRate=NR_PUCCH_MaxCodeRate_zeroDot25; - pucchfmt2->nrofSlots=NULL; - pucchfmt2->pi2BPSK=NULL; - pucchfmt2->simultaneousHARQ_ACK_CSI=NULL; - pucch_Config->schedulingRequestResourceToAddModList=NULL; - pucch_Config->schedulingRequestResourceToReleaseList=NULL; - pucch_Config->multi_CSI_PUCCH_ResourceList=NULL; - pucch_Config->dl_DataToUL_ACK = calloc(1,sizeof(*pucch_Config->dl_DataToUL_ACK)); - long *delay[8]; - for (int i=0;i<8;i++) { - delay[i] = calloc(1,sizeof(*delay[i])); - *delay[i] = (i<6) ? (i+2) : 0; - ASN_SEQUENCE_ADD(&pucch_Config->dl_DataToUL_ACK->list,delay[i]); - } - pucch_Config->spatialRelationInfoToAddModList = calloc(1,sizeof(*pucch_Config->spatialRelationInfoToAddModList)); - NR_PUCCH_SpatialRelationInfo_t *pucchspatial = calloc(1,sizeof(*pucchspatial)); - pucchspatial->pucch_SpatialRelationInfoId = 1; - pucchspatial->servingCellId = NULL; - pucchspatial->referenceSignal.present = NR_PUCCH_SpatialRelationInfo__referenceSignal_PR_csi_RS_Index; - pucchspatial->referenceSignal.choice.csi_RS_Index = 0; - pucchspatial->pucch_PathlossReferenceRS_Id = 0; - pucchspatial->p0_PUCCH_Id = 1; - pucchspatial->closedLoopIndex = NR_PUCCH_SpatialRelationInfo__closedLoopIndex_i0; - ASN_SEQUENCE_ADD(&pucch_Config->spatialRelationInfoToAddModList->list,pucchspatial); - pucch_Config->spatialRelationInfoToReleaseList=NULL; - pucch_Config->pucch_PowerControl=calloc(1,sizeof(*pucch_Config->pucch_PowerControl)); - pucch_Config->pucch_PowerControl->deltaF_PUCCH_f0 = calloc(1,sizeof(*pucch_Config->pucch_PowerControl->deltaF_PUCCH_f0)); - *pucch_Config->pucch_PowerControl->deltaF_PUCCH_f0 = 0; - pucch_Config->pucch_PowerControl->deltaF_PUCCH_f1 = calloc(1,sizeof(*pucch_Config->pucch_PowerControl->deltaF_PUCCH_f1)); - *pucch_Config->pucch_PowerControl->deltaF_PUCCH_f1 = 0; - pucch_Config->pucch_PowerControl->deltaF_PUCCH_f2 = calloc(1,sizeof(*pucch_Config->pucch_PowerControl->deltaF_PUCCH_f2)); - *pucch_Config->pucch_PowerControl->deltaF_PUCCH_f2 = 0; - pucch_Config->pucch_PowerControl->deltaF_PUCCH_f3 = calloc(1,sizeof(*pucch_Config->pucch_PowerControl->deltaF_PUCCH_f3)); - *pucch_Config->pucch_PowerControl->deltaF_PUCCH_f3 = 0; - pucch_Config->pucch_PowerControl->deltaF_PUCCH_f4 = calloc(1,sizeof(*pucch_Config->pucch_PowerControl->deltaF_PUCCH_f4)); - *pucch_Config->pucch_PowerControl->deltaF_PUCCH_f4 = 0; - pucch_Config->pucch_PowerControl->p0_Set = calloc(1,sizeof(*pucch_Config->pucch_PowerControl->p0_Set)); - NR_P0_PUCCH_t *p00 = calloc(1,sizeof(*p00)); - p00->p0_PUCCH_Id=1; - p00->p0_PUCCH_Value = 0; - ASN_SEQUENCE_ADD(&pucch_Config->pucch_PowerControl->p0_Set->list,p00); - pucch_Config->pucch_PowerControl->pathlossReferenceRSs = NULL; - - // copy pusch_Config from dedicated initialBWP - ubwp->bwp_Dedicated->pusch_Config = calloc(1,sizeof(*ubwp->bwp_Dedicated->pusch_Config)); - ubwp->bwp_Dedicated->pusch_Config->present = NR_SetupRelease_PUSCH_Config_PR_setup; - ubwp->bwp_Dedicated->pusch_Config->choice.setup = pusch_Config; - - ubwp->bwp_Dedicated->configuredGrantConfig = NULL; - ubwp->bwp_Dedicated->srs_Config = calloc(1,sizeof(*ubwp->bwp_Dedicated->srs_Config)); - ubwp->bwp_Dedicated->srs_Config->present = NR_SetupRelease_SRS_Config_PR_setup; - ubwp->bwp_Dedicated->srs_Config->choice.setup = srs_Config; - - ubwp->bwp_Dedicated->beamFailureRecoveryConfig = NULL; - - ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list,ubwp); - - secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->firstActiveUplinkBWP_Id = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->firstActiveUplinkBWP_Id)); - *secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->firstActiveUplinkBWP_Id = 1; - - secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig)); - NR_PUSCH_ServingCellConfig_t *pusch_scc = calloc(1,sizeof(*pusch_scc)); - secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig->present = NR_SetupRelease_PUSCH_ServingCellConfig_PR_setup; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup = pusch_scc; - pusch_scc->codeBlockGroupTransmission = NULL; - pusch_scc->rateMatching = NULL; - pusch_scc->xOverhead = NULL; - pusch_scc->ext1=calloc(1,sizeof(*pusch_scc->ext1)); - pusch_scc->ext1->maxMIMO_Layers = calloc(1,sizeof(*pusch_scc->ext1->maxMIMO_Layers)); - *pusch_scc->ext1->maxMIMO_Layers = 1; - pusch_scc->ext1->processingType2Enabled = NULL; - - secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->carrierSwitching = NULL; - - secondaryCellGroup->spCellConfig->spCellConfigDedicated->supplementaryUplink=NULL; - - secondaryCellGroup->spCellConfig->spCellConfigDedicated->pdcch_ServingCellConfig=NULL; - - secondaryCellGroup->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig=calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig)); - NR_PDSCH_ServingCellConfig_t *pdsch_servingcellconfig = calloc(1,sizeof(*pdsch_servingcellconfig)); - secondaryCellGroup->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->present = NR_SetupRelease_PDSCH_ServingCellConfig_PR_setup; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup = pdsch_servingcellconfig; - pdsch_servingcellconfig->codeBlockGroupTransmission = NULL; - pdsch_servingcellconfig->xOverhead = NULL; - pdsch_servingcellconfig->nrofHARQ_ProcessesForPDSCH = calloc(1, sizeof(*pdsch_servingcellconfig->nrofHARQ_ProcessesForPDSCH)); - *pdsch_servingcellconfig->nrofHARQ_ProcessesForPDSCH = NR_PDSCH_ServingCellConfig__nrofHARQ_ProcessesForPDSCH_n16; - pdsch_servingcellconfig->pucch_Cell= NULL; - pdsch_servingcellconfig->ext1=calloc(1,sizeof(*pdsch_servingcellconfig->ext1)); - pdsch_servingcellconfig->ext1->maxMIMO_Layers = calloc(1,sizeof(*pdsch_servingcellconfig->ext1->maxMIMO_Layers)); - *pdsch_servingcellconfig->ext1->maxMIMO_Layers = 2; - pdsch_servingcellconfig->ext1->processingType2Enabled = NULL; - - secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig=NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig=calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig)); - secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->present = NR_SetupRelease_CSI_MeasConfig_PR_setup; - - NR_CSI_MeasConfig_t *csi_MeasConfig = calloc(1,sizeof(*csi_MeasConfig)); - secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup = csi_MeasConfig; - - csi_MeasConfig->csi_IM_ResourceToAddModList = NULL; - csi_MeasConfig->csi_IM_ResourceToReleaseList = NULL; - csi_MeasConfig->csi_IM_ResourceSetToAddModList = NULL; - csi_MeasConfig->csi_IM_ResourceSetToReleaseList = NULL; - csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList = NULL; - csi_MeasConfig->nzp_CSI_RS_ResourceSetToReleaseList = NULL; - csi_MeasConfig->nzp_CSI_RS_ResourceToAddModList = NULL; - - csi_MeasConfig->csi_SSB_ResourceSetToAddModList = calloc(1,sizeof(*csi_MeasConfig->csi_SSB_ResourceSetToAddModList)); - csi_MeasConfig->csi_SSB_ResourceSetToReleaseList = NULL; - - NR_CSI_SSB_ResourceSet_t *ssbresset0 = calloc(1,sizeof(*ssbresset0)); - ssbresset0->csi_SSB_ResourceSetId=0; - - NR_SSB_Index_t *ssbresset[64]; - for (int i=0;i<64;i++) { - if ((bitmap>>(63-i))&0x01){ - ssbresset[i]=calloc(1,sizeof(*ssbresset[i])); - *ssbresset[i] = i; - ASN_SEQUENCE_ADD(&ssbresset0->csi_SSB_ResourceList.list,ssbresset[i]); - } - } - ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list,ssbresset0); - - csi_MeasConfig->csi_ResourceConfigToAddModList = calloc(1,sizeof(*csi_MeasConfig->csi_ResourceConfigToAddModList)); - csi_MeasConfig->csi_ResourceConfigToReleaseList = NULL; - NR_CSI_ResourceConfig_t *csires0 = calloc(1,sizeof(*csires0)); - csires0->csi_ResourceConfigId=0; - csires0->csi_RS_ResourceSetList.present = NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB; - csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB = calloc(1,sizeof(*csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB)); - csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList = NULL; - csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList = calloc(1,sizeof(*csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList)); - NR_CSI_SSB_ResourceSetId_t *ssbres00 = calloc(1,sizeof(*ssbres00)); - *ssbres00 = 0; - ASN_SEQUENCE_ADD(&csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list,ssbres00); - csires0->bwp_Id = 1; - csires0->resourceType = NR_CSI_ResourceConfig__resourceType_periodic; - ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_ResourceConfigToAddModList->list,csires0); - - csi_MeasConfig->csi_ReportConfigToAddModList = calloc(1,sizeof(*csi_MeasConfig->csi_ReportConfigToAddModList)); - csi_MeasConfig->csi_ReportConfigToReleaseList = NULL; - NR_CSI_ReportConfig_t *csirep1 = calloc(1,sizeof(*csirep1)); - csirep1->reportConfigId=0; - csirep1->carrier=NULL; - csirep1->resourcesForChannelMeasurement=0; - csirep1->csi_IM_ResourcesForInterference=NULL; - csirep1->nzp_CSI_RS_ResourcesForInterference=NULL; - csirep1->reportConfigType.present = NR_CSI_ReportConfig__reportConfigType_PR_periodic; - csirep1->reportConfigType.choice.periodic = calloc(1,sizeof(*csirep1->reportConfigType.choice.periodic)); - csirep1->reportConfigType.choice.periodic->reportSlotConfig.present=NR_CSI_ReportPeriodicityAndOffset_PR_slots320; - csirep1->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320 = 49; - NR_PUCCH_CSI_Resource_t *pucchcsires1 = calloc(1,sizeof(*pucchcsires1)); - pucchcsires1->uplinkBandwidthPartId=1; - pucchcsires1->pucch_Resource=3; - ASN_SEQUENCE_ADD(&csirep1->reportConfigType.choice.periodic->pucch_CSI_ResourceList.list,pucchcsires1); - csirep1->reportQuantity.present = NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP; - csirep1->reportQuantity.choice.ssb_Index_RSRP=(NULL_t)0; - csirep1->reportFreqConfiguration = calloc(1,sizeof(*csirep1->reportFreqConfiguration)); - csirep1->reportFreqConfiguration->cqi_FormatIndicator=NR_CSI_ReportConfig__reportFreqConfiguration__cqi_FormatIndicator_widebandCQI; - csirep1->reportFreqConfiguration->pmi_FormatIndicator=NR_CSI_ReportConfig__reportFreqConfiguration__pmi_FormatIndicator_widebandPMI; - csirep1->reportFreqConfiguration->csi_ReportingBand=NULL; - csirep1->timeRestrictionForChannelMeasurements= NR_CSI_ReportConfig__timeRestrictionForChannelMeasurements_configured; - csirep1->timeRestrictionForInterferenceMeasurements=NR_CSI_ReportConfig__timeRestrictionForInterferenceMeasurements_configured; - csirep1->codebookConfig=calloc(1,sizeof(*csirep1->codebookConfig)); - csirep1->codebookConfig->codebookType.present = NR_CodebookConfig__codebookType_PR_type1; - csirep1->codebookConfig->codebookType.choice.type1 = calloc(1,sizeof(*csirep1->codebookConfig->codebookType.choice.type1)); - csirep1->codebookConfig->codebookType.choice.type1->subType.present=NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel; - csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel=calloc(1,sizeof(*csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel)); - csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.present=NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_two; - csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.two= - calloc(1,sizeof(*csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.two)); - csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.two->twoTX_CodebookSubsetRestriction.size=1; - csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.two->twoTX_CodebookSubsetRestriction.bits_unused=2; - csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.two->twoTX_CodebookSubsetRestriction.buf=malloc(1); - csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.two->twoTX_CodebookSubsetRestriction.buf[0]=0xfc; - //'111111'B - - - csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.size=1; - csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.bits_unused=0; - csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.buf=malloc(1); - csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.buf[0]=0xc0; //'00000011'B - - csirep1->codebookConfig->codebookType.choice.type1->codebookMode=1; - csirep1->dummy = NULL; - csirep1->groupBasedBeamReporting.present = NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled; - csirep1->groupBasedBeamReporting.choice.disabled=calloc(1,sizeof(*csirep1->groupBasedBeamReporting.choice.disabled)); - csirep1->groupBasedBeamReporting.choice.disabled->nrofReportedRS = calloc(1,sizeof(*csirep1->groupBasedBeamReporting.choice.disabled->nrofReportedRS)); - *csirep1->groupBasedBeamReporting.choice.disabled->nrofReportedRS=NR_CSI_ReportConfig__groupBasedBeamReporting__disabled__nrofReportedRS_n1; - // this corresponds to: - //if the UE is configured with the higher layer parameter groupBasedBeamReporting set to 'disabled', the UE is not required to update measurements for more than 64 CSI-RS and/or SSB resources, and the UE shall report in a single report nrofReportedRS (higher layer configured) different CRI or SSBRI for each report setting. - - csirep1->cqi_Table = calloc(1,sizeof(*csirep1->cqi_Table)); - *csirep1->cqi_Table = NR_CSI_ReportConfig__cqi_Table_table1; - csirep1->subbandSize = NR_CSI_ReportConfig__subbandSize_value1; - csirep1->non_PMI_PortIndication = NULL; - csirep1->ext1 = NULL; - - ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_ReportConfigToAddModList->list,csirep1); - - secondaryCellGroup->spCellConfig->spCellConfigDedicated->sCellDeactivationTimer=NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->crossCarrierSchedulingConfig=NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->tag_Id=0; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->dummy=NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->pathlossReferenceLinking=NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->servingCellMO=NULL; - -} -#endif void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon, NR_RRCReconfiguration_IEs_t *reconfig, NR_CellGroupConfig_t *secondaryCellGroup, From f338d6d65db226ba031a1cb2dbff144f5aee50ef Mon Sep 17 00:00:00 2001 From: guhan Date: Mon, 8 Feb 2021 18:44:49 +0530 Subject: [PATCH 144/231] Removed rrc dependency, code rearrangement --- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 70 -- .../LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 1039 ++++++++--------- openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 16 - openair2/NR_PHY_INTERFACE/NR_IF_Module.c | 1 - 4 files changed, 468 insertions(+), 658 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 7a39514531..845be51f58 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -1830,76 +1830,6 @@ bool find_free_CCE(module_id_t module_id, return true; } -int checkTargetSSBInFirst64TCIStates_pdschConfig(int ssb_index_t, int Mod_idP, int UE_id) { - NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; - NR_CellGroupConfig_t *secondaryCellGroup = UE_info->secondaryCellGroup[UE_id] ; - int nb_tci_states = secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list.count; - NR_TCI_State_t *tci =NULL; - int i; - - for(i=0; ispCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list.array[i]; - - if(tci != NULL) { - if(tci->qcl_Type1.referenceSignal.present == NR_QCL_Info__referenceSignal_PR_ssb) { - if(tci->qcl_Type1.referenceSignal.choice.ssb == ssb_index_t) - return tci->tci_StateId; // returned TCI state ID - } - // if type2 is configured - else if(tci->qcl_Type2 != NULL && tci->qcl_Type2->referenceSignal.present == NR_QCL_Info__referenceSignal_PR_ssb) { - if(tci->qcl_Type2->referenceSignal.choice.ssb == ssb_index_t) - return tci->tci_StateId; // returned TCI state ID - } else LOG_I(MAC,"SSB index is not found in first 64 TCI states of TCI_statestoAddModList[%d]", i); - } - } - - // tci state not identified in first 64 TCI States of PDSCH Config - return -1; -} - - -int checkTargetSSBInTCIStates_pdcchConfig(int ssb_index_t, int Mod_idP, int UE_id) { - NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; - NR_CellGroupConfig_t *secondaryCellGroup = UE_info->secondaryCellGroup[UE_id] ; - int nb_tci_states = secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list.count; - NR_TCI_State_t *tci =NULL; - NR_TCI_StateId_t *tci_id = NULL; - int bwp_id = 1; - NR_BWP_Downlink_t *bwp = secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1]; - NR_ControlResourceSet_t *coreset = bwp->bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList->list.array[bwp_id-1]; - int i; - int flag = 0; - int tci_stateID = -1; - - for(i=0; ispCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list.array[i]; - - if(tci != NULL && tci->qcl_Type1.referenceSignal.present == NR_QCL_Info__referenceSignal_PR_ssb) { - if(tci->qcl_Type1.referenceSignal.choice.ssb == ssb_index_t) { - flag = 1; - tci_stateID = tci->tci_StateId; - break; - } else if(tci->qcl_Type2 != NULL && tci->qcl_Type2->referenceSignal.present == NR_QCL_Info__referenceSignal_PR_ssb) { - flag = 1; - tci_stateID = tci->tci_StateId; - break; - } - } - - if(flag != 0 && tci_stateID != -1 && coreset != NULL) { - for(i=0; i<64 && itci_StatesPDCCH_ToAddList->list.count; i++) { - tci_id = coreset->tci_StatesPDCCH_ToAddList->list.array[i]; - - if(tci_id != NULL && *tci_id == tci_stateID) - return tci_stateID; - } - } - } - - // Need to implement once configuration is received - return -1; -} - /*void fill_nfapi_coresets_and_searchspaces(NR_CellGroupConfig_t *cg, nfapi_nr_coreset_t *coreset, nfapi_nr_search_space_t *search_space) { diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index 39b6bcc46c..98aca65496 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -86,11 +86,6 @@ void nr_fill_nfapi_pucch(module_id_t mod_id, #define L1_RSRP_HYSTERIS 10 //considering 10 dBm as hysterisis for avoiding frequent SSB Beam Switching. !Fixme provide exact value if any //#define L1_DIFF_RSRP_STEP_SIZE 2 -void nr_rx_acknack(nfapi_nr_uci_pusch_pdu_t *uci_pusch, - const nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_01, - const nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_234, - NR_UL_IND_t *UL_info, NR_UE_sched_ctrl_t *sched_ctrl, NR_mac_stats_t *stats); - int ssb_index_sorted[MAX_NUM_SSB] = {0}; int ssb_rsrp_sorted[MAX_NUM_SSB] = {0}; //Sorts ssb_index and ssb_rsrp array data and keeps in ssb_index_sorted and @@ -283,7 +278,7 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in if (NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel==csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.present){ - switch (RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts) { + switch (RC.nrmac[Mod_idP]->config[0].carrier_config.num_tx_ant.value) { case 1:; UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.ri_bitlen=0; break; @@ -348,12 +343,10 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in nb_allowed_ri = number_of_bits_set(ri_restriction, &max_ri); ri_bitlen = ceil(log2(nb_allowed_ri)); } - //ri_bitlen = ri_bitlen<1?ri_bitlen:1; //from the spec 38.212 and table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.ri_bitlen=ri_bitlen; break; default: - //UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.ri_bitlen=0; - AssertFatal(RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts>8,"Number of antennas %d are out of range", RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts); + AssertFatal(RC.nrmac[Mod_idP]->config[0].carrier_config.num_tx_ant.value>8,"Number of antennas %d are out of range", RC.nrmac[Mod_idP]->config[0].carrier_config.num_tx_ant.value); } } UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.li_bitlen=0; @@ -365,7 +358,7 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in if( NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI==reportQuantity_type ){ if (NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel==csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.present){ - switch (RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts) { + switch (RC.nrmac[Mod_idP]->config[0].carrier_config.num_tx_ant.value) { case 1:; UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.li_bitlen=0; break; @@ -387,7 +380,7 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.li_bitlen=ceil(log2(max_ri))<2?ceil(log2(max_ri)):2; break; default: - AssertFatal(RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts>8,"Number of antennas %d are out of range", RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts); + AssertFatal(RC.nrmac[Mod_idP]->config[0].carrier_config.num_tx_ant.value>8,"Number of antennas %d are out of range", RC.nrmac[Mod_idP]->config[0].carrier_config.num_tx_ant.value); } } } @@ -397,7 +390,7 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_CQI==reportQuantity_type || NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_i1_CQI==reportQuantity_type){ - switch (RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts){ + switch (RC.nrmac[Mod_idP]->config[0].carrier_config.num_tx_ant.value){ case 1: case 2: case 4: @@ -428,7 +421,7 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in } break; default: - AssertFatal(RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts>8,"Number of antennas %d are out of range", RC.nrrrc[Mod_idP]->carrier.pdsch_AntennaPorts); + AssertFatal(RC.nrmac[Mod_idP]->config[0].carrier_config.num_tx_ant.value>8,"Number of antennas %d are out of range", RC.nrmac[Mod_idP]->config[0].carrier_config.num_tx_ant.value); } } if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI == reportQuantity_type || @@ -470,7 +463,7 @@ uint16_t nr_get_csi_bitlen(int Mod_idP, CSI_report_bitlen = &(UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen); //This might need to be moodif for Aperiodic CSI-RS measurements csi_bitlen+= ((CSI_report_bitlen->cri_ssbri_bitlen * CSI_report_bitlen->nb_ssbri_cri) + CSI_report_bitlen->rsrp_bitlen +(CSI_report_bitlen->diff_rsrp_bitlen * - (CSI_report_bitlen->nb_ssbri_cri -1 )));//*UE_info->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report); + (CSI_report_bitlen->nb_ssbri_cri -1 ))); } else{ csi_meas_bitlen = &(UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen); //This might need to be moodif for Aperiodic CSI-RS measurements csi_bitlen+= (csi_meas_bitlen->cri_bitlen +csi_meas_bitlen->ri_bitlen+csi_meas_bitlen->li_bitlen+csi_meas_bitlen->cqi_bitlen+csi_meas_bitlen->pmi_x1_bitlen+csi_meas_bitlen->pmi_x2_bitlen); @@ -602,567 +595,92 @@ static void handle_dl_harq(module_id_t mod_id, } } -void handle_nr_uci_pucch_0_1(module_id_t mod_id, - frame_t frame, - sub_frame_t slot, - const nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_01, - NR_UL_IND_t *UL_info) -{ - int UE_id = find_nr_UE_id(mod_id, uci_01->rnti); - if (UE_id < 0) { - LOG_E(MAC, "%s(): unknown RNTI %04x in PUCCH UCI\n", __func__, uci_01->rnti); - return; - } - NR_UE_info_t *UE_info = &RC.nrmac[mod_id]->UE_info; - NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; +int checkTargetSSBInFirst64TCIStates_pdschConfig(int ssb_index_t, int Mod_idP, int UE_id) { + NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; + NR_CellGroupConfig_t *secondaryCellGroup = UE_info->secondaryCellGroup[UE_id] ; + int nb_tci_states = secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list.count; + NR_TCI_State_t *tci =NULL; + int i; - // tpc (power control) - sched_ctrl->tpc1 = nr_get_tpc(RC.nrmac[mod_id]->pucch_target_snrx10, - uci_01->ul_cqi, - 30); + for(i=0; ispCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list.array[i]; - NR_ServingCellConfigCommon_t *scc = RC.nrmac[mod_id]->common_channels->ServingCellConfigCommon; - const int num_slots = nr_slots_per_frame[*scc->ssbSubcarrierSpacing]; - if (((uci_01->pduBitmap >> 1) & 0x01)) { - // iterate over received harq bits - for (int harq_bit = 0; harq_bit < uci_01->harq->num_harq; harq_bit++) { - const uint8_t harq_value = uci_01->harq->harq_list[harq_bit].harq_value; - const uint8_t harq_confidence = uci_01->harq->harq_confidence_level; - const int feedback_slot = (slot - 1 + num_slots) % num_slots; - /* In case of realtime problems: we can only identify a HARQ process by - * timing. If the HARQ process's feedback_slot is not the one we - * expected, we assume that processing has been aborted and we need to - * skip this HARQ process, which is what happens in the loop below. If - * you don't experience real-time problems, you might simply revert the - * commit that introduced these changes. */ - int8_t pid = sched_ctrl->feedback_dl_harq.head; - DevAssert(pid >= 0); - while (sched_ctrl->harq_processes[pid].feedback_slot != feedback_slot) { - LOG_W(MAC, - "expected feedback slot %d, but found %d instead\n", - sched_ctrl->harq_processes[pid].feedback_slot, - feedback_slot); - remove_front_nr_list(&sched_ctrl->feedback_dl_harq); - handle_dl_harq(mod_id, UE_id, pid, 0); - pid = sched_ctrl->feedback_dl_harq.head; - DevAssert(pid >= 0); + if(tci != NULL) { + if(tci->qcl_Type1.referenceSignal.present == NR_QCL_Info__referenceSignal_PR_ssb) { + if(tci->qcl_Type1.referenceSignal.choice.ssb == ssb_index_t) + return tci->tci_StateId; // returned TCI state ID } - remove_front_nr_list(&sched_ctrl->feedback_dl_harq); - NR_UE_harq_t *harq = &sched_ctrl->harq_processes[pid]; - DevAssert(harq->is_waiting); - handle_dl_harq(mod_id, UE_id, pid, harq_value == 1 && harq_confidence == 0); + // if type2 is configured + else if(tci->qcl_Type2 != NULL && tci->qcl_Type2->referenceSignal.present == NR_QCL_Info__referenceSignal_PR_ssb) { + if(tci->qcl_Type2->referenceSignal.choice.ssb == ssb_index_t) + return tci->tci_StateId; // returned TCI state ID + } else LOG_I(MAC,"SSB index is not found in first 64 TCI states of TCI_statestoAddModList[%d]", i); } - - if (((uci_01->pduBitmap >> 1) & 0x01)) { - nr_rx_acknack(NULL,uci_01,NULL,UL_info,sched_ctrl,&UE_info->mac_stats[0]); } + + // tci state not identified in first 64 TCI States of PDSCH Config + return -1; } -void handle_nr_uci_pucch_2_3_4(module_id_t mod_id, - frame_t frame, - sub_frame_t slot, - const nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_234, - NR_UL_IND_t *UL_info) -{ - int UE_id = find_nr_UE_id(mod_id, uci_234->rnti); - if (UE_id < 0) { - LOG_E(MAC, "%s(): unknown RNTI %04x in PUCCH UCI\n", __func__, uci_234->rnti); - return; - } - NR_CSI_MeasConfig_t *csi_MeasConfig = RC.nrmac[mod_id]->UE_info.secondaryCellGroup[UE_id]->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup; - NR_UE_info_t *UE_info = &RC.nrmac[mod_id]->UE_info; - NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; +int checkTargetSSBInTCIStates_pdcchConfig(int ssb_index_t, int Mod_idP, int UE_id) { + NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; + NR_CellGroupConfig_t *secondaryCellGroup = UE_info->secondaryCellGroup[UE_id] ; + int nb_tci_states = secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list.count; + NR_TCI_State_t *tci =NULL; + NR_TCI_StateId_t *tci_id = NULL; + int bwp_id = 1; + NR_BWP_Downlink_t *bwp = secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1]; + NR_ControlResourceSet_t *coreset = bwp->bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList->list.array[bwp_id-1]; + int i; + int flag = 0; + int tci_stateID = -1; - // tpc (power control) - sched_ctrl->tpc1 = nr_get_tpc(RC.nrmac[mod_id]->pucch_target_snrx10, - uci_234->ul_cqi, - 30); + for(i=0; ispCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list.array[i]; - NR_ServingCellConfigCommon_t *scc = RC.nrmac[mod_id]->common_channels->ServingCellConfigCommon; - const int num_slots = nr_slots_per_frame[*scc->ssbSubcarrierSpacing]; - if ( uci_234 -> pduBitmap & 0x01 ) { - ///Handle SR PDU - uint8_t sr_id = 0; - - for (sr_id = 0; sr_id < uci_234->sr.sr_bit_len; sr_id++) { - sched_ctrl->sr_req.ul_SR[sr_id] = *(uci_234->sr.sr_payload) & 1; - *(uci_234->sr.sr_payload) >>= 1; - } - - sched_ctrl->sr_req.nr_of_srs = uci_234->sr.sr_bit_len; - } - // TODO - if ((uci_234->pduBitmap >> 1) & 0x01) { - // iterate over received harq bits - for (int harq_bit = 0; harq_bit < uci_234->harq.harq_bit_len; harq_bit++) { - const int acknack = ((uci_234->harq.harq_payload[harq_bit >> 3]) >> harq_bit) & 0x01; - const int feedback_slot = (slot - 1 + num_slots) % num_slots; - /* In case of realtime problems: we can only identify a HARQ process by - * timing. If the HARQ process's feedback_slot is not the one we - * expected, we assume that processing has been aborted and we need to - * skip this HARQ process, which is what happens in the loop below. If - * you don't experience real-time problems, you might simply revert the - * commit that introduced these changes. */ - int8_t pid = sched_ctrl->feedback_dl_harq.head; - DevAssert(pid >= 0); - while (sched_ctrl->harq_processes[pid].feedback_slot != feedback_slot) { - LOG_W(MAC, - "expected feedback slot %d, but found %d instead\n", - sched_ctrl->harq_processes[pid].feedback_slot, - feedback_slot); - remove_front_nr_list(&sched_ctrl->feedback_dl_harq); - handle_dl_harq(mod_id, UE_id, pid, 0); - pid = sched_ctrl->feedback_dl_harq.head; - DevAssert(pid >= 0); + if(tci != NULL && tci->qcl_Type1.referenceSignal.present == NR_QCL_Info__referenceSignal_PR_ssb) { + if(tci->qcl_Type1.referenceSignal.choice.ssb == ssb_index_t) { + flag = 1; + tci_stateID = tci->tci_StateId; + break; + } else if(tci->qcl_Type2 != NULL && tci->qcl_Type2->referenceSignal.present == NR_QCL_Info__referenceSignal_PR_ssb) { + flag = 1; + tci_stateID = tci->tci_StateId; + break; } - remove_front_nr_list(&sched_ctrl->feedback_dl_harq); - NR_UE_harq_t *harq = &sched_ctrl->harq_processes[pid]; - DevAssert(harq->is_waiting); - handle_dl_harq(mod_id, UE_id, pid, uci_234->harq.harq_crc != 1 && acknack); } - nr_rx_acknack(NULL,NULL,uci_234,UL_info,sched_ctrl,stats); - } - if ((uci_234->pduBitmap >> 1) & 0x01) { - NR_SubcarrierSpacing_t scs=*(RC.nrmac[mod_id]->common_channels->ServingCellConfigCommon->ssbSubcarrierSpacing); - LOG_I(PHY,"SFN/SF:%d%d scs %ld \n", - UL_info->frame,UL_info->slot, - scs); - //API to parse the csi report and store it into sched_ctrl - extract_pucch_csi_report (csi_MeasConfig, uci_234, sched_ctrl,UL_info->frame, UL_info->slot, scs, UE_id, mod_id); - //TCI handling function - tci_handling(mod_id, UE_id, UL_info->CC_id, sched_ctrl, UL_info->frame, UL_info->slot); - } + if(flag != 0 && tci_stateID != -1 && coreset != NULL) { + for(i=0; i<64 && itci_StatesPDCCH_ToAddList->list.count; i++) { + tci_id = coreset->tci_StatesPDCCH_ToAddList->list.array[i]; - if (uci_234 -> pduBitmap & 0x08) { - ///Handle CSI Report 2 - } -} - -void nr_rx_acknack(nfapi_nr_uci_pusch_pdu_t *uci_pusch, - const nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_01, - const nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_234, - NR_UL_IND_t *UL_info, NR_UE_sched_ctrl_t *sched_ctrl, NR_mac_stats_t *stats) { - - // TODO - int max_harq_rounds = 4; // TODO define macro - - if (uci_01 != NULL) { - // handle harq - int harq_idx_s = 0; - - // iterate over received harq bits - for (int harq_bit = 0; harq_bit < uci_01->harq->num_harq; harq_bit++) { - // search for the right harq process - for (int harq_idx = harq_idx_s; harq_idx < NR_MAX_NB_HARQ_PROCESSES; harq_idx++) { - // if the gNB received ack with a good confidence - if ((UL_info->slot-1) == sched_ctrl->harq_processes[harq_idx].feedback_slot) { - if ((uci_01->harq->harq_list[harq_bit].harq_value == 1) && - (uci_01->harq->harq_confidence_level == 0)) { - // toggle NDI and reset round - sched_ctrl->harq_processes[harq_idx].ndi ^= 1; - sched_ctrl->harq_processes[harq_idx].round = 0; - } - else - sched_ctrl->harq_processes[harq_idx].round++; - sched_ctrl->harq_processes[harq_idx].is_waiting = 0; - harq_idx_s = harq_idx + 1; - // if the max harq rounds was reached - if (sched_ctrl->harq_processes[harq_idx].round == max_harq_rounds) { - sched_ctrl->harq_processes[harq_idx].ndi ^= 1; - sched_ctrl->harq_processes[harq_idx].round = 0; - stats->dlsch_errors++; - } - break; - } - // if feedback slot processing is aborted - else if (((UL_info->slot-1) > sched_ctrl->harq_processes[harq_idx].feedback_slot) && - (sched_ctrl->harq_processes[harq_idx].is_waiting)) { - sched_ctrl->harq_processes[harq_idx].round++; - if (sched_ctrl->harq_processes[harq_idx].round == max_harq_rounds) { - sched_ctrl->harq_processes[harq_idx].ndi ^= 1; - sched_ctrl->harq_processes[harq_idx].round = 0; - } - sched_ctrl->harq_processes[harq_idx].is_waiting = 0; - } + if(tci_id != NULL && *tci_id == tci_stateID) + return tci_stateID; } } } - if (uci_234 != NULL) { - int harq_idx_s = 0; - int acknack; - - // iterate over received harq bits - for (int harq_bit = 0; harq_bit < uci_234->harq.harq_bit_len; harq_bit++) { - acknack = ((uci_234->harq.harq_payload[harq_bit>>3])>>harq_bit)&0x01; - for (int harq_idx = harq_idx_s; harq_idx < NR_MAX_NB_HARQ_PROCESSES-1; harq_idx++) { - // if the gNB received ack with a good confidence or if the max harq rounds was reached - if ((UL_info->slot-1) == sched_ctrl->harq_processes[harq_idx].feedback_slot) { - // TODO add some confidence level for when there is no CRC - if ((uci_234->harq.harq_crc != 1) && acknack) { - // toggle NDI and reset round - sched_ctrl->harq_processes[harq_idx].ndi ^= 1; - sched_ctrl->harq_processes[harq_idx].round = 0; - } - else - sched_ctrl->harq_processes[harq_idx].round++; - sched_ctrl->harq_processes[harq_idx].is_waiting = 0; - harq_idx_s = harq_idx + 1; - // if the max harq rounds was reached - if (sched_ctrl->harq_processes[harq_idx].round == max_harq_rounds) { - sched_ctrl->harq_processes[harq_idx].ndi ^= 1; - sched_ctrl->harq_processes[harq_idx].round = 0; - stats->dlsch_errors++; - } - break; - } - // if feedback slot processing is aborted - else if (((UL_info->slot-1) > sched_ctrl->harq_processes[harq_idx].feedback_slot) && - (sched_ctrl->harq_processes[harq_idx].is_waiting)) { - sched_ctrl->harq_processes[harq_idx].round++; - if (sched_ctrl->harq_processes[harq_idx].round == max_harq_rounds) { - sched_ctrl->harq_processes[harq_idx].ndi ^= 1; - sched_ctrl->harq_processes[harq_idx].round = 0; - } - sched_ctrl->harq_processes[harq_idx].is_waiting = 0; - } - } - } - } + // Need to implement once configuration is received + return -1; } +//returns the measured RSRP value (upper limit) +int get_measured_rsrp(uint8_t index) { + //if index is invalid returning minimum rsrp -140 + if((index >= 0 && index <= 15) || index >= 114) + return MIN_RSRP_VALUE; -// function to update pucch scheduling parameters in UE list when a USS DL is scheduled -bool nr_acknack_scheduling(int mod_id, - int UE_id, - frame_t frame, - sub_frame_t slot) -{ - const NR_ServingCellConfigCommon_t *scc = RC.nrmac[mod_id]->common_channels->ServingCellConfigCommon; - const int n_slots_frame = nr_slots_per_frame[*scc->ssbSubcarrierSpacing]; - const NR_TDD_UL_DL_Pattern_t *tdd = &scc->tdd_UL_DL_ConfigurationCommon->pattern1; - const int nr_ulmix_slots = tdd->nrofUplinkSlots + (tdd->nrofUplinkSymbols != 0); - const int nr_mix_slots = tdd->nrofDownlinkSymbols != 0 || tdd->nrofUplinkSymbols != 0; - const int nr_slots_period = tdd->nrofDownlinkSlots + tdd->nrofUplinkSlots + nr_mix_slots; - const int first_ul_slot_tdd = tdd->nrofDownlinkSlots + nr_slots_period * (slot / nr_slots_period); - const int CC_id = 0; - - AssertFatal(slot < first_ul_slot_tdd + (tdd->nrofUplinkSymbols != 0), - "cannot handle multiple TDD periods (yet): slot %d first_ul_slot_tdd %d nrofUplinkSlots %ld\n", - slot, - first_ul_slot_tdd, - tdd->nrofUplinkSlots); - - /* for the moment, we consider: - * * only pucch_sched[0] holds HARQ (and SR) - * * we do not multiplex with CSI, which is always in pucch_sched[2] - * * SR uses format 0 and is allocated in the first UL (mixed) slot (and not - * later) - * * that the PUCCH resource set 0 (for up to 2 bits) points to the first N - * PUCCH resources, where N is the number of resources in the PUCCH - * resource set. This is used in pucch_index_used, which counts the used - * resources by index, and not by their ID! */ - NR_UE_sched_ctrl_t *sched_ctrl = &RC.nrmac[mod_id]->UE_info.UE_sched_ctrl[UE_id]; - NR_sched_pucch_t *pucch = &sched_ctrl->sched_pucch[0]; - AssertFatal(pucch->csi_bits == 0, - "%s(): csi_bits %d in sched_pucch[0]\n", - __func__, - pucch->csi_bits); - - const int max_acknacks = 2; - AssertFatal(pucch->dai_c + pucch->sr_flag <= max_acknacks, - "illegal number of bits in PUCCH of UE %d\n", - UE_id); - /* if the currently allocated PUCCH of this UE is full, allocate it */ - if (pucch->sr_flag + pucch->dai_c == max_acknacks) { - /* advance the UL slot information in PUCCH by one so we won't schedule in - * the same slot again */ - const int f = pucch->frame; - const int s = pucch->ul_slot; - nr_fill_nfapi_pucch(mod_id, frame, slot, pucch, UE_id); - memset(pucch, 0, sizeof(*pucch)); - pucch->frame = s == n_slots_frame - 1 ? (f + 1) % 1024 : f; - pucch->ul_slot = (s + 1) % n_slots_frame; - // we assume that only two indices over the array sched_pucch exist - const NR_sched_pucch_t *csi_pucch = &sched_ctrl->sched_pucch[2]; - // skip the CSI PUCCH if it is present and if in the next frame/slot - if (csi_pucch->csi_bits > 0 - && csi_pucch->frame == pucch->frame - && csi_pucch->ul_slot == pucch->ul_slot) { - AssertFatal(!csi_pucch->simultaneous_harqcsi, - "%s(): %d.%d cannot handle simultaneous_harqcsi, but found for UE %d\n", - __func__, - pucch->frame, - pucch->ul_slot, - UE_id); - nr_fill_nfapi_pucch(mod_id, frame, slot, csi_pucch, UE_id); - pucch->frame = s >= n_slots_frame - 2 ? (f + 1) % 1024 : f; - pucch->ul_slot = (s + 2) % n_slots_frame; - } - } - - /* if the UE's next PUCCH occasion is after the possible UL slots (within the - * same frame) or wrapped around to the next frame, then we assume there is - * no possible PUCCH allocation anymore */ - if ((pucch->frame == frame - && (pucch->ul_slot >= first_ul_slot_tdd + nr_ulmix_slots)) - || (pucch->frame == frame + 1)) - return false; - - // this is hardcoded for now as ue specific - NR_SearchSpace__searchSpaceType_PR ss_type = NR_SearchSpace__searchSpaceType_PR_ue_Specific; - uint8_t pdsch_to_harq_feedback[8]; - get_pdsch_to_harq_feedback(mod_id, UE_id, ss_type, pdsch_to_harq_feedback); - - /* there is a scheduled SR or HARQ. Check whether we can use it for this - * ACKNACK */ - if (pucch->sr_flag + pucch->dai_c > 0) { - /* this UE already has a PUCCH occasion */ - DevAssert(pucch->frame == frame); - - // Find the right timing_indicator value. - int i = 0; - while (i < 8) { - if (pdsch_to_harq_feedback[i] == pucch->ul_slot - slot) - break; - ++i; - } - if (i >= 8) { - // we cannot reach this timing anymore, allocate and try again - const int f = pucch->frame; - const int s = pucch->ul_slot; - const int n_slots_frame = nr_slots_per_frame[*scc->ssbSubcarrierSpacing]; - nr_fill_nfapi_pucch(mod_id, frame, slot, pucch, UE_id); - memset(pucch, 0, sizeof(*pucch)); - pucch->frame = s == n_slots_frame - 1 ? (f + 1) % 1024 : f; - pucch->ul_slot = (s + 1) % n_slots_frame; - return nr_acknack_scheduling(mod_id, UE_id, frame, slot); - } - - pucch->timing_indicator = i; - pucch->dai_c++; - // retain old resource indicator, and we are good - return true; - } - - /* we need to find a new PUCCH occasion */ - - NR_PUCCH_Config_t *pucch_Config = sched_ctrl->active_ubwp->bwp_Dedicated->pucch_Config->choice.setup; - DevAssert(pucch_Config->resourceToAddModList->list.count > 0); - DevAssert(pucch_Config->resourceSetToAddModList->list.count > 0); - const int n_res = pucch_Config->resourceSetToAddModList->list.array[0]->resourceList.list.count; - int *pucch_index_used = RC.nrmac[mod_id]->pucch_index_used[sched_ctrl->active_ubwp->bwp_Id]; - - /* if time information is outdated (e.g., last PUCCH occasion in last frame), - * set to first possible UL occasion in this frame. Note that if such UE is - * scheduled a lot and used all AckNacks, pucch->frame might have been - * wrapped around to next frame */ - if (frame != pucch->frame || pucch->ul_slot < first_ul_slot_tdd) { - DevAssert(pucch->sr_flag + pucch->dai_c == 0); - AssertFatal(frame + 1 != pucch->frame, - "frame wrap around not handled in %s() yet\n", - __func__); - pucch->frame = frame; - pucch->ul_slot = first_ul_slot_tdd; - } - - // increase to first slot in which PUCCH resources are available - while (pucch_index_used[pucch->ul_slot] >= n_res) { - pucch->ul_slot++; - /* if there is no free resource anymore, abort search */ - if ((pucch->frame == frame - && pucch->ul_slot >= first_ul_slot_tdd + nr_ulmix_slots) - || (pucch->frame == frame + 1)) { - LOG_E(MAC, - "%4d.%2d no free PUCCH resources anymore while searching for UE %d\n", - frame, - slot, - UE_id); - return false; - } - } - - // advance ul_slot if it is not reachable by UE - pucch->ul_slot = max(pucch->ul_slot, slot + pdsch_to_harq_feedback[0]); - - // Find the right timing_indicator value. - int i = 0; - while (i < 8) { - if (pdsch_to_harq_feedback[i] == pucch->ul_slot - slot) - break; - ++i; - } - if (i >= 8) { - LOG_W(MAC, - "%4d.%2d could not find pdsch_to_harq_feedback for UE %d: earliest " - "ack slot %d\n", - frame, - slot, - UE_id, - pucch->ul_slot); - return false; - } - pucch->timing_indicator = i; // index in the list of timing indicators - - pucch->dai_c++; - const int pucch_res = pucch_index_used[pucch->ul_slot]; - pucch->resource_indicator = pucch_res; - pucch_index_used[pucch->ul_slot] += 1; - AssertFatal(pucch_index_used[pucch->ul_slot] <= n_res, - "UE %d in %4d.%2d: pucch_index_used is %d (%d available)\n", - UE_id, - pucch->frame, - pucch->ul_slot, - pucch_index_used[pucch->ul_slot], - n_res); - - /* verify that at that slot and symbol, resources are free. We only do this - * for initialCyclicShift 0 (we assume it always has that one), so other - * initialCyclicShifts can overlap with ICS 0!*/ - const NR_PUCCH_Resource_t *resource = - pucch_Config->resourceToAddModList->list.array[pucch_res]; - DevAssert(resource->format.present == NR_PUCCH_Resource__format_PR_format0); - if (resource->format.choice.format0->initialCyclicShift == 0) { - uint16_t *vrb_map_UL = &RC.nrmac[mod_id]->common_channels[CC_id].vrb_map_UL[pucch->ul_slot * MAX_BWP_SIZE]; - const uint16_t symb = 1 << resource->format.choice.format0->startingSymbolIndex; - AssertFatal((vrb_map_UL[resource->startingPRB] & symb) == 0, - "symbol %x is not free for PUCCH alloc in vrb_map_UL at RB %ld and slot %d\n", - symb, resource->startingPRB, pucch->ul_slot); - vrb_map_UL[resource->startingPRB] |= symb; - } - return true; + return L1_SSB_CSI_RSRP_measReport_mapping_38133_10_1_6_1_1[index]; } - -void csi_period_offset(const NR_CSI_ReportConfig_t *csirep, - int *period, int *offset) { - - NR_CSI_ReportPeriodicityAndOffset_PR p_and_o = csirep->reportConfigType.choice.periodic->reportSlotConfig.present; - - switch(p_and_o){ - case NR_CSI_ReportPeriodicityAndOffset_PR_slots4: - *period = 4; - *offset = csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots4; - break; - case NR_CSI_ReportPeriodicityAndOffset_PR_slots5: - *period = 5; - *offset = csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots5; - break; - case NR_CSI_ReportPeriodicityAndOffset_PR_slots8: - *period = 8; - *offset = csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots8; - break; - case NR_CSI_ReportPeriodicityAndOffset_PR_slots10: - *period = 10; - *offset = csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots10; - break; - case NR_CSI_ReportPeriodicityAndOffset_PR_slots16: - *period = 16; - *offset = csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots16; - break; - case NR_CSI_ReportPeriodicityAndOffset_PR_slots20: - *period = 20; - *offset = csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots20; - break; - case NR_CSI_ReportPeriodicityAndOffset_PR_slots40: - *period = 40; - *offset = csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots40; - break; - case NR_CSI_ReportPeriodicityAndOffset_PR_slots80: - *period = 80; - *offset = csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots80; - break; - case NR_CSI_ReportPeriodicityAndOffset_PR_slots160: - *period = 160; - *offset = csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots160; - break; - case NR_CSI_ReportPeriodicityAndOffset_PR_slots320: - *period = 320; - *offset = csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320; - break; - default: - AssertFatal(1==0,"No periodicity and offset resource found in CSI report"); - } +//returns the differential RSRP value (upper limit) +int get_diff_rsrp(uint8_t index, int strongest_rsrp) { + if(strongest_rsrp != -1) { + return strongest_rsrp + diff_rsrp_ssb_csi_meas_10_1_6_1_2[index]; + } else + return MIN_RSRP_VALUE; } -uint16_t compute_pucch_prb_size(uint8_t format, - uint8_t nr_prbs, - uint16_t O_tot, - uint16_t O_csi, - NR_PUCCH_MaxCodeRate_t *maxCodeRate, - uint8_t Qm, - uint8_t n_symb, - uint8_t n_re_ctrl) { - - uint16_t O_crc; - - if (O_tot<12) - O_crc = 0; - else{ - if (O_tot<20) - O_crc = 6; - else { - if (O_tot<360) - O_crc = 11; - else - AssertFatal(1==0,"Case for segmented PUCCH not yet implemented"); - } - } - - int rtimes100; - switch(*maxCodeRate){ - case NR_PUCCH_MaxCodeRate_zeroDot08 : - rtimes100 = 8; - break; - case NR_PUCCH_MaxCodeRate_zeroDot15 : - rtimes100 = 15; - break; - case NR_PUCCH_MaxCodeRate_zeroDot25 : - rtimes100 = 25; - break; - case NR_PUCCH_MaxCodeRate_zeroDot35 : - rtimes100 = 35; - break; - case NR_PUCCH_MaxCodeRate_zeroDot45 : - rtimes100 = 45; - break; - case NR_PUCCH_MaxCodeRate_zeroDot60 : - rtimes100 = 60; - break; - case NR_PUCCH_MaxCodeRate_zeroDot80 : - rtimes100 = 80; - break; - default : - AssertFatal(1==0,"Invalid MaxCodeRate"); - } - - float r = (float)rtimes100/100; - - if (O_csi == O_tot) { - if ((O_tot+O_csi)>(nr_prbs*n_re_ctrl*n_symb*Qm*r)) - AssertFatal(1==0,"MaxCodeRate %.2f can't support %d UCI bits and %d CRC bits with %d PRBs", - r,O_tot,O_crc,nr_prbs); - else - return nr_prbs; - } - - if (format==2){ - // TODO fix this for multiple CSI reports - for (int i=1; i<=nr_prbs; i++){ - if((O_tot+O_crc)<=(i*n_symb*Qm*n_re_ctrl*r) && - (O_tot+O_crc)>((i-1)*n_symb*Qm*n_re_ctrl*r)) - return i; - } - AssertFatal(1==0,"MaxCodeRate %.2f can't support %d UCI bits and %d CRC bits with at most %d PRBs", - r,O_tot,O_crc,nr_prbs); - } - else{ - AssertFatal(1==0,"Not yet implemented"); - } -} - - //identifies the target SSB Beam index //keeps the required date for PDCCH and PDSCH TCI state activation/deactivation CE consutruction globally //handles triggering of PDCCH and PDSCH MAC CEs @@ -1345,26 +863,6 @@ void tci_handling(module_id_t Mod_idP, int UE_id, int CC_id, NR_UE_sched_ctrl_t }//is-triggering_beam_switch }//tci handling - -//returns the measured RSRP value (upper limit) -int get_measured_rsrp(uint8_t index) { - //if index is invalid returning minimum rsrp -140 - if((index >= 0 && index <= 15) || index >= 114) - return MIN_RSRP_VALUE; - - return L1_SSB_CSI_RSRP_measReport_mapping_38133_10_1_6_1_1[index]; -} - - -//returns the differential RSRP value (upper limit) -int get_diff_rsrp(uint8_t index, int strongest_rsrp) { - if(strongest_rsrp != -1) { - return strongest_rsrp + diff_rsrp_ssb_csi_meas_10_1_6_1_2[index]; - } else - return MIN_RSRP_VALUE; -} - - void reverse_n_bits(uint8_t *value, uint16_t bitlen) { uint16_t j; uint8_t i; @@ -1461,4 +959,403 @@ void extract_pucch_csi_report (NR_CSI_MeasConfig_t *csi_MeasConfig, } +void nr_rx_acknack(nfapi_nr_uci_pusch_pdu_t *uci_pusch, + const nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_01, + const nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_234, + NR_UL_IND_t *UL_info, NR_UE_sched_ctrl_t *sched_ctrl, NR_mac_stats_t *stats) { + + // TODO + int max_harq_rounds = 4; // TODO define macro + + if (uci_01 != NULL) { + // handle harq + int harq_idx_s = 0; + + // iterate over received harq bits + for (int harq_bit = 0; harq_bit < uci_01->harq->num_harq; harq_bit++) { + // search for the right harq process + for (int harq_idx = harq_idx_s; harq_idx < NR_MAX_NB_HARQ_PROCESSES; harq_idx++) { + // if the gNB received ack with a good confidence + if ((UL_info->slot-1) == sched_ctrl->harq_processes[harq_idx].feedback_slot) { + if ((uci_01->harq->harq_list[harq_bit].harq_value == 1) && + (uci_01->harq->harq_confidence_level == 0)) { + // toggle NDI and reset round + sched_ctrl->harq_processes[harq_idx].ndi ^= 1; + sched_ctrl->harq_processes[harq_idx].round = 0; + } + else + sched_ctrl->harq_processes[harq_idx].round++; + sched_ctrl->harq_processes[harq_idx].is_waiting = 0; + harq_idx_s = harq_idx + 1; + // if the max harq rounds was reached + if (sched_ctrl->harq_processes[harq_idx].round == max_harq_rounds) { + sched_ctrl->harq_processes[harq_idx].ndi ^= 1; + sched_ctrl->harq_processes[harq_idx].round = 0; + stats->dlsch_errors++; + } + break; + } + // if feedback slot processing is aborted + else if (((UL_info->slot-1) > sched_ctrl->harq_processes[harq_idx].feedback_slot) && + (sched_ctrl->harq_processes[harq_idx].is_waiting)) { + sched_ctrl->harq_processes[harq_idx].round++; + if (sched_ctrl->harq_processes[harq_idx].round == max_harq_rounds) { + sched_ctrl->harq_processes[harq_idx].ndi ^= 1; + sched_ctrl->harq_processes[harq_idx].round = 0; + } + sched_ctrl->harq_processes[harq_idx].is_waiting = 0; + } + } + } + } + + if (uci_234 != NULL) { + int harq_idx_s = 0; + int acknack; + + // iterate over received harq bits + for (int harq_bit = 0; harq_bit < uci_234->harq.harq_bit_len; harq_bit++) { + acknack = ((uci_234->harq.harq_payload[harq_bit>>3])>>harq_bit)&0x01; + for (int harq_idx = harq_idx_s; harq_idx < NR_MAX_NB_HARQ_PROCESSES-1; harq_idx++) { + // if the gNB received ack with a good confidence or if the max harq rounds was reached + if ((UL_info->slot-1) == sched_ctrl->harq_processes[harq_idx].feedback_slot) { + // TODO add some confidence level for when there is no CRC + if ((uci_234->harq.harq_crc != 1) && acknack) { + // toggle NDI and reset round + sched_ctrl->harq_processes[harq_idx].ndi ^= 1; + sched_ctrl->harq_processes[harq_idx].round = 0; + } + else + sched_ctrl->harq_processes[harq_idx].round++; + sched_ctrl->harq_processes[harq_idx].is_waiting = 0; + harq_idx_s = harq_idx + 1; + // if the max harq rounds was reached + if (sched_ctrl->harq_processes[harq_idx].round == max_harq_rounds) { + sched_ctrl->harq_processes[harq_idx].ndi ^= 1; + sched_ctrl->harq_processes[harq_idx].round = 0; + stats->dlsch_errors++; + } + break; + } + // if feedback slot processing is aborted + else if (((UL_info->slot-1) > sched_ctrl->harq_processes[harq_idx].feedback_slot) && + (sched_ctrl->harq_processes[harq_idx].is_waiting)) { + sched_ctrl->harq_processes[harq_idx].round++; + if (sched_ctrl->harq_processes[harq_idx].round == max_harq_rounds) { + sched_ctrl->harq_processes[harq_idx].ndi ^= 1; + sched_ctrl->harq_processes[harq_idx].round = 0; + } + sched_ctrl->harq_processes[harq_idx].is_waiting = 0; + } + } + } + } +} + +void handle_nr_uci_pucch_0_1(module_id_t mod_id, + frame_t frame, + sub_frame_t slot, + const nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_01, + NR_UL_IND_t *UL_info) +{ + int UE_id = find_nr_UE_id(mod_id, uci_01->rnti); + if (UE_id < 0) { + LOG_E(MAC, "%s(): unknown RNTI %04x in PUCCH UCI\n", __func__, uci_01->rnti); + return; + } + NR_UE_info_t *UE_info = &RC.nrmac[mod_id]->UE_info; + NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; + + // tpc (power control) + sched_ctrl->tpc1 = nr_get_tpc(RC.nrmac[mod_id]->pucch_target_snrx10, + uci_01->ul_cqi, + 30); + + if ( uci_01 -> pduBitmap & 0x01 ) { + if ( uci_01->sr->sr_indication && !(uci_01->sr->sr_confidence_level)) { + sched_ctrl->sr_req.nr_of_srs =1; + sched_ctrl->sr_req.ul_SR[0] = 1; + } + } + + if (((uci_01->pduBitmap >> 1) & 0x01)) { + nr_rx_acknack(NULL,uci_01,NULL,UL_info,sched_ctrl,&UE_info->mac_stats[0]); + } +} + +void handle_nr_uci_pucch_2_3_4(module_id_t mod_id, + frame_t frame, + sub_frame_t slot, + const nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_234, + NR_UL_IND_t *UL_info) +{ + int UE_id = find_nr_UE_id(mod_id, uci_234->rnti); + if (UE_id < 0) { + LOG_E(MAC, "%s(): unknown RNTI %04x in PUCCH UCI\n", __func__, uci_234->rnti); + return; + } + NR_CSI_MeasConfig_t *csi_MeasConfig = RC.nrmac[mod_id]->UE_info.secondaryCellGroup[UE_id]->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup; + NR_UE_info_t *UE_info = &RC.nrmac[mod_id]->UE_info; + NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; + + // tpc (power control) + sched_ctrl->tpc1 = nr_get_tpc(RC.nrmac[mod_id]->pucch_target_snrx10, + uci_234->ul_cqi, + 30); + + if ( uci_234 -> pduBitmap & 0x01 ) { + ///Handle SR PDU + uint8_t sr_id = 0; + + for (sr_id = 0; sr_id < uci_234->sr.sr_bit_len; sr_id++) { + sched_ctrl->sr_req.ul_SR[sr_id] = *(uci_234->sr.sr_payload) & 1; + *(uci_234->sr.sr_payload) >>= 1; + } + + sched_ctrl->sr_req.nr_of_srs = uci_234->sr.sr_bit_len; + } + // TODO + if ((uci_234->pduBitmap >> 1) & 0x01) { + nr_rx_acknack(NULL,NULL,uci_234,UL_info,sched_ctrl,&UE_info->mac_stats[0]); + } + if ((uci_234->pduBitmap >> 1) & 0x01) { + + NR_SubcarrierSpacing_t scs=*(RC.nrmac[mod_id]->common_channels->ServingCellConfigCommon->ssbSubcarrierSpacing); + LOG_I(PHY,"SFN/SF:%d%d scs %ld \n", + UL_info->frame,UL_info->slot, + scs); + //API to parse the csi report and store it into sched_ctrl + extract_pucch_csi_report (csi_MeasConfig, uci_234, sched_ctrl,UL_info->frame, UL_info->slot, scs, UE_id, mod_id); + //TCI handling function + tci_handling(mod_id, UE_id, UL_info->CC_id, sched_ctrl, UL_info->frame, UL_info->slot); + } + + if (uci_234 -> pduBitmap & 0x08) { + ///Handle CSI Report 2 + } +} + + +// function to update pucch scheduling parameters in UE list when a USS DL is scheduled +void nr_acknack_scheduling(int Mod_idP, + int UE_id, + frame_t frameP, + sub_frame_t slotP, + int slots_per_tdd, + int *pucch_id, + int *pucch_occ) { + + NR_ServingCellConfigCommon_t *scc = RC.nrmac[Mod_idP]->common_channels->ServingCellConfigCommon; + NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; + NR_sched_pucch *curr_pucch; + int max_acknacks,pucch_res,first_ul_slot_tdd,k,i,l; + uint8_t pdsch_to_harq_feedback[8]; + int found = 0; + int nr_ulmix_slots = scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots; + if (scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols!=0) + nr_ulmix_slots++; + + bool csi_pres=false; + for (k=0; kUE_sched_ctrl[UE_id].sched_pucch[k][0].csi_bits>0) + csi_pres=true; + } + + // As a preference always schedule ack nacks in PUCCH0 (max 2 per slots) + // Unless there is CSI meas reporting scheduled in the period to avoid conflicts in the same slot + if (csi_pres) + max_acknacks=10; + else + max_acknacks=2; + + // this is hardcoded for now as ue specific + NR_SearchSpace__searchSpaceType_PR ss_type = NR_SearchSpace__searchSpaceType_PR_ue_Specific; + get_pdsch_to_harq_feedback(Mod_idP,UE_id,ss_type,pdsch_to_harq_feedback); + + // for each possible ul or mixed slot + for (k=0; kUE_sched_ctrl[UE_id].sched_pucch[k][l]; + //if it is possible to schedule acknack in current pucch (no exclusive csi pucch) + if ((curr_pucch->csi_bits == 0) || (curr_pucch->simultaneous_harqcsi==true)) { + // if there is free room in current pucch structure + if (curr_pucch->dai_c-1){ + curr_pucch->resource_indicator = pucch_res; + curr_pucch->frame = frameP; + // first pucch occasion in first UL or MIXED slot + first_ul_slot_tdd = scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots; + i = 0; + while (i<8 && found == 0) { // look if timing indicator is among allowed values + if (pdsch_to_harq_feedback[i]==(first_ul_slot_tdd+k)-(slotP % slots_per_tdd)) + found = 1; + if (found == 0) i++; + } + if (found == 1) { + // computing slot in which pucch is scheduled + curr_pucch->dai_c++; + curr_pucch->ul_slot = first_ul_slot_tdd + k + (slotP - (slotP % slots_per_tdd)); + curr_pucch->timing_indicator = i; // index in the list of timing indicators + *pucch_id = k; + *pucch_occ = l; + return; + } + } + } + } + } + } + AssertFatal(1==0,"No Uplink slot available in accordance to allowed timing indicator\n"); +} + + +void csi_period_offset(NR_CSI_ReportConfig_t *csirep, + int *period, int *offset) { + + NR_CSI_ReportPeriodicityAndOffset_PR p_and_o = csirep->reportConfigType.choice.periodic->reportSlotConfig.present; + + switch(p_and_o){ + case NR_CSI_ReportPeriodicityAndOffset_PR_slots4: + *period = 4; + *offset = csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots4; + break; + case NR_CSI_ReportPeriodicityAndOffset_PR_slots5: + *period = 5; + *offset = csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots5; + break; + case NR_CSI_ReportPeriodicityAndOffset_PR_slots8: + *period = 8; + *offset = csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots8; + break; + case NR_CSI_ReportPeriodicityAndOffset_PR_slots10: + *period = 10; + *offset = csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots10; + break; + case NR_CSI_ReportPeriodicityAndOffset_PR_slots16: + *period = 16; + *offset = csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots16; + break; + case NR_CSI_ReportPeriodicityAndOffset_PR_slots20: + *period = 20; + *offset = csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots20; + break; + case NR_CSI_ReportPeriodicityAndOffset_PR_slots40: + *period = 40; + *offset = csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots40; + break; + case NR_CSI_ReportPeriodicityAndOffset_PR_slots80: + *period = 80; + *offset = csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots80; + break; + case NR_CSI_ReportPeriodicityAndOffset_PR_slots160: + *period = 160; + *offset = csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots160; + break; + case NR_CSI_ReportPeriodicityAndOffset_PR_slots320: + *period = 320; + *offset = csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320; + break; + default: + AssertFatal(1==0,"No periodicity and offset resource found in CSI report"); + } +} + + +int get_pucch_resource(NR_UE_info_t *UE_info,int UE_id,int k,int l) { + + // to be updated later, for now simple implementation + // use the second allocation just in case there is csi in the first + // in that case use second resource (for a different symbol) see 9.2 in 38.213 + if (l==1) { + if (UE_info->UE_sched_ctrl[UE_id].sched_pucch[k][0].csi_bits==0) + return -1; + else + return 1; + } + else + return 0; + +} + + +uint16_t compute_pucch_prb_size(uint8_t format, + uint8_t nr_prbs, + uint16_t O_tot, + uint16_t O_csi, + NR_PUCCH_MaxCodeRate_t *maxCodeRate, + uint8_t Qm, + uint8_t n_symb, + uint8_t n_re_ctrl) { + + uint16_t O_crc; + + if (O_tot<12) + O_crc = 0; + else{ + if (O_tot<20) + O_crc = 6; + else { + if (O_tot<360) + O_crc = 11; + else + AssertFatal(1==0,"Case for segmented PUCCH not yet implemented"); + } + } + + int rtimes100; + switch(*maxCodeRate){ + case NR_PUCCH_MaxCodeRate_zeroDot08 : + rtimes100 = 8; + break; + case NR_PUCCH_MaxCodeRate_zeroDot15 : + rtimes100 = 15; + break; + case NR_PUCCH_MaxCodeRate_zeroDot25 : + rtimes100 = 25; + break; + case NR_PUCCH_MaxCodeRate_zeroDot35 : + rtimes100 = 35; + break; + case NR_PUCCH_MaxCodeRate_zeroDot45 : + rtimes100 = 45; + break; + case NR_PUCCH_MaxCodeRate_zeroDot60 : + rtimes100 = 60; + break; + case NR_PUCCH_MaxCodeRate_zeroDot80 : + rtimes100 = 80; + break; + default : + AssertFatal(1==0,"Invalid MaxCodeRate"); + } + + float r = (float)rtimes100/100; + + if (O_csi == O_tot) { + if ((O_tot+O_csi)>(nr_prbs*n_re_ctrl*n_symb*Qm*r)) + AssertFatal(1==0,"MaxCodeRate %.2f can't support %d UCI bits and %d CRC bits with %d PRBs", + r,O_tot,O_crc,nr_prbs); + else + return nr_prbs; + } + + if (format==2){ + // TODO fix this for multiple CSI reports + for (int i=1; i<=nr_prbs; i++){ + if((O_tot+O_crc)<=(i*n_symb*Qm*n_re_ctrl*r) && + (O_tot+O_crc)>((i-1)*n_symb*Qm*n_re_ctrl*r)) + return i; + } + AssertFatal(1==0,"MaxCodeRate %.2f can't support %d UCI bits and %d CRC bits with at most %d PRBs", + r,O_tot,O_crc,nr_prbs); + } + else{ + AssertFatal(1==0,"Not yet implemented"); + } +} + + + + diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index 24a93040c4..f94d22f1e9 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -196,22 +196,6 @@ bool nr_acknack_scheduling(int Mod_idP, frame_t frameP, sub_frame_t slotP); -int checkTargetSSBInTCIStates_pdcchConfig(int ssb_index_t, int Mod_idP, int UE_id); - -int checkTargetSSBInFirst64TCIStates_pdschConfig(int ssb_index_t, int Mod_idP, int UE_id); - -int get_measured_rsrp(uint8_t index); - -int get_diff_rsrp(uint8_t index, int strongest_rsrp); - -void extract_pucch_csi_report (NR_CSI_MeasConfig_t *csi_MeasConfig, - const nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_pdu, - NR_UE_sched_ctrl_t *sched_ctrl, - frame_t frame, - slot_t slot, - NR_SubcarrierSpacing_t scs, int UE_id, - module_id_t Mod_idP); - void get_pdsch_to_harq_feedback(int Mod_idP, int UE_id, NR_SearchSpace__searchSpaceType_PR ss_type, diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index a7ca7909bf..04f6468470 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -52,7 +52,6 @@ extern int oai_nfapi_rx_ind(nfapi_rx_indication_t *ind); extern uint8_t nfapi_mode; extern uint16_t sf_ahead; extern uint16_t sl_ahead; -void tci_handling(module_id_t Mod_idP, int UE_id, int CC_id, NR_UE_sched_ctrl_t *sched_ctrl, frame_t frame, slot_t slot); void handle_nr_rach(NR_UL_IND_t *UL_info) { From 6505729aadd9da34f03e8a1c7783237f0160d51e Mon Sep 17 00:00:00 2001 From: guhan Date: Wed, 10 Feb 2021 22:54:58 +0530 Subject: [PATCH 145/231] some modifications in gNB_scheduler_uci.c --- .../LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 128 ++++++++---------- openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 6 +- openair2/NR_PHY_INTERFACE/NR_IF_Module.c | 4 +- 3 files changed, 59 insertions(+), 79 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index 98aca65496..b5288a07c7 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -88,20 +88,6 @@ void nr_fill_nfapi_pucch(module_id_t mod_id, int ssb_index_sorted[MAX_NUM_SSB] = {0}; int ssb_rsrp_sorted[MAX_NUM_SSB] = {0}; -//Sorts ssb_index and ssb_rsrp array data and keeps in ssb_index_sorted and -//ssb_rsrp_sorted respectively -void ssb_rsrp_sort(int *ssb_index, int *ssb_rsrp) { - int i, j; - - for(i = 0; *(ssb_index+i) != 0; i++) { - for(j = i; *(ssb_index+j) != 0; j++) { - if(*(ssb_rsrp+j) >= *(ssb_rsrp+i)) { - ssb_index_sorted[i] = *(ssb_index+j); - ssb_rsrp_sorted[i] = *(ssb_rsrp+j); - } - } - } -} //Measured RSRP Values Table 10.1.16.1-1 from 36.133 //Stored all the upper limits[Max RSRP Value of corresponding index] @@ -183,9 +169,10 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in for (csi_report_id=0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++){ struct NR_CSI_ReportConfig *csi_reportconfig = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]; + nr_csi_report_t *csi_report = &UE_info->csi_report_template[UE_id][csi_report_id]; csi_ResourceConfigId=csi_reportconfig->resourcesForChannelMeasurement; reportQuantity_type = csi_reportconfig->reportQuantity.present; - UE_info->csi_report_template[UE_id][csi_report_id].reportQuantity_type = reportQuantity_type; + csi_report->reportQuantity_type = reportQuantity_type; for ( csi_resourceidx = 0; csi_resourceidx < csi_MeasConfig->csi_ResourceConfigToAddModList->list.count; csi_resourceidx++) { struct NR_CSI_ResourceConfig *csi_resourceconfig = csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]; @@ -199,7 +186,7 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in if (NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled == csi_reportconfig->groupBasedBeamReporting.present) { if (NULL != csi_reportconfig->groupBasedBeamReporting.choice.disabled->nrofReportedRS) - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.nb_ssbri_cri = *(csi_reportconfig->groupBasedBeamReporting.choice.disabled->nrofReportedRS)+1; + csi_report->CSI_report_bitlen.nb_ssbri_cri = *(csi_reportconfig->groupBasedBeamReporting.choice.disabled->nrofReportedRS)+1; else /*! From Spec 38.331 * nrofReportedRS @@ -207,21 +194,21 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in * capability. FFS: The signaling mechanism for the gNB to select a subset of N beams for the UE to measure and report. * When the field is absent the UE applies the value 1 */ - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.nb_ssbri_cri= 1; + csi_report->CSI_report_bitlen.nb_ssbri_cri= 1; }else - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.nb_ssbri_cri= 2; + csi_report->CSI_report_bitlen.nb_ssbri_cri= 2; - if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == UE_info->csi_report_template[UE_id][csi_report_id].reportQuantity_type) { + if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == csi_report->reportQuantity_type) { for ( csi_ssb_idx = 0; csi_ssb_idx < csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.count; csi_ssb_idx++) { if (csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceSetId == *(csi_resourceconfig->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.array[0])){ ///We can configure only one SSB resource set from spec 38.331 IE CSI-ResourceConfig nb_ssb_resources= csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceList.list.count; - UE_info->csi_report_template[UE_id][csi_report_id].SSB_Index_list = csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceList.list.array; - UE_info->csi_report_template[UE_id][csi_report_id].CSI_Index_list = NULL; + csi_report->SSB_Index_list = csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceList.list.array; + csi_report->CSI_Index_list = NULL; + break; } - break; } } else /*if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == UE_info->csi_report_template[UE_id][csi_report_id].reportQuantity_type)*/{ for ( csi_ssb_idx = 0; csi_ssb_idx < csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.count; csi_ssb_idx++) { @@ -230,27 +217,27 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in ///For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 for spec 38.212 nb_ssb_resources= csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_RS_Resources.list.count; - UE_info->csi_report_template[UE_id][csi_report_id].CSI_Index_list = csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_RS_Resources.list.array; - UE_info->csi_report_template[UE_id][csi_report_id].SSB_Index_list = NULL; + csi_report->CSI_Index_list = csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_RS_Resources.list.array; + csi_report->SSB_Index_list = NULL; + break; } - break; } } if (nb_ssb_resources) { - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.cri_ssbri_bitlen =ceil(log2 (nb_ssb_resources)); - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.rsrp_bitlen = 7; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.diff_rsrp_bitlen =4; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP + csi_report->CSI_report_bitlen.cri_ssbri_bitlen =ceil(log2 (nb_ssb_resources)); + csi_report->CSI_report_bitlen.rsrp_bitlen = 7; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP + csi_report->CSI_report_bitlen.diff_rsrp_bitlen =4; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP } else { - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.cri_ssbri_bitlen =0; - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.rsrp_bitlen = 0; - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.diff_rsrp_bitlen =0; + csi_report->CSI_report_bitlen.cri_ssbri_bitlen =0; + csi_report->CSI_report_bitlen.rsrp_bitlen = 0; + csi_report->CSI_report_bitlen.diff_rsrp_bitlen =0; } LOG_I (MAC, "UCI: CSI_bit len : ssbri %d, rsrp: %d, diff_rsrp: %d\n", - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.cri_ssbri_bitlen, - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.rsrp_bitlen, - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.diff_rsrp_bitlen); + csi_report->CSI_report_bitlen.cri_ssbri_bitlen, + csi_report->CSI_report_bitlen.rsrp_bitlen, + csi_report->CSI_report_bitlen.diff_rsrp_bitlen); } uint8_t ri_restriction; @@ -269,18 +256,18 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in *(csi_resourceconfig->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.array[0])) { ///For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 for spec 38.212 nb_ssb_resources= csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_RS_Resources.list.count; - UE_info->csi_report_template[UE_id][csi_report_id].CSI_Index_list = csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_RS_Resources.list.array; - UE_info->csi_report_template[UE_id][csi_report_id].SSB_Index_list = NULL; + csi_report->CSI_Index_list = csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_RS_Resources.list.array; + csi_report->SSB_Index_list = NULL; } break; } - UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.cri_bitlen=ceil(log2 (nb_ssb_resources)); + csi_report->csi_meas_bitlen.cri_bitlen=ceil(log2 (nb_ssb_resources)); if (NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel==csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.present){ switch (RC.nrmac[Mod_idP]->config[0].carrier_config.num_tx_ant.value) { case 1:; - UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.ri_bitlen=0; + csi_report->csi_meas_bitlen.ri_bitlen=0; break; case 2: /* From Spec 38.212 @@ -307,7 +294,7 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in ri_bitlen = ceil(log2(nb_allowed_ri)); } ri_bitlen = ri_bitlen<1?ri_bitlen:1; //from the spec 38.212 and table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel - UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.ri_bitlen=ri_bitlen; + csi_report->csi_meas_bitlen.ri_bitlen=ri_bitlen; break; case 4: AssertFatal (NULL!=csi_reportconfig->dummy, "nrofCQIsPerReport is not present"); @@ -325,7 +312,7 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in ri_bitlen = ceil(log2(nb_allowed_ri)); } ri_bitlen = ri_bitlen<2?ri_bitlen:2; //from the spec 38.212 and table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel - UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.ri_bitlen=ri_bitlen; + csi_report->csi_meas_bitlen.ri_bitlen=ri_bitlen; break; case 6: case 8: @@ -343,16 +330,16 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in nb_allowed_ri = number_of_bits_set(ri_restriction, &max_ri); ri_bitlen = ceil(log2(nb_allowed_ri)); } - UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.ri_bitlen=ri_bitlen; + csi_report->csi_meas_bitlen.ri_bitlen=ri_bitlen; break; default: AssertFatal(RC.nrmac[Mod_idP]->config[0].carrier_config.num_tx_ant.value>8,"Number of antennas %d are out of range", RC.nrmac[Mod_idP]->config[0].carrier_config.num_tx_ant.value); } } - UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.li_bitlen=0; - UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.cqi_bitlen=0; - UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.pmi_x1_bitlen=0; - UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.pmi_x2_bitlen=0; + csi_report->csi_meas_bitlen.li_bitlen=0; + csi_report->csi_meas_bitlen.cqi_bitlen=0; + csi_report->csi_meas_bitlen.pmi_x1_bitlen=0; + csi_report->csi_meas_bitlen.pmi_x2_bitlen=0; } if( NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI==reportQuantity_type ){ @@ -360,7 +347,7 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in switch (RC.nrmac[Mod_idP]->config[0].carrier_config.num_tx_ant.value) { case 1:; - UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.li_bitlen=0; + csi_report->csi_meas_bitlen.li_bitlen=0; break; case 2: case 4: @@ -377,7 +364,7 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in * */ //! TODO: The bit length of LI is as follows LI = log2(RI), Need to confirm wheather we should consider maximum RI can be reported from ri_restricted // or we should consider reported RI. If we need to consider reported RI for calculating LI bit length then we need to modify the code. - UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.li_bitlen=ceil(log2(max_ri))<2?ceil(log2(max_ri)):2; + csi_report->csi_meas_bitlen.li_bitlen=ceil(log2(max_ri))<2?ceil(log2(max_ri)):2; break; default: AssertFatal(RC.nrmac[Mod_idP]->config[0].carrier_config.num_tx_ant.value>8,"Number of antennas %d are out of range", RC.nrmac[Mod_idP]->config[0].carrier_config.num_tx_ant.value); @@ -409,15 +396,15 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in if (max_ri > 4 && max_ri < 8){ if (NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel==csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.present){ if (NR_CSI_ReportConfig__reportFreqConfiguration__cqi_FormatIndicator_widebandCQI==csi_reportconfig->reportFreqConfiguration->cqi_FormatIndicator) - UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.cqi_bitlen = 8; + csi_report->csi_meas_bitlen.cqi_bitlen = 8; else - UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.cqi_bitlen = 4; + csi_report->csi_meas_bitlen.cqi_bitlen = 4; } }else{ //This condition will work even for type1-multipanel. if (NR_CSI_ReportConfig__reportFreqConfiguration__cqi_FormatIndicator_widebandCQI==csi_reportconfig->reportFreqConfiguration->cqi_FormatIndicator) - UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.cqi_bitlen = 4; + csi_report->csi_meas_bitlen.cqi_bitlen = 4; else - UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.cqi_bitlen = 2; + csi_report->csi_meas_bitlen.cqi_bitlen = 2; } break; default: @@ -430,9 +417,9 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in switch (csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.present){ case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_two: if (max_ri ==1) - UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.pmi_x1_bitlen = 2; + csi_report->csi_meas_bitlen.pmi_x1_bitlen = 2; else if (max_ri ==2) - UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.pmi_x1_bitlen = 1; + csi_report->csi_meas_bitlen.pmi_x1_bitlen = 1; break; default: AssertFatal(csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.present!= @@ -684,7 +671,7 @@ int get_diff_rsrp(uint8_t index, int strongest_rsrp) { //identifies the target SSB Beam index //keeps the required date for PDCCH and PDSCH TCI state activation/deactivation CE consutruction globally //handles triggering of PDCCH and PDSCH MAC CEs -void tci_handling(module_id_t Mod_idP, int UE_id, int CC_id, NR_UE_sched_ctrl_t *sched_ctrl, frame_t frame, slot_t slot) { +void tci_handling(module_id_t Mod_idP, int UE_id, frame_t frame, slot_t slot) { int strongest_ssb_rsrp = 0; int cqi_idx = 0; @@ -707,6 +694,7 @@ void tci_handling(module_id_t Mod_idP, int UE_id, int CC_id, NR_UE_sched_ctrl_t int better_rsrp_reported = -140-(-0); /*minimum_measured_RSRP_value - minimum_differntail_RSRP_value*///considering the minimum RSRP value as better RSRP initially uint8_t diff_rsrp_idx = 0; uint8_t i, j; + NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; if (n_dl_bwp < 4) pdsch_bwp_id = bwp_id; @@ -876,10 +864,9 @@ void reverse_n_bits(uint8_t *value, uint16_t bitlen) { void extract_pucch_csi_report (NR_CSI_MeasConfig_t *csi_MeasConfig, const nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_pdu, - NR_UE_sched_ctrl_t *sched_ctrl, frame_t frame, slot_t slot, - NR_SubcarrierSpacing_t scs, int UE_id, + int UE_id, module_id_t Mod_idP) { /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ @@ -888,6 +875,7 @@ void extract_pucch_csi_report (NR_CSI_MeasConfig_t *csi_MeasConfig, uint8_t *payload = uci_pdu->csi_part1.csi_part1_payload; NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type = NR_CSI_ReportConfig__reportQuantity_PR_NOTHING; NR_UE_info_t *UE_info = &(RC.nrmac[Mod_idP]->UE_info); + NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; uint8_t csi_report_id = 0; UE_info->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report = 0; @@ -962,7 +950,7 @@ void extract_pucch_csi_report (NR_CSI_MeasConfig_t *csi_MeasConfig, void nr_rx_acknack(nfapi_nr_uci_pusch_pdu_t *uci_pusch, const nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_01, const nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_234, - NR_UL_IND_t *UL_info, NR_UE_sched_ctrl_t *sched_ctrl, NR_mac_stats_t *stats) { + slot_t slot, NR_UE_sched_ctrl_t *sched_ctrl, NR_mac_stats_t *stats) { // TODO int max_harq_rounds = 4; // TODO define macro @@ -976,7 +964,7 @@ void nr_rx_acknack(nfapi_nr_uci_pusch_pdu_t *uci_pusch, // search for the right harq process for (int harq_idx = harq_idx_s; harq_idx < NR_MAX_NB_HARQ_PROCESSES; harq_idx++) { // if the gNB received ack with a good confidence - if ((UL_info->slot-1) == sched_ctrl->harq_processes[harq_idx].feedback_slot) { + if ((slot-1) == sched_ctrl->harq_processes[harq_idx].feedback_slot) { if ((uci_01->harq->harq_list[harq_bit].harq_value == 1) && (uci_01->harq->harq_confidence_level == 0)) { // toggle NDI and reset round @@ -996,7 +984,7 @@ void nr_rx_acknack(nfapi_nr_uci_pusch_pdu_t *uci_pusch, break; } // if feedback slot processing is aborted - else if (((UL_info->slot-1) > sched_ctrl->harq_processes[harq_idx].feedback_slot) && + else if (((slot-1) > sched_ctrl->harq_processes[harq_idx].feedback_slot) && (sched_ctrl->harq_processes[harq_idx].is_waiting)) { sched_ctrl->harq_processes[harq_idx].round++; if (sched_ctrl->harq_processes[harq_idx].round == max_harq_rounds) { @@ -1018,7 +1006,7 @@ void nr_rx_acknack(nfapi_nr_uci_pusch_pdu_t *uci_pusch, acknack = ((uci_234->harq.harq_payload[harq_bit>>3])>>harq_bit)&0x01; for (int harq_idx = harq_idx_s; harq_idx < NR_MAX_NB_HARQ_PROCESSES-1; harq_idx++) { // if the gNB received ack with a good confidence or if the max harq rounds was reached - if ((UL_info->slot-1) == sched_ctrl->harq_processes[harq_idx].feedback_slot) { + if ((slot-1) == sched_ctrl->harq_processes[harq_idx].feedback_slot) { // TODO add some confidence level for when there is no CRC if ((uci_234->harq.harq_crc != 1) && acknack) { // toggle NDI and reset round @@ -1038,7 +1026,7 @@ void nr_rx_acknack(nfapi_nr_uci_pusch_pdu_t *uci_pusch, break; } // if feedback slot processing is aborted - else if (((UL_info->slot-1) > sched_ctrl->harq_processes[harq_idx].feedback_slot) && + else if (((slot-1) > sched_ctrl->harq_processes[harq_idx].feedback_slot) && (sched_ctrl->harq_processes[harq_idx].is_waiting)) { sched_ctrl->harq_processes[harq_idx].round++; if (sched_ctrl->harq_processes[harq_idx].round == max_harq_rounds) { @@ -1055,8 +1043,7 @@ void nr_rx_acknack(nfapi_nr_uci_pusch_pdu_t *uci_pusch, void handle_nr_uci_pucch_0_1(module_id_t mod_id, frame_t frame, sub_frame_t slot, - const nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_01, - NR_UL_IND_t *UL_info) + const nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_01) { int UE_id = find_nr_UE_id(mod_id, uci_01->rnti); if (UE_id < 0) { @@ -1079,15 +1066,14 @@ void handle_nr_uci_pucch_0_1(module_id_t mod_id, } if (((uci_01->pduBitmap >> 1) & 0x01)) { - nr_rx_acknack(NULL,uci_01,NULL,UL_info,sched_ctrl,&UE_info->mac_stats[0]); + nr_rx_acknack(NULL,uci_01,NULL,slot,sched_ctrl,&UE_info->mac_stats[0]); } } void handle_nr_uci_pucch_2_3_4(module_id_t mod_id, frame_t frame, sub_frame_t slot, - const nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_234, - NR_UL_IND_t *UL_info) + const nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_234) { int UE_id = find_nr_UE_id(mod_id, uci_234->rnti); if (UE_id < 0) { @@ -1116,18 +1102,14 @@ void handle_nr_uci_pucch_2_3_4(module_id_t mod_id, } // TODO if ((uci_234->pduBitmap >> 1) & 0x01) { - nr_rx_acknack(NULL,NULL,uci_234,UL_info,sched_ctrl,&UE_info->mac_stats[0]); + nr_rx_acknack(NULL,NULL,uci_234,slot,sched_ctrl,&UE_info->mac_stats[0]); } if ((uci_234->pduBitmap >> 1) & 0x01) { - NR_SubcarrierSpacing_t scs=*(RC.nrmac[mod_id]->common_channels->ServingCellConfigCommon->ssbSubcarrierSpacing); - LOG_I(PHY,"SFN/SF:%d%d scs %ld \n", - UL_info->frame,UL_info->slot, - scs); //API to parse the csi report and store it into sched_ctrl - extract_pucch_csi_report (csi_MeasConfig, uci_234, sched_ctrl,UL_info->frame, UL_info->slot, scs, UE_id, mod_id); + extract_pucch_csi_report (csi_MeasConfig, uci_234, frame, slot, UE_id, mod_id); //TCI handling function - tci_handling(mod_id, UE_id, UL_info->CC_id, sched_ctrl, UL_info->frame, UL_info->slot); + tci_handling(mod_id, UE_id,frame, slot); } if (uci_234 -> pduBitmap & 0x08) { diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index f94d22f1e9..73c6120e6d 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -162,13 +162,11 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP, void handle_nr_uci_pucch_0_1(module_id_t mod_id, frame_t frame, sub_frame_t slot, - const nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_01, - NR_UL_IND_t *UL_info); + const nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_01); void handle_nr_uci_pucch_2_3_4(module_id_t mod_id, frame_t frame, sub_frame_t slot, - const nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_234, - NR_UL_IND_t *UL_info); + const nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_234); void config_uldci(const NR_BWP_Uplink_t *ubwp, diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index 04f6468470..c1fd4a9ea1 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -93,13 +93,13 @@ void handle_nr_uci(NR_UL_IND_t *UL_info) case NFAPI_NR_UCI_FORMAT_0_1_PDU_TYPE: { const nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_pdu = &uci_list[i].pucch_pdu_format_0_1; - handle_nr_uci_pucch_0_1(mod_id, frame, slot, uci_pdu, UL_info); + handle_nr_uci_pucch_0_1(mod_id, frame, slot, uci_pdu); break; } case NFAPI_NR_UCI_FORMAT_2_3_4_PDU_TYPE: { const nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_pdu = &uci_list[i].pucch_pdu_format_2_3_4; - handle_nr_uci_pucch_2_3_4(mod_id, frame, slot, uci_pdu, UL_info); + handle_nr_uci_pucch_2_3_4(mod_id, frame, slot, uci_pdu); break; } } From 89c1a9c2849ff29f68248df7670d0b3e5bd1d938 Mon Sep 17 00:00:00 2001 From: guhan Date: Fri, 12 Feb 2021 23:21:32 +0530 Subject: [PATCH 146/231] Removed SR --- .../LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 22 ------------------- openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 4 ---- 2 files changed, 26 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index b5288a07c7..28c74d818d 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -1058,13 +1058,6 @@ void handle_nr_uci_pucch_0_1(module_id_t mod_id, uci_01->ul_cqi, 30); - if ( uci_01 -> pduBitmap & 0x01 ) { - if ( uci_01->sr->sr_indication && !(uci_01->sr->sr_confidence_level)) { - sched_ctrl->sr_req.nr_of_srs =1; - sched_ctrl->sr_req.ul_SR[0] = 1; - } - } - if (((uci_01->pduBitmap >> 1) & 0x01)) { nr_rx_acknack(NULL,uci_01,NULL,slot,sched_ctrl,&UE_info->mac_stats[0]); } @@ -1089,23 +1082,8 @@ void handle_nr_uci_pucch_2_3_4(module_id_t mod_id, uci_234->ul_cqi, 30); - if ( uci_234 -> pduBitmap & 0x01 ) { - ///Handle SR PDU - uint8_t sr_id = 0; - - for (sr_id = 0; sr_id < uci_234->sr.sr_bit_len; sr_id++) { - sched_ctrl->sr_req.ul_SR[sr_id] = *(uci_234->sr.sr_payload) & 1; - *(uci_234->sr.sr_payload) >>= 1; - } - - sched_ctrl->sr_req.nr_of_srs = uci_234->sr.sr_bit_len; - } - // TODO if ((uci_234->pduBitmap >> 1) & 0x01) { nr_rx_acknack(NULL,NULL,uci_234,slot,sched_ctrl,&UE_info->mac_stats[0]); - } - if ((uci_234->pduBitmap >> 1) & 0x01) { - //API to parse the csi report and store it into sched_ctrl extract_pucch_csi_report (csi_MeasConfig, uci_234, frame, slot, UE_id, mod_id); //TCI handling function diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index a21b2fdb46..92787c5c2e 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -406,10 +406,6 @@ struct CSI_Report { }; #define MAX_SR_BITLEN 8 -typedef struct NR_UE_sr { - uint8_t nr_of_srs; - bool ul_SR [MAX_SR_BITLEN]; -} NR_UE_sr_t; typedef struct { uint8_t nb_ssbri_cri; From 02ae169250ea987dce677cb0b8181513d74047ae Mon Sep 17 00:00:00 2001 From: Guhan Date: Mon, 1 Mar 2021 11:43:30 +0530 Subject: [PATCH 147/231] Rebased to latest develop and removed nr_rx_acknack function --- openair2/LAYER2/NR_MAC_gNB/config.c | 2 + openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 10 +- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 2 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 431 ++++++++++-------- openair2/RRC/NR/rrc_gNB_reconfig.c | 4 +- 5 files changed, 262 insertions(+), 187 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index b675c5b670..3fc2556bfc 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -392,6 +392,8 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, if (secondaryCellGroup) { + RC.nrmac[Mod_idP]->secondaryCellGroupCommon = secondaryCellGroup; + NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; if (add_ue == 1 && get_softmodem_params()->phy_test) { const int UE_id = add_new_nr_ue(Mod_idP, rnti, secondaryCellGroup); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index b7c654c4f7..7201b29596 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -89,8 +89,7 @@ void dump_mac_stats(gNB_MAC_INST *gNB) } } - -void clear_nr_nfapi_information(gNB_MAC_INST *gNB, +void clear_nr_nfapi_information(gNB_MAC_INST * gNB, int CC_idP, frame_t frameP, sub_frame_t slotP){ @@ -103,6 +102,7 @@ void clear_nr_nfapi_information(gNB_MAC_INST *gNB, &gNB->UL_tti_req_ahead[CC_idP][(slotP + num_slots - 1) % num_slots]; nfapi_nr_ul_dci_request_t *UL_dci_req = &gNB->UL_dci_req[0]; nfapi_nr_tx_data_request_t *TX_req = &gNB->TX_req[0]; + gNB->pdu_index[CC_idP] = 0; if (NFAPI_MODE == NFAPI_MONOLITHIC || NFAPI_MODE == NFAPI_MODE_PNF) { // monolithic or PNF @@ -131,6 +131,7 @@ void clear_nr_nfapi_information(gNB_MAC_INST *gNB, gNB->UL_tti_req[CC_idP] = &gNB->UL_tti_req_ahead[CC_idP][slotP]; TX_req[CC_idP].Number_of_PDUs = 0; + } } /* @@ -294,11 +295,11 @@ void schedule_nr_SRS(module_id_t module_idP, frame_t frameP, sub_frame_t subfram } */ + bool is_xlsch_in_slot(uint64_t bitmap, sub_frame_t slot) { return (bitmap >> slot) & 0x01; } - void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frame, sub_frame_t slot){ @@ -358,6 +359,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, start_meas(&RC.nrmac[module_idP]->eNB_scheduler); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_DLSCH_ULSCH_SCHEDULER,VCD_FUNCTION_IN); + pdcp_run(&ctxt); /* send tick to RLC and RRC every ms */ if ((slot & ((1 << *scc->ssbSubcarrierSpacing) - 1)) == 0) { @@ -394,6 +396,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, if ((slot == 0) && (frame & 127) == 0) dump_mac_stats(RC.nrmac[module_idP]); + // This schedules MIB schedule_nr_mib(module_idP, frame, slot, nr_slots_per_frame[*scc->ssbSubcarrierSpacing]); @@ -442,5 +445,6 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, nr_schedule_pucch(module_idP, frame, slot); stop_meas(&RC.nrmac[module_idP]->eNB_scheduler); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_DLSCH_ULSCH_SCHEDULER,VCD_FUNCTION_OUT); } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 845be51f58..30bd2d4195 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -1638,7 +1638,7 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *secon add_nr_list(&UE_info->list, UE_id); memset(&UE_info->mac_stats[UE_id], 0, sizeof(NR_mac_stats_t)); set_Y(UE_info->Y[UE_id], rntiP); - compute_csi_bitlen(secondaryCellGroup, UE_info, UE_id); + compute_csi_bitlen (secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup, UE_info, UE_id, mod_idP); NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; memset(sched_ctrl, 0, sizeof(*sched_ctrl)); sched_ctrl->ta_frame = 0; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index 28c74d818d..cd3506d522 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -514,7 +514,7 @@ void nr_csi_meas_reporting(int Mod_idP, curr_pucch->ul_slot = sched_slot; curr_pucch->resource_indicator = res_index; curr_pucch->csi_bits += - nr_get_csi_bitlen(&UE_info->csi_report_template[UE_id][csi_report_id]); + nr_get_csi_bitlen(Mod_idP,UE_id,csi_report_id); // going through the list of PUCCH resources to find the one indexed by resource_id uint16_t *vrb_map_UL = &RC.nrmac[Mod_idP]->common_channels[0].vrb_map_UL[sched_slot * MAX_BWP_SIZE]; @@ -947,99 +947,6 @@ void extract_pucch_csi_report (NR_CSI_MeasConfig_t *csi_MeasConfig, } -void nr_rx_acknack(nfapi_nr_uci_pusch_pdu_t *uci_pusch, - const nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_01, - const nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_234, - slot_t slot, NR_UE_sched_ctrl_t *sched_ctrl, NR_mac_stats_t *stats) { - - // TODO - int max_harq_rounds = 4; // TODO define macro - - if (uci_01 != NULL) { - // handle harq - int harq_idx_s = 0; - - // iterate over received harq bits - for (int harq_bit = 0; harq_bit < uci_01->harq->num_harq; harq_bit++) { - // search for the right harq process - for (int harq_idx = harq_idx_s; harq_idx < NR_MAX_NB_HARQ_PROCESSES; harq_idx++) { - // if the gNB received ack with a good confidence - if ((slot-1) == sched_ctrl->harq_processes[harq_idx].feedback_slot) { - if ((uci_01->harq->harq_list[harq_bit].harq_value == 1) && - (uci_01->harq->harq_confidence_level == 0)) { - // toggle NDI and reset round - sched_ctrl->harq_processes[harq_idx].ndi ^= 1; - sched_ctrl->harq_processes[harq_idx].round = 0; - } - else - sched_ctrl->harq_processes[harq_idx].round++; - sched_ctrl->harq_processes[harq_idx].is_waiting = 0; - harq_idx_s = harq_idx + 1; - // if the max harq rounds was reached - if (sched_ctrl->harq_processes[harq_idx].round == max_harq_rounds) { - sched_ctrl->harq_processes[harq_idx].ndi ^= 1; - sched_ctrl->harq_processes[harq_idx].round = 0; - stats->dlsch_errors++; - } - break; - } - // if feedback slot processing is aborted - else if (((slot-1) > sched_ctrl->harq_processes[harq_idx].feedback_slot) && - (sched_ctrl->harq_processes[harq_idx].is_waiting)) { - sched_ctrl->harq_processes[harq_idx].round++; - if (sched_ctrl->harq_processes[harq_idx].round == max_harq_rounds) { - sched_ctrl->harq_processes[harq_idx].ndi ^= 1; - sched_ctrl->harq_processes[harq_idx].round = 0; - } - sched_ctrl->harq_processes[harq_idx].is_waiting = 0; - } - } - } - } - - if (uci_234 != NULL) { - int harq_idx_s = 0; - int acknack; - - // iterate over received harq bits - for (int harq_bit = 0; harq_bit < uci_234->harq.harq_bit_len; harq_bit++) { - acknack = ((uci_234->harq.harq_payload[harq_bit>>3])>>harq_bit)&0x01; - for (int harq_idx = harq_idx_s; harq_idx < NR_MAX_NB_HARQ_PROCESSES-1; harq_idx++) { - // if the gNB received ack with a good confidence or if the max harq rounds was reached - if ((slot-1) == sched_ctrl->harq_processes[harq_idx].feedback_slot) { - // TODO add some confidence level for when there is no CRC - if ((uci_234->harq.harq_crc != 1) && acknack) { - // toggle NDI and reset round - sched_ctrl->harq_processes[harq_idx].ndi ^= 1; - sched_ctrl->harq_processes[harq_idx].round = 0; - } - else - sched_ctrl->harq_processes[harq_idx].round++; - sched_ctrl->harq_processes[harq_idx].is_waiting = 0; - harq_idx_s = harq_idx + 1; - // if the max harq rounds was reached - if (sched_ctrl->harq_processes[harq_idx].round == max_harq_rounds) { - sched_ctrl->harq_processes[harq_idx].ndi ^= 1; - sched_ctrl->harq_processes[harq_idx].round = 0; - stats->dlsch_errors++; - } - break; - } - // if feedback slot processing is aborted - else if (((slot-1) > sched_ctrl->harq_processes[harq_idx].feedback_slot) && - (sched_ctrl->harq_processes[harq_idx].is_waiting)) { - sched_ctrl->harq_processes[harq_idx].round++; - if (sched_ctrl->harq_processes[harq_idx].round == max_harq_rounds) { - sched_ctrl->harq_processes[harq_idx].ndi ^= 1; - sched_ctrl->harq_processes[harq_idx].round = 0; - } - sched_ctrl->harq_processes[harq_idx].is_waiting = 0; - } - } - } - } -} - void handle_nr_uci_pucch_0_1(module_id_t mod_id, frame_t frame, sub_frame_t slot, @@ -1058,8 +965,37 @@ void handle_nr_uci_pucch_0_1(module_id_t mod_id, uci_01->ul_cqi, 30); + NR_ServingCellConfigCommon_t *scc = RC.nrmac[mod_id]->common_channels->ServingCellConfigCommon; + const int num_slots = nr_slots_per_frame[*scc->ssbSubcarrierSpacing]; if (((uci_01->pduBitmap >> 1) & 0x01)) { - nr_rx_acknack(NULL,uci_01,NULL,slot,sched_ctrl,&UE_info->mac_stats[0]); + // iterate over received harq bits + for (int harq_bit = 0; harq_bit < uci_01->harq->num_harq; harq_bit++) { + const uint8_t harq_value = uci_01->harq->harq_list[harq_bit].harq_value; + const uint8_t harq_confidence = uci_01->harq->harq_confidence_level; + const int feedback_slot = (slot - 1 + num_slots) % num_slots; + /* In case of realtime problems: we can only identify a HARQ process by + * timing. If the HARQ process's feedback_slot is not the one we + * expected, we assume that processing has been aborted and we need to + * skip this HARQ process, which is what happens in the loop below. If + * you don't experience real-time problems, you might simply revert the + * commit that introduced these changes. */ + int8_t pid = sched_ctrl->feedback_dl_harq.head; + DevAssert(pid >= 0); + while (sched_ctrl->harq_processes[pid].feedback_slot != feedback_slot) { + LOG_W(MAC, + "expected feedback slot %d, but found %d instead\n", + sched_ctrl->harq_processes[pid].feedback_slot, + feedback_slot); + remove_front_nr_list(&sched_ctrl->feedback_dl_harq); + handle_dl_harq(mod_id, UE_id, pid, 0); + pid = sched_ctrl->feedback_dl_harq.head; + DevAssert(pid >= 0); + } + remove_front_nr_list(&sched_ctrl->feedback_dl_harq); + NR_UE_harq_t *harq = &sched_ctrl->harq_processes[pid]; + DevAssert(harq->is_waiting); + handle_dl_harq(mod_id, UE_id, pid, harq_value == 1 && harq_confidence == 0); + } } } @@ -1082,95 +1018,251 @@ void handle_nr_uci_pucch_2_3_4(module_id_t mod_id, uci_234->ul_cqi, 30); + NR_ServingCellConfigCommon_t *scc = RC.nrmac[mod_id]->common_channels->ServingCellConfigCommon; + const int num_slots = nr_slots_per_frame[*scc->ssbSubcarrierSpacing]; if ((uci_234->pduBitmap >> 1) & 0x01) { - nr_rx_acknack(NULL,NULL,uci_234,slot,sched_ctrl,&UE_info->mac_stats[0]); - //API to parse the csi report and store it into sched_ctrl + // iterate over received harq bits + for (int harq_bit = 0; harq_bit < uci_234->harq.harq_bit_len; harq_bit++) { + const int acknack = ((uci_234->harq.harq_payload[harq_bit >> 3]) >> harq_bit) & 0x01; + const int feedback_slot = (slot - 1 + num_slots) % num_slots; + /* In case of realtime problems: we can only identify a HARQ process by + * timing. If the HARQ process's feedback_slot is not the one we + * expected, we assume that processing has been aborted and we need to + * skip this HARQ process, which is what happens in the loop below. If + * you don't experience real-time problems, you might simply revert the + * commit that introduced these changes. */ + int8_t pid = sched_ctrl->feedback_dl_harq.head; + DevAssert(pid >= 0); + while (sched_ctrl->harq_processes[pid].feedback_slot != feedback_slot) { + LOG_W(MAC, + "expected feedback slot %d, but found %d instead\n", + sched_ctrl->harq_processes[pid].feedback_slot, + feedback_slot); + remove_front_nr_list(&sched_ctrl->feedback_dl_harq); + handle_dl_harq(mod_id, UE_id, pid, 0); + pid = sched_ctrl->feedback_dl_harq.head; + DevAssert(pid >= 0); + } + remove_front_nr_list(&sched_ctrl->feedback_dl_harq); + NR_UE_harq_t *harq = &sched_ctrl->harq_processes[pid]; + DevAssert(harq->is_waiting); + handle_dl_harq(mod_id, UE_id, pid, uci_234->harq.harq_crc != 1 && acknack); + } + //API to parse the csi report and store it into sched_ctrl extract_pucch_csi_report (csi_MeasConfig, uci_234, frame, slot, UE_id, mod_id); //TCI handling function tci_handling(mod_id, UE_id,frame, slot); } if (uci_234 -> pduBitmap & 0x08) { - ///Handle CSI Report 2 + //@TODO:Handle CSI Report 2 } } // function to update pucch scheduling parameters in UE list when a USS DL is scheduled -void nr_acknack_scheduling(int Mod_idP, +bool nr_acknack_scheduling(int mod_id, int UE_id, - frame_t frameP, - sub_frame_t slotP, - int slots_per_tdd, - int *pucch_id, - int *pucch_occ) { + frame_t frame, + sub_frame_t slot) +{ + const NR_ServingCellConfigCommon_t *scc = RC.nrmac[mod_id]->common_channels->ServingCellConfigCommon; + const int n_slots_frame = nr_slots_per_frame[*scc->ssbSubcarrierSpacing]; + const NR_TDD_UL_DL_Pattern_t *tdd = &scc->tdd_UL_DL_ConfigurationCommon->pattern1; + const int nr_ulmix_slots = tdd->nrofUplinkSlots + (tdd->nrofUplinkSymbols != 0); + const int nr_mix_slots = tdd->nrofDownlinkSymbols != 0 || tdd->nrofUplinkSymbols != 0; + const int nr_slots_period = tdd->nrofDownlinkSlots + tdd->nrofUplinkSlots + nr_mix_slots; + const int first_ul_slot_tdd = tdd->nrofDownlinkSlots + nr_slots_period * (slot / nr_slots_period); + const int CC_id = 0; - NR_ServingCellConfigCommon_t *scc = RC.nrmac[Mod_idP]->common_channels->ServingCellConfigCommon; - NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; - NR_sched_pucch *curr_pucch; - int max_acknacks,pucch_res,first_ul_slot_tdd,k,i,l; - uint8_t pdsch_to_harq_feedback[8]; - int found = 0; - int nr_ulmix_slots = scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots; - if (scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols!=0) - nr_ulmix_slots++; + AssertFatal(slot < first_ul_slot_tdd + (tdd->nrofUplinkSymbols != 0), + "cannot handle multiple TDD periods (yet): slot %d first_ul_slot_tdd %d nrofUplinkSlots %ld\n", + slot, + first_ul_slot_tdd, + tdd->nrofUplinkSlots); - bool csi_pres=false; - for (k=0; kUE_sched_ctrl[UE_id].sched_pucch[k][0].csi_bits>0) - csi_pres=true; + /* for the moment, we consider: + * * only pucch_sched[0] holds HARQ (and SR) + * * we do not multiplex with CSI, which is always in pucch_sched[2] + * * SR uses format 0 and is allocated in the first UL (mixed) slot (and not + * later) + * * that the PUCCH resource set 0 (for up to 2 bits) points to the first N + * PUCCH resources, where N is the number of resources in the PUCCH + * resource set. This is used in pucch_index_used, which counts the used + * resources by index, and not by their ID! */ + NR_UE_sched_ctrl_t *sched_ctrl = &RC.nrmac[mod_id]->UE_info.UE_sched_ctrl[UE_id]; + NR_sched_pucch_t *pucch = &sched_ctrl->sched_pucch[0]; + AssertFatal(pucch->csi_bits == 0, + "%s(): csi_bits %d in sched_pucch[0]\n", + __func__, + pucch->csi_bits); + + const int max_acknacks = 2; + AssertFatal(pucch->dai_c + pucch->sr_flag <= max_acknacks, + "illegal number of bits in PUCCH of UE %d\n", + UE_id); + /* if the currently allocated PUCCH of this UE is full, allocate it */ + if (pucch->sr_flag + pucch->dai_c == max_acknacks) { + /* advance the UL slot information in PUCCH by one so we won't schedule in + * the same slot again */ + const int f = pucch->frame; + const int s = pucch->ul_slot; + nr_fill_nfapi_pucch(mod_id, frame, slot, pucch, UE_id); + memset(pucch, 0, sizeof(*pucch)); + pucch->frame = s == n_slots_frame - 1 ? (f + 1) % 1024 : f; + pucch->ul_slot = (s + 1) % n_slots_frame; + // we assume that only two indices over the array sched_pucch exist + const NR_sched_pucch_t *csi_pucch = &sched_ctrl->sched_pucch[2]; + // skip the CSI PUCCH if it is present and if in the next frame/slot + if (csi_pucch->csi_bits > 0 + && csi_pucch->frame == pucch->frame + && csi_pucch->ul_slot == pucch->ul_slot) { + AssertFatal(!csi_pucch->simultaneous_harqcsi, + "%s(): %d.%d cannot handle simultaneous_harqcsi, but found for UE %d\n", + __func__, + pucch->frame, + pucch->ul_slot, + UE_id); + nr_fill_nfapi_pucch(mod_id, frame, slot, csi_pucch, UE_id); + pucch->frame = s >= n_slots_frame - 2 ? (f + 1) % 1024 : f; + pucch->ul_slot = (s + 2) % n_slots_frame; + } } - // As a preference always schedule ack nacks in PUCCH0 (max 2 per slots) - // Unless there is CSI meas reporting scheduled in the period to avoid conflicts in the same slot - if (csi_pres) - max_acknacks=10; - else - max_acknacks=2; + /* if the UE's next PUCCH occasion is after the possible UL slots (within the + * same frame) or wrapped around to the next frame, then we assume there is + * no possible PUCCH allocation anymore */ + if ((pucch->frame == frame + && (pucch->ul_slot >= first_ul_slot_tdd + nr_ulmix_slots)) + || (pucch->frame == frame + 1)) + return false; // this is hardcoded for now as ue specific NR_SearchSpace__searchSpaceType_PR ss_type = NR_SearchSpace__searchSpaceType_PR_ue_Specific; - get_pdsch_to_harq_feedback(Mod_idP,UE_id,ss_type,pdsch_to_harq_feedback); + uint8_t pdsch_to_harq_feedback[8]; + get_pdsch_to_harq_feedback(mod_id, UE_id, ss_type, pdsch_to_harq_feedback); - // for each possible ul or mixed slot - for (k=0; kUE_sched_ctrl[UE_id].sched_pucch[k][l]; - //if it is possible to schedule acknack in current pucch (no exclusive csi pucch) - if ((curr_pucch->csi_bits == 0) || (curr_pucch->simultaneous_harqcsi==true)) { - // if there is free room in current pucch structure - if (curr_pucch->dai_c-1){ - curr_pucch->resource_indicator = pucch_res; - curr_pucch->frame = frameP; - // first pucch occasion in first UL or MIXED slot - first_ul_slot_tdd = scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots; - i = 0; - while (i<8 && found == 0) { // look if timing indicator is among allowed values - if (pdsch_to_harq_feedback[i]==(first_ul_slot_tdd+k)-(slotP % slots_per_tdd)) - found = 1; - if (found == 0) i++; - } - if (found == 1) { - // computing slot in which pucch is scheduled - curr_pucch->dai_c++; - curr_pucch->ul_slot = first_ul_slot_tdd + k + (slotP - (slotP % slots_per_tdd)); - curr_pucch->timing_indicator = i; // index in the list of timing indicators - *pucch_id = k; - *pucch_occ = l; - return; - } - } - } - } + /* there is a scheduled SR or HARQ. Check whether we can use it for this + * ACKNACK */ + if (pucch->sr_flag + pucch->dai_c > 0) { + /* this UE already has a PUCCH occasion */ + DevAssert(pucch->frame == frame); + + // Find the right timing_indicator value. + int i = 0; + while (i < 8) { + if (pdsch_to_harq_feedback[i] == pucch->ul_slot - slot) + break; + ++i; + } + if (i >= 8) { + // we cannot reach this timing anymore, allocate and try again + const int f = pucch->frame; + const int s = pucch->ul_slot; + const int n_slots_frame = nr_slots_per_frame[*scc->ssbSubcarrierSpacing]; + nr_fill_nfapi_pucch(mod_id, frame, slot, pucch, UE_id); + memset(pucch, 0, sizeof(*pucch)); + pucch->frame = s == n_slots_frame - 1 ? (f + 1) % 1024 : f; + pucch->ul_slot = (s + 1) % n_slots_frame; + return nr_acknack_scheduling(mod_id, UE_id, frame, slot); + } + + pucch->timing_indicator = i; + pucch->dai_c++; + // retain old resource indicator, and we are good + return true; + } + + /* we need to find a new PUCCH occasion */ + + NR_PUCCH_Config_t *pucch_Config = sched_ctrl->active_ubwp->bwp_Dedicated->pucch_Config->choice.setup; + DevAssert(pucch_Config->resourceToAddModList->list.count > 0); + DevAssert(pucch_Config->resourceSetToAddModList->list.count > 0); + const int n_res = pucch_Config->resourceSetToAddModList->list.array[0]->resourceList.list.count; + int *pucch_index_used = RC.nrmac[mod_id]->pucch_index_used[sched_ctrl->active_ubwp->bwp_Id]; + + /* if time information is outdated (e.g., last PUCCH occasion in last frame), + * set to first possible UL occasion in this frame. Note that if such UE is + * scheduled a lot and used all AckNacks, pucch->frame might have been + * wrapped around to next frame */ + if (frame != pucch->frame || pucch->ul_slot < first_ul_slot_tdd) { + DevAssert(pucch->sr_flag + pucch->dai_c == 0); + AssertFatal(frame + 1 != pucch->frame, + "frame wrap around not handled in %s() yet\n", + __func__); + pucch->frame = frame; + pucch->ul_slot = first_ul_slot_tdd; + } + + // increase to first slot in which PUCCH resources are available + while (pucch_index_used[pucch->ul_slot] >= n_res) { + pucch->ul_slot++; + /* if there is no free resource anymore, abort search */ + if ((pucch->frame == frame + && pucch->ul_slot >= first_ul_slot_tdd + nr_ulmix_slots) + || (pucch->frame == frame + 1)) { + LOG_E(MAC, + "%4d.%2d no free PUCCH resources anymore while searching for UE %d\n", + frame, + slot, + UE_id); + return false; } } - AssertFatal(1==0,"No Uplink slot available in accordance to allowed timing indicator\n"); + + // advance ul_slot if it is not reachable by UE + pucch->ul_slot = max(pucch->ul_slot, slot + pdsch_to_harq_feedback[0]); + + // Find the right timing_indicator value. + int i = 0; + while (i < 8) { + if (pdsch_to_harq_feedback[i] == pucch->ul_slot - slot) + break; + ++i; + } + if (i >= 8) { + LOG_W(MAC, + "%4d.%2d could not find pdsch_to_harq_feedback for UE %d: earliest " + "ack slot %d\n", + frame, + slot, + UE_id, + pucch->ul_slot); + return false; + } + pucch->timing_indicator = i; // index in the list of timing indicators + + pucch->dai_c++; + const int pucch_res = pucch_index_used[pucch->ul_slot]; + pucch->resource_indicator = pucch_res; + pucch_index_used[pucch->ul_slot] += 1; + AssertFatal(pucch_index_used[pucch->ul_slot] <= n_res, + "UE %d in %4d.%2d: pucch_index_used is %d (%d available)\n", + UE_id, + pucch->frame, + pucch->ul_slot, + pucch_index_used[pucch->ul_slot], + n_res); + + /* verify that at that slot and symbol, resources are free. We only do this + * for initialCyclicShift 0 (we assume it always has that one), so other + * initialCyclicShifts can overlap with ICS 0!*/ + const NR_PUCCH_Resource_t *resource = + pucch_Config->resourceToAddModList->list.array[pucch_res]; + DevAssert(resource->format.present == NR_PUCCH_Resource__format_PR_format0); + if (resource->format.choice.format0->initialCyclicShift == 0) { + uint16_t *vrb_map_UL = &RC.nrmac[mod_id]->common_channels[CC_id].vrb_map_UL[pucch->ul_slot * MAX_BWP_SIZE]; + const uint16_t symb = 1 << resource->format.choice.format0->startingSymbolIndex; + AssertFatal((vrb_map_UL[resource->startingPRB] & symb) == 0, + "symbol %x is not free for PUCCH alloc in vrb_map_UL at RB %ld and slot %d\n", + symb, resource->startingPRB, pucch->ul_slot); + vrb_map_UL[resource->startingPRB] |= symb; + } + return true; } -void csi_period_offset(NR_CSI_ReportConfig_t *csirep, +void csi_period_offset(const NR_CSI_ReportConfig_t *csirep, int *period, int *offset) { NR_CSI_ReportPeriodicityAndOffset_PR p_and_o = csirep->reportConfigType.choice.periodic->reportSlotConfig.present; @@ -1221,24 +1313,6 @@ void csi_period_offset(NR_CSI_ReportConfig_t *csirep, } } - -int get_pucch_resource(NR_UE_info_t *UE_info,int UE_id,int k,int l) { - - // to be updated later, for now simple implementation - // use the second allocation just in case there is csi in the first - // in that case use second resource (for a different symbol) see 9.2 in 38.213 - if (l==1) { - if (UE_info->UE_sched_ctrl[UE_id].sched_pucch[k][0].csi_bits==0) - return -1; - else - return 1; - } - else - return 0; - -} - - uint16_t compute_pucch_prb_size(uint8_t format, uint8_t nr_prbs, uint16_t O_tot, @@ -1314,8 +1388,3 @@ uint16_t compute_pucch_prb_size(uint8_t format, AssertFatal(1==0,"Not yet implemented"); } } - - - - - diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index f63ba8911a..c0d3f92942 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -1053,7 +1053,8 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco secondaryCellGroup->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup = pdsch_servingcellconfig; pdsch_servingcellconfig->codeBlockGroupTransmission = NULL; pdsch_servingcellconfig->xOverhead = NULL; - pdsch_servingcellconfig->nrofHARQ_ProcessesForPDSCH = NULL; + pdsch_servingcellconfig->nrofHARQ_ProcessesForPDSCH = calloc(1, sizeof(*pdsch_servingcellconfig->nrofHARQ_ProcessesForPDSCH)); + *pdsch_servingcellconfig->nrofHARQ_ProcessesForPDSCH = NR_PDSCH_ServingCellConfig__nrofHARQ_ProcessesForPDSCH_n16; pdsch_servingcellconfig->pucch_Cell= NULL; pdsch_servingcellconfig->ext1=calloc(1,sizeof(*pdsch_servingcellconfig->ext1)); pdsch_servingcellconfig->ext1->maxMIMO_Layers = calloc(1,sizeof(*pdsch_servingcellconfig->ext1->maxMIMO_Layers)); @@ -1287,4 +1288,3 @@ void rrc_config_dl_ptrs_params(NR_BWP_Downlink_t *bwp, int *ptrsNrb, int *ptrsMc *bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->resourceElementOffset = *reOffset; } #endif - From 95b659ab449373d2be8a46ccccee70c1411b7dfe Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Wed, 24 Feb 2021 16:21:36 +0100 Subject: [PATCH 148/231] T tracer: add gnb tracer Minimalist gnb tracer to trace (for the moment) rxdataF when some decoding for PUCCH or PUSCH has been done. Important: T_BUFFER_MAX and T_CACHE_SIZE have been changed. T_BUFFER_MAX is twice as big as before. T_CACHE_SIZE has been devided by two. Globally, the memory usage of the T tracer is the same, but since we divided by two the number of buffers in the cache, we may hit some realtime problems if all the buffers are busy at some point. The simple solution would be to use 8192*2 for T_CACHE_SIZE as it was, but then we double the memory usage of the T tracer. This, or another solution, to be defined. --- common/utils/T/.gitignore | 1 + common/utils/T/T_messages.txt | 8 +- common/utils/T/tracer/Makefile | 10 +- common/utils/T/tracer/gnb.c | 172 ++++++++++++++++++++++ common/utils/T/tracer/logger/iqlog.c | 78 ++++++++++ common/utils/T/tracer/logger/logger.h | 2 + openair1/SCHED_NR/phy_procedures_nr_gNB.c | 11 +- 7 files changed, 275 insertions(+), 7 deletions(-) create mode 100644 common/utils/T/tracer/gnb.c diff --git a/common/utils/T/.gitignore b/common/utils/T/.gitignore index d754ff7c38..6a6e5817c5 100644 --- a/common/utils/T/.gitignore +++ b/common/utils/T/.gitignore @@ -4,6 +4,7 @@ T_IDs.h T_messages.txt.h genids tracer/enb +tracer/gnb tracer/extract_config tracer/record tracer/replay diff --git a/common/utils/T/T_messages.txt b/common/utils/T/T_messages.txt index bad6444e13..fedc50cf5d 100644 --- a/common/utils/T/T_messages.txt +++ b/common/utils/T/T_messages.txt @@ -1,7 +1,3 @@ -ID = BENETEL - GROUP = ALL - FORMAT = int,frame : int,slot : buffer,rxdataF - #general logs ID = ENB_MASTER_TICK DESC = eNodeB master tick - one tick per ms, to be used as "reference clock", mostly for ticktime view @@ -93,6 +89,10 @@ ID = GNB_PHY_MIB DESC = NR MIB data GROUP = ALL:PHY:GNB:WIRESHARK FORMAT = int,gNB_ID : int,frame : int,slot : buffer,data +ID = GNB_PHY_PUCCH_PUSCH_IQ + DESC = gNodeB input data in the frequency domain for a slot where some PUCCH or PUSCH detection was done + GROUP = ALL:PHY:GRAPHIC:HEAVY:GNB + FORMAT = int,frame : int,slot : buffer,rxdataF #MAC logs ID = ENB_MAC_UE_DL_SDU diff --git a/common/utils/T/tracer/Makefile b/common/utils/T/tracer/Makefile index 792c2a407c..0713d9a3df 100644 --- a/common/utils/T/tracer/Makefile +++ b/common/utils/T/tracer/Makefile @@ -7,7 +7,8 @@ LIBS=-lm XLIBS=-lX11 -lpng -lXft all: record replay extract_config textlog enb ue vcd macpdu2wireshark \ - extract_input_subframe extract_output_subframe to_vcd extract multi + extract_input_subframe extract_output_subframe to_vcd extract multi \ + gnb record: utils.o record.o database.o config.o $(CC) $(CFLAGS) -o record $^ $(LIBS) @@ -60,6 +61,11 @@ macpdu2wireshark: macpdu2wireshark.o database.o utils.o handler.o event.o \ multi: multi.o utils.o database.o config.o $(CC) $(CFLAGS) -o multi $^ $(LIBS) +gnb: utils.o gnb.o database.o event.o handler.o config.o \ + view/view.a gui/gui.a logger/logger.a \ + filter/filter.a + $(CC) $(CFLAGS) -o gnb $^ $(LIBS) $(XLIBS) + multi.o: ../T_IDs.h ../T_IDs.h: @@ -85,7 +91,7 @@ filter/filter.a: clean: rm -f *.o core tracer_remote textlog enb ue vcd record replay rm -f extract_config macpdu2wireshark extract_input_subframe - rm -f extract_output_subframe to_vcd extract multi + rm -f extract_output_subframe to_vcd extract multi gnb cd gui && $(MAKE) clean cd view && $(MAKE) clean cd logger && $(MAKE) clean diff --git a/common/utils/T/tracer/gnb.c b/common/utils/T/tracer/gnb.c new file mode 100644 index 0000000000..4aaa4898a1 --- /dev/null +++ b/common/utils/T/tracer/gnb.c @@ -0,0 +1,172 @@ +#include +#include +#include +#include +#include +#include "database.h" +#include "handler.h" +#include "config.h" +#include "logger/logger.h" +#include "view/view.h" +#include "gui/gui.h" + +typedef struct { + widget *pucch_pusch_iq_plot; + logger *pucch_pusch_iq_logger; +} gnb_gui; + +typedef struct { + int socket; + int *is_on; + int nevents; + pthread_mutex_t lock; + gnb_gui *e; + void *database; +} gnb_data; + +void is_on_changed(void *_d) +{ + gnb_data *d = _d; + char t; + + if (pthread_mutex_lock(&d->lock)) abort(); + + if (d->socket == -1) goto no_connection; + + t = 1; + if (socket_send(d->socket, &t, 1) == -1 || + socket_send(d->socket, &d->nevents, sizeof(int)) == -1 || + socket_send(d->socket, d->is_on, d->nevents * sizeof(int)) == -1) + goto connection_dies; + +no_connection: + if (pthread_mutex_unlock(&d->lock)) abort(); + return; + +connection_dies: + close(d->socket); + d->socket = -1; + if (pthread_mutex_unlock(&d->lock)) abort(); +} + +void usage(void) +{ + printf( +"options:\n" +" -d this option is mandatory\n" +" -ip connect to given IP address (default %s)\n" +" -p connect to given port (default %d)\n", + DEFAULT_REMOTE_IP, + DEFAULT_REMOTE_PORT + ); + exit(1); +} + +static void *gui_thread(void *_g) +{ + gui *g = _g; + gui_loop(g); + return NULL; +} + +static void gnb_main_gui(gnb_gui *e, gui *g, event_handler *h, void *database, + gnb_data *ed) +{ + widget *main_window; + widget *top_container; + widget *line; + widget *w; + logger *l; + view *v; + + main_window = new_toplevel_window(g, 500, 300, "gNB tracer"); + + top_container = new_container(g, VERTICAL); + widget_add_child(g, main_window, top_container, -1); + + line = new_container(g, HORIZONTAL); + widget_add_child(g, top_container, line, -1); + + /* PUCCH/PUSCH IQ data */ + w = new_xy_plot(g, 55, 55, "", 50); + e->pucch_pusch_iq_plot = w; + widget_add_child(g, line, w, -1); + xy_plot_set_range(g, w, -1000, 1000, -1000, 1000); + xy_plot_set_title(g, w, "rxdataF"); + l = new_iqlog_full(h, database, "GNB_PHY_PUCCH_PUSCH_IQ", "rxdataF"); + v = new_view_xy(300*12*14,10,g,w,new_color(g,"#000"),XY_FORCED_MODE); + logger_add_view(l, v); + e->pucch_pusch_iq_logger = l; +} + +int main(int n, char **v) +{ + char *database_filename = NULL; + void *database; + char *ip = DEFAULT_REMOTE_IP; + int port = DEFAULT_REMOTE_PORT; + int *is_on; + int number_of_events; + int i; + event_handler *h; + gnb_data gnb_data; + gui *g; + gnb_gui eg; + + for (i = 1; i < n; i++) { + if (!strcmp(v[i], "-h") || !strcmp(v[i], "--help")) usage(); + if (!strcmp(v[i], "-d")) + { if (i > n-2) usage(); database_filename = v[++i]; continue; } + usage(); + } + + if (database_filename == NULL) { + printf("ERROR: provide a database file (-d)\n"); + exit(1); + } + + database = parse_database(database_filename); + + load_config_file(database_filename); + + number_of_events = number_of_ids(database); + is_on = calloc(number_of_events, sizeof(int)); + if (is_on == NULL) abort(); + + h = new_handler(database); + + on_off(database, "GNB_PHY_PUCCH_PUSCH_IQ", is_on, 1); + + gnb_data.database = database; + gnb_data.socket = -1; + gnb_data.is_on = is_on; + gnb_data.nevents = number_of_events; + if (pthread_mutex_init(&gnb_data.lock, NULL)) abort(); + + g = gui_init(); + new_thread(gui_thread, g); + + gnb_main_gui(&eg, g, h, database, &gnb_data); + + OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL }; + +restart: + clear_remote_config(); + if (gnb_data.socket != -1) close(gnb_data.socket); + gnb_data.socket = connect_to(ip, port); + + /* send the first message - activate selected traces */ + is_on_changed(&gnb_data); + + /* read messages */ + while (1) { + event e; + e = get_event(gnb_data.socket, &ebuf, database); + if (e.type == -1) goto restart; + if (pthread_mutex_lock(&gnb_data.lock)) abort(); + handle_event(h, e); + if (pthread_mutex_unlock(&gnb_data.lock)) abort(); + } + + return 0; +} diff --git a/common/utils/T/tracer/logger/iqlog.c b/common/utils/T/tracer/logger/iqlog.c index 168c50e39b..1947de2bca 100644 --- a/common/utils/T/tracer/logger/iqlog.c +++ b/common/utils/T/tracer/logger/iqlog.c @@ -74,6 +74,44 @@ static void _event(void *p, event e) l->common.v[i]->append(l->common.v[i], l->i, l->q, count); } +static void _event_full(void *p, event e) +{ + struct iqlog *l = p; + int i; + void *buffer; + int bsize; + int nsamples; + float *idst, *qdst; + + if (l->common.filter != NULL && filter_eval(l->common.filter, e) == 0) + return; + + buffer = e.e[l->buffer_arg].b; + bsize = e.e[l->buffer_arg].bsize; + + nsamples = bsize / 4; + + if (nsamples > l->max_length) { + l->i = realloc(l->i, nsamples * sizeof(float)); + if (l->i == NULL) abort(); + l->q = realloc(l->q, nsamples * sizeof(float)); + if (l->q == NULL) abort(); + l->max_length = nsamples; + } + + idst = l->i; + qdst = l->q; + for (i = 0; i < nsamples; i++) { + *idst = ((int16_t *)buffer)[i * 2]; + *qdst = ((int16_t *)buffer)[i * 2 + 1]; + idst++; + qdst++; + } + + for (i = 0; i < l->common.vsize; i++) + l->common.v[i]->append(l->common.v[i], l->i, l->q, nsamples); +} + logger *new_iqlog(event_handler *h, void *database, char *event_name, char *nb_rb, char *N_RB_UL, char *symbols_per_tti, char *buffer_varname) @@ -149,3 +187,43 @@ logger *new_iqlog(event_handler *h, void *database, return ret; } + +logger *new_iqlog_full(event_handler *h, void *database, char *event_name, + char *buffer_varname) +{ + struct iqlog *ret; + int event_id; + database_event_format f; + int i; + + ret = calloc(1, sizeof(struct iqlog)); if (ret == NULL) abort(); + + ret->common.event_name = strdup(event_name); + if (ret->common.event_name == NULL) abort(); + ret->database = database; + + event_id = event_id_from_name(database, event_name); + + ret->common.handler_id = register_handler_function(h, event_id, _event_full, + ret); + + f = get_format(database, event_id); + + /* look for args */ + ret->buffer_arg = -1; + for (i = 0; i < f.count; i++) { + if (!strcmp(f.name[i], buffer_varname)) ret->buffer_arg = i; + } + if (ret->buffer_arg == -1) { + printf("%s:%d: buffer argument '%s' not found in event '%s'\n", + __FILE__, __LINE__, buffer_varname, event_name); + abort(); + } + if (strcmp(f.type[ret->buffer_arg], "buffer") != 0) { + printf("%s:%d: argument '%s' has wrong type (should be 'buffer')\n", + __FILE__, __LINE__, buffer_varname); + abort(); + } + + return ret; +} diff --git a/common/utils/T/tracer/logger/logger.h b/common/utils/T/tracer/logger/logger.h index 7c019b4797..d746161e70 100644 --- a/common/utils/T/tracer/logger/logger.h +++ b/common/utils/T/tracer/logger/logger.h @@ -23,6 +23,8 @@ logger *new_ticklog(void *event_handler, void *database, logger *new_iqlog(void *event_handler, void *database, char *event_name, char *nb_rb, char *N_RB_UL, char *symbols_per_tti, char *buffer_varname); +logger *new_iqlog_full(void *event_handler, void *database, char *event_name, + char *buffer_varname); logger *new_iqdotlog(void *event_handler, void *database, char *event_name, char *I, char *Q); diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index 9d7422745e..b26c95fc4d 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -542,6 +542,9 @@ void phy_procedures_gNB_common_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) } void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) { + /* those variables to log T_GNB_PHY_PUCCH_PUSCH_IQ only when we try to decode */ + int pucch_decode_done = 0; + int pusch_decode_done = 0; VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_UESPEC_RX,1); LOG_D(PHY,"phy_procedures_gNB_uespec_RX frame %d, slot %d\n",frame_rx,slot_rx); @@ -563,6 +566,8 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) (pucch->frame == frame_rx) && (pucch->slot == slot_rx) ) { + pucch_decode_done = 1; + nfapi_nr_pucch_pdu_t *pucch_pdu = &pucch->pucch_pdu; uint16_t num_ucis; switch (pucch_pdu->format_type) { @@ -651,7 +656,7 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) } #endif -T(T_BENETEL, T_INT(frame_rx), T_INT(slot_rx), T_BUFFER(&gNB->common_vars.rxdataF[0][0], 2048*4*14)); + pusch_decode_done = 1; uint8_t symbol_start = ulsch_harq->ulsch_pdu.start_symbol_index; uint8_t symbol_end = symbol_start + ulsch_harq->ulsch_pdu.nr_of_symbols; @@ -680,5 +685,9 @@ T(T_BENETEL, T_INT(frame_rx), T_INT(slot_rx), T_BUFFER(&gNB->common_vars.rxdataF // figure out a better way to choose slot_rx, 19 is ok for a particular TDD configuration with 30kHz SCS if ((frame_rx&127) == 0 && slot_rx==19) dump_pusch_stats(gNB); + if (pucch_decode_done || pusch_decode_done) { + T(T_GNB_PHY_PUCCH_PUSCH_IQ, T_INT(frame_rx), T_INT(slot_rx), T_BUFFER(&gNB->common_vars.rxdataF[0][0], gNB->frame_parms.symbols_per_slot * gNB->frame_parms.ofdm_symbol_size * 4)); + } + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_UESPEC_RX,0); } From 429a5d41879fd0d8290360fa566e26752a2aab18 Mon Sep 17 00:00:00 2001 From: Rohan Patil Date: Wed, 3 Mar 2021 17:10:02 +0530 Subject: [PATCH 149/231] Support added for 2 RX Antenna case in ulsim and fixed indexing issue in gNB RX chain --- .../PHY/NR_TRANSPORT/nr_ulsch_demodulation.c | 1 + openair1/SIMULATION/NR_PHY/ulsim.c | 84 +++++++++---------- 2 files changed, 43 insertions(+), 42 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c index 42d6cfad7a..dd8627f0e0 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c @@ -345,6 +345,7 @@ void nr_ulsch_extract_rbs_single(int32_t **rxdataF, n = 0; k_prime = 0; + rxF_ext_index = ul_ch0_ext_index = ul_ch0_index = 0; /* In RX Antenna(aarx) loop, Reset the index */ if (is_dmrs_symbol == 0) { // diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index 443ee6e1c0..fc35ee4cf7 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -1,4 +1,4 @@ -/* +g* * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. @@ -607,8 +607,8 @@ int main(int argc, char **argv) frame_parms = &gNB->frame_parms; //to be initialized I suppose (maybe not necessary for PBCH) - frame_parms->nb_antennas_tx = n_tx; - frame_parms->nb_antennas_rx = n_rx; + //frame_parms->nb_antennas_tx = n_tx; + //frame_parms->nb_antennas_rx = n_rx; frame_parms->N_RB_DL = N_RB_DL; frame_parms->N_RB_UL = N_RB_UL; frame_parms->Ncp = extended_prefix_flag ? EXTENDED : NORMAL; @@ -646,7 +646,7 @@ int main(int argc, char **argv) gNB->if_inst->NR_PHY_config_req = nr_phy_config_request; // common configuration - rrc_mac_config_req_gNB(0,0,1,pusch_tgt_snrx10,pucch_tgt_snrx10,scc,0,0,NULL); + rrc_mac_config_req_gNB(0,0,n_rx,pusch_tgt_snrx10,pucch_tgt_snrx10,scc,0,0,NULL); // UE dedicated configuration rrc_mac_config_req_gNB(0,0,1,pusch_tgt_snrx10,pucch_tgt_snrx10,NULL,1,secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity,secondaryCellGroup); phy_init_nr_gNB(gNB,0,0); @@ -1053,70 +1053,70 @@ int main(int argc, char **argv) } - nr_fill_ulsch(gNB,frame,slot,pusch_pdu); + //nr_fill_ulsch(gNB,frame,slot,pusch_pdu); // Not needed as its its already filled as apart of "nr_schedule_response(Sched_INFO);" for (int i=0;i<(TBS/8);i++) ulsch_ue[0]->harq_processes[harq_pid]->a[i]=i&0xff; if (input_fd == NULL) { - // set FAPI parameters for UE, put them in the scheduled response and call - nr_ue_scheduled_response(&scheduled_response); + // set FAPI parameters for UE, put them in the scheduled response and call + nr_ue_scheduled_response(&scheduled_response); - /////////////////////////phy_procedures_nr_ue_TX/////////////////////// - /////////// + /////////////////////////phy_procedures_nr_ue_TX/////////////////////// + /////////// - phy_procedures_nrUE_TX(UE, &UE_proc, gNB_id); + phy_procedures_nrUE_TX(UE, &UE_proc, gNB_id); - if (n_trials==1) { - LOG_M("txsig0.m","txs0", UE->common_vars.txdata[0],frame_parms->samples_per_subframe*10,1,1); - LOG_M("txsig0F.m","txs0F", UE->common_vars.txdataF[0],frame_parms->ofdm_symbol_size*14,1,1); - } - /////////// - //////////////////////////////////////////////////// - tx_offset = frame_parms->get_samples_slot_timestamp(slot,frame_parms,0); + if (n_trials==1) { + LOG_M("txsig0.m","txs0", UE->common_vars.txdata[0],frame_parms->samples_per_subframe*10,1,1); + LOG_M("txsig0F.m","txs0F", UE->common_vars.txdataF[0],frame_parms->ofdm_symbol_size*14,1,1); + } + /////////// + //////////////////////////////////////////////////// + tx_offset = frame_parms->get_samples_slot_timestamp(slot,frame_parms,0); - txlev = signal_energy(&UE->common_vars.txdata[0][tx_offset + 5*frame_parms->ofdm_symbol_size + 4*frame_parms->nb_prefix_samples + frame_parms->nb_prefix_samples0], - frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples); + txlev = signal_energy(&UE->common_vars.txdata[0][tx_offset + 5*frame_parms->ofdm_symbol_size + 4*frame_parms->nb_prefix_samples + frame_parms->nb_prefix_samples0], + frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples); } else n_trials = 1; if (input_fd == NULL ) { - sigma_dB = 10 * log10((double)txlev * ((double)frame_parms->ofdm_symbol_size/(12*nb_rb))) - SNR;; - sigma = pow(10,sigma_dB/10); + sigma_dB = 10 * log10((double)txlev * ((double)frame_parms->ofdm_symbol_size/(12*nb_rb))) - SNR;; + sigma = pow(10,sigma_dB/10); - if(n_trials==1) printf("sigma %f (%f dB), txlev %f (factor %f)\n",sigma,sigma_dB,10*log10((double)txlev),(double)(double)frame_parms->ofdm_symbol_size/(12*nb_rb)); + if(n_trials==1) printf("sigma %f (%f dB), txlev %f (factor %f)\n",sigma,sigma_dB,10*log10((double)txlev),(double)(double)frame_parms->ofdm_symbol_size/(12*nb_rb)); - for (i=0; icommon_vars.txdata[aa][slot_offset]))[(i<<1)]); - s_im[aa][i] = ((double)(((short *)&UE->common_vars.txdata[aa][slot_offset]))[(i<<1)+1]); - } + for (i=0; inb_antennas_rx; aa++) { + s_re[aa][i] = ((double)(((short *)&UE->common_vars.txdata[aa][slot_offset]))[(i<<1)]); + s_im[aa][i] = ((double)(((short *)&UE->common_vars.txdata[aa][slot_offset]))[(i<<1)+1]); + } } - - if (UE2gNB->max_Doppler == 0) { - multipath_channel(UE2gNB,s_re,s_im,r_re,r_im, - slot_length,0,(n_trials==1)?1:0); - } else { - multipath_tv_channel(UE2gNB,s_re,s_im,r_re,r_im, - 2*slot_length,0); - } - for (i=0; inb_antennas_rx; ap++) { - ((int16_t*) &gNB->common_vars.rxdata[ap][slot_offset])[(2*i) + (delay*2)] = (int16_t)((r_re[ap][i]) + (sqrt(sigma/2)*gaussdouble(0.0,1.0))); // convert to fixed point - ((int16_t*) &gNB->common_vars.rxdata[ap][slot_offset])[(2*i)+1 + (delay*2)] = (int16_t)((r_im[ap][i]) + (sqrt(sigma/2)*gaussdouble(0.0,1.0))); + + if (UE2gNB->max_Doppler == 0) { + multipath_channel(UE2gNB,s_re,s_im,r_re,r_im, + slot_length,0,(n_trials==1)?1:0); + } else { + multipath_tv_channel(UE2gNB,s_re,s_im,r_re,r_im, + 2*slot_length,0); + } + for (i=0; inb_antennas_rx; ap++) { + ((int16_t*) &gNB->common_vars.rxdata[ap][slot_offset])[(2*i) + (delay*2)] = (int16_t)((r_re[ap][i]) + (sqrt(sigma/2)*gaussdouble(0.0,1.0))); // convert to fixed point + ((int16_t*) &gNB->common_vars.rxdata[ap][slot_offset])[(2*i)+1 + (delay*2)] = (int16_t)((r_im[ap][i]) + (sqrt(sigma/2)*gaussdouble(0.0,1.0))); /* Add phase noise if enabled */ if (pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) { phase_noise(ts, &((int16_t*)&gNB->common_vars.rxdata[ap][slot_offset])[(2*i)], &((int16_t*)&gNB->common_vars.rxdata[ap][slot_offset])[(2*i)+1]); } - } - } + } + } - } + } /*End input_fd */ if(pusch_pdu->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) { From 9edc8cce0ab9e61babec8b9263831a4df57bc82e Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Wed, 3 Mar 2021 13:41:10 +0100 Subject: [PATCH 150/231] nr pdcp: improvements Implement data transfer (38.331 5.2): - transmit operation (in nr_pdcp_entity_recv_sdu) - receive operation (in nr_pdcp_entity_recv_pdu) - t-Reordering expiration To keep track of time the function nr_pdcp_wakeup_timer_thread has been added and is called by the gNB's MAC scheduler via nr_pdcp_tick. (The UE has not been modified.) A thread has been introduced to set time of all the existing PDCP entities in the system. This probably does not scale well with many PDCP entities (many UEs connected to the gNB). To be changed at some point when needed. Hopefully, with a few UEs this mechanism won't be too problematic (ie. won't cause realtime problems). The problem with time in PDCP is that SDUs are kept if some are missing, to do reordering. A timer is started and when it expires we have to transmit the SDUs even if some are still missing. We want to do that as soon as possible. So we have to check timers often (every millisecond). In RLC the time is set when there is some activity (SDU or PDU received). In PDCP we cannot wait for this kind of activity. We would keep packets longer than necessary, which may disturb upper layers (think: TCP). That is why we introduced the thread, as a simple mechanism to keep packets no longer than necessary. The locking done by this thread may create realtime issues. The whole logic of time keeping can be changed later if it turns out that it is not efficient. The functions dealing with DRB AM have been removed. All the types of PDCP entities (DRB AM, DRB UM, SRB) use the same mechanism for transmit and receive operations. So the code has been made common for all those types. We don't deal with: - entity re-establishment, entity release or entity suspend - SDU discard (the timer is present but not used) - status reporting - data recovery - data volume calculation - header compression / decompression There is no plan to implement those features in a near future. Integrity protection is not done yet, and will be implemented soon. --- cmake_targets/CMakeLists.txt | 3 +- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 2 + openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c | 262 ++++++++++++++++-- openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h | 57 +++- .../LAYER2/nr_pdcp/nr_pdcp_entity_drb_am.c | 90 ------ openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c | 29 +- openair2/LAYER2/nr_pdcp/nr_pdcp_sdu.c | 78 ++++++ ...{nr_pdcp_entity_drb_am.h => nr_pdcp_sdu.h} | 30 +- .../LAYER2/nr_pdcp/nr_pdcp_timer_thread.c | 87 ++++++ .../LAYER2/nr_pdcp/nr_pdcp_timer_thread.h | 32 +++ openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.c | 14 + openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.h | 3 + 12 files changed, 530 insertions(+), 157 deletions(-) delete mode 100644 openair2/LAYER2/nr_pdcp/nr_pdcp_entity_drb_am.c create mode 100644 openair2/LAYER2/nr_pdcp/nr_pdcp_sdu.c rename openair2/LAYER2/nr_pdcp/{nr_pdcp_entity_drb_am.h => nr_pdcp_sdu.h} (58%) create mode 100644 openair2/LAYER2/nr_pdcp/nr_pdcp_timer_thread.c create mode 100644 openair2/LAYER2/nr_pdcp/nr_pdcp_timer_thread.h diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index e11c850b8e..58530a5ae4 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -1967,7 +1967,8 @@ set(NR_PDCP_SRC ${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_oai_api.c ${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_ue_manager.c ${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_entity.c - ${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_entity_drb_am.c + ${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_sdu.c + ${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_timer_thread.c ${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_security_nea2.c ${OPENAIR2_DIR}/LAYER2/nr_pdcp/asn1_utils.c ) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index ede68b11ef..3c300c5f9d 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -364,7 +364,9 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, /* send tick to RLC and RRC every ms */ if ((slot & ((1 << *scc->ssbSubcarrierSpacing) - 1)) == 0) { void nr_rlc_tick(int frame, int subframe); + void nr_pdcp_tick(int frame, int subframe); nr_rlc_tick(frame, slot >> *scc->ssbSubcarrierSpacing); + nr_pdcp_tick(frame, slot >> *scc->ssbSubcarrierSpacing); nr_rrc_trigger(&ctxt, 0 /*CC_id*/, frame, slot >> *scc->ssbSubcarrierSpacing); } diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c index ffc669a461..eda6888ecd 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c @@ -21,24 +21,222 @@ #include "nr_pdcp_entity.h" -#include "nr_pdcp_entity_drb_am.h" +#include +#include +#include + #include "nr_pdcp_security_nea2.h" +#include "nr_pdcp_sdu.h" #include "LOG/log.h" -nr_pdcp_entity_t *new_nr_pdcp_entity_srb( - int is_gnb, int rb_id, - void (*deliver_sdu)(void *deliver_sdu_data, struct nr_pdcp_entity_t *entity, - char *buf, int size), - void *deliver_sdu_data, - void (*deliver_pdu)(void *deliver_pdu_data, struct nr_pdcp_entity_t *entity, - char *buf, int size, int sdu_id), - void *deliver_pdu_data) +static void nr_pdcp_entity_recv_pdu(nr_pdcp_entity_t *entity, + char *_buffer, int size) { - abort(); + unsigned char *buffer = (unsigned char *)_buffer; + nr_pdcp_sdu_t *sdu; + int rcvd_sn; + uint32_t rcvd_hfn; + uint32_t rcvd_count; + int header_size; + int integrity_size; + int rx_deliv_sn; + uint32_t rx_deliv_hfn; + + if (size < 1) { + LOG_E(PDCP, "bad PDU received (size = %d)\n", size); + return; + } + + if (!(buffer[0] & 0x80)) { + LOG_E(PDCP, "%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__); + exit(1); + } + + if (entity->sn_size == 12) { + rcvd_sn = (((unsigned char)buffer[0] & 0xf) << 8) | + (unsigned char)buffer[1]; + header_size = 2; + } else { + rcvd_sn = (((unsigned char)buffer[0] & 0x3) << 16) | + ((unsigned char)buffer[1] << 8) | + (unsigned char)buffer[2]; + header_size = 3; + } + + integrity_size = 0; + + if (size < header_size + integrity_size + 1) { + LOG_E(PDCP, "bad PDU received (size = %d)\n", size); + return; + } + + rx_deliv_sn = entity->rx_deliv & entity->sn_max; + rx_deliv_hfn = (entity->rx_deliv >> entity->sn_size) & ~entity->sn_max; + + if (rcvd_sn < rx_deliv_sn - entity->window_size) { + rcvd_hfn = rx_deliv_hfn + 1; + } else if (rcvd_sn >= rx_deliv_sn + entity->window_size) { + rcvd_hfn = rx_deliv_hfn - 1; + } else { + rcvd_hfn = rx_deliv_hfn; + } + + rcvd_count = (rcvd_hfn << entity->sn_size) | rcvd_sn; + + if (entity->has_ciphering) + entity->cipher(entity->security_context, + (unsigned char *)buffer+header_size, size-header_size, + entity->rb_id, rcvd_count, entity->is_gnb ? 0 : 1); + + if (rcvd_count < entity->rx_deliv + || nr_pdcp_sdu_in_list(entity->rx_list, rcvd_count)) { + LOG_D(PDCP, "discard NR PDU rcvd_count=%d\n", rcvd_count); + return; + } + + sdu = nr_pdcp_new_sdu(rcvd_count, + (char *)buffer + header_size, + size - header_size - integrity_size); + entity->rx_list = nr_pdcp_sdu_list_add(entity->rx_list, sdu); + entity->rx_size += size-header_size; + + if (rcvd_count >= entity->rx_next) { + entity->rx_next = rcvd_count + 1; + } + + /* TODO(?): out of order delivery */ + + if (rcvd_count == entity->rx_deliv) { + /* deliver all SDUs starting from rx_deliv up to discontinuity or end of list */ + uint32_t count = entity->rx_deliv; + while (entity->rx_list != NULL && count == entity->rx_list->count) { + nr_pdcp_sdu_t *cur = entity->rx_list; + entity->deliver_sdu(entity->deliver_sdu_data, entity, + cur->buffer, cur->size); + entity->rx_list = cur->next; + entity->rx_size -= cur->size; + nr_pdcp_free_sdu(cur); + count++; + } + entity->rx_deliv = count; + } + + if (entity->t_reordering_start != 0 && entity->rx_deliv > entity->rx_reord) { + /* stop and reset t-Reordering */ + entity->t_reordering_start = 0; + } + + if (entity->t_reordering_start == 0 && entity->rx_deliv < entity->rx_next) { + entity->rx_reord = entity->rx_next; + entity->t_reordering_start = entity->t_current; + } } -nr_pdcp_entity_t *new_nr_pdcp_entity_drb_am( +static void nr_pdcp_entity_recv_sdu(nr_pdcp_entity_t *entity, + char *buffer, int size, int sdu_id) +{ + uint32_t count; + int sn; + int header_size; + char buf[size+3+4]; + + count = entity->tx_next; + sn = entity->tx_next & entity->sn_max; + + if (entity->sn_size == 12) { + buf[0] = 0x80 | ((sn >> 8) & 0xf); + buf[1] = sn & 0xff; + header_size = 2; + } else { + buf[0] = 0x80 | ((sn >> 16) & 0x3); + buf[1] = (sn >> 8) & 0xff; + buf[2] = sn & 0xff; + header_size = 3; + } + + memcpy(buf+header_size, buffer, size); + + if (entity->has_ciphering) + entity->cipher(entity->security_context, + (unsigned char *)buf+header_size, size, + entity->rb_id, count, entity->is_gnb ? 1 : 0); + + entity->tx_next++; + + entity->deliver_pdu(entity->deliver_pdu_data, entity, buf, + size+header_size, sdu_id); +} + +static void nr_pdcp_entity_set_integrity_key(nr_pdcp_entity_t *entity, + char *key) +{ + memcpy(entity->integrity_key, key, 16); +} + +static void check_t_reordering(nr_pdcp_entity_t *entity) +{ + uint32_t count; + + if (entity->t_reordering_start == 0 + || entity->t_current <= entity->t_reordering_start + entity->t_reordering) + return; + + /* stop timer */ + entity->t_reordering_start = 0; + + /* deliver all SDUs with count < rx_reord */ + while (entity->rx_list != NULL && entity->rx_list->count < entity->rx_reord) { + nr_pdcp_sdu_t *cur = entity->rx_list; + entity->deliver_sdu(entity->deliver_sdu_data, entity, + cur->buffer, cur->size); + entity->rx_list = cur->next; + entity->rx_size -= cur->size; + nr_pdcp_free_sdu(cur); + } + + /* deliver all SDUs starting from rx_reord up to discontinuity or end of list */ + count = entity->rx_reord; + while (entity->rx_list != NULL && count == entity->rx_list->count) { + nr_pdcp_sdu_t *cur = entity->rx_list; + entity->deliver_sdu(entity->deliver_sdu_data, entity, + cur->buffer, cur->size); + entity->rx_list = cur->next; + entity->rx_size -= cur->size; + nr_pdcp_free_sdu(cur); + count++; + } + + entity->rx_deliv = count; + + if (entity->rx_deliv < entity->rx_next) { + entity->rx_reord = entity->rx_next; + entity->t_reordering_start = entity->t_current; + } +} + +void nr_pdcp_entity_set_time(struct nr_pdcp_entity_t *entity, uint64_t now) +{ + entity->t_current = now; + + check_t_reordering(entity); +} + +void nr_pdcp_entity_delete(nr_pdcp_entity_t *entity) +{ + nr_pdcp_sdu_t *cur = entity->rx_list; + while (cur != NULL) { + nr_pdcp_sdu_t *next = cur->next; + nr_pdcp_free_sdu(cur); + cur = next; + } + if (entity->free_security != NULL) + entity->free_security(entity->security_context); + free(entity); +} + +nr_pdcp_entity_t *new_nr_pdcp_entity( + nr_pdcp_entity_type_t type, int is_gnb, int rb_id, void (*deliver_sdu)(void *deliver_sdu_data, struct nr_pdcp_entity_t *entity, char *buf, int size), @@ -54,52 +252,56 @@ nr_pdcp_entity_t *new_nr_pdcp_entity_drb_am( unsigned char *ciphering_key, unsigned char *integrity_key) { - nr_pdcp_entity_drb_am_t *ret; + nr_pdcp_entity_t *ret; - ret = calloc(1, sizeof(nr_pdcp_entity_drb_am_t)); + ret = calloc(1, sizeof(nr_pdcp_entity_t)); if (ret == NULL) { LOG_E(PDCP, "%s:%d:%s: out of memory\n", __FILE__, __LINE__, __FUNCTION__); exit(1); } - ret->common.recv_pdu = nr_pdcp_entity_drb_am_recv_pdu; - ret->common.recv_sdu = nr_pdcp_entity_drb_am_recv_sdu; - ret->common.set_integrity_key = nr_pdcp_entity_drb_am_set_integrity_key; + ret->type = type; - ret->common.delete = nr_pdcp_entity_drb_am_delete; + ret->recv_pdu = nr_pdcp_entity_recv_pdu; + ret->recv_sdu = nr_pdcp_entity_recv_sdu; + ret->set_integrity_key = nr_pdcp_entity_set_integrity_key; + ret->set_time = nr_pdcp_entity_set_time; - ret->common.deliver_sdu = deliver_sdu; - ret->common.deliver_sdu_data = deliver_sdu_data; + ret->delete = nr_pdcp_entity_delete; - ret->common.deliver_pdu = deliver_pdu; - ret->common.deliver_pdu_data = deliver_pdu_data; + ret->deliver_sdu = deliver_sdu; + ret->deliver_sdu_data = deliver_sdu_data; + + ret->deliver_pdu = deliver_pdu; + ret->deliver_pdu_data = deliver_pdu_data; ret->rb_id = rb_id; ret->sn_size = sn_size; ret->t_reordering = t_reordering; ret->discard_timer = discard_timer; - ret->common.maximum_nr_pdcp_sn = (1 << sn_size) - 1; + ret->sn_max = (1 << sn_size) - 1; + ret->window_size = 1 << (sn_size - 1); if (ciphering_key != NULL && ciphering_algorithm != 0) { if (ciphering_algorithm != 2) { LOG_E(PDCP, "FATAL: only nea2 supported for the moment\n"); exit(1); } - ret->common.has_ciphering = 1; - ret->common.ciphering_algorithm = ciphering_algorithm; - memcpy(ret->common.ciphering_key, ciphering_key, 16); + ret->has_ciphering = 1; + ret->ciphering_algorithm = ciphering_algorithm; + memcpy(ret->ciphering_key, ciphering_key, 16); - ret->common.security_context = nr_pdcp_security_nea2_init(ciphering_key); - ret->common.cipher = nr_pdcp_security_nea2_cipher; - ret->common.free_security = nr_pdcp_security_nea2_free_security; + ret->security_context = nr_pdcp_security_nea2_init(ciphering_key); + ret->cipher = nr_pdcp_security_nea2_cipher; + ret->free_security = nr_pdcp_security_nea2_free_security; } - ret->common.is_gnb = is_gnb; + ret->is_gnb = is_gnb; if (integrity_key != NULL) { printf("%s:%d:%s: TODO\n", __FILE__, __LINE__, __FUNCTION__); exit(1); } - return (nr_pdcp_entity_t *)ret; + return ret; } diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h index 58d79835ec..36e7a540c4 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h @@ -19,18 +19,29 @@ * contact@openairinterface.org */ -#include - #ifndef _NR_PDCP_ENTITY_H_ #define _NR_PDCP_ENTITY_H_ +#include + +#include "nr_pdcp_sdu.h" + +typedef enum { + NR_PDCP_DRB_AM, + NR_PDCP_DRB_UM, + NR_PDCP_SRB +} nr_pdcp_entity_type_t; + typedef struct nr_pdcp_entity_t { + nr_pdcp_entity_type_t type; + /* functions provided by the PDCP module */ void (*recv_pdu)(struct nr_pdcp_entity_t *entity, char *buffer, int size); void (*recv_sdu)(struct nr_pdcp_entity_t *entity, char *buffer, int size, int sdu_id); void (*delete)(struct nr_pdcp_entity_t *entity); void (*set_integrity_key)(struct nr_pdcp_entity_t *entity, char *key); + void (*set_time)(struct nr_pdcp_entity_t *entity, uint64_t now); /* callbacks provided to the PDCP module */ void (*deliver_sdu)(void *deliver_sdu_data, struct nr_pdcp_entity_t *entity, @@ -39,9 +50,28 @@ typedef struct nr_pdcp_entity_t { void (*deliver_pdu)(void *deliver_pdu_data, struct nr_pdcp_entity_t *entity, char *buf, int size, int sdu_id); void *deliver_pdu_data; - int tx_hfn; - int next_nr_pdcp_tx_sn; - int maximum_nr_pdcp_sn; + + /* configuration variables */ + int rb_id; + + int sn_size; /* SN size, in bits */ + int t_reordering; /* unit: ms */ + int discard_timer; /* unit: ms */ + + int sn_max; /* (2^SN_size) - 1 */ + int window_size; /* 2^(SN_size - 1) */ + + /* state variables */ + uint32_t tx_next; + uint32_t rx_next; + uint32_t rx_deliv; + uint32_t rx_reord; + + /* set to the latest know time by the user of the module. Unit: ms */ + uint64_t t_current; + + /* timers (stores the ms of activation, 0 means not active) */ + int t_reordering_start; /* security */ int has_ciphering; @@ -60,18 +90,15 @@ typedef struct nr_pdcp_entity_t { * pdcp entity is for a gnb or an ue */ int is_gnb; + + /* rx management */ + nr_pdcp_sdu_t *rx_list; + int rx_size; + int rx_maxsize; } nr_pdcp_entity_t; -nr_pdcp_entity_t *new_nr_pdcp_entity_srb( - int is_gnb, int rb_id, - void (*deliver_sdu)(void *deliver_sdu_data, struct nr_pdcp_entity_t *entity, - char *buf, int size), - void *deliver_sdu_data, - void (*deliver_pdu)(void *deliver_pdu_data, struct nr_pdcp_entity_t *entity, - char *buf, int size, int sdu_id), - void *deliver_pdu_data); - -nr_pdcp_entity_t *new_nr_pdcp_entity_drb_am( +nr_pdcp_entity_t *new_nr_pdcp_entity( + nr_pdcp_entity_type_t type, int is_gnb, int rb_id, void (*deliver_sdu)(void *deliver_sdu_data, struct nr_pdcp_entity_t *entity, char *buf, int size), diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity_drb_am.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity_drb_am.c deleted file mode 100644 index 62881c184e..0000000000 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity_drb_am.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -#include "nr_pdcp_entity_drb_am.h" - -#include -#include -#include -#include "common/utils/LOG/log.h" - -void nr_pdcp_entity_drb_am_recv_pdu(nr_pdcp_entity_t *_entity, char *buffer, int size) -{ - nr_pdcp_entity_drb_am_t *entity = (nr_pdcp_entity_drb_am_t *)_entity; - int sn; - - if (size < 3) abort(); - - if (!(buffer[0] & 0x80)) - LOG_E(PDCP, "%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__); - - sn = (((unsigned char)buffer[0] & 0x3) << 16) | - ((unsigned char)buffer[1] << 8) | - (unsigned char)buffer[2]; - - if (entity->common.has_ciphering) - entity->common.cipher(entity->common.security_context, (unsigned char *)buffer+3, size-3, - entity->rb_id, sn, entity->common.is_gnb ? 0 : 1); - - entity->common.deliver_sdu(entity->common.deliver_sdu_data, - (nr_pdcp_entity_t *)entity, buffer+3, size-3); -} - -void nr_pdcp_entity_drb_am_recv_sdu(nr_pdcp_entity_t *_entity, char *buffer, int size, - int sdu_id) -{ - nr_pdcp_entity_drb_am_t *entity = (nr_pdcp_entity_drb_am_t *)_entity; - int sn; - char buf[size+3]; - - sn = entity->common.next_nr_pdcp_tx_sn; - - entity->common.next_nr_pdcp_tx_sn++; - if (entity->common.next_nr_pdcp_tx_sn > entity->common.maximum_nr_pdcp_sn) { - entity->common.next_nr_pdcp_tx_sn = 0; - entity->common.tx_hfn++; - } - - buf[0] = 0x80 | ((sn >> 16) & 0x3); - buf[1] = (sn >> 8) & 0xff; - buf[2] = sn & 0xff; - memcpy(buf+3, buffer, size); - - if (entity->common.has_ciphering) - entity->common.cipher(entity->common.security_context, (unsigned char *)buf+3, size, - entity->rb_id, sn, entity->common.is_gnb ? 1 : 0); - - entity->common.deliver_pdu(entity->common.deliver_pdu_data, - (nr_pdcp_entity_t *)entity, buf, size+3, sdu_id); -} - -void nr_pdcp_entity_drb_am_set_integrity_key(nr_pdcp_entity_t *_entity, char *key) -{ - /* nothing to do */ -} - -void nr_pdcp_entity_drb_am_delete(nr_pdcp_entity_t *_entity) -{ - nr_pdcp_entity_drb_am_t *entity = (nr_pdcp_entity_drb_am_t *)_entity; - if (entity->common.free_security != NULL) - entity->common.free_security(entity->common.security_context); - free(entity); -} diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index f14d25b145..597cba7bf5 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -24,6 +24,7 @@ #endif #include "asn1_utils.h" #include "nr_pdcp_ue_manager.h" +#include "nr_pdcp_timer_thread.h" #include "NR_RadioBearerConfig.h" #include "NR_RLC-BearerConfig.h" #include "NR_RLC-Config.h" @@ -41,6 +42,11 @@ static nr_pdcp_ue_manager_t *nr_pdcp_ue_manager; +/* TODO: handle time a bit more properly */ +static uint64_t nr_pdcp_current_time; +static int nr_pdcp_current_time_last_frame; +static int nr_pdcp_current_time_last_subframe; + /* necessary globals for OAI, not used internally */ hash_table_t *pdcp_coll_p; static uint64_t pdcp_optmask; @@ -339,6 +345,8 @@ void pdcp_layer_init(void) nr_pdcp_ue_manager = new_nr_pdcp_ue_manager(1); init_nr_rlc_data_req_queue(); + + nr_pdcp_init_timer_thread(nr_pdcp_ue_manager); } #include "nfapi/oai_integration/vendor_ext.h" @@ -625,11 +633,11 @@ static void add_drb_am(int is_gnb, int rnti, struct NR_DRB_ToAddMod *s, LOG_D(PDCP, "%s:%d:%s: warning DRB %d already exist for ue %d, do nothing\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rnti); } else { - pdcp_drb = new_nr_pdcp_entity_drb_am(is_gnb, drb_id, - deliver_sdu_drb, ue, deliver_pdu_drb, ue, - sn_size_dl, t_reordering, discard_timer, - ciphering_algorithm, integrity_algorithm, - ciphering_key, integrity_key); + pdcp_drb = new_nr_pdcp_entity(NR_PDCP_DRB_AM, is_gnb, drb_id, + deliver_sdu_drb, ue, deliver_pdu_drb, ue, + sn_size_dl, t_reordering, discard_timer, + ciphering_algorithm, integrity_algorithm, + ciphering_key, integrity_key); nr_pdcp_ue_add_drb_pdcp_entity(ue, drb_id, pdcp_drb); LOG_D(PDCP, "%s:%d:%s: added drb %d to ue rnti %x\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rnti); @@ -976,3 +984,14 @@ void pdcp_mbms_run ( const protocol_ctxt_t *const ctxt_pP){ /* nothing to do */ } + +void nr_pdcp_tick(int frame, int subframe) +{ + if (frame != nr_pdcp_current_time_last_frame || + subframe != nr_pdcp_current_time_last_subframe) { + nr_pdcp_current_time_last_frame = frame; + nr_pdcp_current_time_last_subframe = subframe; + nr_pdcp_current_time++; + nr_pdcp_wakeup_timer_thread(nr_pdcp_current_time); + } +} diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_sdu.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_sdu.c new file mode 100644 index 0000000000..47d95156e3 --- /dev/null +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_sdu.c @@ -0,0 +1,78 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +#include "nr_pdcp_sdu.h" + +#include +#include + +nr_pdcp_sdu_t *nr_pdcp_new_sdu(uint32_t count, char *buffer, int size) +{ + nr_pdcp_sdu_t *ret = calloc(1, sizeof(nr_pdcp_sdu_t)); + if (ret == NULL) + exit(1); + ret->count = count; + ret->buffer = malloc(size); + if (ret->buffer == NULL) + exit(1); + memcpy(ret->buffer, buffer, size); + ret->size = size; + return ret; +} + +nr_pdcp_sdu_t *nr_pdcp_sdu_list_add(nr_pdcp_sdu_t *l, nr_pdcp_sdu_t *sdu) +{ + nr_pdcp_sdu_t head; + nr_pdcp_sdu_t *cur; + nr_pdcp_sdu_t *prev; + + head.next = l; + cur = l; + prev = &head; + + /* order is by 'count' */ + while (cur != NULL) { + /* check if 'sdu' is before 'cur' in the list */ + if (sdu->count < cur->count) + break; + prev = cur; + cur = cur->next; + } + prev->next = sdu; + sdu->next = cur; + return head.next; +} + +int nr_pdcp_sdu_in_list(nr_pdcp_sdu_t *l, uint32_t count) +{ + while (l != NULL) { + if (l->count == count) + return 1; + l = l->next; + } + return 0; +} + +void nr_pdcp_free_sdu(nr_pdcp_sdu_t *sdu) +{ + free(sdu->buffer); + free(sdu); +} diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity_drb_am.h b/openair2/LAYER2/nr_pdcp/nr_pdcp_sdu.h similarity index 58% rename from openair2/LAYER2/nr_pdcp/nr_pdcp_entity_drb_am.h rename to openair2/LAYER2/nr_pdcp/nr_pdcp_sdu.h index d7c42e6a62..3d4e50a4ce 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity_drb_am.h +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_sdu.h @@ -19,23 +19,21 @@ * contact@openairinterface.org */ -#ifndef _NR_PDCP_ENTITY_DRB_AM_H_ -#define _NR_PDCP_ENTITY_DRB_AM_H_ +#ifndef _NR_PDCP_SDU_H_ +#define _NR_PDCP_SDU_H_ -#include "nr_pdcp_entity.h" +#include -typedef struct { - nr_pdcp_entity_t common; - int rb_id; - int sn_size; /* unit: bits */ - int t_reordering; /* unit: ms */ - int discard_timer; /* unit: ms, -1 means infinity */ -} nr_pdcp_entity_drb_am_t; +typedef struct nr_pdcp_sdu_t { + uint32_t count; + char *buffer; + int size; + struct nr_pdcp_sdu_t *next; +} nr_pdcp_sdu_t; -void nr_pdcp_entity_drb_am_recv_pdu(nr_pdcp_entity_t *entity, char *buffer, int size); -void nr_pdcp_entity_drb_am_recv_sdu(nr_pdcp_entity_t *entity, char *buffer, int size, - int sdu_id); -void nr_pdcp_entity_drb_am_set_integrity_key(nr_pdcp_entity_t *entity, char *key); -void nr_pdcp_entity_drb_am_delete(nr_pdcp_entity_t *entity); +nr_pdcp_sdu_t *nr_pdcp_new_sdu(uint32_t count, char *buffer, int size); +nr_pdcp_sdu_t *nr_pdcp_sdu_list_add(nr_pdcp_sdu_t *l, nr_pdcp_sdu_t *sdu); +int nr_pdcp_sdu_in_list(nr_pdcp_sdu_t *l, uint32_t count); +void nr_pdcp_free_sdu(nr_pdcp_sdu_t *sdu); -#endif /* _NR_PDCP_ENTITY_DRB_AM_H_ */ +#endif /* _NR_PDCP_SDU_H_ */ diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_timer_thread.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_timer_thread.c new file mode 100644 index 0000000000..36e9b16024 --- /dev/null +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_timer_thread.c @@ -0,0 +1,87 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +#include "nr_pdcp_timer_thread.h" + +#include +#include +#include + +#include "LOG/log.h" + +static pthread_mutex_t timer_thread_mutex = PTHREAD_MUTEX_INITIALIZER; +static pthread_cond_t timer_thread_cond = PTHREAD_COND_INITIALIZER; +static volatile uint64_t timer_thread_curtime = 0; + +static void *nr_pdcp_timer_thread(void *_nr_pdcp_ue_manager) +{ + nr_pdcp_ue_manager_t *nr_pdcp_ue_manager = (nr_pdcp_ue_manager_t *)_nr_pdcp_ue_manager; + nr_pdcp_ue_t **ue_list; + int ue_count; + int i; + int j; + uint64_t curtime = 0; + + while (1) { + if (pthread_mutex_lock(&timer_thread_mutex) != 0) abort(); + while (curtime == timer_thread_curtime) + if (pthread_cond_wait(&timer_thread_cond, &timer_thread_mutex) != 0) abort(); + curtime = timer_thread_curtime; + if (pthread_mutex_unlock(&timer_thread_mutex) != 0) abort(); + + nr_pdcp_manager_lock(nr_pdcp_ue_manager); + + ue_list = nr_pdcp_manager_get_ue_list(nr_pdcp_ue_manager); + ue_count = nr_pdcp_manager_get_ue_count(nr_pdcp_ue_manager); + for (i = 0; i < ue_count; i++) { + for (j = 0; j < 2; j++) { + if (ue_list[i]->srb[j] != NULL) + ue_list[i]->srb[j]->set_time(ue_list[i]->srb[j], curtime); + } + for (j = 0; j < 5; j++) { + if (ue_list[i]->drb[j] != NULL) + ue_list[i]->drb[j]->set_time(ue_list[i]->drb[j], curtime); + } + } + + nr_pdcp_manager_unlock(nr_pdcp_ue_manager); + } + + return NULL; +} + +void nr_pdcp_init_timer_thread(nr_pdcp_ue_manager_t *nr_pdcp_ue_manager) +{ + pthread_t t; + + if (pthread_create(&t, NULL, nr_pdcp_timer_thread, nr_pdcp_ue_manager) != 0) { + LOG_E(PDCP, "%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__); + exit(1); + } +} + +void nr_pdcp_wakeup_timer_thread(uint64_t time) +{ + if (pthread_mutex_lock(&timer_thread_mutex)) abort(); + timer_thread_curtime = time; + if (pthread_cond_broadcast(&timer_thread_cond)) abort(); + if (pthread_mutex_unlock(&timer_thread_mutex)) abort(); +} diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_timer_thread.h b/openair2/LAYER2/nr_pdcp/nr_pdcp_timer_thread.h new file mode 100644 index 0000000000..db8282f940 --- /dev/null +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_timer_thread.h @@ -0,0 +1,32 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +#ifndef _NR_PDCP_TIMER_THREAD_H_ +#define _NR_PDCP_TIMER_THREAD_H_ + +#include "nr_pdcp_ue_manager.h" + +#include + +void nr_pdcp_init_timer_thread(nr_pdcp_ue_manager_t *nr_pdcp_ue_manager); +void nr_pdcp_wakeup_timer_thread(uint64_t time); + +#endif /* _NR_PDCP_TIMER_THREAD_H_ */ diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.c index ca51da3d5f..f89a18f94e 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.c @@ -189,6 +189,20 @@ void nr_pdcp_ue_add_drb_pdcp_entity(nr_pdcp_ue_t *ue, int drb_id, nr_pdcp_entity ue->drb[drb_id] = entity; } +/* must be called with lock acquired */ +nr_pdcp_ue_t **nr_pdcp_manager_get_ue_list(nr_pdcp_ue_manager_t *_m) +{ + nr_pdcp_ue_manager_internal_t *m = _m; + return m->ue_list; +} + +/* must be called with lock acquired */ +int nr_pdcp_manager_get_ue_count(nr_pdcp_ue_manager_t *_m) +{ + nr_pdcp_ue_manager_internal_t *m = _m; + return m->ue_count; +} + int nr_pdcp_get_first_rnti(nr_pdcp_ue_manager_t *_m) { nr_pdcp_ue_manager_internal_t *m = _m; diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.h b/openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.h index 0de2f024b3..3329f856b7 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.h +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.h @@ -46,6 +46,9 @@ void nr_pdcp_manager_unlock(nr_pdcp_ue_manager_t *m); nr_pdcp_ue_t *nr_pdcp_manager_get_ue(nr_pdcp_ue_manager_t *m, int rnti); void nr_pdcp_manager_remove_ue(nr_pdcp_ue_manager_t *m, int rnti); +nr_pdcp_ue_t **nr_pdcp_manager_get_ue_list(nr_pdcp_ue_manager_t *_m); +int nr_pdcp_manager_get_ue_count(nr_pdcp_ue_manager_t *_m); + /***********************************************************************/ /* ue functions */ /***********************************************************************/ From 01645168f0ebaaa0374a0d62740e17e5b23e4de5 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Thu, 18 Feb 2021 13:17:38 +0100 Subject: [PATCH 151/231] NR_UE: handle initial TA the same way as TA updates, independent of the UE_mode In FDD mode, the UE_mode switches to PUSCH mode before the initial TA value was applied. Because of this, the ta_command was misinterpreted. Fix this by adding 31 to the initial TA comamnd and handle it the same as TA updates. --- openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 34 +++++--------------- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 2 +- 2 files changed, 9 insertions(+), 27 deletions(-) diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index f516ad8639..9843a7e174 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -238,33 +238,15 @@ void ue_ta_procedures(PHY_VARS_NR_UE *ue, int slot_tx, int frame_tx){ int factor_mu = 1 << numerology; uint16_t bw_scaling = get_bw_scaling(bwp_ul_NB_RB); - LOG_D(PHY, "In %s: applying timing advance -- frame %d -- slot %d -- UE_mode %d\n", __FUNCTION__, frame_tx, slot_tx, ue->UE_mode[gNB_id]); + ue->timing_advance += (ul_time_alignment->ta_command - 31) * bw_scaling / factor_mu; - if (ue->UE_mode[gNB_id] == RA_RESPONSE){ - - ue->timing_advance = ul_time_alignment->ta_command * bw_scaling / factor_mu; - - LOG_D(PHY, "In %s: [UE %d] [%d.%d] Received (RAR) timing advance command %d new value is %u \n", - __FUNCTION__, - ue->Mod_id, - frame_tx, - slot_tx, - ul_time_alignment->ta_command, - ue->timing_advance); - - } else if (ue->UE_mode[gNB_id] == PUSCH){ - - ue->timing_advance += (ul_time_alignment->ta_command - 31) * bw_scaling / factor_mu; - - LOG_D(PHY, "In %s: [UE %d] [%d.%d] Got timing advance command %u from MAC, new value is %d\n", - __FUNCTION__, - ue->Mod_id, - frame_tx, - slot_tx, - ul_time_alignment->ta_command, - ue->timing_advance); - - } + LOG_I(PHY, "In %s: [UE %d] [%d.%d] Got timing advance command %u from MAC, new value is %d\n", + __FUNCTION__, + ue->Mod_id, + frame_tx, + slot_tx, + ul_time_alignment->ta_command, + ue->timing_advance); ul_time_alignment->ta_frame = -1; ul_time_alignment->ta_slot = -1; diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 64067e9d60..0f347204a0 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -2230,7 +2230,7 @@ int nr_ue_process_rar(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t // TA command ul_time_alignment->apply_ta = 1; - ul_time_alignment->ta_command = rar->TA2 + (rar->TA1 << 5); + ul_time_alignment->ta_command = 31 + rar->TA2 + (rar->TA1 << 5); #ifdef DEBUG_RAR // CSI From f2bc1012be43ae2f630877ab2b1d28bc478758ac Mon Sep 17 00:00:00 2001 From: cig Date: Thu, 18 Feb 2021 08:56:54 +0100 Subject: [PATCH 152/231] Minor cleanup UE - removed commented out code - improved logging in UL channel estimation - minor fixes according to OAI coding guidelines - moving fetching TDD configuration parameters in nr-ue.c only in TDD case --- executables/nr-ue.c | 10 ++- .../NR_ESTIMATION/nr_ul_channel_estimation.c | 90 ++++++++++++++----- 2 files changed, 73 insertions(+), 27 deletions(-) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 0c97552c15..dd11071682 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -703,12 +703,14 @@ void *UE_thread(void *arg) { int flags = 0; int slot_tx_usrp = slot_nr + DURATION_RX_TO_TX - RX_NB_TH; - uint8_t tdd_period = mac->phy_config.config_req.tdd_table.tdd_period_in_slots; - uint8_t num_UL_slots = mac->scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots + - (mac->scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols!=0); - uint8_t first_tx_slot = tdd_period - num_UL_slots; if (openair0_cfg[0].duplex_mode == duplex_mode_TDD) { + + uint8_t tdd_period = mac->phy_config.config_req.tdd_table.tdd_period_in_slots; + int nrofUplinkSlots = mac->scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots; + uint8_t num_UL_slots = nrofUplinkSlots + (nrofUplinkSlots != 0); + uint8_t first_tx_slot = tdd_period - num_UL_slots; + if (slot_tx_usrp % tdd_period == first_tx_slot) flags = 2; else if (slot_tx_usrp % tdd_period == first_tx_slot + num_UL_slots - 1) diff --git a/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c b/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c index 713e71674b..6617fabbb4 100644 --- a/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c +++ b/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c @@ -61,8 +61,6 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, debug_ch_est = fopen("debug_ch_est.txt","w"); #endif - //uint16_t Nid_cell = (eNB_offset == 0) ? gNB->frame_parms.Nid_cell : gNB->measurements.adj_cell_id[eNB_offset-1]; - uint8_t nushift; int **ul_ch_estimates = gNB->pusch_vars[ul_id]->ul_ch_estimates; int **rxdataF = gNB->common_vars.rxdataF; @@ -79,12 +77,17 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, uint16_t nb_rb_pusch = pusch_pdu->rb_size; -/* #ifdef DEBUG_CH - printf("PUSCH Channel Estimation : ch_offset %d, symbol_offset %d OFDM size %d, Ncp=%d, l=%d, Ns=%d, k=%d symbol %d\n", ,ch_offset,symbol_offset,gNB->frame_parms.ofdm_symbol_size, - gNB->frame_parms.Ncp,l,Ns,k, symbol); + LOG_I(PHY, "In %s: ch_offset %d, symbol_offset %d OFDM size %d, Ns = %d, k = %d symbol %d\n", + __FUNCTION__, + ch_offset, + symbol_offset, + gNB->frame_parms.ofdm_symbol_size, + Ns, + k, + symbol); #endif -*/ + switch (nushift) { case 0: fl = filt8_l0; @@ -124,9 +127,9 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, //------------------generate DMRS------------------// - if (pusch_pdu->transform_precoding == transform_precoder_disabled) + if (pusch_pdu->transform_precoding == transform_precoder_disabled) { nr_pusch_dmrs_rx(gNB, Ns, gNB->nr_gold_pusch_dmrs[pusch_pdu->scid][Ns][symbol], &pilot[0], 1000, 0, nb_rb_pusch, pusch_pdu->rb_start*NR_NB_SC_PER_RB, pusch_pdu->dmrs_config_type); - + } else { // if transform precoding or SC-FDMA is enabled in Uplink // NR_SC_FDMA supports type1 DMRS so only 6 DMRS REs per RB possible @@ -151,11 +154,15 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, //------------------------------------------------// - #ifdef DEBUG_PUSCH - for (int i=0;i<(6*nb_rb_pusch);i++) - printf("%d+j*(%d)\n",((int16_t*)pilot)[2*i],((int16_t*)pilot)[1+(2*i)]); + for (int i = 0; i < (6 * nb_rb_pusch); i++) { + LOG_I(PHY, "In %s: %d + j*(%d)\n", + __FUNCTION__, + ((int16_t*)pilot)[2 * i], + ((int16_t*)pilot)[1 + (2 * i)]); + } #endif + for (aarx=0; aarxframe_parms.nb_antennas_rx; aarx++) { pil = (int16_t *)&pilot[0]; @@ -165,11 +172,11 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, memset(ul_ch,0,4*(gNB->frame_parms.ofdm_symbol_size)); #ifdef DEBUG_PUSCH - printf("symbol_offset %d, nushift %d\n",symbol_offset,nushift); - printf("ch est pilot addr %p RB_DL %d\n",&pilot[0], gNB->frame_parms.N_RB_UL); - printf("bwp_start_subcarrier %d, k %d, first_carrier %d, nb_rb_pusch %d\n",bwp_start_subcarrier,k,gNB->frame_parms.first_carrier_offset,nb_rb_pusch); - printf("rxF addr %p p %d\n", rxF,p); - printf("ul_ch addr %p nushift %d\n",ul_ch,nushift); + LOG_I(PHY, "In %s symbol_offset %d, nushift %d\n", __FUNCTION__, symbol_offset, nushift); + LOG_I(PHY, "In %s ch est pilot addr %p, N_RB_UL %d\n", __FUNCTION__, &pilot[0], gNB->frame_parms.N_RB_UL); + LOG_I(PHY, "In %s bwp_start_subcarrier %d, k %d, first_carrier %d, nb_rb_pusch %d\n", __FUNCTION__, bwp_start_subcarrier, k, gNB->frame_parms.first_carrier_offset, nb_rb_pusch); + LOG_I(PHY, "In %s rxF addr %p p %d\n", __FUNCTION__, rxF, p); + LOG_I(PHY, "In %s ul_ch addr %p nushift %d\n", __FUNCTION__, ul_ch, nushift); #endif //if ((gNB->frame_parms.N_RB_UL&1)==0) { @@ -180,9 +187,18 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); #ifdef DEBUG_PUSCH - printf("ch 0 %d\n",((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])); - printf("pilot 0 : rxF - > (%d,%d) (%d) ch -> (%d,%d) (%d), pil -> (%d,%d) \n",rxF[0],rxF[1],dBc(rxF[0],rxF[1]),ch[0],ch[1],dBc(ch[0],ch[1]),pil[0],pil[1]); - printf("data 0 : rxF - > (%d,%d) (%d)\n",rxF[2],rxF[3],dBc(rxF[2],rxF[3])); + LOG_I(PHY, "In %s ch 0 %d\n", __FUNCTION__, ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])); + LOG_I(PHY, "In %s pilot 0 : rxF - > (%d,%d) (%d) ch -> (%d,%d) (%d), pil -> (%d,%d) \n", + __FUNCTION__, + rxF[0], + rxF[1], + dBc(rxF[0],rxF[1]), + ch[0], + ch[1], + dBc(ch[0],ch[1]), + pil[0], + pil[1]); + LOG_I(PHY, "In %s data 0 : rxF - > (%d,%d) (%d)\n", __FUNCTION__, rxF[2], rxF[3], dBc(rxF[2],rxF[3])); #endif multadd_real_vector_complex_scalar(fl, @@ -199,9 +215,23 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); #ifdef DEBUG_PUSCH - printf("pilot 1 : rxF - > (%d,%d) (%d) ch -> (%d,%d) (%d), pil -> (%d,%d) \n",rxF[0],rxF[1],dBc(rxF[0],rxF[1]),ch[0],ch[1],dBc(ch[0],ch[1]),pil[0],pil[1]); - printf("data 1 : rxF - > (%d,%d) (%d)\n",rxF[2],rxF[3],dBc(rxF[2],rxF[3])); + LOG_I(PHY, "In %s pilot 1 : rxF - > (%d,%d) (%d) ch -> (%d,%d) (%d), pil -> (%d,%d) \n", + __FUNCTION__, + rxF[0], + rxF[1], + dBc(rxF[0],rxF[1]), + ch[0], + ch[1], + dBc(ch[0],ch[1]), + pil[0], + pil[1]); + LOG_I(PHY, "In %s data 1 : rxF - > (%d,%d) (%d)\n", + __FUNCTION__, + rxF[2], + rxF[3], + dBc(rxF[2],rxF[3])); #endif + multadd_real_vector_complex_scalar(fml, ch, ul_ch, @@ -215,9 +245,23 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); #ifdef DEBUG_PUSCH - printf("pilot 2 : rxF - > (%d,%d) (%d) ch -> (%d,%d) (%d), pil -> (%d,%d) \n",rxF[0],rxF[1],dBc(rxF[0],rxF[1]),ch[0],ch[1],dBc(ch[0],ch[1]),pil[0],pil[1]); - printf("data 2 : rxF - > (%d,%d) (%d)\n",rxF[2],rxF[3],dBc(rxF[2],rxF[3])); + LOG_I(PHY, "In %s pilot 2 : rxF - > (%d,%d) (%d) ch -> (%d,%d) (%d), pil -> (%d,%d) \n", + __FUNCTION__, + rxF[0], + rxF[1], + dBc(rxF[0],rxF[1]), + ch[0], + ch[1], + dBc(ch[0],ch[1]), + pil[0], + pil[1]); + LOG_I(PHY, "In %s data 2 : rxF - > (%d,%d) (%d)\n", + __FUNCTION__, + rxF[2], + rxF[3], + dBc(rxF[2],rxF[3])); #endif + multadd_real_vector_complex_scalar(fmm, ch, ul_ch, From 222933a59ba1eb4894377d73edf50cc525edbe11 Mon Sep 17 00:00:00 2001 From: cig Date: Tue, 23 Feb 2021 09:40:04 +0100 Subject: [PATCH 153/231] Updated arbitrary frequencies section in RUNMODEM.md file --- doc/RUNMODEM.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/doc/RUNMODEM.md b/doc/RUNMODEM.md index d13b193ff9..ffe963da8f 100644 --- a/doc/RUNMODEM.md +++ b/doc/RUNMODEM.md @@ -168,7 +168,7 @@ With the RF simulator (on the same machine): ## IF setup with OAI -The -C and -CO flags can be used together at UE side to set custom downlink and uplink FR1 intermediate frequencies for the IF equipment. +The -C and --CO flags can be used together at UE side to set custom downlink and uplink FR1 arbitrary frequencies for the IF equipment. In order to run this setup, the following flags are needed at the UE side: @@ -182,9 +182,11 @@ and the following parameters must be configured in the RUs section of the gNB co `if_offset` -### Run OAI with custom DL/UL intermediate frequencies +The values must be given in Hz. -The following example uses DL frequency 2169.080 MHz and UL frequency offset -400 MHz, with a configuration file for band 66 at gNB side. +### Run OAI with custom DL/UL arbitrary frequencies + +The following example uses DL frequency 2169.080 MHz and UL frequency offset -400 MHz, with a configuration file for band 66 (FDD) at gNB side. From the `cmake_targets/ran_build/build` folder: From 62612feebf710ee97542d4ddfb7d518d0d4c83bb Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Wed, 3 Mar 2021 18:00:08 +0100 Subject: [PATCH 154/231] change get_band() to take the duplex spacing into account --- openair1/PHY/INIT/nr_init.c | 12 +- openair1/PHY/INIT/nr_parms.c | 5 +- openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c | 115 ++++++++---------- openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h | 7 +- openair2/LAYER2/NR_MAC_UE/config_ue.c | 3 +- openair2/LAYER2/NR_MAC_gNB/config.c | 3 +- 6 files changed, 63 insertions(+), 82 deletions(-) diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index 52a6b49cbb..a8faf2bba7 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -455,7 +455,6 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config) { uint8_t short_sequence, num_sequences, rootSequenceIndex, fd_occasion; NR_DL_FRAME_PARMS *fp = &RC.gNB[Mod_id]->frame_parms; nfapi_nr_config_request_scf_t *gNB_config = &RC.gNB[Mod_id]->gNB_config; - int32_t dlul_offset = 0; memcpy((void*)gNB_config,phy_config->cfg,sizeof(*phy_config->cfg)); RC.gNB[Mod_id]->mac_enabled = 1; @@ -466,16 +465,9 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config) { uint64_t ul_bw_khz = (12*gNB_config->carrier_config.ul_grid_size[gNB_config->ssb_config.scs_common.value].value)*(15<ssb_config.scs_common.value); fp->ul_CarrierFreq = ((ul_bw_khz>>1) + gNB_config->carrier_config.uplink_frequency.value)*1000 ; - //fp->nr_band = *RC.nrmac[Mod_id]->common_channels[0].ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; - lte_frame_type_t frame_type = 0; // FDD - - get_band(fp->dl_CarrierFreq,&fp->nr_band,&dlul_offset,&frame_type); //RC.nrmac[Mod_id] cannot be accessed in NFAPI + int32_t dlul_offset = fp->ul_CarrierFreq - fp->dl_CarrierFreq; + fp->nr_band = get_band(fp->dl_CarrierFreq, dlul_offset); - get_delta_duplex(fp->nr_band, gNB_config->ssb_config.scs_common.value, &dlul_offset); - dlul_offset *= 1000; - - AssertFatal(fp->ul_CarrierFreq == (fp->dl_CarrierFreq + dlul_offset), "Disagreement in uplink frequency for band %d: ul_CarrierFreq = %lu Hz vs expected %lu Hz\n", fp->nr_band, fp->ul_CarrierFreq, fp->dl_CarrierFreq + dlul_offset); - LOG_I(PHY, "DL frequency %lu Hz, UL frequency %lu Hz: band %d, uldl offset %d Hz\n", fp->dl_CarrierFreq, fp->ul_CarrierFreq, fp->nr_band, dlul_offset); fp->threequarter_fs = openair0_cfg[0].threequarter_fs; diff --git a/openair1/PHY/INIT/nr_parms.c b/openair1/PHY/INIT/nr_parms.c index ba4147e5cd..c5904a7da5 100644 --- a/openair1/PHY/INIT/nr_parms.c +++ b/openair1/PHY/INIT/nr_parms.c @@ -352,9 +352,8 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp, fp->N_RB_UL = config->carrier_config.ul_grid_size[fp->numerology_index]; fp->N_RB_DL = config->carrier_config.dl_grid_size[fp->numerology_index]; - int32_t uplink_frequency_offset = 0; - get_delta_duplex(fp->nr_band, fp->numerology_index, &uplink_frequency_offset); - get_frame_type(fp->nr_band, fp->numerology_index, &fp->frame_type); + fp->frame_type = get_frame_type(fp->nr_band, fp->numerology_index); + int32_t uplink_frequency_offset = get_delta_duplex(fp->nr_band, fp->numerology_index); uplink_frequency_offset *= 1000; LOG_I(PHY, "Initializing frame parms: DL frequency %lu Hz, UL frequency %lu Hz: band %d, uldl offset %d Hz\n", fp->dl_CarrierFreq, fp->ul_CarrierFreq, fp->nr_band, uplink_frequency_offset); diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index 1ebf83e9a3..5c0c97f566 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -1692,9 +1692,45 @@ int32_t table_6_4_1_1_3_4_pusch_dmrs_positions_l [12][8] = { #define NR_BANDTABLE_SIZE (sizeof(nr_bandtable)/sizeof(nr_bandentry_t)) -// Returns the corresponding row index of the NR table -int get_nr_table_idx(int nr_bandP, uint8_t scs_index){ +uint16_t get_band(uint64_t downlink_frequency, int32_t delta_duplex) +{ + const uint64_t dl_freq_khz = downlink_frequency / 1000; + const int32_t delta_duplex_khz = delta_duplex / 1000; + uint64_t center_freq_diff_khz = 999999999999999999; // 2^64 + uint16_t current_band = 0; + + for (int ind = 0; ind < NR_BANDTABLE_SIZE; ind++) { + + LOG_D(PHY, "Scanning band %d, dl_min %"PRIu64", ul_min %"PRIu64"\n", nr_bandtable[ind].band, nr_bandtable[ind].dl_min, nr_bandtable[ind].ul_min); + + if (dl_freq_khz < nr_bandtable[ind].dl_min || dl_freq_khz > nr_bandtable[ind].dl_max) + continue; + + int32_t current_offset_khz = nr_bandtable[ind].ul_min - nr_bandtable[ind].dl_min; + + if (current_offset_khz != delta_duplex_khz) + continue; + + uint64_t center_frequency_khz = (nr_bandtable[ind].dl_max + nr_bandtable[ind].dl_min) / 2; + + if (abs(dl_freq_khz - center_frequency_khz) < center_freq_diff_khz){ + current_band = nr_bandtable[ind].band; + center_freq_diff_khz = abs(dl_freq_khz - center_frequency_khz); + } + } + + LOG_I(PHY, "DL frequency %"PRIu64": band %d, UL frequency %"PRIu64"\n", + downlink_frequency, current_band, downlink_frequency+delta_duplex); + + AssertFatal(current_band != 0, "Can't find EUTRA band for frequency %"PRIu64" and duplex_spacing %u\n", downlink_frequency, delta_duplex); + + return current_band; +} + +// Returns the corresponding row index of the NR table +int get_nr_table_idx(int nr_bandP, uint8_t scs_index) +{ int i, j; int scs_khz = 15 << scs_index; int supplementary_bands[] = {29,75,76,80,81,82,83,84,86,89,95}; @@ -1715,35 +1751,33 @@ int get_nr_table_idx(int nr_bandP, uint8_t scs_index){ LOG_D(PHY, "NR band table index %d (Band %d, dl_min %lu, ul_min %lu)\n", i, nr_bandtable[i].band, nr_bandtable[i].dl_min,nr_bandtable[i].ul_min); return i; - } // Computes the duplex spacing (either positive or negative) in KHz -void get_delta_duplex(int nr_bandP, uint8_t scs_index, int32_t *delta_duplex){ - +int32_t get_delta_duplex(int nr_bandP, uint8_t scs_index) +{ int nr_table_idx = get_nr_table_idx(nr_bandP, scs_index); - *delta_duplex = (nr_bandtable[nr_table_idx].ul_min - nr_bandtable[nr_table_idx].dl_min); + int32_t delta_duplex = (nr_bandtable[nr_table_idx].ul_min - nr_bandtable[nr_table_idx].dl_min); - LOG_D(PHY, "NR band duplex spacing is %d KHz (nr_bandtable[%d].band = %d)\n", *delta_duplex, nr_table_idx, nr_bandtable[nr_table_idx].band); + LOG_I(PHY, "NR band duplex spacing is %d KHz (nr_bandtable[%d].band = %d)\n", delta_duplex, nr_table_idx, nr_bandtable[nr_table_idx].band); + return delta_duplex; } -void get_frame_type(uint16_t current_band, - uint8_t scs_index, - lte_frame_type_t *current_type){ +lte_frame_type_t get_frame_type(uint16_t current_band, uint8_t scs_index) +{ + lte_frame_type_t current_type; + int32_t delta_duplex = get_delta_duplex(current_band, scs_index); - int32_t current_offset; - get_delta_duplex(current_band, scs_index, ¤t_offset); - - current_offset *= 1000; - if (current_offset == 0) - *current_type = TDD; + if (delta_duplex == 0) + current_type = TDD; else - *current_type = FDD; + current_type = FDD; - LOG_I(MAC, "NR band %d, duplex mode %s, duplex spacing = %d KHz\n", current_band, duplex_mode[*current_type], current_offset); + LOG_I(MAC, "NR band %d, duplex mode %s, duplex spacing = %d KHz\n", current_band, duplex_mode[current_type], delta_duplex); + return current_type; } uint16_t config_bandwidth(int mu, int nb_rb, int nr_band) @@ -1921,7 +1955,6 @@ uint64_t from_nrarfcn(int nr_bandP, int deltaFglobal = 5; uint32_t N_REF_Offs = 0; uint64_t F_REF_Offs_khz = 0; - int32_t delta_duplex; uint64_t N_OFFs, frequency, freq_min; int i = get_nr_table_idx(nr_bandP, scs_index); @@ -1936,7 +1969,7 @@ uint64_t from_nrarfcn(int nr_bandP, F_REF_Offs_khz = 24250080; } - get_delta_duplex(nr_bandP, scs_index, &delta_duplex); + int32_t delta_duplex = get_delta_duplex(nr_bandP, scs_index); if (delta_duplex <= 0){ // DL band >= UL band if (nrarfcn >= nr_bandtable[i].N_OFFs_DL){ // is TDD of FDD DL @@ -3081,48 +3114,6 @@ bool set_dl_ptrs_values(NR_PTRS_DownlinkConfig_t *ptrs_config, //printf("[MAC] PTRS is set K= %u L= %u\n", *K_ptrs,1<<*L_ptrs); return valid; } -void get_band(uint64_t downlink_frequency, - uint16_t *current_band, - int32_t *current_offset, - lte_frame_type_t *current_type) -{ - int ind; - uint64_t center_frequency_khz; - uint64_t center_freq_diff_khz; - uint64_t dl_freq_khz = downlink_frequency/1000; - - center_freq_diff_khz = 999999999999999999; // 2^64 - *current_band = 0; - - for ( ind=0; - ind < sizeof(nr_bandtable) / sizeof(nr_bandtable[0]); - ind++) { - - LOG_I(PHY, "Scanning band %d, dl_min %"PRIu64", ul_min %"PRIu64"\n", nr_bandtable[ind].band, nr_bandtable[ind].dl_min,nr_bandtable[ind].ul_min); - - if ( nr_bandtable[ind].dl_min <= dl_freq_khz && nr_bandtable[ind].dl_max >= dl_freq_khz ) { - - center_frequency_khz = (nr_bandtable[ind].dl_max + nr_bandtable[ind].dl_min)/2; - if (abs(dl_freq_khz - center_frequency_khz) < center_freq_diff_khz){ - *current_band = nr_bandtable[ind].band; - *current_offset = (nr_bandtable[ind].ul_min - nr_bandtable[ind].dl_min)*1000; - center_freq_diff_khz = abs(dl_freq_khz - center_frequency_khz); - - if (*current_offset == 0) - *current_type = TDD; - else - *current_type = FDD; - } - } - } - - LOG_I( PHY, "DL frequency %"PRIu64": band %d, frame_type %d, UL frequency %"PRIu64"\n", - downlink_frequency, *current_band, *current_type, downlink_frequency+*current_offset); - - AssertFatal(*current_band != 0, - "Can't find EUTRA band for frequency %lu\n", downlink_frequency); -} - uint32_t get_ssb_slot(uint32_t ssb_index){ // this function now only support f <= 3GHz diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h index a94a79fe37..380b5b9067 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h @@ -39,9 +39,11 @@ uint16_t config_bandwidth(int mu, int nb_rb, int nr_band); -void get_frame_type(uint16_t nr_bandP, uint8_t scs_index, lte_frame_type_t *current_type); +uint16_t get_band(uint64_t downlink_frequency, int32_t delta_duplex); -void get_delta_duplex(int nr_bandP, uint8_t scs_index, int32_t *delta_duplex); +lte_frame_type_t get_frame_type(uint16_t nr_bandP, uint8_t scs_index); + +int32_t get_delta_duplex(int nr_bandP, uint8_t scs_index); uint64_t from_nrarfcn(int nr_bandP, uint8_t scs_index, uint32_t dl_nrarfcn); @@ -140,7 +142,6 @@ bool set_dl_ptrs_values(NR_PTRS_DownlinkConfig_t *ptrs_config, uint8_t *K_ptrs, uint8_t *L_ptrs,uint8_t *portIndex, uint8_t *nERatio,uint8_t *reOffset, uint8_t NrOfSymbols); -void get_band(uint64_t downlink_frequency, uint16_t *current_band, int32_t *current_offset, lte_frame_type_t *current_type); uint8_t get_num_dmrs_symbols(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols); diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index f6bd5436bc..4910588ab3 100755 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -203,8 +203,7 @@ void config_common_ue(NR_UE_MAC_INST_t *mac, uint32_t band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; frequency_range_t frequency_range = band<100?FR1:FR2; - lte_frame_type_t frame_type; - get_frame_type(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing, &frame_type); + lte_frame_type_t frame_type = get_frame_type(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing); // cell config diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index bce0719556..1640ba25a6 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -127,8 +127,7 @@ void config_common(int Mod_idP, int pdsch_AntennaPorts, NR_ServingCellConfigComm uint32_t band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; frequency_range_t frequency_range = band<100?FR1:FR2; - lte_frame_type_t frame_type; - get_frame_type(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing, &frame_type); + lte_frame_type_t frame_type = get_frame_type(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing); RC.nrmac[Mod_idP]->common_channels[0].frame_type = frame_type; // Cell configuration From bae3bebdeb3dfea612e3893051169811fb326087 Mon Sep 17 00:00:00 2001 From: rohan Date: Thu, 4 Mar 2021 08:02:48 +0100 Subject: [PATCH 155/231] Update ulsim.c, build issue resolved. --- openair1/SIMULATION/NR_PHY/ulsim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index fc35ee4cf7..fc350796ac 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -1,4 +1,4 @@ -g* +/* * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. From 06b368914beb86e6a8e0729276364284a3fe73c4 Mon Sep 17 00:00:00 2001 From: Rohan Patil Date: Thu, 4 Mar 2021 15:19:22 +0530 Subject: [PATCH 156/231] PBCH test case support for non-zero bchpyload --- openair1/SIMULATION/NR_PHY/pbchsim.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openair1/SIMULATION/NR_PHY/pbchsim.c b/openair1/SIMULATION/NR_PHY/pbchsim.c index 2512988371..86029a4e79 100644 --- a/openair1/SIMULATION/NR_PHY/pbchsim.c +++ b/openair1/SIMULATION/NR_PHY/pbchsim.c @@ -540,7 +540,7 @@ int main(int argc, char **argv) if (input_fd==NULL) { gNB->pbch_configured = 1; - gNB->ssb_pdu.ssb_pdu_rel15.bchPayload = 0; + gNB->ssb_pdu.ssb_pdu_rel15.bchPayload = 0x55dd33; for (int slot=0;slotslots_per_frame;slot++) { for (aa=0; aaframe_parms.nb_antennas_tx; aa++) @@ -718,9 +718,9 @@ int main(int argc, char **argv) payload_ret = (UE->pbch_vars[0]->xtra_byte == gNB_xtra_byte); for (i=0;i<3;i++){ - payload_ret += (UE->pbch_vars[0]->decoded_output[i] == (gNB->ssb_pdu.ssb_pdu_rel15.bchPayload>>(8*i))); + payload_ret += (UE->pbch_vars[0]->decoded_output[i] == ((gNB->ssb_pdu.ssb_pdu_rel15.bchPayload>>(8*i)) & 0xff)); } - //printf("xtra byte gNB: 0x%02x UE: 0x%02x\n",gNB_xtra_byte, UE->rx_ind.rx_indication_body->mib_pdu.additional_bits); + //printf("xtra byte gNB: 0x%02x UE: 0x%02x\n",gNB_xtra_byte, UE->pbch_vars[0]->xtra_byte); //printf("ret %d\n", payload_ret); if (payload_ret!=4) n_errors_payload++; From a0922cef2fda367034a994bebd7118ee1ae4592a Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Thu, 4 Mar 2021 14:49:38 +0100 Subject: [PATCH 157/231] merge develop --- executables/nr-gnb.c | 28 +-------------------------- executables/softmodem-common.h | 3 +++ openair1/PHY/TOOLS/nr_phy_scope.c | 24 ----------------------- openair1/SIMULATION/NR_PHY/dlsim.c | 4 ++-- openair1/SIMULATION/NR_PHY/prachsim.c | 2 +- openair1/SIMULATION/NR_PHY/ulsim.c | 4 ++-- 6 files changed, 9 insertions(+), 56 deletions(-) diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index 0d2ffbc2c3..fce01f04fd 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -85,6 +85,7 @@ #include "T.h" #include "nfapi/oai_integration/vendor_ext.h" +#include //#define DEBUG_THREADS 1 //#define USRP_DEBUG 1 @@ -92,17 +93,6 @@ // extern openair0_device openair0; -extern volatile int start_gNB; -extern volatile int start_UE; -extern volatile int oai_exit; - -extern openair0_config_t openair0_cfg[MAX_CARDS]; - -extern int transmission_mode; - -extern uint16_t sf_ahead; -extern uint16_t sl_ahead; - //pthread_t main_gNB_thread; time_stats_t softmodem_stats_mt; // main thread @@ -111,25 +101,13 @@ time_stats_t softmodem_stats_rxtx_sf; // total tx time time_stats_t nfapi_meas; // total tx time time_stats_t softmodem_stats_rx_sf; // total rx time -extern double cpuf; - -void init_gNB(int,int); -void stop_gNB(int nb_inst); #include "executables/thread-common.h" -//extern PARALLEL_CONF_t get_thread_parallel_conf(void); -//extern WORKER_CONF_t get_thread_worker_conf(void); -extern uint8_t nfapi_mode; -extern void oai_subframe_ind(uint16_t sfn, uint16_t sf); -extern void oai_slot_ind(uint16_t sfn, uint16_t slot); -extern void add_subframe(uint16_t *frameP, uint16_t *subframeP, int offset); //#define TICK_TO_US(ts) (ts.diff) #define TICK_TO_US(ts) (ts.trials==0?0:ts.diff/ts.trials) -extern void init_td_thread(PHY_VARS_gNB *); -extern void init_te_thread(PHY_VARS_gNB *); void tx_func(void *param) { @@ -411,9 +389,6 @@ void kill_gNB_proc(int inst) { } - - - void reset_opp_meas(void) { int sfn; reset_meas(&softmodem_stats_mt); @@ -481,7 +456,6 @@ printf("after %p\n", gNB->common_vars.rxdataF[aa]); * (not tested in other modes). */ //init_precoding_weights(RC.gNB[inst]); - //init_gNB_proc(inst); init_gNB_Tpool(inst); } diff --git a/executables/softmodem-common.h b/executables/softmodem-common.h index 6dd798ff36..7a7be1de96 100644 --- a/executables/softmodem-common.h +++ b/executables/softmodem-common.h @@ -244,6 +244,9 @@ extern char *get_softmodem_function(uint64_t *sofmodemfunc_mask_ptr); extern void set_softmodem_sighandler(void); extern uint64_t downlink_frequency[MAX_NUM_CCs][4]; extern int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; +extern uint16_t sl_ahead; +extern uint16_t sf_ahead; +extern volatile int oai_exit; void tx_func(void *param); void rx_func(void *param); diff --git a/openair1/PHY/TOOLS/nr_phy_scope.c b/openair1/PHY/TOOLS/nr_phy_scope.c index cb61523852..b45c1abf0b 100644 --- a/openair1/PHY/TOOLS/nr_phy_scope.c +++ b/openair1/PHY/TOOLS/nr_phy_scope.c @@ -282,30 +282,6 @@ static void genericWaterFall (OAIgraph_t *graph, scopeSample_t *values, const in graph->iteration++; } -static void genericLogPowerPerAntena(OAIgraph_t *graph, const int nb_ant, const scopeSample_t **data, const int len) { - float *values, *time; - oai_xygraph_getbuff(graph, &time, &values, len, 0); - - for (int ant=0; ant Date: Thu, 4 Mar 2021 22:15:56 +0100 Subject: [PATCH 158/231] Adding thread count parameter to ci-scripts config file --- ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf index aeba400cad..17bc3507f8 100644 --- a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf +++ b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf @@ -234,6 +234,7 @@ L1s = ( { num_cc = 1; tr_n_preference = "local_mac"; + pusch_proc_threads = 8; } ); From eab6379bffef426f1d82b30de0e133cf6fdda86d Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Wed, 24 Feb 2021 10:20:44 +0100 Subject: [PATCH 159/231] gNB: cut OFDM symbol for PUSCH reception within 1/8th of CP to avoid ISI --- openair1/PHY/MODULATION/slot_fep_nr.c | 10 ++++++---- openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c | 12 +++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/openair1/PHY/MODULATION/slot_fep_nr.c b/openair1/PHY/MODULATION/slot_fep_nr.c index 60b28d4ad1..3ca007daf2 100644 --- a/openair1/PHY/MODULATION/slot_fep_nr.c +++ b/openair1/PHY/MODULATION/slot_fep_nr.c @@ -468,10 +468,12 @@ int nr_slot_fep_ul(NR_DL_FRAME_PARMS *frame_parms, slot_offset = frame_parms->get_samples_slot_timestamp(Ns,frame_parms,0); - if(symbol == 0) - rxdata_offset = slot_offset + nb_prefix_samples0 - SOFFSET; - else - rxdata_offset = slot_offset + nb_prefix_samples0 + (symbol * (frame_parms->ofdm_symbol_size + nb_prefix_samples)) - SOFFSET; + // offset of first OFDM symbol + rxdata_offset = slot_offset + nb_prefix_samples0 - SOFFSET; + // offset of n-th OFDM symbol + rxdata_offset += symbol * (frame_parms->ofdm_symbol_size + nb_prefix_samples); + // use OFDM symbol from within 1/8th of the CP to avoid ISI + rxdata_offset -= nb_prefix_samples / 8; if(sample_offset>rxdata_offset) { memcpy1((void *)tmp_dft_in, diff --git a/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c b/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c index ec55eabf31..a54aec7bc2 100644 --- a/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c +++ b/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c @@ -37,22 +37,20 @@ int nr_est_timing_advance_pusch(PHY_VARS_gNB* gNB, int UE_id) { - int temp, i, aa, max_pos = 0, max_val = 0; - short Re, Im; - uint8_t cyclic_shift = 0; + int i, aa, max_pos = 0, max_val = 0; NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms; NR_gNB_PUSCH *gNB_pusch_vars = gNB->pusch_vars[UE_id]; int32_t **ul_ch_estimates_time = gNB_pusch_vars->ul_ch_estimates_time; - int sync_pos = (frame_parms->ofdm_symbol_size - cyclic_shift*frame_parms->ofdm_symbol_size/12) % (frame_parms->ofdm_symbol_size); + int sync_pos = frame_parms->nb_prefix_samples / 8; for (i = 0; i < frame_parms->ofdm_symbol_size; i++) { - temp = 0; + int temp = 0; for (aa = 0; aa < frame_parms->nb_antennas_rx; aa++) { - Re = ((int16_t*)ul_ch_estimates_time[aa])[(i<<1)]; - Im = ((int16_t*)ul_ch_estimates_time[aa])[1+(i<<1)]; + short Re = ((int16_t*)ul_ch_estimates_time[aa])[(i<<1)]; + short Im = ((int16_t*)ul_ch_estimates_time[aa])[1+(i<<1)]; temp += (Re*Re/2) + (Im*Im/2); } From dd275d014822304b70162e7b77065eceee6446f2 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Thu, 25 Feb 2021 18:05:21 +0100 Subject: [PATCH 160/231] improve nr_slot_fep() and variants --- openair1/PHY/MODULATION/modulation_UE.h | 7 +- openair1/PHY/MODULATION/nr_modulation.h | 4 +- openair1/PHY/MODULATION/slot_fep_nr.c | 618 +++++++----------- .../PHY/NR_UE_TRANSPORT/nr_initial_sync.c | 3 +- openair1/SCHED_NR/nr_ru_procedures.c | 6 +- openair1/SCHED_NR/phy_procedures_nr_gNB.c | 3 - openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 12 +- openair1/SIMULATION/NR_PHY/pbchsim.c | 4 +- 8 files changed, 234 insertions(+), 423 deletions(-) diff --git a/openair1/PHY/MODULATION/modulation_UE.h b/openair1/PHY/MODULATION/modulation_UE.h index 72a1334fe9..20fdaa7ad8 100644 --- a/openair1/PHY/MODULATION/modulation_UE.h +++ b/openair1/PHY/MODULATION/modulation_UE.h @@ -51,16 +51,13 @@ int slot_fep(PHY_VARS_UE *phy_vars_ue, int nr_slot_fep(PHY_VARS_NR_UE *phy_vars_ue, UE_nr_rxtx_proc_t *proc, unsigned char l, - unsigned char Ns, - int sample_offset, - int no_prefix); + unsigned char Ns); int nr_slot_fep_init_sync(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, unsigned char symbol, unsigned char Ns, - int sample_offset, - int no_prefix); + int sample_offset); int slot_fep_mbsfn(PHY_VARS_UE *phy_vars_ue, unsigned char l, diff --git a/openair1/PHY/MODULATION/nr_modulation.h b/openair1/PHY/MODULATION/nr_modulation.h index 3d2be905ac..62b3ab90d5 100644 --- a/openair1/PHY/MODULATION/nr_modulation.h +++ b/openair1/PHY/MODULATION/nr_modulation.h @@ -74,7 +74,6 @@ void nr_ue_layer_mapping(NR_UE_ULSCH_t **ulsch_ue, \param symbol symbol within slot (0..12/14) \param Ns Slot number (0..19) \param sample_offset offset within rxdata (points to beginning of subframe) -\param no_prefix if 1 prefix is removed by HW */ int nr_slot_fep_ul(NR_DL_FRAME_PARMS *frame_parms, @@ -82,8 +81,7 @@ int nr_slot_fep_ul(NR_DL_FRAME_PARMS *frame_parms, int32_t *rxdataF, unsigned char symbol, unsigned char Ns, - int sample_offset, - int no_prefix); + int sample_offset); /*! \brief This function implements the dft transform precoding in PUSCH diff --git a/openair1/PHY/MODULATION/slot_fep_nr.c b/openair1/PHY/MODULATION/slot_fep_nr.c index 3ca007daf2..42bfa88b6c 100644 --- a/openair1/PHY/MODULATION/slot_fep_nr.c +++ b/openair1/PHY/MODULATION/slot_fep_nr.c @@ -29,361 +29,115 @@ //#define DEBUG_FEP -#define SOFFSET 0 - /*#ifdef LOG_I #undef LOG_I #define LOG_I(A,B...) printf(A) #endif*/ +dft_size_idx_t get_dft_size_idx(uint16_t ofdm_symbol_size) +{ + switch (ofdm_symbol_size) { + case 128: + return DFT_128; + + case 256: + return DFT_256; + + case 512: + return DFT_512; + + case 1024: + return DFT_1024; + + case 1536: + return DFT_1536; + + case 2048: + return DFT_2048; + + case 3072: + return DFT_3072; + + case 4096: + return DFT_4096; + + case 6144: + return DFT_6144; + + case 8192: + return DFT_8192; + + default: + printf("unsupported ofdm symbol size \n"); + assert(0); + } + + return DFT_SIZE_IDXTABLESIZE; +} + int nr_slot_fep(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, unsigned char symbol, - unsigned char Ns, - int sample_offset, - int no_prefix) + unsigned char Ns) { NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms; - NR_UE_COMMON *common_vars = &ue->common_vars; - unsigned char aa; + NR_UE_COMMON *common_vars = &ue->common_vars; + + AssertFatal(symbol < frame_parms->symbols_per_slot, "slot_fep: symbol must be between 0 and %d\n", frame_parms->symbols_per_slot-1); + AssertFatal(Ns < frame_parms->slots_per_frame, "slot_fep: Ns must be between 0 and %d\n", frame_parms->slots_per_frame-1); + unsigned int nb_prefix_samples; unsigned int nb_prefix_samples0; - unsigned int abs_symbol; if (ue->is_synchronized) { - nb_prefix_samples = (no_prefix ? 0 : frame_parms->nb_prefix_samples); - nb_prefix_samples0 = (no_prefix ? 0 : frame_parms->nb_prefix_samples0); - } - else { - nb_prefix_samples = (no_prefix ? 0 : frame_parms->nb_prefix_samples); - nb_prefix_samples0 = (no_prefix ? 0 : frame_parms->nb_prefix_samples); - } - //unsigned int subframe_offset;//,subframe_offset_F; - unsigned int slot_offset; - //int i; - unsigned int frame_length_samples = frame_parms->samples_per_subframe * 10; - unsigned int rx_offset; - - - dft_size_idx_t dftsize; - int tmp_dft_in[8192] __attribute__ ((aligned (32))); // This is for misalignment issues for 6 and 15 PRBs - - switch (frame_parms->ofdm_symbol_size) { - case 128: - dftsize = DFT_128; - break; - - case 256: - dftsize = DFT_256; - break; - - case 512: - dftsize = DFT_512; - break; - - case 1024: - dftsize = DFT_1024; - break; - - case 1536: - dftsize = DFT_1536; - break; - - case 2048: - dftsize = DFT_2048; - break; - - case 3072: - dftsize = DFT_3072; - break; - - case 4096: - dftsize = DFT_4096; - break; - - case 8192: - dftsize = DFT_8192; - break; - - default: - printf("unsupported ofdm symbol size \n"); - assert(0); - } - - if (no_prefix) { - slot_offset = frame_parms->ofdm_symbol_size * (frame_parms->symbols_per_slot) * (Ns); + nb_prefix_samples = frame_parms->nb_prefix_samples; + nb_prefix_samples0 = frame_parms->nb_prefix_samples0; } else { - slot_offset = frame_parms->get_samples_slot_timestamp(Ns,frame_parms,0); + nb_prefix_samples = frame_parms->nb_prefix_samples; + nb_prefix_samples0 = frame_parms->nb_prefix_samples; } - /*if (l<0 || l>=7-frame_parms->Ncp) { - printf("slot_fep: l must be between 0 and %d\n",7-frame_parms->Ncp); - return(-1); - }*/ + dft_size_idx_t dftsize = get_dft_size_idx(frame_parms->ofdm_symbol_size); + // This is for misalignment issues + int32_t tmp_dft_in[8192] __attribute__ ((aligned (32))); - if (Ns<0 || Ns>(frame_parms->slots_per_frame-1)) { - printf("slot_fep: Ns must be between 0 and %d\n",frame_parms->slots_per_frame-1); - return(-1); - } - - for (aa=0; aanb_antennas_rx; aa++) { - memset(&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],0,frame_parms->ofdm_symbol_size*sizeof(int)); - - rx_offset = sample_offset + slot_offset - SOFFSET; - // Align with 256 bit - // rx_offset = rx_offset&0xfffffff8; + unsigned int rx_offset = frame_parms->get_samples_slot_timestamp(Ns,frame_parms,0); + unsigned int abs_symbol = Ns * frame_parms->symbols_per_slot + symbol; + for (int idx_symb = Ns*frame_parms->symbols_per_slot; idx_symb <= abs_symbol; idx_symb++) + rx_offset += (idx_symb%(0x7<numerology_index)) ? nb_prefix_samples : nb_prefix_samples0; + rx_offset += frame_parms->ofdm_symbol_size * symbol; #ifdef DEBUG_FEP - // if (ue->frame <100) - /*LOG_I(PHY,*/printf("slot_fep: slot %d, symbol %d, nb_prefix_samples %u, nb_prefix_samples0 %u, slot_offset %u, sample_offset %d,rx_offset %u, frame_length_samples %u\n", - Ns, symbol, nb_prefix_samples, nb_prefix_samples0, slot_offset, sample_offset, rx_offset, frame_length_samples); + // if (ue->frame <100) + printf("slot_fep: slot %d, symbol %d, nb_prefix_samples %u, nb_prefix_samples0 %u, rx_offset %u\n", + Ns, symbol, nb_prefix_samples, nb_prefix_samples0, rx_offset); #endif - abs_symbol = Ns * frame_parms->symbols_per_slot + symbol; - - for (int idx_symb = Ns*frame_parms->symbols_per_slot; idx_symb < abs_symbol; idx_symb++) - rx_offset += (idx_symb%(0x7<numerology_index)) ? nb_prefix_samples : nb_prefix_samples0; + for (unsigned char aa=0; aanb_antennas_rx; aa++) { + memset(&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],0,frame_parms->ofdm_symbol_size*sizeof(int32_t)); - rx_offset += frame_parms->ofdm_symbol_size * symbol; - - if (abs_symbol%(0x7<numerology_index)) { - - rx_offset += nb_prefix_samples; - if (rx_offset > (frame_length_samples - frame_parms->ofdm_symbol_size)) - memcpy((short*) &common_vars->rxdata[aa][frame_length_samples], - (short*) &common_vars->rxdata[aa][0], - frame_parms->ofdm_symbol_size*sizeof(int)); - - if ((rx_offset&7)!=0) { // if input to dft is not 256-bit aligned, issue for size 6,15 and 25 PRBs - memcpy((void *)tmp_dft_in, - (void *) &common_vars->rxdata[aa][rx_offset % frame_length_samples], - frame_parms->ofdm_symbol_size*sizeof(int)); - dft(dftsize,(int16_t *)tmp_dft_in, - (int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1); - } else { // use dft input from RX buffer directly -#if UE_TIMING_TRACE - start_meas(&ue->rx_dft_stats); -#endif - - dft(dftsize,(int16_t *) &common_vars->rxdata[aa][(rx_offset) % frame_length_samples], - (int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1); -#if UE_TIMING_TRACE - stop_meas(&ue->rx_dft_stats); -#endif - } - } else { - - rx_offset += nb_prefix_samples0; - if (rx_offset > (frame_length_samples - frame_parms->ofdm_symbol_size)) - memcpy((void *) &common_vars->rxdata[aa][frame_length_samples], - (void *) &common_vars->rxdata[aa][0], - frame_parms->ofdm_symbol_size*sizeof(int)); -#if UE_TIMING_TRACE - start_meas(&ue->rx_dft_stats); -#endif - - if ((rx_offset&7)!=0) { // if input to dft is not 128-bit aligned, issue for size 6 and 15 PRBs - memcpy((void *)tmp_dft_in, - (void *) &common_vars->rxdata[aa][(rx_offset) % frame_length_samples], - frame_parms->ofdm_symbol_size*sizeof(int)); - dft(dftsize,(int16_t *)tmp_dft_in, - (int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1); - } else { // use dft input from RX buffer directly - - dft(dftsize,(int16_t *) &common_vars->rxdata[aa][(rx_offset) % frame_length_samples], - (int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1); - } -#if UE_TIMING_TRACE - stop_meas(&ue->rx_dft_stats); -#endif + int16_t *rxdata_ptr = (int16_t *)&common_vars->rxdata[aa][rx_offset]; + // if input to dft is not 256-bit aligned + if ((rx_offset & 7) != 0) { + memcpy((void *)&tmp_dft_in[0], + (void *)&common_vars->rxdata[aa][rx_offset], + frame_parms->ofdm_symbol_size * sizeof(int32_t)); + rxdata_ptr = (int16_t *)tmp_dft_in; } -#ifdef DEBUG_FEP - // if (ue->frame <100) - printf("slot_fep: symbol %d rx_offset %u\n", symbol, rx_offset); -#endif - - int symb_offset = (Ns%frame_parms->slots_per_subframe)*frame_parms->symbols_per_slot; - int32_t rot2 = ((uint32_t*)frame_parms->symbol_rotation)[symbol+symb_offset]; - ((int16_t*)&rot2)[1]=-((int16_t*)&rot2)[1]; - rotate_cpx_vector((int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol], - (int16_t*)&rot2, - (int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol], - frame_parms->ofdm_symbol_size, - 15); - - } - - -#ifdef DEBUG_FEP - printf("slot_fep: done\n"); -#endif - return(0); -} - -int nr_slot_fep_init_sync(PHY_VARS_NR_UE *ue, - UE_nr_rxtx_proc_t *proc, - unsigned char symbol, - unsigned char Ns, - int sample_offset, - int no_prefix) -{ - NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms; - NR_UE_COMMON *common_vars = &ue->common_vars; - unsigned char aa; - unsigned int nb_prefix_samples; - unsigned int nb_prefix_samples0; - unsigned int abs_symbol; - if (ue->is_synchronized) { - nb_prefix_samples = (no_prefix ? 0 : frame_parms->nb_prefix_samples); - nb_prefix_samples0 = (no_prefix ? 0 : frame_parms->nb_prefix_samples0); - } - else { - nb_prefix_samples = (no_prefix ? 0 : frame_parms->nb_prefix_samples); - nb_prefix_samples0 = (no_prefix ? 0 : frame_parms->nb_prefix_samples); - } - //unsigned int subframe_offset;//,subframe_offset_F; - unsigned int slot_offset; - //int i; - unsigned int frame_length_samples = frame_parms->samples_per_subframe * 10; - unsigned int rx_offset; - - - dft_size_idx_t dftsize; - int tmp_dft_in[8192] __attribute__ ((aligned (32))); // This is for misalignment issues for 6 and 15 PRBs - - switch (frame_parms->ofdm_symbol_size) { - case 128: - dftsize = DFT_128; - break; - - case 256: - dftsize = DFT_256; - break; - - case 512: - dftsize = DFT_512; - break; - - case 1024: - dftsize = DFT_1024; - break; - - case 1536: - dftsize = DFT_1536; - break; - - case 2048: - dftsize = DFT_2048; - break; - - case 3072: - dftsize = DFT_3072; - break; - - case 4096: - dftsize = DFT_4096; - break; - - case 8192: - dftsize = DFT_8192; - break; - - default: - printf("unsupported ofdm symbol size \n"); - assert(0); - } - - if (no_prefix) { - slot_offset = frame_parms->ofdm_symbol_size * (frame_parms->symbols_per_slot) * (Ns); - } else { - slot_offset = frame_parms->get_samples_slot_timestamp(Ns,frame_parms,0); - } - - /*if (l<0 || l>=7-frame_parms->Ncp) { - printf("slot_fep: l must be between 0 and %d\n",7-frame_parms->Ncp); - return(-1); - }*/ - - if (Ns<0 || Ns>(frame_parms->slots_per_frame-1)) { - printf("slot_fep: Ns must be between 0 and %d\n",frame_parms->slots_per_frame-1); - return(-1); - } - - for (aa=0; aanb_antennas_rx; aa++) { - memset(&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],0,frame_parms->ofdm_symbol_size*sizeof(int)); - - rx_offset = sample_offset + slot_offset - SOFFSET; - // Align with 256 bit - // rx_offset = rx_offset&0xfffffff8; - -#ifdef DEBUG_FEP - // if (ue->frame <100) - /*LOG_I(PHY,*/printf("slot_fep: slot %d, symbol %d, nb_prefix_samples %u, nb_prefix_samples0 %u, slot_offset %u, sample_offset %d,rx_offset %u, frame_length_samples %u\n", - Ns, symbol, nb_prefix_samples, nb_prefix_samples0, slot_offset, sample_offset, rx_offset, frame_length_samples); -#endif - - abs_symbol = Ns * frame_parms->symbols_per_slot + symbol; - - for (int idx_symb = Ns*frame_parms->symbols_per_slot; idx_symb < abs_symbol; idx_symb++) - rx_offset += (abs_symbol%(0x7<numerology_index)) ? nb_prefix_samples : nb_prefix_samples0; - - rx_offset += frame_parms->ofdm_symbol_size * symbol; - - if (abs_symbol%(0x7<numerology_index)) { - - rx_offset += nb_prefix_samples; - if (rx_offset > (frame_length_samples - frame_parms->ofdm_symbol_size)) - memcpy((short*) &common_vars->rxdata[aa][frame_length_samples], - (short*) &common_vars->rxdata[aa][0], - frame_parms->ofdm_symbol_size*sizeof(int)); - - if ((rx_offset&7)!=0) { // if input to dft is not 256-bit aligned, issue for size 6,15 and 25 PRBs - memcpy((void *)tmp_dft_in, - (void *) &common_vars->rxdata[aa][rx_offset], - frame_parms->ofdm_symbol_size*sizeof(int)); - dft(dftsize,(int16_t *)tmp_dft_in, - (int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1); - } else { // use dft input from RX buffer directly #if UE_TIMING_TRACE - start_meas(&ue->rx_dft_stats); + start_meas(&ue->rx_dft_stats); #endif + dft(dftsize, + rxdata_ptr, + (int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol], + 1); - dft(dftsize,(int16_t *) &common_vars->rxdata[aa][rx_offset], - (int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1); #if UE_TIMING_TRACE - stop_meas(&ue->rx_dft_stats); + stop_meas(&ue->rx_dft_stats); #endif - } - } else { - - rx_offset += nb_prefix_samples0; - if (rx_offset > (frame_length_samples - frame_parms->ofdm_symbol_size)) - memcpy((void *) &common_vars->rxdata[aa][frame_length_samples], - (void *) &common_vars->rxdata[aa][0], - frame_parms->ofdm_symbol_size*sizeof(int)); -#if UE_TIMING_TRACE - start_meas(&ue->rx_dft_stats); -#endif - - if ((rx_offset&7)!=0) { // if input to dft is not 128-bit aligned, issue for size 6 and 15 PRBs - memcpy((void *)tmp_dft_in, - (void *) &common_vars->rxdata[aa][rx_offset], - frame_parms->ofdm_symbol_size*sizeof(int)); - dft(dftsize,(int16_t *)tmp_dft_in, - (int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1); - } else { // use dft input from RX buffer directly - dft(dftsize,(int16_t *) &common_vars->rxdata[aa][rx_offset], - (int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1); - } -#if UE_TIMING_TRACE - stop_meas(&ue->rx_dft_stats); -#endif - - - } int symb_offset = (Ns%frame_parms->slots_per_subframe)*frame_parms->symbols_per_slot; int32_t rot2 = ((uint32_t*)frame_parms->symbol_rotation)[symbol+symb_offset]; @@ -400,14 +154,121 @@ int nr_slot_fep_init_sync(PHY_VARS_NR_UE *ue, (int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol], frame_parms->ofdm_symbol_size, 15); - } - #ifdef DEBUG_FEP printf("slot_fep: done\n"); #endif - return(0); + + return 0; +} + +int nr_slot_fep_init_sync(PHY_VARS_NR_UE *ue, + UE_nr_rxtx_proc_t *proc, + unsigned char symbol, + unsigned char Ns, + int sample_offset) +{ + NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms; + NR_UE_COMMON *common_vars = &ue->common_vars; + + AssertFatal(symbol < frame_parms->symbols_per_slot, "slot_fep: symbol must be between 0 and %d\n", frame_parms->symbols_per_slot-1); + AssertFatal(Ns < frame_parms->slots_per_frame, "slot_fep: Ns must be between 0 and %d\n", frame_parms->slots_per_frame-1); + + unsigned int nb_prefix_samples; + unsigned int nb_prefix_samples0; + if (ue->is_synchronized) { + nb_prefix_samples = frame_parms->nb_prefix_samples; + nb_prefix_samples0 = frame_parms->nb_prefix_samples0; + } + else { + nb_prefix_samples = frame_parms->nb_prefix_samples; + nb_prefix_samples0 = frame_parms->nb_prefix_samples; + } + unsigned int frame_length_samples = frame_parms->samples_per_frame; + + dft_size_idx_t dftsize = get_dft_size_idx(frame_parms->ofdm_symbol_size); + // This is for misalignment issues + int32_t tmp_dft_in[8192] __attribute__ ((aligned (32))); + + unsigned int slot_offset = frame_parms->get_samples_slot_timestamp(Ns,frame_parms,0); + unsigned int rx_offset = sample_offset + slot_offset; + unsigned int abs_symbol = Ns * frame_parms->symbols_per_slot + symbol; + for (int idx_symb = Ns*frame_parms->symbols_per_slot; idx_symb <= abs_symbol; idx_symb++) + rx_offset += (abs_symbol%(0x7<numerology_index)) ? nb_prefix_samples : nb_prefix_samples0; + rx_offset += frame_parms->ofdm_symbol_size * symbol; + +#ifdef DEBUG_FEP + // if (ue->frame <100) + printf("slot_fep: slot %d, symbol %d, nb_prefix_samples %u, nb_prefix_samples0 %u, slot_offset %u, sample_offset %d,rx_offset %u, frame_length_samples %u\n", + Ns, symbol, nb_prefix_samples, nb_prefix_samples0, slot_offset, sample_offset, rx_offset, frame_length_samples); +#endif + + for (unsigned char aa=0; aanb_antennas_rx; aa++) { + memset(&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],0,frame_parms->ofdm_symbol_size*sizeof(int32_t)); + + int16_t *rxdata_ptr; + + if (frame_length_samples - rx_offset < frame_parms->ofdm_symbol_size) { + + memcpy((void *)&tmp_dft_in[0], + (void *)&common_vars->rxdata[aa][rx_offset], + (frame_length_samples - rx_offset) * sizeof(int32_t)); + memcpy((void *)&tmp_dft_in[frame_length_samples - rx_offset], + (void *)&common_vars->rxdata[aa][0], + (frame_parms->ofdm_symbol_size - (frame_length_samples - rx_offset)) * sizeof(int32_t)); + rxdata_ptr = (int16_t *)&tmp_dft_in[0]; + + } else if ((rx_offset & 7) != 0) { + + // if input to dft is not 256-bit aligned + memcpy((void *)&tmp_dft_in[0], + (void *)&common_vars->rxdata[aa][rx_offset], + frame_parms->ofdm_symbol_size * sizeof(int32_t)); + rxdata_ptr = (int16_t *)&tmp_dft_in[0]; + + } else { + + // use dft input from RX buffer directly + rxdata_ptr = (int16_t *)&common_vars->rxdata[aa][rx_offset]; + + } + +#if UE_TIMING_TRACE + start_meas(&ue->rx_dft_stats); +#endif + + dft(dftsize, + rxdata_ptr, + (int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol], + 1); + +#if UE_TIMING_TRACE + stop_meas(&ue->rx_dft_stats); +#endif + + int symb_offset = (Ns%frame_parms->slots_per_subframe)*frame_parms->symbols_per_slot; + int32_t rot2 = ((uint32_t*)frame_parms->symbol_rotation)[symbol+symb_offset]; + ((int16_t*)&rot2)[1]=-((int16_t*)&rot2)[1]; + +#ifdef DEBUG_FEP + // if (ue->frame <100) + printf("slot_fep: slot %d, symbol %d rx_offset %u, rotation symbol %d %d.%d\n", Ns,symbol, rx_offset, + symbol+symb_offset,((int16_t*)&rot2)[0],((int16_t*)&rot2)[1]); +#endif + + rotate_cpx_vector((int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol], + (int16_t*)&rot2, + (int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol], + frame_parms->ofdm_symbol_size, + 15); + } + +#ifdef DEBUG_FEP + printf("slot_fep: done\n"); +#endif + + return 0; } @@ -416,91 +277,60 @@ int nr_slot_fep_ul(NR_DL_FRAME_PARMS *frame_parms, int32_t *rxdataF, unsigned char symbol, unsigned char Ns, - int sample_offset, - int no_prefix) + int sample_offset) { - int32_t slot_offset, rxdata_offset; - - unsigned int nb_prefix_samples = (no_prefix ? 0 : frame_parms->nb_prefix_samples); - unsigned int nb_prefix_samples0 = (no_prefix ? 0 : frame_parms->nb_prefix_samples0); + unsigned int nb_prefix_samples = frame_parms->nb_prefix_samples; + unsigned int nb_prefix_samples0 = frame_parms->nb_prefix_samples0; - int tmp_dft_in[8192] __attribute__ ((aligned (32))); + dft_size_idx_t dftsize = get_dft_size_idx(frame_parms->ofdm_symbol_size); + // This is for misalignment issues + int32_t tmp_dft_in[8192] __attribute__ ((aligned (32))); - dft_size_idx_t dftsize; - - switch (frame_parms->ofdm_symbol_size) { - case 128: - dftsize = DFT_128; - break; - - case 256: - dftsize = DFT_256; - break; - - case 512: - dftsize = DFT_512; - break; - - case 1024: - dftsize = DFT_1024; - break; - - case 1536: - dftsize = DFT_1536; - break; - - case 2048: - dftsize = DFT_2048; - break; - - case 4096: - dftsize = DFT_4096; - break; - - case 8192: - dftsize = DFT_8192; - break; - - default: - dftsize = DFT_512; - break; - } - - slot_offset = frame_parms->get_samples_slot_timestamp(Ns,frame_parms,0); + unsigned int slot_offset = frame_parms->get_samples_slot_timestamp(Ns,frame_parms,0); // offset of first OFDM symbol - rxdata_offset = slot_offset + nb_prefix_samples0 - SOFFSET; + int32_t rxdata_offset = slot_offset + nb_prefix_samples0; // offset of n-th OFDM symbol rxdata_offset += symbol * (frame_parms->ofdm_symbol_size + nb_prefix_samples); // use OFDM symbol from within 1/8th of the CP to avoid ISI rxdata_offset -= nb_prefix_samples / 8; - if(sample_offset>rxdata_offset) { - memcpy1((void *)tmp_dft_in, - (void *) &rxdata[frame_parms->samples_per_frame-sample_offset+rxdata_offset], - (sample_offset-rxdata_offset)*sizeof(int)); + int16_t *rxdata_ptr; - memcpy1((void *)&tmp_dft_in[sample_offset-rxdata_offset], - (void *) &rxdata[0], - (frame_parms->ofdm_symbol_size-sample_offset+rxdata_offset)*sizeof(int)); + if(sample_offset > rxdata_offset) { + + memcpy((void *)&tmp_dft_in[0], + (void *)&rxdata[frame_parms->samples_per_frame - sample_offset + rxdata_offset], + (sample_offset - rxdata_offset) * sizeof(int32_t)); + memcpy((void *)&tmp_dft_in[sample_offset - rxdata_offset], + (void *)&rxdata[0], + (frame_parms->ofdm_symbol_size - sample_offset + rxdata_offset) * sizeof(int32_t)); + rxdata_ptr = (int16_t *)&tmp_dft_in[0]; + + } else if (((rxdata_offset - sample_offset) & 7) != 0) { + + // if input to dft is not 256-bit aligned + memcpy((void *)&tmp_dft_in[0], + (void *)&rxdata[rxdata_offset - sample_offset], + (frame_parms->ofdm_symbol_size) * sizeof(int32_t)); + rxdata_ptr = (int16_t *)&tmp_dft_in[0]; + + } else { + + // use dft input from RX buffer directly + rxdata_ptr = (int16_t *)&rxdata[rxdata_offset - sample_offset]; - dft(dftsize,(int16_t *)&tmp_dft_in, - (int16_t *)&rxdataF[symbol * frame_parms->ofdm_symbol_size], 1); - } - else { - //dft(dftsize,(int16_t *)&rxdata[rxdata_offset-sample_offset], - // (int16_t *)&rxdataF[symbol * frame_parms->ofdm_symbol_size], 1); - memcpy((void *)tmp_dft_in, - (void *) &rxdata[rxdata_offset-sample_offset], - (frame_parms->ofdm_symbol_size)*sizeof(int)); - dft(dftsize,(int16_t *)&tmp_dft_in, - (int16_t *)&rxdataF[symbol * frame_parms->ofdm_symbol_size], 1); } + dft(dftsize, + rxdata_ptr, + (int16_t *)&rxdataF[symbol * frame_parms->ofdm_symbol_size], + 1); + // clear DC carrier from OFDM symbols rxdataF[symbol * frame_parms->ofdm_symbol_size] = 0; - return(0); + return 0; } void apply_nr_rotation_ul(NR_DL_FRAME_PARMS *frame_parms, diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c index 3d750d2ab3..164c1f08c9 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c @@ -289,8 +289,7 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, int n_frames) proc, i, 0, - is*fp->samples_per_frame+ue->ssb_offset, - 0); + is*fp->samples_per_frame+ue->ssb_offset); #ifdef DEBUG_INITIAL_SYNCH LOG_I(PHY,"Calling sss detection (normal CP)\n"); diff --git a/openair1/SCHED_NR/nr_ru_procedures.c b/openair1/SCHED_NR/nr_ru_procedures.c index a78b1f4805..9a71f96815 100644 --- a/openair1/SCHED_NR/nr_ru_procedures.c +++ b/openair1/SCHED_NR/nr_ru_procedures.c @@ -520,8 +520,7 @@ void nr_fep0(RU_t *ru, int first_half) { ru->common.rxdataF[aa], l, proc->tti_rx, - ru->N_TA_offset, - 0); + ru->N_TA_offset); } } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX+proc->tti_rx, 0); @@ -657,8 +656,7 @@ void nr_fep_full(RU_t *ru, int slot) { ru->common.rxdataF[aa], l, proc->tti_rx, - ru->N_TA_offset, - 0); + ru->N_TA_offset); } } diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index 761ff4a142..ff7d531313 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -508,15 +508,12 @@ void phy_procedures_gNB_common_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) unsigned char aa; for(symbol = 0; symbol < (gNB->frame_parms.Ncp==EXTENDED?12:14); symbol++) { - // nr_slot_fep_ul(gNB, symbol, proc->slot_rx, 0, 0); - for (aa = 0; aa < gNB->frame_parms.nb_antennas_rx; aa++) { nr_slot_fep_ul(&gNB->frame_parms, gNB->common_vars.rxdata[aa], gNB->common_vars.rxdataF[aa], symbol, slot_rx, - 0, 0); } } diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index 19a4e43569..f97d33fa97 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -1689,9 +1689,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, nr_slot_fep(ue, proc, (ue->symbol_offset+i)%(fp->symbols_per_slot), - nr_slot_rx, - 0, - 0); + nr_slot_rx); #if UE_TIMING_TRACE start_meas(&ue->dlsch_channel_estimation_stats); @@ -1744,9 +1742,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, nr_slot_fep(ue, proc, l, - nr_slot_rx, - 0, - 0); + nr_slot_rx); dci_cnt = 0; for(int n_ss = 0; n_ssnb_search_space; n_ss++) { @@ -1805,9 +1801,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, nr_slot_fep(ue, proc, m, //to be updated from higher layer - nr_slot_rx, - 0, - 0); + nr_slot_rx); } } } else { diff --git a/openair1/SIMULATION/NR_PHY/pbchsim.c b/openair1/SIMULATION/NR_PHY/pbchsim.c index 2512988371..d8b356df54 100644 --- a/openair1/SIMULATION/NR_PHY/pbchsim.c +++ b/openair1/SIMULATION/NR_PHY/pbchsim.c @@ -692,9 +692,7 @@ int main(int argc, char **argv) nr_slot_fep(UE, &proc, i%frame_parms->symbols_per_slot, - ssb_slot, - 0, - 0); + ssb_slot); nr_pbch_channel_estimation(UE,&proc,0,ssb_slot,i%frame_parms->symbols_per_slot,i-(UE->symbol_offset+1),ssb_index%8,n_hf); From 2266d4611ad477f54a7d20d916db6b441139b939 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Thu, 25 Feb 2021 18:34:45 +0100 Subject: [PATCH 161/231] NR_UE: move OFDM symbol cut position handling to nr_slot_fep() this slightly cleans up nr_initial_sync() and UE_thread() --- executables/nr-ue.c | 2 +- openair1/PHY/MODULATION/slot_fep_nr.c | 3 +++ openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c | 1 - 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index a8302666a1..02d0aa31f0 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -656,7 +656,7 @@ void *UE_thread(void *arg) { // use previous timing_advance value to compute writeTimestamp writeTimestamp = timestamp + UE->frame_parms.get_samples_slot_timestamp(slot_nr, &UE->frame_parms,DURATION_RX_TO_TX - RX_NB_TH) - - firstSymSamp - openair0_cfg[0].tx_sample_advance - UE->N_TA_offset - timing_advance + UE->frame_parms.nb_prefix_samples / 8; + firstSymSamp - openair0_cfg[0].tx_sample_advance - UE->N_TA_offset - timing_advance; // but use current UE->timing_advance value to compute writeBlockSize if (UE->timing_advance != timing_advance) { diff --git a/openair1/PHY/MODULATION/slot_fep_nr.c b/openair1/PHY/MODULATION/slot_fep_nr.c index 42bfa88b6c..2ed0063d83 100644 --- a/openair1/PHY/MODULATION/slot_fep_nr.c +++ b/openair1/PHY/MODULATION/slot_fep_nr.c @@ -106,6 +106,9 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, rx_offset += (idx_symb%(0x7<numerology_index)) ? nb_prefix_samples : nb_prefix_samples0; rx_offset += frame_parms->ofdm_symbol_size * symbol; + // use OFDM symbol from within 1/8th of the CP to avoid ISI + rx_offset -= nb_prefix_samples / 8; + #ifdef DEBUG_FEP // if (ue->frame <100) printf("slot_fep: slot %d, symbol %d, nb_prefix_samples %u, nb_prefix_samples0 %u, rx_offset %u\n", diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c index 164c1f08c9..189ad53efa 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c @@ -308,7 +308,6 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, int n_frames) // every 7*(1<symbol_offset/(7*(1<ofdm_symbol_size + fp->nb_prefix_samples0)+(ue->symbol_offset-n_symb_prefix0)*(fp->ofdm_symbol_size + fp->nb_prefix_samples); - sync_pos_frame += fp->nb_prefix_samples / 8; // shift sync position ahead by 1/8th of cyclic prefix, same as in nr_adjust_synch_ue() if (ue->ssb_offset < sync_pos_frame) ue->rx_offset = fp->samples_per_frame - sync_pos_frame + ue->ssb_offset; else From 2411743f4438548626cecf89d2468dbbcf08e055 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Fri, 5 Mar 2021 17:27:45 +0100 Subject: [PATCH 162/231] gNB: move get_band() to its only user in nr_init.c --- openair1/PHY/INIT/nr_init.c | 40 +++++++++++++++++-- openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c | 40 +------------------ openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h | 6 ++- 3 files changed, 42 insertions(+), 44 deletions(-) diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index a8faf2bba7..d5e0da5c70 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -45,10 +45,42 @@ #include "PHY/NR_REFSIG/ul_ref_seq_nr.h" -/* -extern uint32_t from_nrarfcn(int nr_bandP,uint32_t dl_nrarfcn); -extern openair0_config_t openair0_cfg[MAX_CARDS]; -*/ +static +uint16_t get_band(uint64_t downlink_frequency, int32_t delta_duplex) +{ + const uint64_t dl_freq_khz = downlink_frequency / 1000; + const int32_t delta_duplex_khz = delta_duplex / 1000; + + uint64_t center_freq_diff_khz = 999999999999999999; // 2^64 + uint16_t current_band = 0; + + for (int ind = 0; ind < nr_bandtable_size; ind++) { + + LOG_D(PHY, "Scanning band %d, dl_min %"PRIu64", ul_min %"PRIu64"\n", nr_bandtable[ind].band, nr_bandtable[ind].dl_min, nr_bandtable[ind].ul_min); + + if (dl_freq_khz < nr_bandtable[ind].dl_min || dl_freq_khz > nr_bandtable[ind].dl_max) + continue; + + int32_t current_offset_khz = nr_bandtable[ind].ul_min - nr_bandtable[ind].dl_min; + + if (current_offset_khz != delta_duplex_khz) + continue; + + uint64_t center_frequency_khz = (nr_bandtable[ind].dl_max + nr_bandtable[ind].dl_min) / 2; + + if (abs(dl_freq_khz - center_frequency_khz) < center_freq_diff_khz){ + current_band = nr_bandtable[ind].band; + center_freq_diff_khz = abs(dl_freq_khz - center_frequency_khz); + } + } + + LOG_I(PHY, "DL frequency %"PRIu64": band %d, UL frequency %"PRIu64"\n", + downlink_frequency, current_band, downlink_frequency+delta_duplex); + + AssertFatal(current_band != 0, "Can't find EUTRA band for frequency %"PRIu64" and duplex_spacing %u\n", downlink_frequency, delta_duplex); + + return current_band; +} int l1_north_init_gNB() { diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index 5c0c97f566..72c113e86e 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -1649,6 +1649,8 @@ nr_bandentry_t nr_bandtable[] = { {261,27500040,28350000,27500040,28350000, 2,2070833, 120} }; +#define NR_BANDTABLE_SIZE (sizeof(nr_bandtable)/sizeof(nr_bandentry_t)) +const size_t nr_bandtable_size = NR_BANDTABLE_SIZE; // TS 38.211 Table 6.4.1.1.3-3: PUSCH DMRS positions l' within a slot for single-symbol DMRS and intra-slot frequency hopping disabled. // The first 4 colomns are PUSCH mapping type A and the last 4 colomns are PUSCH mapping type B. @@ -1690,44 +1692,6 @@ int32_t table_6_4_1_1_3_4_pusch_dmrs_positions_l [12][8] = { {1, 1025, -1, -1, 1, 513, -1, -1}, //14 // (DMRS l' position) }; -#define NR_BANDTABLE_SIZE (sizeof(nr_bandtable)/sizeof(nr_bandentry_t)) - -uint16_t get_band(uint64_t downlink_frequency, int32_t delta_duplex) -{ - const uint64_t dl_freq_khz = downlink_frequency / 1000; - const int32_t delta_duplex_khz = delta_duplex / 1000; - - uint64_t center_freq_diff_khz = 999999999999999999; // 2^64 - uint16_t current_band = 0; - - for (int ind = 0; ind < NR_BANDTABLE_SIZE; ind++) { - - LOG_D(PHY, "Scanning band %d, dl_min %"PRIu64", ul_min %"PRIu64"\n", nr_bandtable[ind].band, nr_bandtable[ind].dl_min, nr_bandtable[ind].ul_min); - - if (dl_freq_khz < nr_bandtable[ind].dl_min || dl_freq_khz > nr_bandtable[ind].dl_max) - continue; - - int32_t current_offset_khz = nr_bandtable[ind].ul_min - nr_bandtable[ind].dl_min; - - if (current_offset_khz != delta_duplex_khz) - continue; - - uint64_t center_frequency_khz = (nr_bandtable[ind].dl_max + nr_bandtable[ind].dl_min) / 2; - - if (abs(dl_freq_khz - center_frequency_khz) < center_freq_diff_khz){ - current_band = nr_bandtable[ind].band; - center_freq_diff_khz = abs(dl_freq_khz - center_frequency_khz); - } - } - - LOG_I(PHY, "DL frequency %"PRIu64": band %d, UL frequency %"PRIu64"\n", - downlink_frequency, current_band, downlink_frequency+delta_duplex); - - AssertFatal(current_band != 0, "Can't find EUTRA band for frequency %"PRIu64" and duplex_spacing %u\n", downlink_frequency, delta_duplex); - - return current_band; -} - // Returns the corresponding row index of the NR table int get_nr_table_idx(int nr_bandP, uint8_t scs_index) { diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h index 380b5b9067..bc41bdabc8 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h @@ -36,11 +36,13 @@ #include "NR_CellGroupConfig.h" #include "nr_mac.h" #include "openair1/PHY/impl_defs_nr.h" +#include "openair1/PHY/defs_nr_common.h" + +extern const size_t nr_bandtable_size; +extern nr_bandentry_t nr_bandtable[]; uint16_t config_bandwidth(int mu, int nb_rb, int nr_band); -uint16_t get_band(uint64_t downlink_frequency, int32_t delta_duplex); - lte_frame_type_t get_frame_type(uint16_t nr_bandP, uint8_t scs_index); int32_t get_delta_duplex(int nr_bandP, uint8_t scs_index); From 606fa3c3aa5dca1e31216cbe129aebd3a1d07630 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Mon, 8 Mar 2021 10:59:43 +0100 Subject: [PATCH 163/231] fix nr_prachsim: 3.5 GHz is _not_ a valid DL frequency for 30 kHz SCS, so change it to 3.6 GHz --- openair1/PHY/INIT/nr_init.c | 4 ++-- openair1/SIMULATION/NR_PHY/pbchsim.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index d00bc90315..4ad948a9bc 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -431,8 +431,8 @@ void nr_phy_config_request_sim(PHY_VARS_gNB *gNB, gNB->mac_enabled = 1; if (mu==1) { - fp->dl_CarrierFreq = 3500000000;//from_nrarfcn(gNB_config->nfapi_config.rf_bands.rf_band[0],gNB_config->nfapi_config.nrarfcn.value); - fp->ul_CarrierFreq = 3500000000;//fp->dl_CarrierFreq - (get_uldl_offset(gNB_config->nfapi_config.rf_bands.rf_band[0])*100000); + fp->dl_CarrierFreq = 3600000000;//from_nrarfcn(gNB_config->nfapi_config.rf_bands.rf_band[0],gNB_config->nfapi_config.nrarfcn.value); + fp->ul_CarrierFreq = 3600000000;//fp->dl_CarrierFreq - (get_uldl_offset(gNB_config->nfapi_config.rf_bands.rf_band[0])*100000); fp->nr_band = 78; // fp->threequarter_fs= 0; } else if (mu==3) { diff --git a/openair1/SIMULATION/NR_PHY/pbchsim.c b/openair1/SIMULATION/NR_PHY/pbchsim.c index d8b356df54..e981077207 100644 --- a/openair1/SIMULATION/NR_PHY/pbchsim.c +++ b/openair1/SIMULATION/NR_PHY/pbchsim.c @@ -101,8 +101,8 @@ void nr_phy_config_request_sim_pbchsim(PHY_VARS_gNB *gNB, //gNB_config->subframe_config.dl_cyclic_prefix_type.value = (fp->Ncp == NORMAL) ? NFAPI_CP_NORMAL : NFAPI_CP_EXTENDED; gNB->mac_enabled = 1; - fp->dl_CarrierFreq = 3500000000;//from_nrarfcn(gNB_config->nfapi_config.rf_bands.rf_band[0],gNB_config->nfapi_config.nrarfcn.value); - fp->ul_CarrierFreq = 3500000000;//fp->dl_CarrierFreq - (get_uldl_offset(gNB_config->nfapi_config.rf_bands.rf_band[0])*100000); + fp->dl_CarrierFreq = 3600000000;//from_nrarfcn(gNB_config->nfapi_config.rf_bands.rf_band[0],gNB_config->nfapi_config.nrarfcn.value); + fp->ul_CarrierFreq = 3600000000;//fp->dl_CarrierFreq - (get_uldl_offset(gNB_config->nfapi_config.rf_bands.rf_band[0])*100000); if (mu>2) fp->nr_band = 257; else fp->nr_band = 78; fp->threequarter_fs= 0; From 681c03667dd58a339c06be559b0da2ce1f0c70c5 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Mon, 8 Mar 2021 16:23:20 +0100 Subject: [PATCH 164/231] NR: fix init_symbol_rotation() for UL --- openair1/PHY/MODULATION/nr_modulation.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/openair1/PHY/MODULATION/nr_modulation.c b/openair1/PHY/MODULATION/nr_modulation.c index b1b07c88e3..f12dcfc01b 100644 --- a/openair1/PHY/MODULATION/nr_modulation.c +++ b/openair1/PHY/MODULATION/nr_modulation.c @@ -602,17 +602,17 @@ void init_symbol_rotation(NR_DL_FRAME_PARMS *fp) { const double Nu=2048*64*(1/(float)(1<numerology_index)); const double Ncp0=16*64 + (144*64*(1/(float)(1<numerology_index))); const double Ncp1=(144*64*(1/(float)(1<numerology_index))); - double tl=0,poff,exp_re,exp_im; - double Ncp,Ncpm1=Ncp0; for (uint8_t ll = 0; ll < 2; ll++){ double f0 = f[ll]; + double Ncpm1 = Ncp0; int16_t *symbol_rotation = fp->symbol_rotation[ll]; - poff = 2 * M_PI * ((Ncp0 * Tc)) * f0; - exp_re = cos(poff); - exp_im = sin(-poff); + double tl = 0; + double poff = 2 * M_PI * ((Ncp0 * Tc)) * f0; + double exp_re = cos(poff); + double exp_im = sin(-poff); symbol_rotation[0] = (int16_t)floor(exp_re * 32767); symbol_rotation[1] = (int16_t)floor(exp_im * 32767); LOG_I(PHY, "Doing symbol rotation calculation for gNB TX/RX, f0 %f Hz, Nsymb %d\n", f0, nsymb); @@ -624,6 +624,7 @@ void init_symbol_rotation(NR_DL_FRAME_PARMS *fp) { for (int l = 1; l < nsymb; l++) { + double Ncp; if (l == (7 * (1 << fp->numerology_index))) { Ncp = Ncp0; } else { From 969425f6a8a5cec22d8b70e26683cc2a3954c4f0 Mon Sep 17 00:00:00 2001 From: "masayuki.harada" Date: Tue, 9 Mar 2021 03:25:00 +0900 Subject: [PATCH 165/231] Replace to itti timer. Fix nnsf selection. Fix indentation and opening brace. --- openair3/S1AP/s1ap_eNB.c | 327 ++++++++---------- openair3/S1AP/s1ap_eNB_handlers.c | 52 +-- .../S1AP/s1ap_eNB_management_procedures.c | 29 +- openair3/S1AP/s1ap_eNB_nas_procedures.c | 9 +- openair3/S1AP/s1ap_eNB_nnsf.c | 102 +++--- openair3/S1AP/s1ap_eNB_nnsf.h | 3 +- openair3/S1AP/s1ap_eNB_timer.c | 260 +------------- 7 files changed, 226 insertions(+), 556 deletions(-) diff --git a/openair3/S1AP/s1ap_eNB.c b/openair3/S1AP/s1ap_eNB.c index c40cc7cea9..6cb82de8d3 100644 --- a/openair3/S1AP/s1ap_eNB.c +++ b/openair3/S1AP/s1ap_eNB.c @@ -78,7 +78,7 @@ void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa static int s1ap_sctp_req(s1ap_eNB_instance_t *instance_p, s1ap_eNB_mme_data_t *s1ap_mme_data_p); void s1ap_eNB_timer_expired(instance_t instance, - s1ap_timer_has_expired_t *msg_p); + timer_has_expired_t *msg_p); uint32_t s1ap_generate_eNB_id(void) { char *out; @@ -157,7 +157,6 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t * uint8_t index; DevAssert(s1ap_register_eNB != NULL); /* Look if the provided instance already exists */ - s1ap_timer_init(); new_instance = s1ap_eNB_get_instance(instance); if (new_instance != NULL) { @@ -268,45 +267,36 @@ void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa sctp_new_association_resp->ulp_cnx_id); DevAssert(s1ap_mme_data_p != NULL); memset(enb_s1ap_id, 0, sizeof(enb_s1ap_id) ); - if( s1ap_mme_data_p->timer_id != S1AP_TIMERID_INIT ) - { + if( s1ap_mme_data_p->timer_id != S1AP_TIMERID_INIT ) { s1ap_timer_remove( s1ap_mme_data_p->timer_id ); s1ap_mme_data_p->timer_id = S1AP_TIMERID_INIT; } - if( sctp_new_association_resp->sctp_state != SCTP_STATE_ESTABLISHED ) - { - RB_FOREACH(ue_p, s1ap_ue_map, &instance_p->s1ap_ue_head) - { - if( ue_p->mme_ref == s1ap_mme_data_p ) - { - if(cnt < NUMBER_OF_UE_MAX){ + if( sctp_new_association_resp->sctp_state != SCTP_STATE_ESTABLISHED ) { + RB_FOREACH(ue_p, s1ap_ue_map, &instance_p->s1ap_ue_head) { + if( ue_p->mme_ref == s1ap_mme_data_p ) { + if(cnt < NUMBER_OF_UE_MAX) { enb_s1ap_id[cnt] = ue_p->eNB_ue_s1ap_id; cnt++; message_p = NULL; - message_p = itti_alloc_new_message(TASK_S1AP, S1AP_UE_CONTEXT_RELEASE_COMMAND); + message_p = itti_alloc_new_message(TASK_S1AP, 0, S1AP_UE_CONTEXT_RELEASE_COMMAND); - if( message_p != NULL ) - { + if( message_p != NULL ) { S1AP_UE_CONTEXT_RELEASE_COMMAND(message_p).eNB_ue_s1ap_id = ue_p->eNB_ue_s1ap_id; - if( itti_send_msg_to_task(TASK_RRC_ENB, ue_p->eNB_instance->instance, message_p) < 0 ) - { + if( itti_send_msg_to_task(TASK_RRC_ENB, ue_p->eNB_instance->instance, message_p) < 0 ) { S1AP_ERROR("UE Context Release Command Transmission Failure: eNB_ue_s1ap_id=%u\n", ue_p->eNB_ue_s1ap_id); } - } - else - { + } else { S1AP_ERROR("Invalid message_p : eNB_ue_s1ap_id=%u\n", ue_p->eNB_ue_s1ap_id); } }else{ - S1AP_ERROR("s1ap_eNB_handle_sctp_association_resp: cnt %d > max\n", cnt); + S1AP_ERROR("s1ap_eNB_handle_sctp_association_resp: cnt %d > max\n", cnt); } } } - for( ; cnt > 0 ; ) - { + for( ; cnt > 0 ; ) { cnt--; struct s1ap_eNB_ue_context_s *ue_context_p = NULL; struct s1ap_eNB_ue_context_s *s1ap_ue_context_p = NULL; @@ -323,25 +313,21 @@ void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa s1ap_mme_data_p->out_streams = 0; s1ap_mme_data_p->assoc_id = -1; - while (!STAILQ_EMPTY(&s1ap_mme_data_p->served_gummei)) - { + while (!STAILQ_EMPTY(&s1ap_mme_data_p->served_gummei)) { gummeiInfo = STAILQ_FIRST(&s1ap_mme_data_p->served_gummei); STAILQ_REMOVE_HEAD(&s1ap_mme_data_p->served_gummei, next); - while (!STAILQ_EMPTY(&gummeiInfo->served_plmns)) - { + while (!STAILQ_EMPTY(&gummeiInfo->served_plmns)) { plmnInfo = STAILQ_FIRST(&gummeiInfo->served_plmns); STAILQ_REMOVE_HEAD(&gummeiInfo->served_plmns, next); free(plmnInfo); } - while (!STAILQ_EMPTY(&gummeiInfo->served_group_ids)) - { + while (!STAILQ_EMPTY(&gummeiInfo->served_group_ids)) { groupInfo = STAILQ_FIRST(&gummeiInfo->served_group_ids); STAILQ_REMOVE_HEAD(&gummeiInfo->served_group_ids, next); free(groupInfo); } - while (!STAILQ_EMPTY(&gummeiInfo->mme_codes)) - { + while (!STAILQ_EMPTY(&gummeiInfo->mme_codes)) { mmeCode = STAILQ_FIRST(&gummeiInfo->mme_codes); STAILQ_REMOVE_HEAD(&gummeiInfo->mme_codes, next); free(mmeCode); @@ -351,45 +337,33 @@ void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa STAILQ_INIT(&s1ap_mme_data_p->served_gummei); - if( s1ap_mme_data_p->state == S1AP_ENB_STATE_DISCONNECTED ) - { + if( s1ap_mme_data_p->state == S1AP_ENB_STATE_DISCONNECTED ) { if( (s1ap_mme_data_p->sctp_req_cnt <= instance_p->sctp_req_count) || - (instance_p->sctp_req_count == 0xffff) ) - { + (instance_p->sctp_req_count == 0xffff) ) { timer_kind = s1ap_mme_data_p->cnx_id; timer_kind = timer_kind | S1AP_MMEIND; timer_kind = timer_kind | SCTP_REQ_WAIT; if( s1ap_timer_setup( instance_p->sctp_req_timer, 0, TASK_S1AP, instance_p->instance, - timer_kind, S1AP_TIMER_ONE_SHOT, NULL, &s1ap_mme_data_p->timer_id) < 0 ) - { + timer_kind, S1AP_TIMER_ONE_SHOT, NULL, &s1ap_mme_data_p->timer_id) < 0 ) { S1AP_ERROR("Timer Start NG(SCTP retransmission wait timer) : MME=%d\n",s1ap_mme_data_p->cnx_id); s1ap_sctp_req( instance_p, s1ap_mme_data_p ); } - } - else - { + } else { S1AP_ERROR("Retransmission count exceeded of SCTP : MME=%d\n",s1ap_mme_data_p->cnx_id); } - } - else - { + } else { S1AP_ERROR("SCTP disconnection reception : MME = %d\n",s1ap_mme_data_p->cnx_id); if( (s1ap_mme_data_p->sctp_req_cnt <= instance_p->sctp_req_count) || - (instance_p->sctp_req_count == 0xffff) ) - { + (instance_p->sctp_req_count == 0xffff) ) { s1ap_sctp_req( instance_p, s1ap_mme_data_p ); - } - else - { + } else { S1AP_ERROR("Retransmission count exceeded of SCTP : MME=%d\n",s1ap_mme_data_p->cnx_id); } s1ap_mme_data_p->state = S1AP_ENB_STATE_DISCONNECTED; } - } - else - { + } else { /* Update parameters */ s1ap_mme_data_p->assoc_id = sctp_new_association_resp->assoc_id; s1ap_mme_data_p->in_streams = sctp_new_association_resp->in_streams; @@ -422,101 +396,81 @@ void s1ap_eNB_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind) { } void s1ap_eNB_timer_expired( - instance_t instance, - s1ap_timer_has_expired_t *msg_p) + instance_t instance, + timer_has_expired_t *msg_p) { - uint32_t timer_kind = 0; - int16_t line_ind = 0; - s1ap_eNB_mme_data_t *mme_desc_p = NULL; - uint32_t timer_ind = 0; - s1ap_eNB_instance_t *instance_p = NULL; - long timer_id = S1AP_TIMERID_INIT; - - instance_p = s1ap_eNB_get_instance(instance); - timer_kind = msg_p->timer_kind; - line_ind = (int16_t)(timer_kind & S1AP_LINEIND); - timer_id = msg_p->timer_id; - - if( (timer_kind & S1AP_MMEIND) == S1AP_MMEIND ) - { - mme_desc_p = s1ap_eNB_get_MME(instance_p, -1, line_ind); - if(mme_desc_p != NULL) + uint32_t timer_kind = 0; + int16_t line_ind = 0; + s1ap_eNB_mme_data_t *mme_desc_p = NULL; + uint32_t timer_ind = 0; + s1ap_eNB_instance_t *instance_p = NULL; + long timer_id = S1AP_TIMERID_INIT; + + instance_p = s1ap_eNB_get_instance(instance); + timer_kind = *((uint32_t*)msg_p->arg); + line_ind = (int16_t)(timer_kind & S1AP_LINEIND); + timer_id = msg_p->timer_id; + + if( (timer_kind & S1AP_MMEIND) == S1AP_MMEIND ) { + mme_desc_p = s1ap_eNB_get_MME(instance_p, -1, line_ind); + if(mme_desc_p != NULL) { + if( timer_id == mme_desc_p->timer_id ) { + mme_desc_p->timer_id = S1AP_TIMERID_INIT; + timer_ind = timer_kind & S1AP_TIMERIND; + + switch(timer_ind) { - if( timer_id == mme_desc_p->timer_id ) - { - mme_desc_p->timer_id = S1AP_TIMERID_INIT; - timer_ind = timer_kind & S1AP_TIMERIND; - - switch(timer_ind) - { - case S1_SETRSP_WAIT: - { - if( (instance_p->s1_setupreq_count >= mme_desc_p->s1_setupreq_cnt) || - (instance_p->s1_setupreq_count == 0xffff) ) - { - s1ap_eNB_generate_s1_setup_request( instance_p, mme_desc_p ); - } - else - { - S1AP_ERROR("Retransmission count exceeded of S1 SETUP REQUEST : MME=%d\n",line_ind); - } - break; - } - case S1_SETREQ_WAIT: - { - if( (instance_p->s1_setupreq_count >= mme_desc_p->s1_setupreq_cnt) || - (instance_p->s1_setupreq_count == 0xffff) ) - { - s1ap_eNB_generate_s1_setup_request( instance_p, mme_desc_p ); - } - else - { - S1AP_ERROR("Retransmission count exceeded of S1 SETUP REQUEST : MME=%d\n",line_ind); - } - break; - } - case SCTP_REQ_WAIT: - { - if( (instance_p->sctp_req_count >= mme_desc_p->sctp_req_cnt) || - (instance_p->sctp_req_count == 0xffff) ) - { - s1ap_sctp_req( instance_p, mme_desc_p ); - } - else - { - S1AP_ERROR("Retransmission count exceeded of SCTP : MME=%d\n",line_ind); - } - break; - } - default: - { - S1AP_WARN("Invalid Timer indication\n"); - break; - } - } + case S1_SETRSP_WAIT: + { + if( (instance_p->s1_setupreq_count >= mme_desc_p->s1_setupreq_cnt) || + (instance_p->s1_setupreq_count == 0xffff) ) { + s1ap_eNB_generate_s1_setup_request( instance_p, mme_desc_p ); + } else { + S1AP_ERROR("Retransmission count exceeded of S1 SETUP REQUEST : MME=%d\n",line_ind); } - else - { - S1AP_DEBUG("Unmatch timer id\n"); - return; + break; + } + case S1_SETREQ_WAIT: + { + if( (instance_p->s1_setupreq_count >= mme_desc_p->s1_setupreq_cnt) || + (instance_p->s1_setupreq_count == 0xffff) ) { + s1ap_eNB_generate_s1_setup_request( instance_p, mme_desc_p ); + } else { + S1AP_ERROR("Retransmission count exceeded of S1 SETUP REQUEST : MME=%d\n",line_ind); } + break; + } + case SCTP_REQ_WAIT: + { + if( (instance_p->sctp_req_count >= mme_desc_p->sctp_req_cnt) || + (instance_p->sctp_req_count == 0xffff) ) { + s1ap_sctp_req( instance_p, mme_desc_p ); + } else { + S1AP_ERROR("Retransmission count exceeded of SCTP : MME=%d\n",line_ind); + } + break; + } + default: + { + S1AP_WARN("Invalid Timer indication\n"); + break; + } } - else - { - S1AP_WARN("Not applicable MME detected : connection id = %d\n", line_ind); - return; - } + } else { + S1AP_DEBUG("Unmatch timer id\n"); + return; + } + } else { + S1AP_WARN("Not applicable MME detected : connection id = %d\n", line_ind); + return; } - else - { - } - return; + } + return; } void s1ap_eNB_init(void) { S1AP_DEBUG("Starting S1AP layer\n"); s1ap_eNB_prepare_internal_data(); - s1ap_timer_init(); itti_mark_task_ready(TASK_S1AP); MSC_START_USE(); } @@ -639,8 +593,8 @@ void *s1ap_eNB_process_itti_msg(void *notUsed) { case TIMER_HAS_EXPIRED: { - s1ap_eNB_timer_expired(ITTI_MESSAGE_GET_INSTANCE(received_msg), - (s1ap_timer_has_expired_t *) &TIMER_HAS_EXPIRED(received_msg)); + s1ap_eNB_timer_expired(ITTI_MSG_DESTINATION_INSTANCE(received_msg), + &received_msg->ittiMsg.timer_has_expired); } break; @@ -781,61 +735,52 @@ static int s1ap_eNB_generate_s1_setup_request( static int s1ap_sctp_req(s1ap_eNB_instance_t *instance_p, s1ap_eNB_mme_data_t *s1ap_mme_data_p) { - MessageDef *message_p = NULL; - sctp_new_association_req_t *sctp_new_association_req_p = NULL; - - if( instance_p == NULL ) - { - S1AP_ERROR("Invalid instance_p\n"); - return -1; + MessageDef *message_p = NULL; + sctp_new_association_req_t *sctp_new_association_req_p = NULL; + + if( instance_p == NULL ) + { + S1AP_ERROR("Invalid instance_p\n"); + return -1; + } + + message_p = itti_alloc_new_message(TASK_S1AP, 0, SCTP_NEW_ASSOCIATION_REQ); + sctp_new_association_req_p = &message_p->ittiMsg.sctp_new_association_req; + sctp_new_association_req_p->port = S1AP_PORT_NUMBER; + sctp_new_association_req_p->ppid = S1AP_SCTP_PPID; + sctp_new_association_req_p->in_streams = instance_p->sctp_in_streams; + sctp_new_association_req_p->out_streams = instance_p->sctp_out_streams; + sctp_new_association_req_p->ulp_cnx_id = s1ap_mme_data_p->cnx_id; + + if( s1ap_mme_data_p->mme_ip_address.ipv4 != 0 ) { + memcpy(&sctp_new_association_req_p->remote_address, + &s1ap_mme_data_p->mme_ip_address, + sizeof(net_ip_address_t)); + if( instance_p->enb_ip_address.ipv4 != 0 ) { + memcpy(&sctp_new_association_req_p->local_address, + &instance_p->enb_ip_address, + sizeof(net_ip_address_t)); + } else { + S1AP_ERROR("Invalid IP Address Format V4(MME):V6\n"); + return -1; } - - message_p = itti_alloc_new_message(TASK_S1AP, SCTP_NEW_ASSOCIATION_REQ); - sctp_new_association_req_p = &message_p->ittiMsg.sctp_new_association_req; - sctp_new_association_req_p->port = S1AP_PORT_NUMBER; - sctp_new_association_req_p->ppid = S1AP_SCTP_PPID; - sctp_new_association_req_p->in_streams = instance_p->sctp_in_streams; - sctp_new_association_req_p->out_streams = instance_p->sctp_out_streams; - sctp_new_association_req_p->ulp_cnx_id = s1ap_mme_data_p->cnx_id; - - if( s1ap_mme_data_p->mme_ip_address.ipv4 != 0 ) - { - memcpy(&sctp_new_association_req_p->remote_address, - &s1ap_mme_data_p->mme_ip_address, - sizeof(net_ip_address_t)); - if( instance_p->enb_ip_address.ipv4 != 0 ) - { - memcpy(&sctp_new_association_req_p->local_address, - &instance_p->enb_ip_address, - sizeof(net_ip_address_t)); - } - else - { - S1AP_ERROR("Invalid IP Address Format V4(MME):V6\n"); - return -1; - } + } else { + memcpy(&sctp_new_association_req_p->remote_address, + &s1ap_mme_data_p->mme_ip_address, + sizeof(net_ip_address_t)); + if( instance_p->enb_ip_address.ipv6 != 0 ) { + memcpy(&sctp_new_association_req_p->local_address, + &instance_p->enb_ip_address, + sizeof(net_ip_address_t)); + } else { + S1AP_ERROR("Invalid IP Address Format V6(MME):V4\n"); + return -1; } - else - { - memcpy(&sctp_new_association_req_p->remote_address, - &s1ap_mme_data_p->mme_ip_address, - sizeof(net_ip_address_t)); - if( instance_p->enb_ip_address.ipv6 != 0 ) - { - memcpy(&sctp_new_association_req_p->local_address, - &instance_p->enb_ip_address, - sizeof(net_ip_address_t)); - } - else - { - S1AP_ERROR("Invalid IP Address Format V6(MME):V4\n"); - return -1; - } - } - - itti_send_msg_to_task(TASK_SCTP, instance_p->instance, message_p); - - s1ap_mme_data_p->sctp_req_cnt++; - - return 0; + } + + itti_send_msg_to_task(TASK_SCTP, instance_p->instance, message_p); + + s1ap_mme_data_p->sctp_req_cnt++; + + return 0; } diff --git a/openair3/S1AP/s1ap_eNB_handlers.c b/openair3/S1AP/s1ap_eNB_handlers.c index ce9e2ce302..7c611b0fbf 100644 --- a/openair3/S1AP/s1ap_eNB_handlers.c +++ b/openair3/S1AP/s1ap_eNB_handlers.c @@ -290,8 +290,7 @@ int s1ap_eNB_handle_s1_setup_failure(uint32_t assoc_id, S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_S1SetupFailureIEs_t, ie, container, S1AP_ProtocolIE_ID_id_Cause,true); - if(ie == NULL) - { + if(ie == NULL) { return -1; } @@ -302,19 +301,16 @@ int s1ap_eNB_handle_s1_setup_failure(uint32_t assoc_id, S1AP_ERROR("Received s1 setup failure for MME... please check your parameters\n"); } - if( mme_desc_p->timer_id != S1AP_TIMERID_INIT ) - { + if( mme_desc_p->timer_id != S1AP_TIMERID_INIT ) { s1ap_timer_remove( mme_desc_p->timer_id ); mme_desc_p->timer_id = S1AP_TIMERID_INIT; } instance_p = mme_desc_p->s1ap_eNB_instance; if( ( instance_p->s1_setupreq_count >= mme_desc_p->s1_setupreq_cnt) || - ( instance_p->s1_setupreq_count == 0xffff) ) - { + ( instance_p->s1_setupreq_count == 0xffff) ) { S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_S1SetupFailureIEs_t, ie, container, S1AP_ProtocolIE_ID_id_TimeToWait, false); - if( ie != NULL ) - { + if( ie != NULL ) { switch(ie->value.choice.TimeToWait) { case S1AP_TimeToWait_v1s: @@ -339,9 +335,7 @@ int s1ap_eNB_handle_s1_setup_failure(uint32_t assoc_id, interval_sec = instance_p->s1_setupreq_wait_timer; break; } - } - else - { + } else { interval_sec = instance_p->s1_setupreq_wait_timer; } @@ -350,16 +344,12 @@ int s1ap_eNB_handle_s1_setup_failure(uint32_t assoc_id, timer_kind = timer_kind | S1_SETREQ_WAIT; if( s1ap_timer_setup(interval_sec, 0, TASK_S1AP, instance_p->instance, timer_kind, S1AP_TIMER_ONE_SHOT, - NULL, &mme_desc_p->timer_id) < 0 ) - { + NULL, &mme_desc_p->timer_id) < 0 ) { S1AP_ERROR("Timer Start NG(S1 Setup Request) : MME=%d\n",mme_desc_p->cnx_id); - s1ap_eNB_snd_s1_setup_request( instance_p, mme_desc_p ); } - } - else - { - S1AP_ERROR("Retransmission count exceeded of S1 SETUP REQUEST : MME=%d\n",mme_desc_p->cnx_id); + } else { + S1AP_ERROR("Retransmission count exceeded of S1 SETUP REQUEST : MME=%d\n",mme_desc_p->cnx_id); } return 0; } @@ -391,16 +381,14 @@ int s1ap_eNB_handle_s1_setup_response(uint32_t assoc_id, /* Set the capacity of this MME */ S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_S1SetupResponseIEs_t, ie, container, S1AP_ProtocolIE_ID_id_RelativeMMECapacity, true); - if(ie == NULL) - { + if(ie == NULL) { return -1; } mme_desc_p->relative_mme_capacity = ie->value.choice.RelativeMMECapacity; S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_S1SetupResponseIEs_t, ie, container, S1AP_ProtocolIE_ID_id_ServedGUMMEIs, true); - if(ie == NULL) - { + if(ie == NULL) { return -1; } @@ -462,13 +450,7 @@ int s1ap_eNB_handle_s1_setup_response(uint32_t assoc_id, STAILQ_INSERT_TAIL(&mme_desc_p->served_gummei, new_gummei_p, next); } - - /* Set the capacity of this MME */ -// S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_S1SetupResponseIEs_t, ie, container, -// S1AP_ProtocolIE_ID_id_RelativeMMECapacity, true); -// -// mme_desc_p->relative_mme_capacity = ie->value.choice.RelativeMMECapacity; -// + /* Optionaly set the mme name */ S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_S1SetupResponseIEs_t, ie, container, S1AP_ProtocolIE_ID_id_MMEname, false); @@ -486,7 +468,6 @@ int s1ap_eNB_handle_s1_setup_response(uint32_t assoc_id, */ mme_desc_p->state = S1AP_ENB_STATE_CONNECTED; mme_desc_p->s1ap_eNB_instance->s1ap_mme_associated_nb ++; -// s1ap_handle_s1_setup_message(mme_desc_p, 0); return 0; } @@ -819,8 +800,7 @@ int s1ap_eNB_handle_error_indication(uint32_t assoc_id, S1AP_ProtocolIE_ID_id_CriticalityDiagnostics, false); if (ie) { - if( ie->value.choice.CriticalityDiagnostics.procedureCode ) - { + if( ie->value.choice.CriticalityDiagnostics.procedureCode ) { S1AP_WARN("Received S1 Error indication CriticalityDiagnostics procedureCode = %ld\n", *ie->value.choice.CriticalityDiagnostics.procedureCode); } // TODO continue @@ -1023,8 +1003,7 @@ int s1ap_eNB_handle_ue_context_release_command(uint32_t assoc_id, S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_UEContextReleaseCommand_IEs_t, ie, container, S1AP_ProtocolIE_ID_id_Cause, true); - if( ie == NULL ) - { + if( ie == NULL ) { S1AP_ERROR( "Mandatory Element Nothing : UEContextReleaseCommand(Cause)\n" ); return -1; } @@ -1076,9 +1055,6 @@ int s1ap_eNB_handle_ue_context_release_command(uint32_t assoc_id, //#warning "TODO mapping mme_ue_s1ap_id enb_ue_s1ap_id?" case S1AP_UE_S1AP_IDs_PR_mME_UE_S1AP_ID: -// mme_ue_s1ap_id = ie->value.choice.UE_S1AP_IDs.choice.uE_S1AP_ID_pair.mME_UE_S1AP_ID; -// S1AP_ERROR("TO DO mapping mme_ue_s1ap_id enb_ue_s1ap_id"); -// (void)mme_ue_s1ap_id; /* TODO: remove - it's to remove gcc warning about unused var */ mme_ue_s1ap_id = ie->value.choice.UE_S1AP_IDs.choice.mME_UE_S1AP_ID; RB_FOREACH(ue_desc_p, s1ap_ue_map, &mme_desc_p->s1ap_eNB_instance->s1ap_ue_head) @@ -1087,7 +1063,7 @@ int s1ap_eNB_handle_ue_context_release_command(uint32_t assoc_id, { enb_ue_s1ap_id = ue_desc_p->eNB_ue_s1ap_id; - message_p = itti_alloc_new_message(TASK_S1AP, S1AP_UE_CONTEXT_RELEASE_COMMAND); + message_p = itti_alloc_new_message(TASK_S1AP, 0, S1AP_UE_CONTEXT_RELEASE_COMMAND); S1AP_UE_CONTEXT_RELEASE_COMMAND(message_p).eNB_ue_s1ap_id = enb_ue_s1ap_id; itti_send_msg_to_task(TASK_RRC_ENB, ue_desc_p->eNB_instance->instance, message_p); diff --git a/openair3/S1AP/s1ap_eNB_management_procedures.c b/openair3/S1AP/s1ap_eNB_management_procedures.c index 1fdc09664b..a870e975a2 100644 --- a/openair3/S1AP/s1ap_eNB_management_procedures.c +++ b/openair3/S1AP/s1ap_eNB_management_procedures.c @@ -102,8 +102,7 @@ struct s1ap_eNB_mme_data_s *s1ap_eNB_get_MME( temp.assoc_id = assoc_id; temp.cnx_id = cnx_id; - if( cnx_id != 0 ) - { + if( cnx_id != 0 ) { if (instance_p == NULL) { STAILQ_FOREACH(instance_p, &s1ap_eNB_internal_data.s1ap_eNB_instances_head, s1ap_eNB_entries) { @@ -116,29 +115,19 @@ struct s1ap_eNB_mme_data_s *s1ap_eNB_get_MME( } else { return RB_FIND(s1ap_mme_map, &instance_p->s1ap_mme_head, &temp); } - } - else - { - if (instance_p == NULL) - { + } else { + if (instance_p == NULL) { STAILQ_FOREACH(instance_p, &s1ap_eNB_internal_data.s1ap_eNB_instances_head, - s1ap_eNB_entries) - { - RB_FOREACH(mme_p, s1ap_mme_map, &instance_p->s1ap_mme_head) - { - if( mme_p->assoc_id == assoc_id ) - { + s1ap_eNB_entries) { + RB_FOREACH(mme_p, s1ap_mme_map, &instance_p->s1ap_mme_head) { + if( mme_p->assoc_id == assoc_id ) { return mme_p; } } } - } - else - { - RB_FOREACH(mme_p, s1ap_mme_map, &instance_p->s1ap_mme_head) - { - if( mme_p->assoc_id == assoc_id ) - { + } else { + RB_FOREACH(mme_p, s1ap_mme_map, &instance_p->s1ap_mme_head) { + if( mme_p->assoc_id == assoc_id ) { return mme_p; } } diff --git a/openair3/S1AP/s1ap_eNB_nas_procedures.c b/openair3/S1AP/s1ap_eNB_nas_procedures.c index 206201089d..b55bc06e11 100644 --- a/openair3/S1AP/s1ap_eNB_nas_procedures.c +++ b/openair3/S1AP/s1ap_eNB_nas_procedures.c @@ -139,8 +139,7 @@ int s1ap_eNB_handle_nas_first_req( */ mme_desc_p = s1ap_eNB_nnsf_select_mme( instance_p, - s1ap_nas_first_req_p->establishment_cause, - s1ap_nas_first_req_p->selected_plmn_identity); + s1ap_nas_first_req_p->establishment_cause); if (mme_desc_p) { S1AP_INFO("[eNB %ld] Chose MME '%s' (assoc_id %d) through highest relative capacity\n", @@ -233,9 +232,9 @@ int s1ap_eNB_handle_nas_first_req( MACRO_ENB_ID_TO_CELL_IDENTITY(instance_p->eNB_id, 0, // Cell ID &ie->value.choice.EUTRAN_CGI.cell_ID); - MCC_MNC_TO_TBCD(instance_p->mcc[mme_desc_p->broadcast_plmn_index[0]], - instance_p->mnc[mme_desc_p->broadcast_plmn_index[0]], - instance_p->mnc_digit_length[mme_desc_p->broadcast_plmn_index[0]], + MCC_MNC_TO_TBCD(instance_p->mcc[ue_desc_p->selected_plmn_identity], + instance_p->mnc[ue_desc_p->selected_plmn_identity], + instance_p->mnc_digit_length[ue_desc_p->selected_plmn_identity], &ie->value.choice.EUTRAN_CGI.pLMNidentity); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* Set the establishment cause according to those provided by RRC */ diff --git a/openair3/S1AP/s1ap_eNB_nnsf.c b/openair3/S1AP/s1ap_eNB_nnsf.c index 6577b8f10b..a5a4e74734 100644 --- a/openair3/S1AP/s1ap_eNB_nnsf.c +++ b/openair3/S1AP/s1ap_eNB_nnsf.c @@ -36,17 +36,18 @@ #include "s1ap_eNB_defs.h" #include "s1ap_eNB_nnsf.h" + +typedef struct MME_nnsf_inf { + struct s1ap_eNB_mme_data_s *mme_p; + uint64_t weight; +} MME_nnsf_inf_t; + struct s1ap_eNB_mme_data_s * s1ap_eNB_nnsf_select_mme(s1ap_eNB_instance_t *instance_p, - rrc_establishment_cause_t cause, - uint32_t plmn_id) + rrc_establishment_cause_t cause) { struct s1ap_eNB_mme_data_s *mme_data_p = NULL; struct s1ap_eNB_mme_data_s *mme_highest_capacity_p = NULL; - typedef struct MME_nnsf_inf { - struct s1ap_eNB_mme_data_s *mme_p; - uint64_t weight; - } MME_nnsf_inf_t; uint16_t capacity_sum = 0; MME_nnsf_inf_t mme_inf[10]; @@ -55,9 +56,8 @@ s1ap_eNB_nnsf_select_mme(s1ap_eNB_instance_t *instance_p, uint64_t weight = 0; memset(mme_inf, 0, sizeof(mme_inf)); - + RB_FOREACH(mme_data_p, s1ap_mme_map, &instance_p->s1ap_mme_head) { - struct served_gummei_s *gummei_p = NULL; capacity_sum = capacity_sum + mme_data_p->relative_mme_capacity; if (mme_data_p->state != S1AP_ENB_STATE_CONNECTED) { /* The association between MME and eNB is not ready for the moment, @@ -83,7 +83,8 @@ s1ap_eNB_nnsf_select_mme(s1ap_eNB_instance_t *instance_p, || (cause == RRC_CAUSE_HIGH_PRIO_ACCESS))) { continue; } - + mme_inf[nb_mme].mme_p = mme_data_p; + nb_mme++; /* At this point, the RRC establishment can be handled by the MME * even if it is in overload state. */ @@ -92,58 +93,27 @@ s1ap_eNB_nnsf_select_mme(s1ap_eNB_instance_t *instance_p, continue; } } - - gummei_p = mme_data_p->served_gummei.stqh_first; - if( gummei_p != NULL ) - { - struct plmn_identity_s *served_plmns_p = NULL; - - served_plmns_p = gummei_p->served_plmns.stqh_first; - if( served_plmns_p != 0 ) - for( cnt = 0 ; cnt < 8 ; cnt++) - { - if ( (served_plmns_p->mcc == instance_p->mcc[plmn_id]) && - (served_plmns_p->mnc == instance_p->mnc[plmn_id]) ) - { - mme_inf[nb_mme].mme_p = mme_data_p; - nb_mme++; - break; - } - if( served_plmns_p->next.stqe_next == 0 ) - { - break; - } - served_plmns_p = served_plmns_p->next.stqe_next; - } - } } - if( nb_mme != 0 ) - { - for( cnt = 0 ; cnt < nb_mme ; cnt++ ) - { + + if( nb_mme != 0 ) { + for( cnt = 0 ; cnt < nb_mme ; cnt++ ) { mme_inf[cnt].weight = (capacity_sum*10)/mme_inf[cnt].mme_p->relative_mme_capacity; mme_inf[cnt].weight = (mme_inf[cnt].weight)*(mme_inf[cnt].mme_p->nb_calls + 1); } mme_highest_capacity_p = mme_inf[0].mme_p; weight = mme_inf[0].weight; - for( cnt = 1 ; cnt < nb_mme ; cnt++ ) - { - if( weight > mme_inf[cnt].weight ) - { + for( cnt = 1 ; cnt < nb_mme ; cnt++ ) { + if( weight > mme_inf[cnt].weight ) { mme_highest_capacity_p = mme_inf[cnt].mme_p; weight = mme_inf[cnt].weight; } } - } - else - { + } else { mme_highest_capacity_p = NULL; } - if( mme_highest_capacity_p != NULL ) - { + if( mme_highest_capacity_p != NULL ) { mme_highest_capacity_p->nb_calls++; } - return mme_highest_capacity_p; } @@ -154,8 +124,15 @@ s1ap_eNB_nnsf_select_mme_by_plmn_id(s1ap_eNB_instance_t *instance_p, { struct s1ap_eNB_mme_data_s *mme_data_p = NULL; struct s1ap_eNB_mme_data_s *mme_highest_capacity_p = NULL; - uint8_t current_capacity = 0; - + + uint16_t capacity_sum = 0; + MME_nnsf_inf_t mme_inf[10]; + int cnt; + int nb_mme = 0; + uint64_t weight = 0; + + memset(mme_inf, 0, sizeof(mme_inf)); + RB_FOREACH(mme_data_p, s1ap_mme_map, &instance_p->s1ap_mme_head) { struct served_gummei_s *gummei_p = NULL; struct plmn_identity_s *served_plmn_p = NULL; @@ -198,6 +175,8 @@ s1ap_eNB_nnsf_select_mme_by_plmn_id(s1ap_eNB_instance_t *instance_p, STAILQ_FOREACH(served_plmn_p, &gummei_p->served_plmns, next) { if ((served_plmn_p->mcc == instance_p->mcc[selected_plmn_identity]) && (served_plmn_p->mnc == instance_p->mnc[selected_plmn_identity])) { + mme_inf[nb_mme].mme_p = mme_data_p; + nb_mme++; break; } } @@ -206,14 +185,27 @@ s1ap_eNB_nnsf_select_mme_by_plmn_id(s1ap_eNB_instance_t *instance_p, } /* if we didn't find such a served PLMN, go on with the next MME */ if (!served_plmn_p) continue; - - if (current_capacity < mme_data_p->relative_mme_capacity) { - /* We find a better MME, keep a reference to it */ - current_capacity = mme_data_p->relative_mme_capacity; - mme_highest_capacity_p = mme_data_p; - } } + if( nb_mme != 0 ) { + for( cnt = 0 ; cnt < nb_mme ; cnt++ ) { + mme_inf[cnt].weight = (capacity_sum*10)/mme_inf[cnt].mme_p->relative_mme_capacity; + mme_inf[cnt].weight = (mme_inf[cnt].weight)*(mme_inf[cnt].mme_p->nb_calls + 1); + } + mme_highest_capacity_p = mme_inf[0].mme_p; + weight = mme_inf[0].weight; + for( cnt = 1 ; cnt < nb_mme ; cnt++ ) { + if( weight > mme_inf[cnt].weight ) { + mme_highest_capacity_p = mme_inf[cnt].mme_p; + weight = mme_inf[cnt].weight; + } + } + } else { + mme_highest_capacity_p = NULL; + } + if( mme_highest_capacity_p != NULL ) { + mme_highest_capacity_p->nb_calls++; + } return mme_highest_capacity_p; } diff --git a/openair3/S1AP/s1ap_eNB_nnsf.h b/openair3/S1AP/s1ap_eNB_nnsf.h index de039b7d30..d5f080649b 100644 --- a/openair3/S1AP/s1ap_eNB_nnsf.h +++ b/openair3/S1AP/s1ap_eNB_nnsf.h @@ -24,8 +24,7 @@ struct s1ap_eNB_mme_data_s * s1ap_eNB_nnsf_select_mme(s1ap_eNB_instance_t *instance_p, - rrc_establishment_cause_t cause, - uint32_t plmn_id); + rrc_establishment_cause_t cause); struct s1ap_eNB_mme_data_s * s1ap_eNB_nnsf_select_mme_by_plmn_id(s1ap_eNB_instance_t *instance_p, diff --git a/openair3/S1AP/s1ap_eNB_timer.c b/openair3/S1AP/s1ap_eNB_timer.c index ccb294cb54..3014f961a9 100644 --- a/openair3/S1AP/s1ap_eNB_timer.c +++ b/openair3/S1AP/s1ap_eNB_timer.c @@ -36,91 +36,6 @@ #include "queue.h" #include "s1ap_common.h" -struct s1ap_timer_elm_s { - task_id_t task_id; ///< Task ID which has requested the timer - int32_t instance; ///< Instance of the task which has requested the timer - uint32_t timer_kind; ///< Instance of the task which has requested the timer - timer_t timer; ///< Unique timer id - timer_type_t type; ///< Timer type - void *timer_arg; ///< Optional argument that will be passed when timer expires - STAILQ_ENTRY(s1ap_timer_elm_s) entries; ///< Pointer to next element -}; - -typedef struct timer_desc_s { - STAILQ_HEAD(timer_list_head, s1ap_timer_elm_s) timer_queue; - pthread_mutex_t timer_list_mutex; - struct timespec timeout; -} timer_desc_t; - -static timer_desc_t timer_desc; - -#define TIMER_SEARCH(vAR, tIMERfIELD, tIMERvALUE, tIMERqUEUE) \ -do { \ - STAILQ_FOREACH(vAR, tIMERqUEUE, entries) { \ - if (((vAR)->tIMERfIELD == tIMERvALUE)) \ - break; \ - } \ -} while(0) - -int s1ap_timer_timeout(sigval_t info) -{ - struct s1ap_timer_elm_s *timer_p; - MessageDef *message_p; - s1ap_timer_has_expired_t *timer_expired_p; - task_id_t task_id; - int32_t instance; - uint32_t timer_kind; - - timer_kind = info.sival_int; - if( pthread_mutex_lock(&timer_desc.timer_list_mutex) != 0 ) - { - S1AP_ERROR("Failed to mutex lock timeout=%x\n", timer_kind); - - return -1; - } - TIMER_SEARCH(timer_p, timer_kind, timer_kind, &timer_desc.timer_queue); - - if( pthread_mutex_unlock(&timer_desc.timer_list_mutex) != 0 ) - { - S1AP_ERROR("Failed to mutex unlock timeout=0x%x\n", timer_kind); - } - if (timer_p == NULL) - { - S1AP_ERROR("Didn't find timer 0x%x in list\n", timer_kind); - - return -1; - } - S1AP_DEBUG("Timer kind 0x%x has expired\n", timer_kind); - - task_id = timer_p->task_id; - instance = timer_p->instance; - message_p = itti_alloc_new_message(TASK_UNKNOWN, TIMER_HAS_EXPIRED); - - timer_expired_p = (s1ap_timer_has_expired_t *)(&message_p->ittiMsg.timer_has_expired); - - timer_expired_p->timer_id = (long)timer_p->timer; - timer_expired_p->timer_kind = timer_p->timer_kind; - timer_expired_p->arg = timer_p->timer_arg; - - /* Timer is a one shot timer, remove it */ - if( (int)timer_p->type == (int)S1AP_TIMER_ONE_SHOT ) - { - if( s1ap_timer_remove((long)timer_p->timer) != 0 ) - { - S1AP_DEBUG("Failed to delete timer 0x%lx\n", (long)timer_p->timer); - } - } - - /* Notify task of timer expiry */ - if( itti_send_msg_to_task(task_id, instance, message_p) < 0 ) - { - S1AP_ERROR("Failed to send msg TIMER_HAS_EXPIRED to task %u\n", task_id); - free(message_p); - return -1; - } - - return 0; -} int s1ap_timer_setup( uint32_t interval_sec, @@ -132,169 +47,24 @@ int s1ap_timer_setup( void *timer_arg, long *timer_id) { - struct sigevent evp; - struct itimerspec its; - struct s1ap_timer_elm_s *timer_p; - timer_t timer; - - if( timer_id == NULL ) - { - S1AP_ERROR("Invalid timer_id\n"); - return -1; - } - - if( (int)type >= (int)S1AP_TIMER_TYPE_MAX ) - { - S1AP_ERROR("Invalid timer type (%d/%d)!\n", type, TIMER_TYPE_MAX); - return -1; - } - - if( *timer_id != S1AP_TIMERID_INIT ) - { - if( s1ap_timer_remove(*timer_id) != 0 ) - { - S1AP_ERROR("Failed to delete timer when the timer start 0x%lx\n", *timer_id); - } - } - - /* Allocate new timer list element */ - timer_p = malloc(sizeof(struct s1ap_timer_elm_s)); - - if( timer_p == NULL ) - { - S1AP_ERROR("Failed to create new timer element\n"); - return -1; - } - - memset(&timer, 0, sizeof(timer_t)); - memset(&evp, 0, sizeof(evp)); - - timer_p->task_id = task_id; - timer_p->instance = instance; - timer_p->timer_kind = timer_kind; - timer_p->type = type; - timer_p->timer_arg = timer_arg; - - evp.sigev_notify = (int)SIGEV_THREAD; - evp.sigev_notify_function = (void *)s1ap_timer_timeout; - evp.sigev_signo = SIGRTMIN; - evp.sigev_notify_attributes = NULL; - evp.sigev_value.sival_int = timer_kind; - - /* At the timer creation, the timer structure will be filled in with timer_id, - * which is unique for this process. This id is allocated by kernel and the - * value might be used to distinguish timers. - */ - if( timer_create(CLOCK_REALTIME, &evp, &timer) < 0 ) - { - S1AP_ERROR("Failed to create timer: (%s:%d)\n", strerror(errno), errno); - free(timer_p); - return -1; - } - - /* Fill in the first expiration value. */ - its.it_value.tv_sec = interval_sec; - its.it_value.tv_nsec = interval_us * 1000; - - if( (int)type == (int)S1AP_TIMER_PERIODIC ) - { - /* Asked for periodic timer. We set the interval time */ - its.it_interval.tv_sec = interval_sec; - its.it_interval.tv_nsec = interval_us * 1000; - } - else - { - /* Asked for one-shot timer. Do not set the interval field */ - its.it_interval.tv_sec = 0; - its.it_interval.tv_nsec = 0; - } - - if( timer_settime(timer, 0, &its, NULL) ) - { - S1AP_ERROR("Failed to Settimer: (%s:%d)\n", strerror(errno), errno); - free(timer_p); - return -1; - } - - /* Simply set the timer_id argument. so it can be used by caller */ - *timer_id = (long)timer; - - timer_p->timer = timer; - - /* Lock the queue and insert the timer at the tail */ - if( pthread_mutex_lock(&timer_desc.timer_list_mutex) != 0 ) - { - S1AP_ERROR("Failed to mutex lock\n"); - if( timer_delete(timer_p->timer) < 0 ) - { - S1AP_ERROR("Failed to delete timer 0x%lx\n", (long)timer_p->timer); - } - free(timer_p); - timer_p = NULL; - - return -1; - } - - STAILQ_INSERT_TAIL(&timer_desc.timer_queue, timer_p, entries); - if( pthread_mutex_unlock(&timer_desc.timer_list_mutex) != 0 ) - { - S1AP_ERROR("Failed to mutex unlock\n"); - } - - return 0; + uint32_t *timeoutArg=NULL; + int ret=0; + timeoutArg=malloc(sizeof(uint32_t)); + *timeoutArg=timer_kind; + ret=timer_setup(interval_sec, + interval_us, + task_id, + instance, + type, + (void*)timeoutArg, + timer_id); + return ret; } int s1ap_timer_remove(long timer_id) { - int rc = 0; - struct s1ap_timer_elm_s *timer_p; - - - if( pthread_mutex_lock(&timer_desc.timer_list_mutex) != 0 ) - { - S1AP_ERROR("Failed to mutex lock\n"); - if( timer_delete((timer_t)timer_id) < 0 ) - { - S1AP_ERROR("Failed to delete timer 0x%lx\n", (long)timer_id); - } - - return -1; - } - - TIMER_SEARCH(timer_p, timer, ((timer_t)timer_id), &timer_desc.timer_queue); - - /* We didn't find the timer in list */ - if (timer_p == NULL) - { - S1AP_ERROR("Didn't find timer 0x%lx in list\n", timer_id); - if( pthread_mutex_unlock(&timer_desc.timer_list_mutex) != 0 ) - { - S1AP_ERROR("Failed to mutex unlock\n"); - } - - return -1; - } - - timer_delete(timer_p->timer); - - STAILQ_REMOVE(&timer_desc.timer_queue, timer_p, s1ap_timer_elm_s, entries); - - if( pthread_mutex_unlock(&timer_desc.timer_list_mutex) != 0 ) - { - S1AP_ERROR("Failed to mutex unlock\n"); - } - - free(timer_p); - timer_p = NULL; - return rc; + int ret; + ret=timer_remove(timer_id); + return ret; } -int s1ap_timer_init(void) -{ - memset(&timer_desc, 0, sizeof(timer_desc_t)); - - STAILQ_INIT(&timer_desc.timer_queue); - pthread_mutex_init(&timer_desc.timer_list_mutex, NULL); - - return 0; -} From a2e2968244bb389927cf58b1552a0e423aa3dacd Mon Sep 17 00:00:00 2001 From: cig Date: Tue, 9 Mar 2021 10:06:33 +0100 Subject: [PATCH 166/231] Fix after review MR 1039 - use LOG_D for debug logging --- openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c b/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c index 7f1ad13c8e..10ac23bef0 100644 --- a/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c +++ b/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c @@ -78,7 +78,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, uint16_t nb_rb_pusch = pusch_pdu->rb_size; #ifdef DEBUG_CH - LOG_I(PHY, "In %s: ch_offset %d, symbol_offset %d OFDM size %d, Ns = %d, k = %d symbol %d\n", + LOG_D(PHY, "In %s: ch_offset %d, symbol_offset %d OFDM size %d, Ns = %d, k = %d symbol %d\n", __FUNCTION__, ch_offset, symbol_offset, From 443a44911996d4facbb785b17eabf8d4e2d4aa45 Mon Sep 17 00:00:00 2001 From: cig Date: Tue, 9 Mar 2021 10:20:58 +0100 Subject: [PATCH 167/231] Fix after review MR 1039 - FAPI structures not to be used as config_req at MAC since that FAPI is just for communication between MAC and PHY - additional frame_type member added to the FAPI struct --- openair2/LAYER2/NR_MAC_UE/config_ue.c | 6 +++--- openair2/LAYER2/NR_MAC_UE/mac_defs.h | 2 ++ openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c | 4 ++-- openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index 4910588ab3..fee2efc4a8 100755 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -203,12 +203,12 @@ void config_common_ue(NR_UE_MAC_INST_t *mac, uint32_t band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; frequency_range_t frequency_range = band<100?FR1:FR2; - lte_frame_type_t frame_type = get_frame_type(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing); + mac->frame_type = get_frame_type(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing); // cell config cfg->cell_config.phy_cell_id = *scc->physCellId; - cfg->cell_config.frame_duplex_type = frame_type; + cfg->cell_config.frame_duplex_type = mac->frame_type; // SSB config cfg->ssb_config.ss_pbch_power = scc->ss_PBCH_BlockPower; @@ -312,7 +312,7 @@ void config_common_ue(NR_UE_MAC_INST_t *mac, cfg->prach_config.num_prach_fd_occasions_list[i].k1 = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FrequencyStart; cfg->prach_config.num_prach_fd_occasions_list[i].prach_zero_corr_conf = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.zeroCorrelationZoneConfig; - cfg->prach_config.num_prach_fd_occasions_list[i].num_root_sequences = compute_nr_root_seq(scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup, nb_preambles, frame_type,frequency_range); + cfg->prach_config.num_prach_fd_occasions_list[i].num_root_sequences = compute_nr_root_seq(scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup, nb_preambles, mac->frame_type, frequency_range); //cfg->prach_config.num_prach_fd_occasions_list[i].num_unused_root_sequences = ??? } diff --git a/openair2/LAYER2/NR_MAC_UE/mac_defs.h b/openair2/LAYER2/NR_MAC_UE/mac_defs.h index dd0aa15c52..3e299d291e 100755 --- a/openair2/LAYER2/NR_MAC_UE/mac_defs.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_defs.h @@ -325,6 +325,8 @@ typedef struct { NR_ControlResourceSet_t *coreset[MAX_NUM_BWP][FAPI_NR_MAX_CORESET_PER_BWP]; NR_SearchSpace_t *SSpace[MAX_NUM_BWP][FAPI_NR_MAX_CORESET_PER_BWP][FAPI_NR_MAX_SS_PER_CORESET]; + lte_frame_type_t frame_type; + /*BWP*/ // dedicated active DL BWP NR_BWP_Id_t DL_BWP_Id; diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index 66b5c7a697..dc3c84d326 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -121,7 +121,7 @@ long get_k2(NR_UE_MAC_INST_t *mac, uint8_t time_domain_ind) { fapi_nr_ul_config_request_t *get_ul_config_request(NR_UE_MAC_INST_t *mac, int slot) { //Check if request to access ul_config is for a UL slot - if (is_nr_UL_slot(mac->scc, slot, mac->phy_config.config_req.cell_config.frame_duplex_type) == 0) { + if (is_nr_UL_slot(mac->scc, slot, mac->frame_type) == 0) { LOG_W(MAC, "Slot %d is not a UL slot. %s called for wrong slot!!!\n", slot, __FUNCTION__); return NULL; } @@ -1663,7 +1663,7 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s ra->RA_offset = 2; // to compensate the rx frame offset at the gNB ra->generate_nr_prach = 0; // Reset flag for PRACH generation - if (is_nr_UL_slot(scc, slotP, mac->phy_config.config_req.cell_config.frame_duplex_type)) { + if (is_nr_UL_slot(scc, slotP, mac->frame_type)) { // WIP Need to get the proper selected ssb_idx // Initial beam selection functionality is not available yet diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index 4956f955b9..653bba0c0a 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -90,7 +90,7 @@ int nr_ue_ul_indication(nr_uplink_indication_t *ul_info){ ret = nr_ue_scheduler(NULL, ul_info); - if (is_nr_UL_slot(mac->scc, ul_info->slot_tx, mac->phy_config.config_req.cell_config.frame_duplex_type) && get_softmodem_params()->do_ra) + if (is_nr_UL_slot(mac->scc, ul_info->slot_tx, mac->frame_type) && get_softmodem_params()->do_ra) nr_ue_prach_scheduler(module_id, ul_info->frame_tx, ul_info->slot_tx, ul_info->thread_id); switch(ret){ From feaccd964cad38389525124d386422b2c6ea5911 Mon Sep 17 00:00:00 2001 From: francescomani Date: Tue, 9 Mar 2021 11:12:16 +0100 Subject: [PATCH 168/231] change a log to D from I --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 30bd2d4195..94524795f3 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -699,7 +699,7 @@ void nr_configure_pucch(nfapi_nr_pucch_pdu_t* pucch_pdu, n_set = pucch_Config->resourceSetToAddModList->list.count; AssertFatal(n_set>0,"PUCCH resourceSetToAddModList is empty\n"); - LOG_I(MAC, "UCI n_set= %d\n", n_set); + LOG_D(MAC, "UCI n_set= %d\n", n_set); N2 = 2; // procedure to select pucch resource id from resource sets according to From 2cf4daefa827b3d875c6afe7acc108c838f4d61f Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Tue, 9 Mar 2021 11:56:06 +0100 Subject: [PATCH 169/231] NR: move nr_bandtable from nr_mac_common.c to nr_common.c so PHY can use it, too --- common/utils/nr/nr_common.c | 75 +++++++++++++++++ common/utils/nr/nr_common.h | 14 ++++ openair1/PHY/INIT/nr_init.c | 1 + openair1/PHY/defs_nr_common.h | 16 ---- openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c | 80 +------------------ openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h | 4 - 6 files changed, 93 insertions(+), 97 deletions(-) diff --git a/common/utils/nr/nr_common.c b/common/utils/nr/nr_common.c index 5f07fc00aa..0671aed813 100644 --- a/common/utils/nr/nr_common.c +++ b/common/utils/nr/nr_common.c @@ -32,6 +32,81 @@ #include #include "assertions.h" +#include "nr_common.h" + +// Table 5.2-1 NR operating bands in FR1 & FR2 (3GPP TS 38.101) +// Table 5.4.2.3-1 Applicable NR-ARFCN per operating band in FR1 & FR2 (3GPP TS 38.101) +// Notes: +// - N_OFFs for bands from 80 to 89 and band 95 is referred to UL +// - Frequencies are expressed in KHz +// - col: NR_band ul_min ul_max dl_min dl_max step N_OFFs_DL deltaf_raster +nr_bandentry_t nr_bandtable[] = { + {1, 1920000, 1980000, 2110000, 2170000, 20, 422000, 100}, + {2, 1850000, 1910000, 1930000, 1990000, 20, 386000, 100}, + {3, 1710000, 1785000, 1805000, 1880000, 20, 361000, 100}, + {5, 824000, 849000, 869000, 894000, 20, 173800, 100}, + {7, 2500000, 2570000, 2620000, 2690000, 20, 524000, 100}, + {8, 880000, 915000, 925000, 960000, 20, 185000, 100}, + {12, 698000, 716000, 729000, 746000, 20, 145800, 100}, + {14, 788000, 798000, 758000, 768000, 20, 151600, 100}, + {18, 815000, 830000, 860000, 875000, 20, 172000, 100}, + {20, 832000, 862000, 791000, 821000, 20, 158200, 100}, + {25, 1850000, 1915000, 1930000, 1995000, 20, 386000, 100}, + {26, 814000, 849000, 859000, 894000, 20, 171800, 100}, + {28, 703000, 758000, 758000, 813000, 20, 151600, 100}, + {29, 000, 000, 717000, 728000, 20, 143400, 100}, + {30, 2305000, 2315000, 2350000, 2360000, 20, 470000, 100}, + {34, 2010000, 2025000, 2010000, 2025000, 20, 402000, 100}, + {38, 2570000, 2620000, 2570000, 2630000, 20, 514000, 100}, + {39, 1880000, 1920000, 1880000, 1920000, 20, 376000, 100}, + {40, 2300000, 2400000, 2300000, 2400000, 20, 460000, 100}, + {41, 2496000, 2690000, 2496000, 2690000, 3, 499200, 15}, + {41, 2496000, 2690000, 2496000, 2690000, 6, 499200, 30}, + {47, 5855000, 5925000, 5855000, 5925000, 1, 790334, 15}, + //{48, 3550000, 3700000, 3550000, 3700000, 1, 636667, 15}, + //{48, 3550000, 3700000, 3550000, 3700000, 2, 636668, 30}, + {50, 1432000, 1517000, 1432000, 1517000, 20, 286400, 100}, + {51, 1427000, 1432000, 1427000, 1432000, 20, 285400, 100}, + {53, 2483500, 2495000, 2483500, 2495000, 20, 496700, 100}, + {65, 1920000, 2010000, 2110000, 2200000, 20, 422000, 100}, + {66, 1710000, 1780000, 2110000, 2200000, 20, 422000, 100}, + {70, 1695000, 1710000, 1995000, 2020000, 20, 399000, 100}, + {71, 663000, 698000, 617000, 652000, 20, 123400, 100}, + {74, 1427000, 1470000, 1475000, 1518000, 20, 295000, 100}, + {75, 000, 000, 1432000, 1517000, 20, 286400, 100}, + {76, 000, 000, 1427000, 1432000, 20, 285400, 100}, + {77, 3300000, 4200000, 3300000, 4200000, 1, 620000, 15}, + {77, 3300000, 4200000, 3300000, 4200000, 2, 620000, 30}, + {78, 3300000, 3800000, 3300000, 3800000, 1, 620000, 15}, + {78, 3300000, 3800000, 3300000, 3800000, 2, 620000, 30}, + {79, 4400010, 5000000, 4400010, 5000000, 1, 693334, 15}, + {79, 4400010, 5000000, 4400010, 5000000, 2, 693334, 30}, + {80, 1710000, 1785000, 000, 000, 20, 342000, 100}, + {81, 880000, 915000, 000, 000, 20, 176000, 100}, + {82, 832000, 862000, 000, 000, 20, 166400, 100}, + {83, 703000, 748000, 000, 000, 20, 140600, 100}, + {84, 1920000, 1980000, 000, 000, 20, 384000, 100}, + {86, 1710000, 1785000, 000, 000, 20, 342000, 100}, + {89, 824000, 849000, 000, 000, 20, 342000, 100}, + {90, 2496000, 2690000, 2496000, 2690000, 3, 499200, 15}, + {90, 2496000, 2690000, 2496000, 2690000, 6, 499200, 30}, + {90, 2496000, 2690000, 2496000, 2690000, 20, 499200, 100}, + {91, 832000, 862000, 1427000, 1432000, 20, 285400, 100}, + {92, 832000, 862000, 1432000, 1517000, 20, 286400, 100}, + {93, 880000, 915000, 1427000, 1432000, 20, 285400, 100}, + {94, 880000, 915000, 1432000, 1517000, 20, 286400, 100}, + {95, 2010000, 2025000, 000, 000, 20, 402000, 100}, + {257,26500020,29500000,26500020,29500000, 1,2054166, 60}, + {257,26500080,29500000,26500080,29500000, 2,2054167, 120}, + {258,24250080,27500000,24250080,27500000, 1,2016667, 60}, + {258,24250080,27500000,24250080,27500000, 2,2016667, 120}, + {260,37000020,40000000,37000020,40000000, 1,2229166, 60}, + {260,37000080,40000000,37000080,40000000, 2,2229167, 120}, + {261,27500040,28350000,27500040,28350000, 1,2070833, 60}, + {261,27500040,28350000,27500040,28350000, 2,2070833, 120} +}; + +const size_t nr_bandtable_size = sizeof(nr_bandtable) / sizeof(nr_bandentry_t); int NRRIV2BW(int locationAndBandwidth,int N_RB) { int tmp = locationAndBandwidth/N_RB; diff --git a/common/utils/nr/nr_common.h b/common/utils/nr/nr_common.h index 5601c0fcbf..6389c2c094 100644 --- a/common/utils/nr/nr_common.h +++ b/common/utils/nr/nr_common.h @@ -36,6 +36,20 @@ #include #include "assertions.h" +typedef struct nr_bandentry_s { + int16_t band; + uint64_t ul_min; + uint64_t ul_max; + uint64_t dl_min; + uint64_t dl_max; + uint64_t step_size; + uint64_t N_OFFs_DL; + uint8_t deltaf_raster; +} nr_bandentry_t; + +extern const size_t nr_bandtable_size; +extern nr_bandentry_t nr_bandtable[]; + int NRRIV2BW(int locationAndBandwidth,int N_RB); int NRRIV2PRBOFFSET(int locationAndBandwidth,int N_RB); int PRBalloc_to_locationandbandwidth0(int NPRB,int RBstart,int BWPsize); diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index d5e0da5c70..ab363fcae4 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -20,6 +20,7 @@ */ #include "executables/nr-softmodem-common.h" +#include "common/utils/nr/nr_common.h" #include "PHY/defs_gNB.h" #include "PHY/phy_extern.h" #include "PHY/NR_REFSIG/nr_refsig.h" diff --git a/openair1/PHY/defs_nr_common.h b/openair1/PHY/defs_nr_common.h index 9458833427..398252c37b 100644 --- a/openair1/PHY/defs_nr_common.h +++ b/openair1/PHY/defs_nr_common.h @@ -369,20 +369,4 @@ struct NR_DL_FRAME_PARMS { #define KHz (1000UL) #define MHz (1000*KHz) -typedef struct nr_bandentry_s { - int16_t band; - uint64_t ul_min; - uint64_t ul_max; - uint64_t dl_min; - uint64_t dl_max; - uint64_t step_size; - uint64_t N_OFFs_DL; - uint8_t deltaf_raster; -} nr_bandentry_t; - -typedef struct nr_band_info_s { - int nbands; - nr_bandentry_t band_info[100]; -} nr_band_info_t; - #endif diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index 72c113e86e..ce4e0f81f3 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -31,6 +31,7 @@ */ #include "LAYER2/NR_MAC_gNB/mac_proto.h" +#include "common/utils/nr/nr_common.h" #include #define reserved 0xffff @@ -1577,81 +1578,6 @@ uint8_t compute_nr_root_seq(NR_RACH_ConfigCommon_t *rach_config, } } -// Table 5.2-1 NR operating bands in FR1 & FR2 (3GPP TS 38.101) -// Table 5.4.2.3-1 Applicable NR-ARFCN per operating band in FR1 & FR2 (3GPP TS 38.101) -// Notes: -// - N_OFFs for bands from 80 to 89 and band 95 is referred to UL -// - Frequencies are expressed in KHz -// - col: NR_band ul_min ul_max dl_min dl_max step N_OFFs_DL deltaf_raster -nr_bandentry_t nr_bandtable[] = { - {1, 1920000, 1980000, 2110000, 2170000, 20, 422000, 100}, - {2, 1850000, 1910000, 1930000, 1990000, 20, 386000, 100}, - {3, 1710000, 1785000, 1805000, 1880000, 20, 361000, 100}, - {5, 824000, 849000, 869000, 894000, 20, 173800, 100}, - {7, 2500000, 2570000, 2620000, 2690000, 20, 524000, 100}, - {8, 880000, 915000, 925000, 960000, 20, 185000, 100}, - {12, 698000, 716000, 729000, 746000, 20, 145800, 100}, - {14, 788000, 798000, 758000, 768000, 20, 151600, 100}, - {18, 815000, 830000, 860000, 875000, 20, 172000, 100}, - {20, 832000, 862000, 791000, 821000, 20, 158200, 100}, - {25, 1850000, 1915000, 1930000, 1995000, 20, 386000, 100}, - {26, 814000, 849000, 859000, 894000, 20, 171800, 100}, - {28, 703000, 758000, 758000, 813000, 20, 151600, 100}, - {29, 000, 000, 717000, 728000, 20, 143400, 100}, - {30, 2305000, 2315000, 2350000, 2360000, 20, 470000, 100}, - {34, 2010000, 2025000, 2010000, 2025000, 20, 402000, 100}, - {38, 2570000, 2620000, 2570000, 2630000, 20, 514000, 100}, - {39, 1880000, 1920000, 1880000, 1920000, 20, 376000, 100}, - {40, 2300000, 2400000, 2300000, 2400000, 20, 460000, 100}, - {41, 2496000, 2690000, 2496000, 2690000, 3, 499200, 15}, - {41, 2496000, 2690000, 2496000, 2690000, 6, 499200, 30}, - {47, 5855000, 5925000, 5855000, 5925000, 1, 790334, 15}, - //{48, 3550000, 3700000, 3550000, 3700000, 1, 636667, 15}, - //{48, 3550000, 3700000, 3550000, 3700000, 2, 636668, 30}, - {50, 1432000, 1517000, 1432000, 1517000, 20, 286400, 100}, - {51, 1427000, 1432000, 1427000, 1432000, 20, 285400, 100}, - {53, 2483500, 2495000, 2483500, 2495000, 20, 496700, 100}, - {65, 1920000, 2010000, 2110000, 2200000, 20, 422000, 100}, - {66, 1710000, 1780000, 2110000, 2200000, 20, 422000, 100}, - {70, 1695000, 1710000, 1995000, 2020000, 20, 399000, 100}, - {71, 663000, 698000, 617000, 652000, 20, 123400, 100}, - {74, 1427000, 1470000, 1475000, 1518000, 20, 295000, 100}, - {75, 000, 000, 1432000, 1517000, 20, 286400, 100}, - {76, 000, 000, 1427000, 1432000, 20, 285400, 100}, - {77, 3300000, 4200000, 3300000, 4200000, 1, 620000, 15}, - {77, 3300000, 4200000, 3300000, 4200000, 2, 620000, 30}, - {78, 3300000, 3800000, 3300000, 3800000, 1, 620000, 15}, - {78, 3300000, 3800000, 3300000, 3800000, 2, 620000, 30}, - {79, 4400010, 5000000, 4400010, 5000000, 1, 693334, 15}, - {79, 4400010, 5000000, 4400010, 5000000, 2, 693334, 30}, - {80, 1710000, 1785000, 000, 000, 20, 342000, 100}, - {81, 880000, 915000, 000, 000, 20, 176000, 100}, - {82, 832000, 862000, 000, 000, 20, 166400, 100}, - {83, 703000, 748000, 000, 000, 20, 140600, 100}, - {84, 1920000, 1980000, 000, 000, 20, 384000, 100}, - {86, 1710000, 1785000, 000, 000, 20, 342000, 100}, - {89, 824000, 849000, 000, 000, 20, 342000, 100}, - {90, 2496000, 2690000, 2496000, 2690000, 3, 499200, 15}, - {90, 2496000, 2690000, 2496000, 2690000, 6, 499200, 30}, - {90, 2496000, 2690000, 2496000, 2690000, 20, 499200, 100}, - {91, 832000, 862000, 1427000, 1432000, 20, 285400, 100}, - {92, 832000, 862000, 1432000, 1517000, 20, 286400, 100}, - {93, 880000, 915000, 1427000, 1432000, 20, 285400, 100}, - {94, 880000, 915000, 1432000, 1517000, 20, 286400, 100}, - {95, 2010000, 2025000, 000, 000, 20, 402000, 100}, - {257,26500020,29500000,26500020,29500000, 1,2054166, 60}, - {257,26500080,29500000,26500080,29500000, 2,2054167, 120}, - {258,24250080,27500000,24250080,27500000, 1,2016667, 60}, - {258,24250080,27500000,24250080,27500000, 2,2016667, 120}, - {260,37000020,40000000,37000020,40000000, 1,2229166, 60}, - {260,37000080,40000000,37000080,40000000, 2,2229167, 120}, - {261,27500040,28350000,27500040,28350000, 1,2070833, 60}, - {261,27500040,28350000,27500040,28350000, 2,2070833, 120} -}; - -#define NR_BANDTABLE_SIZE (sizeof(nr_bandtable)/sizeof(nr_bandentry_t)) -const size_t nr_bandtable_size = NR_BANDTABLE_SIZE; - // TS 38.211 Table 6.4.1.1.3-3: PUSCH DMRS positions l' within a slot for single-symbol DMRS and intra-slot frequency hopping disabled. // The first 4 colomns are PUSCH mapping type A and the last 4 colomns are PUSCH mapping type B. // When l' = l0, it is represented by 1 @@ -1705,8 +1631,8 @@ int get_nr_table_idx(int nr_bandP, uint8_t scs_index) AssertFatal(0 == 1, "Band %d is a supplementary band (%d). This is not supported yet.\n", nr_bandP, supplementary_bands[j]); } - AssertFatal(nr_bandP <= nr_bandtable[NR_BANDTABLE_SIZE-1].band, "NR band %d exceeds NR bands table maximum limit %d\n", nr_bandP, nr_bandtable[NR_BANDTABLE_SIZE-1].band); - for (i = 0; i < NR_BANDTABLE_SIZE && nr_bandtable[i].band != nr_bandP; i++); + AssertFatal(nr_bandP <= nr_bandtable[nr_bandtable_size-1].band, "NR band %d exceeds NR bands table maximum limit %d\n", nr_bandP, nr_bandtable[nr_bandtable_size-1].band); + for (i = 0; i < nr_bandtable_size && nr_bandtable[i].band != nr_bandP; i++); // selection of correct Deltaf raster according to SCS if ((nr_bandtable[i].deltaf_raster != 100) && (nr_bandtable[i].deltaf_raster != scs_khz)) diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h index bc41bdabc8..ffb36963a7 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h @@ -36,10 +36,6 @@ #include "NR_CellGroupConfig.h" #include "nr_mac.h" #include "openair1/PHY/impl_defs_nr.h" -#include "openair1/PHY/defs_nr_common.h" - -extern const size_t nr_bandtable_size; -extern nr_bandentry_t nr_bandtable[]; uint16_t config_bandwidth(int mu, int nb_rb, int nr_band); From 7da57e7608984b25dbca46071f102579dcae2232 Mon Sep 17 00:00:00 2001 From: rohan Date: Tue, 9 Mar 2021 12:04:42 +0100 Subject: [PATCH 170/231] Update ulsim.c, whitespace error corrected. --- openair1/SIMULATION/NR_PHY/ulsim.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index fc350796ac..07c7ece3cf 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -1074,27 +1074,28 @@ int main(int argc, char **argv) } /////////// //////////////////////////////////////////////////// - tx_offset = frame_parms->get_samples_slot_timestamp(slot,frame_parms,0); + tx_offset = frame_parms->get_samples_slot_timestamp(slot,frame_parms,0); - txlev = signal_energy(&UE->common_vars.txdata[0][tx_offset + 5*frame_parms->ofdm_symbol_size + 4*frame_parms->nb_prefix_samples + frame_parms->nb_prefix_samples0], - frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples); + txlev = signal_energy(&UE->common_vars.txdata[0][tx_offset + 5*frame_parms->ofdm_symbol_size + 4*frame_parms->nb_prefix_samples + frame_parms->nb_prefix_samples0], + frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples); } else n_trials = 1; if (input_fd == NULL ) { - sigma_dB = 10 * log10((double)txlev * ((double)frame_parms->ofdm_symbol_size/(12*nb_rb))) - SNR;; - sigma = pow(10,sigma_dB/10); + sigma_dB = 10 * log10((double)txlev * ((double)frame_parms->ofdm_symbol_size/(12*nb_rb))) - SNR;; + sigma = pow(10,sigma_dB/10); - if(n_trials==1) printf("sigma %f (%f dB), txlev %f (factor %f)\n",sigma,sigma_dB,10*log10((double)txlev),(double)(double)frame_parms->ofdm_symbol_size/(12*nb_rb)); + if(n_trials==1) printf("sigma %f (%f dB), txlev %f (factor %f)\n",sigma,sigma_dB,10*log10((double)txlev),(double)(double) + frame_parms->ofdm_symbol_size/(12*nb_rb)); - for (i=0; inb_antennas_rx; aa++) { - s_re[aa][i] = ((double)(((short *)&UE->common_vars.txdata[aa][slot_offset]))[(i<<1)]); - s_im[aa][i] = ((double)(((short *)&UE->common_vars.txdata[aa][slot_offset]))[(i<<1)+1]); - } - } + for (i=0; inb_antennas_rx; aa++) { + s_re[aa][i] = ((double)(((short *)&UE->common_vars.txdata[aa][slot_offset]))[(i<<1)]); + s_im[aa][i] = ((double)(((short *)&UE->common_vars.txdata[aa][slot_offset]))[(i<<1)+1]); + } + } if (UE2gNB->max_Doppler == 0) { @@ -1113,8 +1114,8 @@ int main(int argc, char **argv) phase_noise(ts, &((int16_t*)&gNB->common_vars.rxdata[ap][slot_offset])[(2*i)], &((int16_t*)&gNB->common_vars.rxdata[ap][slot_offset])[(2*i)+1]); } - } - } + } + } } /*End input_fd */ From 82cd7c44da817ae0c53016537fc9274321fcc9b1 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Tue, 9 Mar 2021 12:11:21 +0100 Subject: [PATCH 171/231] nr_ulsim: whitespace cleanup --- openair1/SIMULATION/NR_PHY/ulsim.c | 58 +++++++++++++++--------------- 1 file changed, 28 insertions(+), 30 deletions(-) diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index 07c7ece3cf..7a5ee739c0 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -1058,26 +1058,26 @@ int main(int argc, char **argv) for (int i=0;i<(TBS/8);i++) ulsch_ue[0]->harq_processes[harq_pid]->a[i]=i&0xff; if (input_fd == NULL) { - // set FAPI parameters for UE, put them in the scheduled response and call - nr_ue_scheduled_response(&scheduled_response); - - - /////////////////////////phy_procedures_nr_ue_TX/////////////////////// - /////////// - - phy_procedures_nrUE_TX(UE, &UE_proc, gNB_id); - - - if (n_trials==1) { - LOG_M("txsig0.m","txs0", UE->common_vars.txdata[0],frame_parms->samples_per_subframe*10,1,1); - LOG_M("txsig0F.m","txs0F", UE->common_vars.txdataF[0],frame_parms->ofdm_symbol_size*14,1,1); - } - /////////// - //////////////////////////////////////////////////// + // set FAPI parameters for UE, put them in the scheduled response and call + nr_ue_scheduled_response(&scheduled_response); + + + /////////////////////////phy_procedures_nr_ue_TX/////////////////////// + /////////// + + phy_procedures_nrUE_TX(UE, &UE_proc, gNB_id); + + + if (n_trials==1) { + LOG_M("txsig0.m","txs0", UE->common_vars.txdata[0],frame_parms->samples_per_subframe*10,1,1); + LOG_M("txsig0F.m","txs0F", UE->common_vars.txdataF[0],frame_parms->ofdm_symbol_size*14,1,1); + } + /////////// + //////////////////////////////////////////////////// tx_offset = frame_parms->get_samples_slot_timestamp(slot,frame_parms,0); - + txlev = signal_energy(&UE->common_vars.txdata[0][tx_offset + 5*frame_parms->ofdm_symbol_size + 4*frame_parms->nb_prefix_samples + frame_parms->nb_prefix_samples0], - frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples); + frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples); } else n_trials = 1; @@ -1087,7 +1087,7 @@ int main(int argc, char **argv) sigma = pow(10,sigma_dB/10); - if(n_trials==1) printf("sigma %f (%f dB), txlev %f (factor %f)\n",sigma,sigma_dB,10*log10((double)txlev),(double)(double) + if(n_trials==1) printf("sigma %f (%f dB), txlev %f (factor %f)\n",sigma,sigma_dB,10*log10((double)txlev),(double)(double) frame_parms->ofdm_symbol_size/(12*nb_rb)); for (i=0; imax_Doppler == 0) { - multipath_channel(UE2gNB,s_re,s_im,r_re,r_im, - slot_length,0,(n_trials==1)?1:0); - } else { - multipath_tv_channel(UE2gNB,s_re,s_im,r_re,r_im, - 2*slot_length,0); - } - for (i=0; inb_antennas_rx; ap++) { - ((int16_t*) &gNB->common_vars.rxdata[ap][slot_offset])[(2*i) + (delay*2)] = (int16_t)((r_re[ap][i]) + (sqrt(sigma/2)*gaussdouble(0.0,1.0))); // convert to fixed point - ((int16_t*) &gNB->common_vars.rxdata[ap][slot_offset])[(2*i)+1 + (delay*2)] = (int16_t)((r_im[ap][i]) + (sqrt(sigma/2)*gaussdouble(0.0,1.0))); + if (UE2gNB->max_Doppler == 0) { + multipath_channel(UE2gNB, s_re, s_im, r_re, r_im, slot_length, 0, (n_trials==1)?1:0); + } else { + multipath_tv_channel(UE2gNB, s_re, s_im, r_re, r_im, 2*slot_length, 0); + } + for (i=0; inb_antennas_rx; ap++) { + ((int16_t*) &gNB->common_vars.rxdata[ap][slot_offset])[(2*i) + (delay*2)] = (int16_t)((r_re[ap][i]) + (sqrt(sigma/2)*gaussdouble(0.0,1.0))); // convert to fixed point + ((int16_t*) &gNB->common_vars.rxdata[ap][slot_offset])[(2*i)+1 + (delay*2)] = (int16_t)((r_im[ap][i]) + (sqrt(sigma/2)*gaussdouble(0.0,1.0))); /* Add phase noise if enabled */ if (pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) { phase_noise(ts, &((int16_t*)&gNB->common_vars.rxdata[ap][slot_offset])[(2*i)], From 3cfc9ae93ccabcccc161edfa3327dfb984670a08 Mon Sep 17 00:00:00 2001 From: francescomani Date: Tue, 9 Mar 2021 14:32:40 +0100 Subject: [PATCH 172/231] fix in handling csi meas report on pucch --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index cd3506d522..1bcd3aa726 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -1048,13 +1048,14 @@ void handle_nr_uci_pucch_2_3_4(module_id_t mod_id, DevAssert(harq->is_waiting); handle_dl_harq(mod_id, UE_id, pid, uci_234->harq.harq_crc != 1 && acknack); } + } + if ((uci_234->pduBitmap >> 2) & 0x01) { //API to parse the csi report and store it into sched_ctrl extract_pucch_csi_report (csi_MeasConfig, uci_234, frame, slot, UE_id, mod_id); //TCI handling function tci_handling(mod_id, UE_id,frame, slot); } - - if (uci_234 -> pduBitmap & 0x08) { + if ((uci_234->pduBitmap >> 3) & 0x01) { //@TODO:Handle CSI Report 2 } } From 4ff8f8832ed371e6180e4cf70d027c6e9411dbc0 Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Wed, 10 Mar 2021 10:30:23 +0100 Subject: [PATCH 173/231] NR: fix: set PDCP discard timer to infinity The discard timer is used by the PDCP layer to discard packets that were not transmitted to RLC after some time. We don't really need it for the moment, maybe never for the default bearer which is a best-effort bearer passing all kind of IP traffic. Maybe for voice over IP kind of traffic it's important, or realtime applications. I ran an iperf UDP uplink test and saw no error on the PHY layer but still lots of packets lost in the iperf logs, which was very surprising. By analyzing the logs in wireshark I saw that, with the current scheduler, an IP packet sent by the UE took 40ms to be sent piece by piece to the gNB, and then the next uplink IP packet was never sent at all because the discard timer was expired, leading to the high count of packets lost in the iperf logs. So let's put infinity for the moment for the discard timer. From my understanding of the moment it's not a problem. If for some reason we should set it to some non-infinity value, then we can change later. --- openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c | 2 +- openair2/RRC/NR/rrc_gNB.c | 2 +- openair2/RRC/NR/rrc_gNB_reconfig.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index f14d25b145..30c169457f 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -768,7 +768,7 @@ void nr_DRB_preconfiguration(uint16_t crnti) drb_ToAddMod->pdcp_Config = calloc(1,sizeof(*drb_ToAddMod->pdcp_Config)); drb_ToAddMod->pdcp_Config->drb = calloc(1,sizeof(*drb_ToAddMod->pdcp_Config->drb)); drb_ToAddMod->pdcp_Config->drb->discardTimer = calloc(1,sizeof(*drb_ToAddMod->pdcp_Config->drb->discardTimer)); - *drb_ToAddMod->pdcp_Config->drb->discardTimer=NR_PDCP_Config__drb__discardTimer_ms30; + *drb_ToAddMod->pdcp_Config->drb->discardTimer=NR_PDCP_Config__drb__discardTimer_infinity; drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeUL = calloc(1,sizeof(*drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeUL)); *drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeUL = NR_PDCP_Config__drb__pdcp_SN_SizeUL_len12bits; drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeDL = calloc(1,sizeof(*drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeDL)); diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 6d430d7223..dd84d016cd 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -631,7 +631,7 @@ rrc_gNB_generate_defaultRRCReconfiguration( DRB_config->pdcp_Config = calloc(1, sizeof(*DRB_config->pdcp_Config)); DRB_config->pdcp_Config->drb = calloc(1,sizeof(*DRB_config->pdcp_Config->drb)); DRB_config->pdcp_Config->drb->discardTimer = calloc(1, sizeof(*DRB_config->pdcp_Config->drb->discardTimer)); - *DRB_config->pdcp_Config->drb->discardTimer = NR_PDCP_Config__drb__discardTimer_ms30; + *DRB_config->pdcp_Config->drb->discardTimer = NR_PDCP_Config__drb__discardTimer_infinity; DRB_config->pdcp_Config->drb->pdcp_SN_SizeUL = calloc(1, sizeof(*DRB_config->pdcp_Config->drb->pdcp_SN_SizeUL)); *DRB_config->pdcp_Config->drb->pdcp_SN_SizeUL = NR_PDCP_Config__drb__pdcp_SN_SizeUL_len18bits; DRB_config->pdcp_Config->drb->pdcp_SN_SizeDL = calloc(1, sizeof(*DRB_config->pdcp_Config->drb->pdcp_SN_SizeDL)); diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index ab3f192276..5f89f86ed9 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -1347,7 +1347,7 @@ void fill_default_rbconfig(NR_RadioBearerConfig_t *rbconfig, drb_ToAddMod->pdcp_Config = calloc(1,sizeof(*drb_ToAddMod->pdcp_Config)); drb_ToAddMod->pdcp_Config->drb = calloc(1,sizeof(*drb_ToAddMod->pdcp_Config->drb)); drb_ToAddMod->pdcp_Config->drb->discardTimer = calloc(1,sizeof(*drb_ToAddMod->pdcp_Config->drb->discardTimer)); - *drb_ToAddMod->pdcp_Config->drb->discardTimer=NR_PDCP_Config__drb__discardTimer_ms30; + *drb_ToAddMod->pdcp_Config->drb->discardTimer=NR_PDCP_Config__drb__discardTimer_infinity; drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeUL = calloc(1,sizeof(*drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeUL)); *drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeUL = NR_PDCP_Config__drb__pdcp_SN_SizeUL_len18bits; drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeDL = calloc(1,sizeof(*drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeDL)); From 4e87bc3c96429d7dbb5d5624ddede35c4de577bc Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Wed, 10 Mar 2021 10:45:31 +0100 Subject: [PATCH 174/231] add missing parameter 'pusch_proc_threads' to configuration files also harmonize configuration files some more --- .../gnb.band66.tm1.106PRB.usrpn300.conf | 18 +++++++++---- .../gnb.band78.tm1.106PRB.usrpn300.conf | 21 ++++++++++----- .../CONF/gnb.band66.tm1.106PRB.usrpn300.conf | 18 +++++++++---- .../CONF/gnb.band66.tm1.106PRB.usrpx300.conf | 18 +++++++++---- .../CONF/gnb.band78.tm1.106PRB.usrpn300.conf | 8 +++--- .../CONF/gnb.band78.tm1.106PRB.usrpx300.conf | 27 ++++++++++++------- 6 files changed, 74 insertions(+), 36 deletions(-) diff --git a/ci-scripts/conf_files/gnb.band66.tm1.106PRB.usrpn300.conf b/ci-scripts/conf_files/gnb.band66.tm1.106PRB.usrpn300.conf index 9e13d493a8..32de0aa4f5 100644 --- a/ci-scripts/conf_files/gnb.band66.tm1.106PRB.usrpn300.conf +++ b/ci-scripts/conf_files/gnb.band66.tm1.106PRB.usrpn300.conf @@ -225,14 +225,15 @@ MACRLCs = ( num_cc = 1; tr_s_preference = "local_L1"; tr_n_preference = "local_RRC"; - } + } ); L1s = ( - { + { num_cc = 1; tr_n_preference = "local_mac"; - } + pusch_proc_threads = 8; + } ); RUs = ( @@ -246,8 +247,15 @@ RUs = ( max_pdschReferenceSignalPower = -27; max_rxgain = 75; eNB_instances = [0]; - #beamforming 1x4 matrix: - bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000]; + ##beamforming 1x2 matrix: 1 layer x 2 antennas + bf_weights = [0x00007fff, 0x0000]; + ##beamforming 1x4 matrix: 1 layer x 4 antennas + #bf_weights = [0x00007fff, 0x0000,0x0000, 0x0000]; + ## beamforming 2x2 matrix: + # bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff]; + ## beamforming 4x4 matrix: + #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; + sdr_addrs = "addr=192.168.10.2,mgmt_addr=192.168.10.2,second_addr=192.168.20.2"; clock_src = "external"; # if_freq = 3700000000L; diff --git a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf index 17bc3507f8..decaa392d7 100644 --- a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf +++ b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf @@ -23,7 +23,7 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; - + servingCellConfigCommon = ( { #spCellConfigCommon @@ -227,15 +227,15 @@ MACRLCs = ( num_cc = 1; tr_s_preference = "local_L1"; tr_n_preference = "local_RRC"; - } + } ); L1s = ( - { + { num_cc = 1; tr_n_preference = "local_mac"; - pusch_proc_threads = 8; - } + pusch_proc_threads = 8; + } ); RUs = ( @@ -249,8 +249,15 @@ RUs = ( max_pdschReferenceSignalPower = -27; max_rxgain = 75; eNB_instances = [0]; - #beamforming 1x4 matrix: - bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000]; + ##beamforming 1x2 matrix: 1 layer x 2 antennas + bf_weights = [0x00007fff, 0x0000]; + ##beamforming 1x4 matrix: 1 layer x 4 antennas + #bf_weights = [0x00007fff, 0x0000,0x0000, 0x0000]; + ## beamforming 2x2 matrix: + # bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff]; + ## beamforming 4x4 matrix: + #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; + sdr_addrs = "addr=192.168.10.2,mgmt_addr=192.168.10.2,second_addr=192.168.20.2"; clock_src = "external"; } diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpn300.conf index 9e13d493a8..32de0aa4f5 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpn300.conf @@ -225,14 +225,15 @@ MACRLCs = ( num_cc = 1; tr_s_preference = "local_L1"; tr_n_preference = "local_RRC"; - } + } ); L1s = ( - { + { num_cc = 1; tr_n_preference = "local_mac"; - } + pusch_proc_threads = 8; + } ); RUs = ( @@ -246,8 +247,15 @@ RUs = ( max_pdschReferenceSignalPower = -27; max_rxgain = 75; eNB_instances = [0]; - #beamforming 1x4 matrix: - bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000]; + ##beamforming 1x2 matrix: 1 layer x 2 antennas + bf_weights = [0x00007fff, 0x0000]; + ##beamforming 1x4 matrix: 1 layer x 4 antennas + #bf_weights = [0x00007fff, 0x0000,0x0000, 0x0000]; + ## beamforming 2x2 matrix: + # bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff]; + ## beamforming 4x4 matrix: + #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; + sdr_addrs = "addr=192.168.10.2,mgmt_addr=192.168.10.2,second_addr=192.168.20.2"; clock_src = "external"; # if_freq = 3700000000L; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpx300.conf index 831f9c7978..307cf52cb3 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpx300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpx300.conf @@ -225,14 +225,15 @@ MACRLCs = ( num_cc = 1; tr_s_preference = "local_L1"; tr_n_preference = "local_RRC"; - } + } ); L1s = ( - { + { num_cc = 1; tr_n_preference = "local_mac"; - } + pusch_proc_threads = 8; + } ); RUs = ( @@ -246,8 +247,15 @@ RUs = ( max_pdschReferenceSignalPower = -27; max_rxgain = 114; eNB_instances = [0]; - #beamforming 1x4 matrix: - bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000]; + ##beamforming 1x2 matrix: 1 layer x 2 antennas + bf_weights = [0x00007fff, 0x0000]; + ##beamforming 1x4 matrix: 1 layer x 4 antennas + #bf_weights = [0x00007fff, 0x0000,0x0000, 0x0000]; + ## beamforming 2x2 matrix: + # bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff]; + ## beamforming 4x4 matrix: + #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; + sdr_addrs = "type=x300"; clock_src = "external"; # if_freq = 3700000000L; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf index 760689f653..c77497dedd 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf @@ -226,15 +226,15 @@ MACRLCs = ( num_cc = 1; tr_s_preference = "local_L1"; tr_n_preference = "local_RRC"; - } + } ); L1s = ( - { + { num_cc = 1; tr_n_preference = "local_mac"; - pusch_proc_threads = 8; - } + pusch_proc_threads = 8; + } ); RUs = ( diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf index d38fff4241..b3fdd79475 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf @@ -23,7 +23,7 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; - + servingCellConfigCommon = ( { #spCellConfigCommon @@ -135,18 +135,17 @@ gNBs = initialULBWPmappingType_0 = 1 # this is SS=0 L=11 initialULBWPstartSymbolAndLength_0 = 55; - - initialULBWPk2_1 = 6; + + initialULBWPk2_1 = 6; initialULBWPmappingType_1 = 1; # this is SS=0 L=12 initialULBWPstartSymbolAndLength_1 = 69; - initialULBWPk2_2 = 7; + initialULBWPk2_2 = 7; initialULBWPmappingType_2 = 1; # this is SS=10 L=4 initialULBWPstartSymbolAndLength_2 = 52; - msg3_DeltaPreamble = 1; p0_NominalWithGrant =-90; @@ -227,14 +226,15 @@ MACRLCs = ( num_cc = 1; tr_s_preference = "local_L1"; tr_n_preference = "local_RRC"; - } + } ); L1s = ( - { + { num_cc = 1; tr_n_preference = "local_mac"; - } + pusch_proc_threads = 8; + } ); RUs = ( @@ -248,8 +248,15 @@ RUs = ( max_pdschReferenceSignalPower = -27; max_rxgain = 114; eNB_instances = [0]; - #beamforming 1x4 matrix: - bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000]; + ##beamforming 1x2 matrix: 1 layer x 2 antennas + bf_weights = [0x00007fff, 0x0000]; + ##beamforming 1x4 matrix: 1 layer x 4 antennas + #bf_weights = [0x00007fff, 0x0000,0x0000, 0x0000]; + ## beamforming 2x2 matrix: + # bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff]; + ## beamforming 4x4 matrix: + #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; + sdr_addrs = "type=x300"; clock_src = "external"; } From c05b62d62083a09253f0dab5163b7726926f1052 Mon Sep 17 00:00:00 2001 From: francescomani Date: Wed, 10 Mar 2021 15:05:26 +0100 Subject: [PATCH 175/231] including measured rsrp in mac stats --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 8 +++++++- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 4 ++++ openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 2 ++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index 7201b29596..6e5ebed5ce 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -66,7 +66,13 @@ void dump_mac_stats(gNB_MAC_INST *gNB) int num = 1; for (int UE_id = UE_info->list.head; UE_id >= 0; UE_id = UE_info->list.next[UE_id]) { LOG_I(MAC, "UE ID %d RNTI %04x (%d/%d)\n", UE_id, UE_info->rnti[UE_id], num++, UE_info->num_UEs); - const NR_mac_stats_t *stats = &UE_info->mac_stats[UE_id]; + NR_mac_stats_t *stats = &UE_info->mac_stats[UE_id]; + LOG_I(MAC, "UE %d: average reported RSRP over %d measurements is %d\n", + UE_id, + stats->num_rsrp_meas, + stats->cumul_rsrp/stats->num_rsrp_meas); + stats->num_rsrp_meas = 0; + stats->cumul_rsrp = 0 ; LOG_I(MAC, "UE %d: dlsch_rounds %d/%d/%d/%d, dlsch_errors %d\n", UE_id, stats->dlsch_rounds[0], stats->dlsch_rounds[1], diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index 1bcd3aa726..247a7e2c45 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -695,6 +695,7 @@ void tci_handling(module_id_t Mod_idP, int UE_id, frame_t frame, slot_t slot) { uint8_t diff_rsrp_idx = 0; uint8_t i, j; NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; + NR_mac_stats_t *stats = &UE_info->mac_stats[UE_id]; if (n_dl_bwp < 4) pdsch_bwp_id = bwp_id; @@ -720,6 +721,9 @@ void tci_handling(module_id_t Mod_idP, int UE_id, frame_t frame, slot_t slot) { //if strongest measured RSRP is configured strongest_ssb_rsrp = get_measured_rsrp(sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP); + // including ssb rsrp in mac stats + stats->cumul_rsrp += strongest_ssb_rsrp; + stats->num_rsrp_meas++; ssb_rsrp[idx * nb_of_csi_ssb_report] = strongest_ssb_rsrp; LOG_D(MAC,"ssb_rsrp = %d\n",strongest_ssb_rsrp); diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 92787c5c2e..ac583b5270 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -560,6 +560,8 @@ typedef struct { int ulsch_total_bytes_scheduled; int ulsch_total_bytes_rx; int ulsch_current_bytes; + int cumul_rsrp; + uint8_t num_rsrp_meas; } NR_mac_stats_t; From 535efa0fd265671afbe021f6f41ee7844349be46 Mon Sep 17 00:00:00 2001 From: "masayuki.harada" Date: Wed, 10 Mar 2021 23:16:12 +0900 Subject: [PATCH 176/231] Remove s1ap_eNB_timer.c and s1ap_eNB_timer.h --- cmake_targets/CMakeLists.txt | 1 - openair3/S1AP/s1ap_eNB.c | 41 +++++++++++++-- openair3/S1AP/s1ap_eNB.h | 17 ++++++ openair3/S1AP/s1ap_eNB_handlers.c | 11 +++- openair3/S1AP/s1ap_eNB_timer.c | 70 ------------------------- openair3/S1AP/s1ap_eNB_timer.h | 86 ------------------------------- 6 files changed, 65 insertions(+), 161 deletions(-) delete mode 100644 openair3/S1AP/s1ap_eNB_timer.c delete mode 100644 openair3/S1AP/s1ap_eNB_timer.h diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index fecb69939f..e11c850b8e 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -539,7 +539,6 @@ add_library(S1AP_ENB ${S1AP_DIR}/s1ap_eNB_overload.c ${S1AP_DIR}/s1ap_eNB_trace.c ${S1AP_DIR}/s1ap_eNB_ue_context.c - ${S1AP_DIR}/s1ap_eNB_timer.c ) add_dependencies(S1AP_ENB rrc_flag s1ap_flag) diff --git a/openair3/S1AP/s1ap_eNB.c b/openair3/S1AP/s1ap_eNB.c index 6cb82de8d3..e528c9e53e 100644 --- a/openair3/S1AP/s1ap_eNB.c +++ b/openair3/S1AP/s1ap_eNB.c @@ -58,8 +58,6 @@ #include "s1ap_eNB_ue_context.h" // test, to be removed #include "msc.h" -#include "s1ap_eNB_timer.h" - #include "assertions.h" #include "conversions.h" #if defined(TEST_S1C_MME) @@ -80,6 +78,37 @@ static int s1ap_sctp_req(s1ap_eNB_instance_t *instance_p, void s1ap_eNB_timer_expired(instance_t instance, timer_has_expired_t *msg_p); +int s1ap_timer_setup( + uint32_t interval_sec, + uint32_t interval_us, + task_id_t task_id, + int32_t instance, + uint32_t timer_kind, + timer_type_t type, + void *timer_arg, + long *timer_id) +{ + uint32_t *timeoutArg=NULL; + int ret=0; + timeoutArg=malloc(sizeof(uint32_t)); + *timeoutArg=timer_kind; + ret=timer_setup(interval_sec, + interval_us, + task_id, + instance, + type, + (void*)timeoutArg, + timer_id); + return ret; +} + +int s1ap_timer_remove(long timer_id) +{ + int ret; + ret=timer_remove(timer_id); + return ret; +} + uint32_t s1ap_generate_eNB_id(void) { char *out; char hostname[50]; @@ -407,7 +436,13 @@ void s1ap_eNB_timer_expired( long timer_id = S1AP_TIMERID_INIT; instance_p = s1ap_eNB_get_instance(instance); - timer_kind = *((uint32_t*)msg_p->arg); + if(msg_p->arg!=NULL){ + timer_kind = *((uint32_t*)msg_p->arg); + free(msg_p->arg); + }else{ + S1AP_ERROR("s1 timer timer_kind is NULL\n"); + return; + } line_ind = (int16_t)(timer_kind & S1AP_LINEIND); timer_id = msg_p->timer_id; diff --git a/openair3/S1AP/s1ap_eNB.h b/openair3/S1AP/s1ap_eNB.h index 2abbc53ec9..2183587214 100644 --- a/openair3/S1AP/s1ap_eNB.h +++ b/openair3/S1AP/s1ap_eNB.h @@ -30,6 +30,22 @@ #ifndef S1AP_ENB_H_ #define S1AP_ENB_H_ +#define S1AP_MMEIND 0x80000000 +#define S1AP_UEIND 0x00000000 +#define S1_SETRSP_WAIT 0x00010000 +#define S1_SETREQ_WAIT 0x00020000 +#define SCTP_REQ_WAIT 0x00030000 +#define S1AP_LINEIND 0x0000ffff +#define S1AP_TIMERIND 0x00ff0000 + +#define S1AP_TIMERID_INIT 0xffffffffffffffff + +typedef enum s1ap_timer_type_s { + S1AP_TIMER_PERIODIC, + S1AP_TIMER_ONE_SHOT, + S1AP_TIMER_TYPE_MAX, +} s1ap_timer_type_t; + typedef struct s1ap_eNB_config_s { // MME related params unsigned char mme_enabled; ///< MME enabled ? @@ -43,6 +59,7 @@ void *s1ap_eNB_process_itti_msg(void*); void s1ap_eNB_init(void); void *s1ap_eNB_task(void *arg); +int s1ap_timer_remove(long timer_id); uint32_t s1ap_generate_eNB_id(void); #endif /* S1AP_ENB_H_ */ diff --git a/openair3/S1AP/s1ap_eNB_handlers.c b/openair3/S1AP/s1ap_eNB_handlers.c index 7c611b0fbf..9ee3287b94 100644 --- a/openair3/S1AP/s1ap_eNB_handlers.c +++ b/openair3/S1AP/s1ap_eNB_handlers.c @@ -52,7 +52,6 @@ #include "assertions.h" #include "conversions.h" #include "msc.h" -#include "s1ap_eNB_timer.h" static int s1ap_eNB_handle_s1_setup_response(uint32_t assoc_id, @@ -117,6 +116,16 @@ static int s1ap_eNB_snd_s1_setup_request( s1ap_eNB_instance_t *instance_p, s1ap_eNB_mme_data_t *s1ap_mme_data_p); +int s1ap_timer_setup( + uint32_t interval_sec, + uint32_t interval_us, + task_id_t task_id, + int32_t instance, + uint32_t timer_kind, + timer_type_t type, + void *timer_arg, + long *timer_id); + /* Handlers matrix. Only eNB related procedure present here */ s1ap_message_decoded_callback messages_callback[][3] = { { 0, 0, 0 }, /* HandoverPreparation */ diff --git a/openair3/S1AP/s1ap_eNB_timer.c b/openair3/S1AP/s1ap_eNB_timer.c deleted file mode 100644 index 3014f961a9..0000000000 --- a/openair3/S1AP/s1ap_eNB_timer.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "assertions.h" -#include "intertask_interface.h" -#include "s1ap_eNB_timer.h" -#include "common/utils/LOG/log.h" -#include "queue.h" -#include "s1ap_common.h" - - -int s1ap_timer_setup( - uint32_t interval_sec, - uint32_t interval_us, - task_id_t task_id, - int32_t instance, - uint32_t timer_kind, - timer_type_t type, - void *timer_arg, - long *timer_id) -{ - uint32_t *timeoutArg=NULL; - int ret=0; - timeoutArg=malloc(sizeof(uint32_t)); - *timeoutArg=timer_kind; - ret=timer_setup(interval_sec, - interval_us, - task_id, - instance, - type, - (void*)timeoutArg, - timer_id); - return ret; -} - -int s1ap_timer_remove(long timer_id) -{ - int ret; - ret=timer_remove(timer_id); - return ret; -} - diff --git a/openair3/S1AP/s1ap_eNB_timer.h b/openair3/S1AP/s1ap_eNB_timer.h deleted file mode 100644 index 7af80eb806..0000000000 --- a/openair3/S1AP/s1ap_eNB_timer.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -#ifndef TIMER_H_ -#define TIMER_H_ - -#include - -#define SIGTIMER SIGRTMIN - -typedef enum s1ap_timer_type_s { - S1AP_TIMER_PERIODIC, - S1AP_TIMER_ONE_SHOT, - S1AP_TIMER_TYPE_MAX, -} s1ap_timer_type_t; - -typedef struct { - void *arg; - long timer_id; - int32_t timer_kind; -} s1ap_timer_has_expired_t; - - -int s1ap_timer_timeout(sigval_t info); - -/** \brief Request a new timer - * \param interval_sec timer interval in seconds - * \param interval_us timer interval in micro seconds - * \param task_id task id of the task requesting the timer - * \param instance instance of the task requesting the timer - * \param type timer type - * \param timer_id unique timer identifier - * @returns -1 on failure, 0 otherwise - **/ -int s1ap_timer_setup( - uint32_t interval_sec, - uint32_t interval_us, - task_id_t task_id, - int32_t instance, - uint32_t timer_kind, - timer_type_t type, - void *timer_arg, - long *timer_id); - -/** \brief Remove the timer from list - * \param timer_id unique timer id - * @returns -1 on failure, 0 otherwise - **/ - -int s1ap_timer_remove(long timer_id); - -/** \brief Initialize timer task and its API - * \param mme_config MME common configuration - * @returns -1 on failure, 0 otherwise - **/ -int s1ap_timer_init(void); - -#define S1AP_MMEIND 0x80000000 -#define S1AP_UEIND 0x00000000 -#define S1_SETRSP_WAIT 0x00010000 -#define S1_SETREQ_WAIT 0x00020000 -#define SCTP_REQ_WAIT 0x00030000 -#define S1AP_LINEIND 0x0000ffff -#define S1AP_TIMERIND 0x00ff0000 - -#define S1AP_TIMERID_INIT 0xffffffffffffffff - -#endif From c56a7e203774cf1817f0af5e35c1370220121070 Mon Sep 17 00:00:00 2001 From: Turker YILMAZ Date: Wed, 10 Mar 2021 19:30:23 +0100 Subject: [PATCH 177/231] Very minor update to test git on new the machine --- .../CONF/gnb.band78.tm1.24PRB.usrpb210.conf | 285 ++++++++++++++++++ 1 file changed, 285 insertions(+) create mode 100644 targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpb210.conf diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpb210.conf new file mode 100644 index 0000000000..33f06b5f89 --- /dev/null +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpb210.conf @@ -0,0 +1,285 @@ +Active_gNBs = ( "gNB-Eurecom-5GNRBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +gNBs = +( + { + ////////// Identification parameters: + gNB_ID = 0xe00; + + cell_type = "CELL_MACRO_GNB"; + + gNB_name = "gNB-Eurecom-5GNRBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 1; + + plmn_list = ({mcc = 208; mnc = 93; mnc_length = 2;}); + + tr_s_preference = "local_mac" + + ////////// Physical parameters: + + ssb_SubcarrierOffset = 0; + pdsch_AntennaPorts = 1; + + servingCellConfigCommon = ( + { + #spCellConfigCommon + + physCellId = 0; + +# downlinkConfigCommon + #frequencyInfoDL + # this is 3600 MHz + 43 PRBs@30kHz SCS (same as initial BWP) + absoluteFrequencySSB = 640288; + dl_frequencyBand = 78; + # this is 3600 MHz + dl_absoluteFrequencyPointA = 640000; + #scs-SpecificCarrierList + dl_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + dl_subcarrierSpacing = 1; + dl_carrierBandwidth = 24; + #initialDownlinkBWP + #genericParameters + # this is RBstart=41,L=24 (275*(L-1))+RBstart + initialDLBWPlocationAndBandwidth = 6325; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialDLBWPsubcarrierSpacing = 1; + #pdcch-ConfigCommon + initialDLBWPcontrolResourceSetZero = 0; + initialDLBWPsearchSpaceZero = 0; + #pdsch-ConfigCommon + #pdschTimeDomainAllocationList (up to 16 entries) + initialDLBWPk0_0 = 0; + #initialULBWPmappingType + #0=typeA,1=typeB + initialDLBWPmappingType_0 = 0; + #this is SS=1,L=13 + initialDLBWPstartSymbolAndLength_0 = 40; + + initialDLBWPk0_1 = 0; + initialDLBWPmappingType_1 = 0; + #this is SS=2,L=12 + initialDLBWPstartSymbolAndLength_1 = 53; + + initialDLBWPk0_2 = 0; + initialDLBWPmappingType_2 = 0; + #this is SS=1,L=12 + initialDLBWPstartSymbolAndLength_2 = 54; + + initialDLBWPk0_3 = 0; + initialDLBWPmappingType_3 = 0; + #this is SS=1,L=5 + initialDLBWPstartSymbolAndLength_3 = 57; + + #uplinkConfigCommon + #frequencyInfoUL + ul_frequencyBand = 78; + #scs-SpecificCarrierList + ul_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + ul_subcarrierSpacing = 1; + ul_carrierBandwidth = 24; + pMax = 20; + #initialUplinkBWP + #genericParameters + initialULBWPlocationAndBandwidth = 6325; +# 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 = -118; +#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 = 15; +#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, + + # pusch-ConfigCommon (up to 16 elements) + initialULBWPk2_0 = 6; + initialULBWPmappingType_0 = 1 + # this is SS=0 L=11 + initialULBWPstartSymbolAndLength_0 = 55; + + initialULBWPk2_1 = 6; + initialULBWPmappingType_1 = 1; + # this is SS=0 L=12 + initialULBWPstartSymbolAndLength_1 = 69; + + initialULBWPk2_2 = 7; + initialULBWPmappingType_2 = 1; + # this is SS=10 L=4 + initialULBWPstartSymbolAndLength_2 = 52; + + 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 = 10; + } + + ); + + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "192.168.12.26"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + + GNB_INTERFACE_NAME_FOR_S1_MME = "eth0"; + GNB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.111/24"; + GNB_INTERFACE_NAME_FOR_S1U = "eth0"; + GNB_IPV4_ADDRESS_FOR_S1U = "192.168.12.111/24"; + GNB_PORT_FOR_S1U = 2152; # Spec 2152 + }; + } +); + +MACRLCs = ( + { + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + } +); + +L1s = ( + { + num_cc = 1; + tr_n_preference = "local_mac"; + } +); + +RUs = ( + { + local_rf = "yes" + nb_tx = 1 + nb_rx = 1 + att_tx = 0 + att_rx = 0; + bands = [7]; + max_pdschReferenceSignalPower = -27; + max_rxgain = 75; + eNB_instances = [0]; + #beamforming 1x4 matrix: + bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000]; + sdr_addrs = "type=b200"; + #"addr=192.168.18.207"; + #"addr=192.168.10.2,mgmt_addr=192.168.10.2,second_addr=192.168.20.2"; + clock_src = "external"; + } +); + +THREAD_STRUCT = ( + { + #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" + parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; + #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" + worker_config = "WORKER_ENABLE"; + } +); + + log_config : + { + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + }; + From 8cec7f717123d6431813d40c12b3fd167879d1b3 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Wed, 10 Mar 2021 20:04:14 +0000 Subject: [PATCH 178/231] Revert commit b6ab1eb9 --- openair1/PHY/NR_TRANSPORT/nr_prach.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair1/PHY/NR_TRANSPORT/nr_prach.c b/openair1/PHY/NR_TRANSPORT/nr_prach.c index 0fc2de2d0a..b5a3c061e9 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_prach.c +++ b/openair1/PHY/NR_TRANSPORT/nr_prach.c @@ -681,7 +681,7 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, preamble_shift -= NCS; if (preamble_shift < 0) - preamble_shift+=((N_ZC/NCS)*NCS); + preamble_shift+=N_ZC; } } else { // This is the high-speed case new_dft = 0; From 95df7843f30a4a120d115de5a0934dcc93acf6d9 Mon Sep 17 00:00:00 2001 From: Shweta Shrivastava Date: Thu, 11 Mar 2021 00:11:16 -0600 Subject: [PATCH 179/231] Fix issues with NSA mode --- openair2/RRC/NR/rrc_gNB_nsa.c | 11 ++++- openair2/RRC/NR/rrc_gNB_reconfig.c | 76 ++++++++++++++++++++++++++++-- 2 files changed, 81 insertions(+), 6 deletions(-) diff --git a/openair2/RRC/NR/rrc_gNB_nsa.c b/openair2/RRC/NR/rrc_gNB_nsa.c index a750fa2bdd..c910767db5 100644 --- a/openair2/RRC/NR/rrc_gNB_nsa.c +++ b/openair2/RRC/NR/rrc_gNB_nsa.c @@ -238,12 +238,21 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_ cipher_algo, NR_SecurityConfig__keyToUse_secondary); } - fill_default_reconfig(carrier->servingcellconfigcommon, + if (ue_context_p->ue_context.spCellConfig) { + fill_default_reconfig(carrier->servingcellconfigcommon, ue_context_p->ue_context.spCellConfig->spCellConfigDedicated, reconfig_ies, ue_context_p->ue_context.secondaryCellGroup, carrier->pdsch_AntennaPorts, carrier->initial_csi_index[rrc->Nb_ue]); + } else { + fill_default_reconfig(carrier->servingcellconfigcommon, + NULL, + reconfig_ies, + ue_context_p->ue_context.secondaryCellGroup, + carrier->pdsch_AntennaPorts, + carrier->initial_csi_index[rrc->Nb_ue]); + } ue_context_p->ue_id_rnti = ue_context_p->ue_context.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 b2becd2a96..4b58e8238e 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -287,7 +287,11 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup->ext1 = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup->ext1)); secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup->ext1->t311 = NR_RLF_TimersAndConstants__ext1__t311_ms30000; secondaryCellGroup->spCellConfig->rlmInSyncOutOfSyncThreshold = NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated = servingcellconfigdedicated; + if (servingcellconfigdedicated) { + secondaryCellGroup->spCellConfig->spCellConfigDedicated = servingcellconfigdedicated; + } else { + secondaryCellGroup->spCellConfig->spCellConfigDedicated = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated)); + } secondaryCellGroup->spCellConfig->spCellConfigDedicated->tdd_UL_DL_ConfigurationDedicated = NULL; secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP)); secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdcch_Config=NULL; @@ -463,7 +467,14 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToReleaseList= NULL; - NR_BWP_Downlink_t *bwp=servingcellconfigdedicated->downlinkBWP_ToAddModList->list.array[0]; + NR_BWP_Downlink_t *bwp = NULL; + if (servingcellconfigdedicated) { + bwp=servingcellconfigdedicated->downlinkBWP_ToAddModList->list.array[0]; + } else { + secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList)); + + bwp=calloc(1,sizeof(*bwp)); + } bwp->bwp_Id=1; bwp->bwp_Common=calloc(1,sizeof(*bwp->bwp_Common)); // copy common BWP size from initial BWP except for bandwdith @@ -578,6 +589,9 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco ASN_SEQUENCE_ADD(&bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list,pdschi); } + if (!servingcellconfigdedicated) { + bwp->bwp_Dedicated=calloc(1,sizeof(*bwp->bwp_Dedicated)); + } bwp->bwp_Dedicated->pdcch_Config=calloc(1,sizeof(*bwp->bwp_Dedicated->pdcch_Config)); bwp->bwp_Dedicated->pdcch_Config->present = NR_SetupRelease_PDCCH_Config_PR_setup; bwp->bwp_Dedicated->pdcch_Config->choice.setup = calloc(1,sizeof(*bwp->bwp_Dedicated->pdcch_Config->choice.setup)); @@ -625,12 +639,25 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToReleaseList = NULL; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->dataScramblingIdentityPDSCH = NULL; + if (!servingcellconfigdedicated) { + bwp->bwp_Dedicated->pdsch_Config = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config)); + + bwp->bwp_Dedicated->pdsch_Config->present = NR_SetupRelease_PDSCH_Config_PR_setup; + bwp->bwp_Dedicated->pdsch_Config->choice.setup = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup)); + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA)); + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->present= NR_SetupRelease_DMRS_DownlinkConfig_PR_setup; + + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup)); + } + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dataScramblingIdentityPDSCH = NULL; bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type=NULL; bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->maxLength=NULL; bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->scramblingID0=NULL; bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->scramblingID1=NULL; + if (!servingcellconfigdedicated) { + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS=NULL; + } bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition)); *bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0; @@ -817,6 +844,9 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco *bwp->bwp_Dedicated->radioLinkMonitoringConfig->choice.setup->beamFailureDetectionTimer = NR_RadioLinkMonitoringConfig__beamFailureDetectionTimer_pbfd2; #endif + if (!servingcellconfigdedicated) { + ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list,bwp); + } secondaryCellGroup->spCellConfig->spCellConfigDedicated->firstActiveDownlinkBWP_Id=calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->firstActiveDownlinkBWP_Id)); *secondaryCellGroup->spCellConfig->spCellConfigDedicated->firstActiveDownlinkBWP_Id=1; @@ -825,20 +855,37 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco secondaryCellGroup->spCellConfig->spCellConfigDedicated->defaultDownlinkBWP_Id = calloc(1, sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->defaultDownlinkBWP_Id)); *secondaryCellGroup->spCellConfig->spCellConfigDedicated->defaultDownlinkBWP_Id = 1; + if (!servingcellconfigdedicated) { + secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig=calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig)); + } + NR_BWP_UplinkDedicated_t *initialUplinkBWP = calloc(1,sizeof(*initialUplinkBWP)); secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP = initialUplinkBWP; initialUplinkBWP->pucch_Config = NULL; initialUplinkBWP->pusch_Config = calloc(1,sizeof(*initialUplinkBWP->pusch_Config)); initialUplinkBWP->pusch_Config->present = NR_SetupRelease_PUSCH_Config_PR_setup; - NR_PUSCH_Config_t *pusch_Config = servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup; + NR_PUSCH_Config_t *pusch_Config = NULL; + if (servingcellconfigdedicated) { + pusch_Config = servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup; + } else { + pusch_Config = calloc(1,sizeof(*pusch_Config)); + } initialUplinkBWP->pusch_Config->choice.setup = pusch_Config; pusch_Config->txConfig=calloc(1,sizeof(*pusch_Config->txConfig)); *pusch_Config->txConfig= NR_PUSCH_Config__txConfig_codebook; pusch_Config->dmrs_UplinkForPUSCH_MappingTypeA = NULL; + if (!servingcellconfigdedicated) { + pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB = calloc(1,sizeof(*pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB)); + pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->present = NR_SetupRelease_DMRS_UplinkConfig_PR_setup; + pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup = calloc(1,sizeof(*pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup)); + } NR_DMRS_UplinkConfig_t *NR_DMRS_UplinkConfig = pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup; NR_DMRS_UplinkConfig->dmrs_Type = NULL; NR_DMRS_UplinkConfig->dmrs_AdditionalPosition = calloc(1,sizeof(*NR_DMRS_UplinkConfig->dmrs_AdditionalPosition)); *NR_DMRS_UplinkConfig->dmrs_AdditionalPosition = NR_DMRS_UplinkConfig__dmrs_AdditionalPosition_pos0; + if (!servingcellconfigdedicated) { + NR_DMRS_UplinkConfig->phaseTrackingRS=NULL; + } NR_DMRS_UplinkConfig->maxLength=NULL; NR_DMRS_UplinkConfig->transformPrecodingDisabled = calloc(1,sizeof(*NR_DMRS_UplinkConfig->transformPrecodingDisabled)); NR_DMRS_UplinkConfig->transformPrecodingDisabled->scramblingID0 = NULL; @@ -974,7 +1021,13 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco ASN_SEQUENCE_ADD(&srs_Config->srs_ResourceToAddModList->list,srs_res0); secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToReleaseList = NULL; - NR_BWP_Uplink_t *ubwp = servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]; + NR_BWP_Uplink_t *ubwp = NULL; + if (servingcellconfigdedicated) { + ubwp = servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]; + } else { + secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList)); + ubwp = calloc(1,sizeof(*ubwp)); + } ubwp->bwp_Id=1; ubwp->bwp_Common = calloc(1,sizeof(*ubwp->bwp_Common)); // copy bwp_Common from Initial UL BWP except for bandwidth @@ -987,6 +1040,9 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco ubwp->bwp_Common->pusch_ConfigCommon = servingcellconfigcommon->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon; ubwp->bwp_Common->pucch_ConfigCommon = servingcellconfigcommon->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon; + if (!servingcellconfigdedicated) { + ubwp->bwp_Dedicated = calloc(1,sizeof(*ubwp->bwp_Dedicated)); + } ubwp->bwp_Dedicated->pucch_Config = calloc(1,sizeof(*ubwp->bwp_Dedicated->pucch_Config)); ubwp->bwp_Dedicated->pucch_Config->present = NR_SetupRelease_PUCCH_Config_PR_setup; NR_PUCCH_Config_t *pucch_Config = calloc(1,sizeof(*pucch_Config)); @@ -1116,6 +1172,12 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco ASN_SEQUENCE_ADD(&pucch_Config->pucch_PowerControl->p0_Set->list,p00); pucch_Config->pucch_PowerControl->pathlossReferenceRSs = NULL; + if (!servingcellconfigdedicated) { + // copy pusch_Config from dedicated initialBWP + ubwp->bwp_Dedicated->pusch_Config = calloc(1,sizeof(*ubwp->bwp_Dedicated->pusch_Config)); + ubwp->bwp_Dedicated->pusch_Config->present = NR_SetupRelease_PUSCH_Config_PR_setup; + ubwp->bwp_Dedicated->pusch_Config->choice.setup = pusch_Config; + } ubwp->bwp_Dedicated->configuredGrantConfig = NULL; ubwp->bwp_Dedicated->srs_Config = calloc(1,sizeof(*ubwp->bwp_Dedicated->srs_Config)); ubwp->bwp_Dedicated->srs_Config->present = NR_SetupRelease_SRS_Config_PR_setup; @@ -1123,6 +1185,10 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco ubwp->bwp_Dedicated->beamFailureRecoveryConfig = NULL; + if (!servingcellconfigdedicated) { + ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list,ubwp); + } + secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->firstActiveUplinkBWP_Id = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->firstActiveUplinkBWP_Id)); *secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->firstActiveUplinkBWP_Id = 1; From 6274348dfb70c7d9cab17fcca6754aaeb6771264 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 11 Mar 2021 12:01:38 +0100 Subject: [PATCH 180/231] Remove redundant code --- openair2/LAYER2/NR_MAC_gNB/config.c | 15 --------------- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 2 -- 2 files changed, 17 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 3fc2556bfc..c52cb12b76 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -397,21 +397,6 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; if (add_ue == 1 && get_softmodem_params()->phy_test) { const int UE_id = add_new_nr_ue(Mod_idP, rnti, secondaryCellGroup); - UE_info->secondaryCellGroup[UE_id] = secondaryCellGroup; - compute_csi_bitlen (secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup, UE_info, UE_id, Mod_idP); - struct NR_ServingCellConfig__downlinkBWP_ToAddModList *bwpList = - secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList; - AssertFatal(bwpList->list.count == 1, - "downlinkBWP_ToAddModList has %d BWP!\n", - bwpList->list.count); - const int bwp_id = 1; - UE_info->UE_sched_ctrl[UE_id].active_bwp = bwpList->list.array[bwp_id - 1]; - struct NR_UplinkConfig__uplinkBWP_ToAddModList *ubwpList = - secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList; - AssertFatal(ubwpList->list.count == 1, - "uplinkBWP_ToAddModList has %d BWP!\n", - ubwpList->list.count); - UE_info->UE_sched_ctrl[UE_id].active_ubwp = ubwpList->list.array[bwp_id - 1]; LOG_I(PHY,"Added new UE_id %d/%x with initial secondaryCellGroup\n",UE_id,rnti); } else if (add_ue == 1 && !get_softmodem_params()->phy_test) { const int CC_id = 0; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 027fac773a..cdb171f0ea 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -474,8 +474,6 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, continue; } const int UE_id = add_new_nr_ue(gnb_mod_idP, ra->rnti, ra->secondaryCellGroup); - UE_info->secondaryCellGroup[UE_id] = ra->secondaryCellGroup; - compute_csi_bitlen (ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup, UE_info, UE_id, gnb_mod_idP); UE_info->UE_beam_index[UE_id] = ra->beam_id; LOG_I(MAC, "[gNB %d][RAPROC] PUSCH with TC_RNTI %x received correctly, " From 9e707bb2d61b9f1e8e5cb70dff6f6dec7e6de440 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 11 Mar 2021 12:01:51 +0100 Subject: [PATCH 181/231] Remove uselessly added code --- openair2/NR_PHY_INTERFACE/NR_IF_Module.c | 1 - 1 file changed, 1 deletion(-) diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index c1fd4a9ea1..5b5f3e6b3c 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -43,7 +43,6 @@ NR_IF_Module_t *if_inst[MAX_IF_MODULES]; NR_Sched_Rsp_t Sched_INFO[MAX_IF_MODULES][MAX_NUM_CCs]; -extern const uint8_t slots_per_frame[5]; extern int oai_nfapi_harq_indication(nfapi_harq_indication_t *harq_ind); extern int oai_nfapi_crc_indication(nfapi_crc_indication_t *crc_ind); extern int oai_nfapi_cqi_indication(nfapi_cqi_indication_t *cqi_ind); From 43f6e2f0de81fe6377354ac424236253c88e149e Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 11 Mar 2021 12:22:32 +0100 Subject: [PATCH 182/231] Shorten RSRP meas print, avoid SIGFPE --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index 6e5ebed5ce..ea0a069eff 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -67,16 +67,14 @@ void dump_mac_stats(gNB_MAC_INST *gNB) for (int UE_id = UE_info->list.head; UE_id >= 0; UE_id = UE_info->list.next[UE_id]) { LOG_I(MAC, "UE ID %d RNTI %04x (%d/%d)\n", UE_id, UE_info->rnti[UE_id], num++, UE_info->num_UEs); NR_mac_stats_t *stats = &UE_info->mac_stats[UE_id]; - LOG_I(MAC, "UE %d: average reported RSRP over %d measurements is %d\n", - UE_id, - stats->num_rsrp_meas, - stats->cumul_rsrp/stats->num_rsrp_meas); - stats->num_rsrp_meas = 0; - stats->cumul_rsrp = 0 ; - LOG_I(MAC, "UE %d: dlsch_rounds %d/%d/%d/%d, dlsch_errors %d\n", + const int avg_rsrp = stats->num_rsrp_meas > 0 ? stats->cumul_rsrp / stats->num_rsrp_meas : 0; + LOG_I(MAC, "UE %d: dlsch_rounds %d/%d/%d/%d, dlsch_errors %d, average RSRP %d (%d meas)\n", UE_id, stats->dlsch_rounds[0], stats->dlsch_rounds[1], - stats->dlsch_rounds[2], stats->dlsch_rounds[3], stats->dlsch_errors); + stats->dlsch_rounds[2], stats->dlsch_rounds[3], stats->dlsch_errors, + avg_rsrp, stats->num_rsrp_meas); + stats->num_rsrp_meas = 0; + stats->cumul_rsrp = 0 ; LOG_I(MAC, "UE %d: dlsch_total_bytes %d\n", UE_id, stats->dlsch_total_bytes); LOG_I(MAC, "UE %d: ulsch_rounds %d/%d/%d/%d, ulsch_errors %d\n", UE_id, From 6d195d739984f9d14b39036a014941c97be80d2e Mon Sep 17 00:00:00 2001 From: rohan Date: Fri, 12 Mar 2021 11:15:05 +0100 Subject: [PATCH 183/231] Updated nr_ulsim to support 2 RX Antenna. (Test14: MCS 16 50 PRBs 2 RX_Antenna) --- cmake_targets/autotests/test_case_list.xml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cmake_targets/autotests/test_case_list.xml b/cmake_targets/autotests/test_case_list.xml index 089d0503fd..f346effafb 100644 --- a/cmake_targets/autotests/test_case_list.xml +++ b/cmake_targets/autotests/test_case_list.xml @@ -1294,7 +1294,8 @@ (Test10: SC-FDMA, 75 PRBs), (Test11: SC-FDMA, 216 PRBs), (Test12: SC-FDMA, 273 PRBs), - (Test13: SC-FDMA, 3 DMRS) + (Test13: SC-FDMA, 3 DMRS), + (Test14: MCS 16 50 PRBs 2 RX_Antenna) $OPENAIR_DIR/cmake_targets/build_oai --phy_simulators -c @@ -1313,7 +1314,8 @@ -n100 -s2 -Z -r75 -n100 -s2 -Z -r216 -R217 -n100 -s2 -Z -r270 -R273 - -n100 -s2 -Z -U 2 0 2 + -n100 -s2 -Z -U 2 0 2 + -n100 -m16 -s10 -z2 nr_ulsim.test1 nr_ulsim.test2 nr_ulsim.test3 nr_ulsim.test4 nr_ulsim.test5 nr_ulsim.test6 nr_ulsim.test7 nr_ulsim.test8 nr_ulsim.test9 nr_ulsim.test10 nr_ulsim.test11 nr_ulsim.test12 nr_ulsim.test13 PUSCH test OK From eaed521bec9f149fa3763ed0572f3a94fc680c5b Mon Sep 17 00:00:00 2001 From: rohan Date: Fri, 12 Mar 2021 13:07:21 +0100 Subject: [PATCH 184/231] Update test_case_list.xml with test14 tag for nr_ulsim --- cmake_targets/autotests/test_case_list.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake_targets/autotests/test_case_list.xml b/cmake_targets/autotests/test_case_list.xml index f346effafb..016c76dc06 100644 --- a/cmake_targets/autotests/test_case_list.xml +++ b/cmake_targets/autotests/test_case_list.xml @@ -1317,7 +1317,7 @@ -n100 -s2 -Z -U 2 0 2 -n100 -m16 -s10 -z2 - nr_ulsim.test1 nr_ulsim.test2 nr_ulsim.test3 nr_ulsim.test4 nr_ulsim.test5 nr_ulsim.test6 nr_ulsim.test7 nr_ulsim.test8 nr_ulsim.test9 nr_ulsim.test10 nr_ulsim.test11 nr_ulsim.test12 nr_ulsim.test13 + nr_ulsim.test1 nr_ulsim.test2 nr_ulsim.test3 nr_ulsim.test4 nr_ulsim.test5 nr_ulsim.test6 nr_ulsim.test7 nr_ulsim.test8 nr_ulsim.test9 nr_ulsim.test10 nr_ulsim.test11 nr_ulsim.test12 nr_ulsim.test13 nr_ulsim.test14 PUSCH test OK segmentation fault|assertion|exiting|fatal 3 From 70b7284581f220304cd3b2b63a3715e4dd5dc49a Mon Sep 17 00:00:00 2001 From: hardy Date: Fri, 12 Mar 2021 13:31:01 +0100 Subject: [PATCH 185/231] adding xml files for benetel build and test --- .../xml_files/benetel_multi_node_build.xml | 66 +++++++ ci-scripts/xml_files/benetel_nsa_base.xml | 170 ++++++++++++++++++ 2 files changed, 236 insertions(+) create mode 100644 ci-scripts/xml_files/benetel_multi_node_build.xml create mode 100644 ci-scripts/xml_files/benetel_nsa_base.xml diff --git a/ci-scripts/xml_files/benetel_multi_node_build.xml b/ci-scripts/xml_files/benetel_multi_node_build.xml new file mode 100644 index 0000000000..7b4eacef3a --- /dev/null +++ b/ci-scripts/xml_files/benetel_multi_node_build.xml @@ -0,0 +1,66 @@ + + + build-tab + Build + wrench + + 000001 000002 + 000003 000004 + + + + + Build_eNB + Build eNB + -w USRP -c --eNB --ninja + 0 + 0 + True + + + + WaitEndBuild_eNB + Wait for end of Build eNB + 0 + 0 + + + + Build_eNB + Build gNB + -w USRP -c --gNB --ninja + 1 + 1 + True + + + + WaitEndBuild_eNB + Wait for end of Build gNB + 1 + 1 + + + + diff --git a/ci-scripts/xml_files/benetel_nsa_base.xml b/ci-scripts/xml_files/benetel_nsa_base.xml new file mode 100644 index 0000000000..3c584f121c --- /dev/null +++ b/ci-scripts/xml_files/benetel_nsa_base.xml @@ -0,0 +1,170 @@ + + + TEST-FR1-TM1 + FR1 + tasks + + 010000 + 030000 + 040000 + 010001 + 000001 + 050000 + 050001 + 050002 + 000001 + 060000 + 060001 + 000001 + 070000 + 070001 + 010002 + 000001 + 080001 + 080000 + 010003 + + + + + Initialize_UE + Initialize UE + + + + Terminate_UE + Terminate UE + + + + Attach_UE + Attach UE + + + + Detach_UE + Detach UE + + + + + Initialize_eNB + Initialize eNB + -O ci-scripts/conf_files/enb.band7.tm1.fr1.25PRB.usrpb210.conf + 0 + 0 + lte + + + + + Initialize_eNB + Initialize gNB + -O ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf -E + 1 + 1 + nr + + + + IdleSleep + Sleep + 20 + + + + Ping + Ping: 20pings in 20sec + -c 20 + 50 + + + + Ping + Ping: 5pings in 1sec + -c 5 -i 0.2 + 50 + + + + Ping + Ping: 100pings in 20sec + -c 100 -i 0.2 + 50 + + + + + Iperf + iperf (DL/1Mbps/UDP)(30 sec)(single-ue profile) + -u -b 1M -t 30 -i 1 + 50 + single-ue + + + + Iperf + iperf (UL/1Mbps/UDP)(30 sec)(single-ue profile) + -u -b 1M -t 30 -i 1 -R + 50 + single-ue + + + + + Iperf + iperf (DL/20Mbps/UDP)(20 sec)(single-ue profile) + -u -b 20M -t 20 -i 1 + 50 + single-ue + + + + Iperf + iperf (UL/3Mbps/UDP)(20 sec)(single-ue profile) + -u -b 3M -t 20 -i 1 -R + 50 + single-ue + + + + + + Terminate_eNB + Terminate eNB + 0 + 0 + lte + + + + Terminate_eNB + Terminate gNB + 1 + 1 + nr + + + + From 73e609db40c8ecc74592398ef60f194ec5f50154 Mon Sep 17 00:00:00 2001 From: hardy Date: Fri, 12 Mar 2021 14:07:39 +0100 Subject: [PATCH 186/231] adding benetel conf files for ci --- ci-scripts/conf_files/benetel-4g.conf | 285 +++++++++++++++++++++++ ci-scripts/conf_files/benetel-5g.conf | 317 ++++++++++++++++++++++++++ 2 files changed, 602 insertions(+) create mode 100644 ci-scripts/conf_files/benetel-4g.conf create mode 100644 ci-scripts/conf_files/benetel-5g.conf diff --git a/ci-scripts/conf_files/benetel-4g.conf b/ci-scripts/conf_files/benetel-4g.conf new file mode 100644 index 0000000000..aab3876d96 --- /dev/null +++ b/ci-scripts/conf_files/benetel-4g.conf @@ -0,0 +1,285 @@ +Active_eNBs = ( "eNB-Eurecom-LTEBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +eNBs = +( + { + # real_time choice in {hard, rt-preempt, no} + real_time = "no"; + + ////////// Identification parameters: + eNB_ID = 0xe00; + + cell_type = "CELL_MACRO_ENB"; + + eNB_name = "eNB-Eurecom-LTEBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 1; + plmn_list = ( { mcc = 222; mnc = 01; mnc_length = 2; } ); + + tr_s_preference = "local_mac" + + ////////// Physical parameters: + + component_carriers = ( + { + node_function = "NGFI_RCC_IF4p5"; + node_timing = "synch_to_ext_device"; + node_synch_ref = 0; + frame_type = "FDD"; + tdd_config = 3; + tdd_config_s = 0; + prefix_type = "NORMAL"; + eutra_band = 7; + downlink_frequency = 2655000000L; + uplink_frequency_offset = -120000000; + Nid_cell = 0; + N_RB_DL = 100; + Nid_cell_mbsfn = 0; + nb_antenna_ports = 1; + nb_antennas_tx = 1; + nb_antennas_rx = 1; + tx_gain = 90; + rx_gain = 125; + pbch_repetition = "FALSE"; + prach_root = 0; + prach_config_index = 0; + prach_high_speed = "DISABLE"; + prach_zero_correlation = 1; + prach_freq_offset = 90; + pucch_delta_shift = 1; + pucch_nRB_CQI = 0; + pucch_nCS_AN = 0; + pucch_n1_AN = 0; + pdsch_referenceSignalPower = -10; + pdsch_p_b = 0; + pusch_n_SB = 1; + pusch_enable64QAM = "DISABLE"; + pusch_hoppingMode = "interSubFrame"; + pusch_hoppingOffset = 0; + pusch_groupHoppingEnabled = "ENABLE"; + pusch_groupAssignment = 0; + pusch_sequenceHoppingEnabled = "DISABLE"; + pusch_nDMRS1 = 1; + phich_duration = "NORMAL"; + phich_resource = "ONESIXTH"; + srs_enable = "DISABLE"; + /* srs_BandwidthConfig =; + srs_SubframeConfig =; + srs_ackNackST =; + srs_MaxUpPts =;*/ + + pusch_p0_Nominal = -96; + pusch_alpha = "AL1"; + pucch_p0_Nominal = -104; + msg3_delta_Preamble = 6; + pucch_deltaF_Format1 = "deltaF2"; + pucch_deltaF_Format1b = "deltaF3"; + pucch_deltaF_Format2 = "deltaF0"; + pucch_deltaF_Format2a = "deltaF0"; + pucch_deltaF_Format2b = "deltaF0"; + + rach_numberOfRA_Preambles = 64; + rach_preamblesGroupAConfig = "DISABLE"; + /* + rach_sizeOfRA_PreamblesGroupA = ; + rach_messageSizeGroupA = ; + rach_messagePowerOffsetGroupB = ; + */ + rach_powerRampingStep = 4; + rach_preambleInitialReceivedTargetPower = -108; + rach_preambleTransMax = 10; + rach_raResponseWindowSize = 10; + rach_macContentionResolutionTimer = 48; + rach_maxHARQ_Msg3Tx = 4; + + pcch_default_PagingCycle = 128; + pcch_nB = "oneT"; + bcch_modificationPeriodCoeff = 2; + ue_TimersAndConstants_t300 = 1000; + ue_TimersAndConstants_t301 = 1000; + ue_TimersAndConstants_t310 = 1000; + ue_TimersAndConstants_t311 = 10000; + ue_TimersAndConstants_n310 = 20; + ue_TimersAndConstants_n311 = 1; + ue_TransmissionMode = 1; + + //Parameters for SIB18 + rxPool_sc_CP_Len = "normal"; + rxPool_sc_Period = "sf40"; + rxPool_data_CP_Len = "normal"; + rxPool_ResourceConfig_prb_Num = 20; + rxPool_ResourceConfig_prb_Start = 5; + rxPool_ResourceConfig_prb_End = 44; + rxPool_ResourceConfig_offsetIndicator_present = "prSmall"; + rxPool_ResourceConfig_offsetIndicator_choice = 0; + rxPool_ResourceConfig_subframeBitmap_present = "prBs40"; + rxPool_ResourceConfig_subframeBitmap_choice_bs_buf = "00000000000000000000"; + rxPool_ResourceConfig_subframeBitmap_choice_bs_size = 5; + rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused = 0; +/* rxPool_dataHoppingConfig_hoppingParameter = 0; + rxPool_dataHoppingConfig_numSubbands = "ns1"; + rxPool_dataHoppingConfig_rbOffset = 0; + rxPool_commTxResourceUC-ReqAllowed = "TRUE"; +*/ + // Parameters for SIB19 + discRxPool_cp_Len = "normal" + discRxPool_discPeriod = "rf32" + discRxPool_numRetx = 1; + discRxPool_numRepetition = 2; + discRxPool_ResourceConfig_prb_Num = 5; + discRxPool_ResourceConfig_prb_Start = 3; + discRxPool_ResourceConfig_prb_End = 21; + discRxPool_ResourceConfig_offsetIndicator_present = "prSmall"; + discRxPool_ResourceConfig_offsetIndicator_choice = 0; + discRxPool_ResourceConfig_subframeBitmap_present = "prBs40"; + discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf = "f0ffffffff"; + discRxPool_ResourceConfig_subframeBitmap_choice_bs_size = 5; + discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused = 0; + + //SSB central frequency of NR secondary cell group (for ENDC NSA) + nr_scg_ssb_freq = 640000; + } + ); + + + srb1_parameters : + { + # timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500] + timer_poll_retransmit = 80; + + # timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200] + timer_reordering = 35; + + # timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500] + timer_status_prohibit = 0; + + # poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)] + poll_pdu = 4; + + # poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)] + poll_byte = 99999; + + # max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32] + max_retx_threshold = 4; + } + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "192.168.18.99"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + enable_measurement_reports = "yes"; + + ///X2 + enable_x2 = "yes"; + t_reloc_prep = 1000; /* unit: millisecond */ + tx2_reloc_overall = 2000; /* unit: millisecond */ + t_dc_prep = 1000; /* unit: millisecond */ + t_dc_overall = 2000; /* unit: millisecond */ + + NETWORK_INTERFACES : + { + ENB_INTERFACE_NAME_FOR_S1_MME = "eth0"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.18.196"; + ENB_INTERFACE_NAME_FOR_S1U = "eth0"; + ENB_IPV4_ADDRESS_FOR_S1U = "192.168.18.196"; + ENB_PORT_FOR_S1U = 2152; # Spec 2152 + ENB_IPV4_ADDRESS_FOR_X2C = "127.0.0.1"; + ENB_PORT_FOR_X2C = 36422; # Spec 36422 + }; + } +); + +MACRLCs = ( + { + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + phy_test_mode = 0; + puSch10xSnr = 160; + puCch10xSnr = 160; + } +); + +L1s = ( + { + num_cc = 1; + tr_n_preference = "local_mac"; + prach_dtx_threshold = 150; + } +); + +RUs = ( + { + //local_if_name = "enp129s0f0"; + local_if_name = "dpdk"; + sdr_addrs = "softmodem -m 2048 -l 35 -n 2 -b 0000:81:00.3 --proc-type auto --file-prefix ggg -- -p 0x1"; + #sdr_addrs = "softmodem -l 8 -n 2 -- -p 0x2"; + #remote_address = "127.0.0.2"; + #local_address = "127.0.0.1"; + #local_portc = 50000; + #remote_portc = 50000; + #local_portd = 50001; + #remote_portd = 50001; + local_rf = "no" + tr_preference = "raw_if4p5" + nb_tx = 1 + nb_rx = 1 + att_tx = 0 + att_rx = 0; + eNB_instances = [0]; + } +); + +THREAD_STRUCT = ( + { + #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" + #parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; + parallel_config = "PARALLEL_SINGLE_THREAD"; + #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" + worker_config = "WORKER_ENABLE"; + } +); + +NETWORK_CONTROLLER : +{ + FLEXRAN_ENABLED = "no"; + FLEXRAN_INTERFACE_NAME = "lo"; + FLEXRAN_IPV4_ADDRESS = "127.0.0.1"; + FLEXRAN_PORT = 2210; + FLEXRAN_CACHE = "/mnt/oai_agent_cache"; + FLEXRAN_AWAIT_RECONF = "no"; +}; + + log_config : + { + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + }; diff --git a/ci-scripts/conf_files/benetel-5g.conf b/ci-scripts/conf_files/benetel-5g.conf new file mode 100644 index 0000000000..504d5e7b34 --- /dev/null +++ b/ci-scripts/conf_files/benetel-5g.conf @@ -0,0 +1,317 @@ +Active_gNBs = ( "gNB-Eurecom-5GNRBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +gNBs = +( + { + ////////// Identification parameters: + gNB_ID = 0xe00; + + cell_type = "CELL_MACRO_GNB"; + + gNB_name = "gNB-Eurecom-5GNRBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 1; + + plmn_list = ({mcc = 222; mnc = 01; mnc_length = 2;}); + + tr_s_preference = "local_mac" + + ////////// Physical parameters: + + ssb_SubcarrierOffset = 31; //0; + pdsch_AntennaPorts = 1; + #pusch_TargetSNRx10 = 200; + #pucch_TargetSNRx10 = 200; + pusch_TargetSNRx10 = 200; + pucch_TargetSNRx10 = 200; + + servingCellConfigCommon = ( + { + #spCellConfigCommon + + physCellId = 0; + +# downlinkConfigCommon + #frequencyInfoDL + # this is is the central frequency of SSB + absoluteFrequencySSB = 640000; //641272 + dl_frequencyBand = 78; + # the carrier frequency is assumed to be in the middle of the carrier, i.e. dl_absoluteFrequencyPointA_kHz + dl_carrierBandwidth*12*SCS_kHz/2 + dl_absoluteFrequencyPointA = 638728; //640000; + #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=84,L=13 (275*(L-1))+RBstart + initialDLBWPlocationAndBandwidth = 6366; //28875; //6366; #6407; #3384; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialDLBWPsubcarrierSpacing = 1; + #pdcch-ConfigCommon + initialDLBWPcontrolResourceSetZero = 0; + initialDLBWPsearchSpaceZero = 0; + #pdsch-ConfigCommon + #pdschTimeDomainAllocationList (up to 16 entries) + initialDLBWPk0_0 = 0; + #initialULBWPmappingType + #0=typeA,1=typeB + initialDLBWPmappingType_0 = 0; + #this is SS=1,L=13 + initialDLBWPstartSymbolAndLength_0 = 40; + + initialDLBWPk0_1 = 0; + initialDLBWPmappingType_1 = 0; + #this is SS=2,L=12 + initialDLBWPstartSymbolAndLength_1 = 53; + + initialDLBWPk0_2 = 0; + initialDLBWPmappingType_2 = 0; + #this is SS=1,L=12 + initialDLBWPstartSymbolAndLength_2 = 54; + + initialDLBWPk0_3 = 0; + initialDLBWPmappingType_3 = 0; + #this is SS=1,L=4 //5 (4 is for 43, 5 is for 57) + initialDLBWPstartSymbolAndLength_3 = 57; //43; //57; + #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 = 6366; //28875; //6366; #6407; #3384; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialULBWPsubcarrierSpacing = 1; + #rach-ConfigCommon + #rach-ConfigGeneric + prach_ConfigurationIndex = 4; +#prach_msg1_FDM +#0 = one, 1=two, 2=four, 3=eight + prach_msg1_FDM = 0; + prach_msg1_FrequencyStart = 74; + zeroCorrelationZoneConfig = 13; + preambleReceivedTargetPower = -118; + #preambleReceivedTargetPower = -104; + #preambleReceivedTargetPower = -108; +#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 = 2; +#ra_ReponseWindow +#1,2,4,8,10,20,40,80 + ra_ResponseWindow = 5; +#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; //15; +#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 = 1; + 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, + # pusch-ConfigCommon (up to 16 elements) + initialULBWPk2_0 = 2; + initialULBWPmappingType_0 = 1 + # this is SS=0 L=11 + initialULBWPstartSymbolAndLength_0 = 55; + + initialULBWPk2_1 = 2; + initialULBWPmappingType_1 = 1; + # this is SS=0 L=12 + initialULBWPstartSymbolAndLength_1 = 69; + + initialULBWPk2_2 = 7; + initialULBWPmappingType_2 = 1; + # this is SS=10 L=4 + initialULBWPstartSymbolAndLength_2 = 52; + + msg3_DeltaPreamble = 1; + #p0_NominalWithGrant =-90; + p0_NominalWithGrant =-118; + +# pucch-ConfigCommon setup : +# pucchGroupHopping +# 0 = neither, 1= group hopping, 2=sequence hopping + pucchGroupHopping = 0; + hoppingId = 40; + #p0_nominal = -90; + p0_nominal = -118; +# ssb_PositionsInBurs_BitmapPR +# 1=short, 2=medium, 3=long + ssb_PositionsInBurst_PR = 2; + ssb_PositionsInBurst_Bitmap = 1; #0x80; + +# 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; //8; //7; + nrofDownlinkSymbols = 6; //0; //6; + nrofUplinkSlots = 2; + nrofUplinkSymbols = 4; //0; //4; + + #ssPBCH_BlockPower = 10; + ssPBCH_BlockPower = -35; + } + + ); + + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "192.168.18.99"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + ///X2 + enable_x2 = "yes"; + t_reloc_prep = 1000; /* unit: millisecond */ + tx2_reloc_overall = 2000; /* unit: millisecond */ + t_dc_prep = 1000; /* unit: millisecond */ + t_dc_overall = 2000; /* unit: millisecond */ + target_enb_x2_ip_address = ( + { ipv4 = "127.0.0.1"; + ipv6 = "192:168:30::17"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + + GNB_INTERFACE_NAME_FOR_S1_MME = "eth0"; + GNB_IPV4_ADDRESS_FOR_S1_MME = "192.168.18.187/24"; + GNB_INTERFACE_NAME_FOR_S1U = "eth0"; + GNB_IPV4_ADDRESS_FOR_S1U = "192.168.18.187/24"; + GNB_PORT_FOR_S1U = 2152; # Spec 2152 + GNB_IPV4_ADDRESS_FOR_X2C = "127.0.0.2/24"; + GNB_PORT_FOR_X2C = 36422; # Spec 36422 + }; + } +); + +MACRLCs = ( + { + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + } +); + +L1s = ( + { + num_cc = 1; + tr_n_preference = "local_mac"; + pusch_proc_threads = 8; + } +); + +RUs = ( + { + local_rf = "no" + nb_tx = 1 + nb_rx = 1 + att_tx = 0 + att_rx = 0; + bands = [7]; + max_pdschReferenceSignalPower = -27; + max_rxgain = 114; + eNB_instances = [0]; + //clock_src = "internal"; + clock_src = "external"; + + local_if_name = "dpdk"; + sdr_addrs = "softmodem -m 2048 -l 34 -n 3 -b 0000:81:00.2 --proc-type auto --file-prefix hhh -- -p 0x1"; + remote_address = "127.0.0.2"; + local_address = "127.0.0.1"; + local_portc = 50000; + remote_portc = 50000; + local_portd = 50001; + remote_portd = 50001; + tr_preference = "raw_if4p5" + + } +); + +THREAD_STRUCT = ( + { + #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" + //parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; + parallel_config = "PARALLEL_SINGLE_THREAD"; + #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" + worker_config = "WORKER_DISABLE"; + } +); + + log_config : + { + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + }; + From fc4e1a4f1e4280619ad9fe1f297cbf70ec9ff948 Mon Sep 17 00:00:00 2001 From: Florian Kaltenberger Date: Sun, 14 Mar 2021 23:17:11 +0100 Subject: [PATCH 187/231] adding Benetel RRUs to build script. --- cmake_targets/build_oai | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index 960b241047..712d3df8c3 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -48,7 +48,7 @@ DEADLINE_SCHEDULER_FLAG_USER="" CPU_AFFINITY_FLAG_USER="False" #Only valid when low-latency flag is set to False REL="Rel15" HW="None" -TP="None" +TP="Ethernet" EPC=0 VERBOSE_COMPILE=0 CFLAGS_PROCESSOR_USER="" @@ -289,6 +289,9 @@ function main() { esac echo_info "Setting hardware to: $HW" shift 2;; + -t | --transport) + TP=$2 + shift 2;; -P | --phy_simulators) SIMUS_PHY=1 echo_info "Will compile dlsim, ulsim, ..." @@ -936,12 +939,30 @@ function main() { echo_info "Building transport protocol libraries" rm -f liboai_transpro.so rm -f $dbin/liboai_transpro.so - compilations \ - $build_dir oai_eth_transpro \ - liboai_eth_transpro.so $dbin/liboai_eth_transpro.so.$REL - ln -sf liboai_eth_transpro.so liboai_transpro.so - ln -sf $dbin/liboai_eth_transpro.so.$REL $dbin/liboai_transpro.so - echo_info "liboai_transpro.so is linked to ETHERNET transport" + if [ "$TP" == "Ethernet" ]; then + compilations \ + $build_dir oai_eth_transpro \ + liboai_eth_transpro.so $dbin/liboai_eth_transpro.so.$REL + ln -sf liboai_eth_transpro.so liboai_transpro.so + ln -sf $dbin/liboai_eth_transpro.so.$REL $dbin/liboai_transpro.so + echo_info "liboai_transpro.so is linked to ETHERNET transport" + fi + if [ "$TP" == "benetel4g" ]; then + compilations \ + $build_dir benetel_4g \ + libbenetel_4g.so $dbin/libbenetel_4g.$REL + ln -sf libbenetel_4g.so liboai_transpro.so + ln -sf $dbin/libbenetel_4g.so.$REL $dbin/liboai_transpro.so + echo_info "liboai_transpro.so is linked to BENETEL4G transport" + fi + if [ "$TP" == "benetel5g" ]; then + compilations \ + $build_dir benetel_5g \ + libbenetel_5g.so $dbin/libbenetel_5g.$REL + ln -sf libbenetel_5g.so liboai_transpro.so + ln -sf $dbin/libbenetel_5g.so.$REL $dbin/liboai_transpro.so + echo_info "liboai_transpro.so is linked to BENETEL4G transport" + fi fi fi From cf864cbb593f3a4c94bf8619c05cd6fed6b536d3 Mon Sep 17 00:00:00 2001 From: hardy Date: Mon, 15 Mar 2021 11:00:22 +0100 Subject: [PATCH 188/231] updaing ci files for benetel test --- ci-scripts/conf_files/benetel-4g.conf | 6 +++--- ci-scripts/conf_files/benetel-5g.conf | 6 +++--- ci-scripts/xml_files/benetel_multi_node_build.xml | 4 ++-- ci-scripts/xml_files/benetel_nsa_base.xml | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ci-scripts/conf_files/benetel-4g.conf b/ci-scripts/conf_files/benetel-4g.conf index aab3876d96..9423ebe56e 100644 --- a/ci-scripts/conf_files/benetel-4g.conf +++ b/ci-scripts/conf_files/benetel-4g.conf @@ -176,7 +176,7 @@ eNBs = ////////// MME parameters: - mme_ip_address = ( { ipv4 = "192.168.18.99"; + mme_ip_address = ( { ipv4 = "CI_MME_IP_ADDR"; ipv6 = "192:168:30::17"; active = "yes"; preference = "ipv4"; @@ -195,9 +195,9 @@ eNBs = NETWORK_INTERFACES : { ENB_INTERFACE_NAME_FOR_S1_MME = "eth0"; - ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.18.196"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "CI_ENB_IP_ADDR"; ENB_INTERFACE_NAME_FOR_S1U = "eth0"; - ENB_IPV4_ADDRESS_FOR_S1U = "192.168.18.196"; + ENB_IPV4_ADDRESS_FOR_S1U = "CI_ENB_IP_ADDR"; ENB_PORT_FOR_S1U = 2152; # Spec 2152 ENB_IPV4_ADDRESS_FOR_X2C = "127.0.0.1"; ENB_PORT_FOR_X2C = 36422; # Spec 36422 diff --git a/ci-scripts/conf_files/benetel-5g.conf b/ci-scripts/conf_files/benetel-5g.conf index 504d5e7b34..0dfe7854ee 100644 --- a/ci-scripts/conf_files/benetel-5g.conf +++ b/ci-scripts/conf_files/benetel-5g.conf @@ -210,7 +210,7 @@ gNBs = ////////// MME parameters: - mme_ip_address = ( { ipv4 = "192.168.18.99"; + mme_ip_address = ( { ipv4 = "CI_MME_IP_ADDR"; ipv6 = "192:168:30::17"; active = "yes"; preference = "ipv4"; @@ -234,9 +234,9 @@ gNBs = { GNB_INTERFACE_NAME_FOR_S1_MME = "eth0"; - GNB_IPV4_ADDRESS_FOR_S1_MME = "192.168.18.187/24"; + GNB_IPV4_ADDRESS_FOR_S1_MME = "CI_GNB_IP_ADDR"; GNB_INTERFACE_NAME_FOR_S1U = "eth0"; - GNB_IPV4_ADDRESS_FOR_S1U = "192.168.18.187/24"; + GNB_IPV4_ADDRESS_FOR_S1U = "CI_GNB_IP_ADDR"; GNB_PORT_FOR_S1U = 2152; # Spec 2152 GNB_IPV4_ADDRESS_FOR_X2C = "127.0.0.2/24"; GNB_PORT_FOR_X2C = 36422; # Spec 36422 diff --git a/ci-scripts/xml_files/benetel_multi_node_build.xml b/ci-scripts/xml_files/benetel_multi_node_build.xml index 7b4eacef3a..6f9ebdd1d1 100644 --- a/ci-scripts/xml_files/benetel_multi_node_build.xml +++ b/ci-scripts/xml_files/benetel_multi_node_build.xml @@ -33,7 +33,7 @@ Build_eNB Build eNB - -w USRP -c --eNB --ninja + --eNB -t benetel4g -w None 0 0 True @@ -49,7 +49,7 @@ Build_eNB Build gNB - -w USRP -c --gNB --ninja + --gNB -t benetel5g -w None 1 1 True diff --git a/ci-scripts/xml_files/benetel_nsa_base.xml b/ci-scripts/xml_files/benetel_nsa_base.xml index 3c584f121c..cf0b69debf 100644 --- a/ci-scripts/xml_files/benetel_nsa_base.xml +++ b/ci-scripts/xml_files/benetel_nsa_base.xml @@ -21,7 +21,7 @@ --> - TEST-FR1-TM1 + BENETEL TEST-FR1-TM1 FR1 tasks From 92c9d80ce06e06183fd9ebc90b82f8c99a5ff055 Mon Sep 17 00:00:00 2001 From: guhan Date: Mon, 15 Mar 2021 17:47:04 +0530 Subject: [PATCH 189/231] Reverted the changes as same as develop --- openair2/RRC/NR/rrc_gNB_reconfig.c | 44 ++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index c0d3f92942..6650d86604 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -550,7 +550,8 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco ASN_SEQUENCE_ADD(&bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList->list,ss); - bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->searchSpaceSIB1=NULL; + bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->searchSpaceSIB1=calloc(1,sizeof(*bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->searchSpaceSIB1)); + *bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->searchSpaceSIB1=0; bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->searchSpaceOtherSystemInformation=NULL; bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->pagingSearchSpace=NULL; bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->ra_SearchSpace=calloc(1,sizeof(*bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->ra_SearchSpace)); @@ -801,8 +802,12 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco pusch_Config->pusch_AggregationFactor=NULL; pusch_Config->mcs_Table=NULL; pusch_Config->mcs_TableTransformPrecoder=NULL; - pusch_Config->transformPrecoder=calloc(1,sizeof(*pusch_Config->transformPrecoder)); - *pusch_Config->transformPrecoder = NR_PUSCH_Config__transformPrecoder_disabled; + pusch_Config->transformPrecoder= NULL; + /* if msg3_transformprecoding is set in conf file - pusch config should not disable it */ + if (servingcellconfigcommon->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg3_transformPrecoder == NULL) { + pusch_Config->transformPrecoder=calloc(1,sizeof(*pusch_Config->transformPrecoder)); + *pusch_Config->transformPrecoder = NR_PUSCH_Config__transformPrecoder_disabled; + } pusch_Config->codebookSubset=calloc(1,sizeof(*pusch_Config->codebookSubset)); *pusch_Config->codebookSubset = NR_PUSCH_Config__codebookSubset_nonCoherent; pusch_Config->maxRank=calloc(1,sizeof(*pusch_Config->maxRank)); @@ -811,6 +816,39 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco pusch_Config->uci_OnPUSCH=NULL; pusch_Config->tp_pi2BPSK=NULL; + /*------------------------------TRANSFORM PRECODING- -----------------------------------------------------------------------*/ + + uint8_t transform_precoding = NR_PUSCH_Config__transformPrecoder_disabled; + + // TBD: configure this from .conf file, Dedicated params cannot yet be configured in .conf file. + // Enable this to test transform precoding enabled from dedicated config. + /*if (pusch_Config->transformPrecoder == NULL) + pusch_Config->transformPrecoder=calloc(1,sizeof(*pusch_Config->transformPrecoder)); + + *pusch_Config->transformPrecoder = NR_PUSCH_Config__transformPrecoder_enabled; */ + // END ------- + + if (pusch_Config->transformPrecoder == NULL) { + if (servingcellconfigcommon->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg3_transformPrecoder != NULL) + transform_precoding = NR_PUSCH_Config__transformPrecoder_enabled; + } + else + transform_precoding = *pusch_Config->transformPrecoder; + + + if (transform_precoding == NR_PUSCH_Config__transformPrecoder_enabled ) { + /* Enable DMRS uplink config for transform precoding enabled */ + NR_DMRS_UplinkConfig->transformPrecodingEnabled = calloc(1,sizeof(*NR_DMRS_UplinkConfig->transformPrecodingEnabled)); + NR_DMRS_UplinkConfig->transformPrecodingEnabled->nPUSCH_Identity = NULL; + NR_DMRS_UplinkConfig->transformPrecodingEnabled->sequenceGroupHopping = NULL; + NR_DMRS_UplinkConfig->transformPrecodingEnabled->sequenceHopping = NULL; + NR_DMRS_UplinkConfig->transformPrecodingEnabled->ext1 = NULL; + + LOG_I(RRC,"TRANSFORM PRECODING ENABLED......\n"); + + } + /*----------------------------------------------------------------------------------------------------------------------------*/ + initialUplinkBWP->srs_Config = calloc(1,sizeof(*initialUplinkBWP->srs_Config)); initialUplinkBWP->srs_Config->present = NR_SetupRelease_SRS_Config_PR_setup; NR_SRS_Config_t *srs_Config = calloc(1,sizeof(*srs_Config)); From 25bba6d0682541785148d5e430261a3ad9fe06f3 Mon Sep 17 00:00:00 2001 From: hardy Date: Mon, 15 Mar 2021 16:37:40 +0100 Subject: [PATCH 190/231] update benetel test = nsa test --- ci-scripts/xml_files/benetel_nsa_base.xml | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/ci-scripts/xml_files/benetel_nsa_base.xml b/ci-scripts/xml_files/benetel_nsa_base.xml index cf0b69debf..01a5398225 100644 --- a/ci-scripts/xml_files/benetel_nsa_base.xml +++ b/ci-scripts/xml_files/benetel_nsa_base.xml @@ -21,7 +21,7 @@ --> - BENETEL TEST-FR1-TM1 + TEST-FR1-TM1 FR1 tasks @@ -32,7 +32,6 @@ 000001 050000 050001 - 050002 000001 060000 060001 @@ -101,13 +100,6 @@ - Ping - Ping: 5pings in 1sec - -c 5 -i 0.2 - 50 - - - Ping Ping: 100pings in 20sec -c 100 -i 0.2 @@ -117,16 +109,16 @@ Iperf - iperf (DL/1Mbps/UDP)(30 sec)(single-ue profile) - -u -b 1M -t 30 -i 1 + iperf (DL/2.5Mbps/UDP)(60 sec)(single-ue profile) + -u -b 2.5M -t 60 -i 1 50 single-ue Iperf - iperf (UL/1Mbps/UDP)(30 sec)(single-ue profile) - -u -b 1M -t 30 -i 1 -R + iperf (UL/1.5Mbps/UDP)(60 sec)(single-ue profile) + -u -b 1.5M -t 60 -i 1 -R 50 single-ue From bdc97f7a569d9995f7230ab92bca06a3666b787c Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Tue, 16 Mar 2021 10:08:54 +0000 Subject: [PATCH 191/231] Send MAC NR-BCCH-SL-SCH to RRC through ITTI at UE --- openair2/RRC/NR_UE/L2_interface_ue.c | 26 +++++++++++++++++++++++++- openair2/RRC/NR_UE/rrc_UE.c | 2 +- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/openair2/RRC/NR_UE/L2_interface_ue.c b/openair2/RRC/NR_UE/L2_interface_ue.c index 609d526127..c78a1caf37 100644 --- a/openair2/RRC/NR_UE/L2_interface_ue.c +++ b/openair2/RRC/NR_UE/L2_interface_ue.c @@ -56,7 +56,29 @@ nr_mac_rrc_data_ind_ue( break; case NR_BCCH_DL_SCH: - AssertFatal( nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(module_id, gNB_index, (uint8_t*)pduP, pdu_len, 0, 0) == 0, "UE decode BCCH-DL-SCH error!\n"); + if (pdu_len>0) { + LOG_T(NR_RRC, "[UE %d] Received SDU for NR-BCCH-DL-SCH on SRB %u from gNB %d\n", module_id, channel & RAB_OFFSET, + gNB_index); + + MessageDef *message_p; + int msg_sdu_size = BCCH_SDU_SIZE; + + if (pdu_len > msg_sdu_size) { + LOG_E(NR_RRC, "SDU larger than NR-BCCH-DL-SCH SDU buffer size (%d, %d)", sdu_size, msg_sdu_size); + sdu_size = msg_sdu_size; + } else { + sdu_size = pdu_len; + } + + message_p = itti_alloc_new_message(TASK_MAC_UE, 0, NR_RRC_MAC_BCCH_DATA_IND); + memset(NR_RRC_MAC_BCCH_DATA_IND (message_p).sdu, 0, BCCH_SDU_SIZE); + memcpy(NR_RRC_MAC_BCCH_DATA_IND (message_p).sdu, pduP, sdu_size); + NR_RRC_MAC_BCCH_DATA_IND (message_p).frame = frame; //frameP + NR_RRC_MAC_BCCH_DATA_IND (message_p).sub_frame = sub_frame; //sub_frameP + NR_RRC_MAC_BCCH_DATA_IND (message_p).sdu_size = sdu_size; + NR_RRC_MAC_BCCH_DATA_IND (message_p).gnb_index = gNB_index; + itti_send_msg_to_task(TASK_RRC_NRUE, GNB_MODULE_ID_TO_INSTANCE(module_id), message_p); + } break; case CCCH: @@ -83,6 +105,8 @@ nr_mac_rrc_data_ind_ue( NR_RRC_MAC_CCCH_DATA_IND (message_p).rnti = rnti; //rntiP itti_send_msg_to_task (TASK_RRC_NRUE, GNB_MODULE_ID_TO_INSTANCE( module_id ), message_p); } + break; + default: break; } diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index f373d74230..703a93c847 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -2472,7 +2472,6 @@ void *rrc_nrue_task( void *args_p ) { case NR_RRC_MAC_BCCH_DATA_IND: LOG_D(NR_RRC, "[UE %d] Received %s: frameP %d, gNB %d\n", ue_mod_id, ITTI_MSG_NAME (msg_p), NR_RRC_MAC_BCCH_DATA_IND (msg_p).frame, NR_RRC_MAC_BCCH_DATA_IND (msg_p).gnb_index); - // PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, ENB_FLAG_NO, NOT_A_RNTI, RRC_MAC_BCCH_DATA_IND (msg_p).frame, 0); PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_id, GNB_FLAG_NO, NOT_A_RNTI, NR_RRC_MAC_BCCH_DATA_IND (msg_p).frame, 0,NR_RRC_MAC_BCCH_DATA_IND (msg_p).gnb_index); nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message (ctxt.module_id, NR_RRC_MAC_BCCH_DATA_IND (msg_p).gnb_index, @@ -2480,6 +2479,7 @@ void *rrc_nrue_task( void *args_p ) { NR_RRC_MAC_BCCH_DATA_IND (msg_p).sdu_size, NR_RRC_MAC_BCCH_DATA_IND (msg_p).rsrq, NR_RRC_MAC_BCCH_DATA_IND (msg_p).rsrp); + break; case NR_RRC_MAC_CCCH_DATA_IND: LOG_D(NR_RRC, "[UE %d] RNTI %x Received %s: frameP %d, gNB %d\n", From 8646dd0bcbc55379c2af89780b88c9a9daa6311c Mon Sep 17 00:00:00 2001 From: rmagueta Date: Tue, 16 Mar 2021 12:51:04 +0000 Subject: [PATCH 192/231] DRB configuration for a new crnti --- openair2/LAYER2/NR_MAC_gNB/config.c | 2 +- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 11 +++-------- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 10 ++-------- openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 2 +- openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c | 4 +++- openair2/RRC/NR/rrc_gNB.c | 3 +++ openair2/RRC/NR_UE/rrc_UE.c | 6 +++--- 7 files changed, 16 insertions(+), 22 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 41317f8bbc..cb30d21d88 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -435,7 +435,7 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, } } else { ra->cfra = false; - ra->rnti = rnti; + ra->rnti = 0; ra->preambles.num_preambles = MAX_NUM_NR_PRACH_PREAMBLES; ra->preambles.preamble_list = (uint8_t *) malloc(MAX_NUM_NR_PRACH_PREAMBLES*sizeof(uint8_t)); for (int i = 0; i < MAX_NUM_NR_PRACH_PREAMBLES; i++) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 92d9f65fef..d3f8cf9693 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -575,8 +575,6 @@ void nr_initiate_ra_proc(module_id_t module_idP, LOG_D(MAC, "%s() Msg2[%04d%d] SFN/SF:%04d%d\n", __FUNCTION__, ra->Msg2_frame, ra->Msg2_slot, frameP, slotP); - // TODO: Configure RRC with the new RNTI of the following commented lines - /* int loop = 0; if (!ra->cfra) { do { @@ -590,7 +588,6 @@ void nr_initiate_ra_proc(module_id_t module_idP, abort(); } } - */ ra->RA_rnti = ra_rnti; ra->preamble_index = preamble_index; @@ -1364,9 +1361,9 @@ void nr_check_Msg4_Ack(module_id_t module_id, int CC_id, frame_t frame, sub_fram { if (harq->round == 0) { - ra->state = RA_IDLE; - UE_info->active[UE_id] = true; + nr_clear_ra_proc(module_id, CC_id, frame, ra); free(ra->preambles.preamble_list); + UE_info->active[UE_id] = true; LOG_I(NR_MAC, "(ue %i, rnti 0x%04x) Received Ack of RA-Msg4. RA procedure succeeded!\n", UE_id, ra->rnti); } else @@ -1377,9 +1374,7 @@ void nr_check_Msg4_Ack(module_id_t module_id, int CC_id, frame_t frame, sub_fram } -void nr_clear_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP){ - - NR_RA_t *ra = &RC.nrmac[module_idP]->common_channels[CC_id].ra[0]; +void nr_clear_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP, NR_RA_t *ra){ LOG_D(MAC,"[gNB %d][RAPROC] CC_id %d Frame %d Clear Random access information rnti %x\n", module_idP, CC_id, frameP, ra->rnti); ra->state = RA_IDLE; ra->timing_offset = 0; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 22827a690d..7af74c931d 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -492,10 +492,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, if(no_sig) { LOG_W(NR_MAC, "Random Access %i failed at state %i\n", i, ra->state); - ra->state = RA_IDLE; - ra->timing_offset = 0; - ra->RRC_timer = 20; - ra->msg3_round = 0; + nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra); } else { // random access pusch with TC-RNTI @@ -547,10 +544,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, continue; LOG_W(NR_MAC, "Random Access %i failed at state %i\n", i, ra->state); - ra->state = RA_IDLE; - ra->timing_offset = 0; - ra->RRC_timer = 20; - ra->msg3_round = 0; + nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra); } } } diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index 823e374ceb..1fa27506a9 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -114,7 +114,7 @@ void nr_schedule_RA(module_id_t module_idP, frame_t frameP, sub_frame_t slotP); void nr_initiate_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t slotP, uint16_t preamble_index, uint8_t freq_index, uint8_t symbol, int16_t timing_offset); -void nr_clear_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP); +void nr_clear_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP, NR_RA_t *ra); int nr_allocate_CCEs(int module_idP, int CC_idP, frame_t frameP, sub_frame_t slotP, int test_only); diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index f14d25b145..100f1d6acc 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -796,7 +796,9 @@ void nr_DRB_preconfiguration(uint16_t crnti) rbconfig->securityConfig->keyToUse = calloc(1,sizeof(*rbconfig->securityConfig->keyToUse)); *rbconfig->securityConfig->keyToUse = NR_SecurityConfig__keyToUse_master; - xer_fprint(stdout, &asn_DEF_NR_RadioBearerConfig, (const void*)rbconfig); + if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { + xer_fprint(stdout, &asn_DEF_NR_RadioBearerConfig, (const void*)rbconfig); + } NR_RLC_BearerConfig_t *RLC_BearerConfig = calloc(1,sizeof(*RLC_BearerConfig)); nr_rlc_bearer_init(RLC_BearerConfig); diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 3a70ea482a..e231cd4d47 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -1496,6 +1496,9 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP, rrc_gNB_generate_RRCSetup(ctxt_pP, rrc_gNB_get_ue_context(gnb_rrc_inst, ctxt_pP->rnti), CC_id); + + // FIXME: Check the best place to perform this DRB configuration + nr_DRB_preconfiguration(ctxt_pP->rnti); } break; diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index 703a93c847..0d52f218a1 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -1365,10 +1365,10 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB (void **)&dl_ccch_msg, (uint8_t *)Srb_info->Rx_buffer.Payload, 100,0,0); - - // if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { + + if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { xer_fprint(stdout,&asn_DEF_NR_DL_CCCH_Message,(void *)dl_ccch_msg); - // } + } if ((dec_rval.code != RC_OK) && (dec_rval.consumed==0)) { LOG_E(RRC,"[UE %d] Frame %d : Failed to decode DL-CCCH-Message (%zu bytes)\n",ctxt_pP->module_id,ctxt_pP->frame,dec_rval.consumed); From 32cdc2703cb823fcd6cddc3ec7949d8910349261 Mon Sep 17 00:00:00 2001 From: Remi Hardy Date: Tue, 9 Mar 2021 14:24:32 +0100 Subject: [PATCH 193/231] nsa test integration into jenkins dummy files cleanup --- ci-scripts/Jenkinsfile-tmp-multi-enb-dummy | 73 +++++ ci-scripts/Jenkinsfile-tmp-multi-enb-nsa | 293 ++++++++++++++++++ ci-scripts/Jenkinsfile-trig-nsa | 58 ++++ ci-scripts/xml_files/fr1_multi_node_test.xml | 77 ----- ...{fr1_ran_ue_iperf.xml => fr1_nsa_base.xml} | 35 ++- ci-scripts/xml_files/fr1_ran_ue_base.xml | 150 --------- 6 files changed, 456 insertions(+), 230 deletions(-) create mode 100644 ci-scripts/Jenkinsfile-tmp-multi-enb-dummy create mode 100644 ci-scripts/Jenkinsfile-tmp-multi-enb-nsa create mode 100644 ci-scripts/Jenkinsfile-trig-nsa delete mode 100644 ci-scripts/xml_files/fr1_multi_node_test.xml rename ci-scripts/xml_files/{fr1_ran_ue_iperf.xml => fr1_nsa_base.xml} (82%) delete mode 100644 ci-scripts/xml_files/fr1_ran_ue_base.xml diff --git a/ci-scripts/Jenkinsfile-tmp-multi-enb-dummy b/ci-scripts/Jenkinsfile-tmp-multi-enb-dummy new file mode 100644 index 0000000000..64dba90f36 --- /dev/null +++ b/ci-scripts/Jenkinsfile-tmp-multi-enb-dummy @@ -0,0 +1,73 @@ +#!/bin/groovy +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +// Template Jenkins Declarative Pipeline script to run Test w/ RF HW + +// Location of the python executor node shall be in the same subnet as the others servers +def pythonExecutor = params.pythonExecutor + +// Location of the test XML file to be run +def testXMLFile = params.pythonTestXmlFile +def mainPythonAllXmlFiles = "" +def buildStageStatus = true + +// Name of the test stage +def testStageName = params.pipelineTestStageName + +// Name of the phone resource +def ciSmartPhoneResource = params.smartphonesResource + +// Global Parameters. Normally they should be populated when the master job +// triggers the slave job with parameters +def eNB_Repository +def eNB_Branch +def eNB_CommitID +def eNB_AllowMergeRequestProcess = false +def eNB_TargetBranch + +pipeline { + agent { + label pythonExecutor + } + options { + disableConcurrentBuilds() + ansiColor('xterm') + } + stages { + stage("Build Init") { + steps { + // update the build name and description + buildName "${params.eNB_MR}" + buildDescription "Branch : ${params.eNB_Branch}" + } + } + stage ("Verify Parameters") { + steps { + script { + echo "eNB_Branch : ${params.eNB_Branch}" + echo "eNB_CommitID : ${params.eNB_CommitID}" + } + } + } + } +} + \ No newline at end of file diff --git a/ci-scripts/Jenkinsfile-tmp-multi-enb-nsa b/ci-scripts/Jenkinsfile-tmp-multi-enb-nsa new file mode 100644 index 0000000000..7f61639261 --- /dev/null +++ b/ci-scripts/Jenkinsfile-tmp-multi-enb-nsa @@ -0,0 +1,293 @@ +#!/bin/groovy +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +// Template Jenkins Declarative Pipeline script to run Test w/ RF HW + +// Location of the python executor node shall be in the same subnet as the others servers +def pythonExecutor = params.pythonExecutor + +// Location of the test XML file to be run +def testXMLFile = params.pythonTestXmlFile +def mainPythonAllXmlFiles = "" +def buildStageStatus = true + +// Name of the test stage +def testStageName = params.pipelineTestStageName + +// Name of the phone resource +def ciSmartPhoneResource1 = params.smartphonesResource1 +def ciSmartPhoneResource2 = params.smartphonesResource2 + +// Global Parameters. Normally they should be populated when the master job +// triggers the slave job with parameters +def eNB_Repository +def eNB_Branch +def eNB_CommitID +def eNB_AllowMergeRequestProcess = false +def eNB_TargetBranch + +pipeline { + agent { + label pythonExecutor + } + options { + disableConcurrentBuilds() + ansiColor('xterm') + lock(extra: [[resource: ciSmartPhoneResource2]], resource: ciSmartPhoneResource1) + } + stages { + stage("Build Init") { + steps { + // update the build name and description + buildName "${params.eNB_MR}" + buildDescription "Branch : ${params.eNB_Branch}" + } + } + stage ("Verify Parameters") { + steps { + script { + echo '\u2705 \u001B[32mVerify Parameters\u001B[0m' + def allParametersPresent = true + + // It is already to late to check it + if (params.pythonExecutor != null) { + echo "eNB CI executor node : ${pythonExecutor}" + } + // If not present picking a default Stage Name + if (params.pipelineTestStageName == null) { + // picking default + testStageName = 'Template Test Stage' + } + + if (params.smartphonesResource1 == null) { + allParametersPresent = false + } + if (params.smartphonesResource2 == null) { + allParametersPresent = false + } + // 1st eNB parameters + if (params.eNB_IPAddress == null) { + allParametersPresent = false + } + if (params.eNB_SourceCodePath == null) { + allParametersPresent = false + } + if (params.eNB_Credentials == null) { + allParametersPresent = false + } + // 2nd eNB parameters + if (params.eNB1_IPAddress == null) { + allParametersPresent = false + } + if (params.eNB1_SourceCodePath == null) { + allParametersPresent = false + } + if (params.eNB1_Credentials == null) { + allParametersPresent = false + } + // 3rd eNB parameters + if (params.eNB2_IPAddress == null) { + allParametersPresent = false + } + if (params.eNB2_SourceCodePath == null) { + allParametersPresent = false + } + if (params.eNB2_Credentials == null) { + allParametersPresent = false + } + // the following 4 parameters should be pushed by the master trigger + // if not present, take the job GIT variables (used for developing) + if (params.eNB_Repository == null) { + eNB_Repository = env.GIT_URL + } else { + eNB_Repository = params.eNB_Repository + } + echo "eNB_Repository : ${eNB_Repository}" + if (params.eNB_Branch == null) { + eNB_Branch = env.GIT_BRANCH + } else { + eNB_Branch = params.eNB_Branch + } + echo "eNB_Branch : ${eNB_Branch}" + if (params.eNB_CommitID == null) { + eNB_CommitID = env.GIT_COMMIT + } else { + eNB_CommitID = params.eNB_CommitID + } + echo "eNB_CommitID : ${eNB_CommitID}" + if (params.eNB_mergeRequest != null) { + eNB_AllowMergeRequestProcess = params.eNB_mergeRequest + if (eNB_AllowMergeRequestProcess) { + if (params.eNB_TargetBranch != null) { + eNB_TargetBranch = params.eNB_TargetBranch + } else { + eNB_TargetBranch = 'develop' + } + echo "eNB_TargetBranch : ${eNB_TargetBranch}" + } + } + + if (params.EPC_IPAddress == null) { + allParametersPresent = false + } + if (params.EPC_Type == null) { + allParametersPresent = false + } + if (params.EPC_SourceCodePath == null) { + allParametersPresent = false + } + if (params.EPC_Credentials == null) { + allParametersPresent = false + } + + if (params.ADB_IPAddress == null) { + allParametersPresent = false + } + if (params.ADB_Credentials == null) { + allParametersPresent = false + } + + if (allParametersPresent) { + echo "All parameters are present" + if (eNB_AllowMergeRequestProcess) { + sh "git fetch" + sh "./ci-scripts/doGitLabMerge.sh --src-branch ${eNB_Branch} --src-commit ${eNB_CommitID} --target-branch ${eNB_TargetBranch} --target-commit latest" + } else { + sh "git fetch" + sh "git checkout -f ${eNB_CommitID}" + } + } else { + echo "Some parameters are missing" + sh "./ci-scripts/fail.sh" + } + } + } + } + stage ("Build and Test") { + steps { + script { + dir ('ci-scripts') { + echo "\u2705 \u001B[32m${testStageName}\u001B[0m" + // If not present picking a default XML file + if (params.pythonTestXmlFile == null) { + // picking default + testXMLFile = 'xml_files/enb_usrpB210_band7_50PRB.xml' + echo "Test XML file(default): ${testXMLFile}" + mainPythonAllXmlFiles += "--XMLTestFile=" + testXMLFile + " " + } else { + String[] myXmlTestSuite = testXMLFile.split("\\r?\\n") + for (xmlFile in myXmlTestSuite) { + if (fileExists(xmlFile)) { + mainPythonAllXmlFiles += "--XMLTestFile=" + xmlFile + " " + echo "Test XML file : ${xmlFile}" + } + } + } + withCredentials([ + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB_Credentials}", usernameVariable: 'eNB_Username', passwordVariable: 'eNB_Password'], + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB1_Credentials}", usernameVariable: 'eNB1_Username', passwordVariable: 'eNB1_Password'], + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB2_Credentials}", usernameVariable: 'eNB2_Username', passwordVariable: 'eNB2_Password'], + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.EPC_Credentials}", usernameVariable: 'EPC_Username', passwordVariable: 'EPC_Password'], + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.ADB_Credentials}", usernameVariable: 'ADB_Username', passwordVariable: 'ADB_Password'] + ]) { + sh "python3 main.py --mode=InitiateHtml --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} ${mainPythonAllXmlFiles}" + String[] myXmlTestSuite = testXMLFile.split("\\r?\\n") + for (xmlFile in myXmlTestSuite) { + if (fileExists(xmlFile)) { + try { + sh "python3 main.py --mode=TesteNB --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath} --eNB1IPAddress=${params.eNB1_IPAddress} --eNB1UserName=${eNB1_Username} --eNB1Password=${eNB1_Password} --eNB1SourceCodePath=${params.eNB1_SourceCodePath} --eNB2IPAddress=${params.eNB2_IPAddress} --eNB2UserName=${eNB2_Username} --eNB2Password=${eNB2_Password} --eNB2SourceCodePath=${params.eNB2_SourceCodePath} --EPCIPAddress=${params.EPC_IPAddress} --EPCType=${params.EPC_Type} --EPCUserName=${EPC_Username} --EPCPassword=${EPC_Password} --EPCSourceCodePath=${params.EPC_SourceCodePath} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} --XMLTestFile=${xmlFile}" + } catch (Exception e) { + currentBuild.result = 'FAILURE' + buildStageStatus = false + } + } + } + sh "python3 main.py --mode=FinalizeHtml --finalStatus=${buildStageStatus} --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password}" + } + } + } + } + } + stage('Log Collection') { + parallel { + stage('Log Collection (eNB - Build)') { + steps { + withCredentials([ + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB_Credentials}", usernameVariable: 'eNB_Username', passwordVariable: 'eNB_Password'] + ]) { + echo '\u2705 \u001B[32mLog Collection (eNB - Build)\u001B[0m' + sh "python3 ci-scripts/main.py --mode=LogCollectBuild --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath}" + + echo '\u2705 \u001B[32mLog Transfer (eNB - Build)\u001B[0m' + sh "sshpass -p \'${eNB_Password}\' scp -o 'StrictHostKeyChecking no' -o 'ConnectTimeout 10' ${eNB_Username}@${params.eNB_IPAddress}:${eNB_SourceCodePath}/cmake_targets/build.log.zip ./build.log.${env.BUILD_ID}.zip || true" + } + script { + if(fileExists("build.log.${env.BUILD_ID}.zip")) { + archiveArtifacts "build.log.${env.BUILD_ID}.zip" + } + } + } + } + stage('Log Collection (eNB - Run)') { + steps { + withCredentials([ + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB_Credentials}", usernameVariable: 'eNB_Username', passwordVariable: 'eNB_Password'] + ]) { + echo '\u2705 \u001B[32mLog Collection (eNB - Run)\u001B[0m' + sh "python3 ci-scripts/main.py --mode=LogCollecteNB --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath}" + + echo '\u2705 \u001B[32mLog Transfer (eNB - Run)\u001B[0m' + sh "sshpass -p \'${eNB_Password}\' scp -o 'StrictHostKeyChecking no' -o 'ConnectTimeout 10' ${eNB_Username}@${params.eNB_IPAddress}:${eNB_SourceCodePath}/cmake_targets/enb.log.zip ./enb.log.${env.BUILD_ID}.zip || true" + } + script { + if(fileExists("enb.log.${env.BUILD_ID}.zip")) { + archiveArtifacts "enb.log.${env.BUILD_ID}.zip" + } + if(fileExists("ci-scripts/test_results.html")) { + sh "mv ci-scripts/test_results.html test_results-${JOB_NAME}.html" + sh "sed -i -e 's#TEMPLATE_JOB_NAME#${JOB_NAME}#' -e 's@build #TEMPLATE_BUILD_ID@build #${BUILD_ID}@' -e 's#Build-ID: TEMPLATE_BUILD_ID#Build-ID: ${BUILD_ID}#' -e 's#TEMPLATE_STAGE_NAME#${testStageName}#' test_results-${JOB_NAME}.html" + archiveArtifacts "test_results-${JOB_NAME}.html" + } + } + } + } + } + } + } + + post { + always { + script { + if (params.pipelineZipsConsoleLog != null) { + if (params.pipelineZipsConsoleLog) { + echo "Archiving Jenkins console log" + sh "wget --no-check-certificate --no-proxy ${env.JENKINS_URL}/job/${env.JOB_NAME}/${env.BUILD_ID}/consoleText -O consoleText.log || true" + sh "zip -m consoleText.log.${env.BUILD_ID}.zip consoleText.log || true" + if(fileExists("consoleText.log.${env.BUILD_ID}.zip")) { + archiveArtifacts "consoleText.log.${env.BUILD_ID}.zip" + } + } + } + } + } + } +} diff --git a/ci-scripts/Jenkinsfile-trig-nsa b/ci-scripts/Jenkinsfile-trig-nsa new file mode 100644 index 0000000000..2ecf6ebd1e --- /dev/null +++ b/ci-scripts/Jenkinsfile-trig-nsa @@ -0,0 +1,58 @@ +#!/bin/groovy +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +// Template Jenkins Declarative Pipeline script to run Test w/ RF HW + +// Location of the python executor node shall be in the same subnet as the others servers +def pythonExecutor = params.pythonExecutor + +pipeline { + agent { + label pythonExecutor + } + stages { + stage ("NSA Test Loop") { + steps { + script { + MR_LIST= sh returnStdout: true, script: 'curl --silent "https://gitlab.eurecom.fr/api/v4/projects/oai%2Fopenairinterface5g/merge_requests?state=opened&per_page=100&labels=READY_TO_BE_MERGED" | jq ".[].iid" || true ' + echo "List of selected MR:\n${MR_LIST}" + def MR_ARRAY = MR_LIST.split('\n') + for (MR in MR_ARRAY) { + SRC_BRANCH=sh returnStdout: true, script: """curl --silent "https://gitlab.eurecom.fr/api/v4/projects/oai%2Fopenairinterface5g/merge_requests/${MR}" | jq ".source_branch" || true """ + SRC_BRANCH=SRC_BRANCH.trim() + COMMIT_ID=sh returnStdout: true, script: """curl --silent "https://gitlab.eurecom.fr/api/v4/projects/oai%2Fopenairinterface5g/merge_requests/${MR}" | jq ".sha" || true """ + COMMIT_ID=COMMIT_ID.trim() + echo "Testing NSA on : ${MR} ${SRC_BRANCH} ${COMMIT_ID}" + //calling sub job + build job: "RAN-CI-NSA-B210", wait : false, propagate : false, parameters: [ + string(name: 'eNB_MR', value: String.valueOf(MR)), + string(name: 'eNB_Branch', value: String.valueOf(SRC_BRANCH)), + string(name: 'eNB_CommitID', value: String.valueOf(COMMIT_ID)) + ] + } + } + } + } + } +} + + diff --git a/ci-scripts/xml_files/fr1_multi_node_test.xml b/ci-scripts/xml_files/fr1_multi_node_test.xml deleted file mode 100644 index 8c56f0bcec..0000000000 --- a/ci-scripts/xml_files/fr1_multi_node_test.xml +++ /dev/null @@ -1,77 +0,0 @@ - - - test-fr1-tm1 - Test-FR1-TM1 - tasks - 1 - - 030000 - 040000 - 000001 - 070001 - 070000 - - - - - - Initialize_eNB - Initialize eNB - -O ci-scripts/conf_files/enb.band7.tm1.fr1.25PRB.usrpb210.conf - 0 - 0 - lte - - - - Initialize_eNB - Initialize gNB (3/4 sampling rate) - -O ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf -E - 1 - 1 - nr - - - - IdleSleep - Sleep - 30 - - - - Terminate_eNB - Terminate eNB - 0 - 0 - - - - Terminate_eNB - Terminate gNB - 1 - 1 - - - - diff --git a/ci-scripts/xml_files/fr1_ran_ue_iperf.xml b/ci-scripts/xml_files/fr1_nsa_base.xml similarity index 82% rename from ci-scripts/xml_files/fr1_ran_ue_iperf.xml rename to ci-scripts/xml_files/fr1_nsa_base.xml index 8ead3afc62..01a5398225 100644 --- a/ci-scripts/xml_files/fr1_ran_ue_iperf.xml +++ b/ci-scripts/xml_files/fr1_nsa_base.xml @@ -31,14 +31,17 @@ 010001 000001 050000 + 050001 000001 060000 060001 000001 + 070000 + 070001 010002 000001 - 070001 - 070000 + 080001 + 080000 010003 @@ -96,6 +99,13 @@ 50 + + Ping + Ping: 100pings in 20sec + -c 100 -i 0.2 + 50 + + Iperf @@ -113,7 +123,26 @@ single-ue + + Iperf + iperf (DL/20Mbps/UDP)(20 sec)(single-ue profile) + -u -b 20M -t 20 -i 1 + 50 + single-ue + + + + Iperf + iperf (UL/3Mbps/UDP)(20 sec)(single-ue profile) + -u -b 3M -t 20 -i 1 -R + 50 + single-ue + + + + + Terminate_eNB Terminate eNB 0 @@ -121,7 +150,7 @@ lte - + Terminate_eNB Terminate gNB 1 diff --git a/ci-scripts/xml_files/fr1_ran_ue_base.xml b/ci-scripts/xml_files/fr1_ran_ue_base.xml deleted file mode 100644 index 847967f81e..0000000000 --- a/ci-scripts/xml_files/fr1_ran_ue_base.xml +++ /dev/null @@ -1,150 +0,0 @@ - - - TEST-FR1-TM1 - FR1 - tasks - - 010000 - 030000 - 040000 - 010001 - 000001 - 050000 - 050001 - 050002 - 050002 - 000001 - 060000 - 060001 - 000001 - 010002 - 000001 - 070001 - 070000 - 010003 - - - - - Initialize_UE - Initialize UE - - - - Terminate_UE - Terminate UE - - - - Attach_UE - Attach UE - - - - Detach_UE - Detach UE - - - - - Initialize_eNB - Initialize eNB - -O ci-scripts/conf_files/enb.band7.tm1.fr1.25PRB.usrpb210.conf - 0 - 0 - lte - - - - - Initialize_eNB - Initialize gNB - -O ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf -E - 1 - 1 - nr - - - - IdleSleep - Sleep - 20 - - - - Ping - Ping: 20pings in 20sec - -c 20 - 50 - - - - Ping - Ping: 5pings in 1sec - -c 5 -i 0.2 - 50 - - - - Ping - Ping: 100pings in 20sec - -c 100 -i 0.2 - 50 - - - - - Iperf - iperf (DL/1Mbps/UDP)(30 sec)(single-ue profile) - -u -b 1M -t 30 -i 1 - 50 - single-ue - - - - Iperf - iperf (UL/1Mbps/UDP)(30 sec)(single-ue profile) - -u -b 1M -t 30 -i 1 -R - 50 - single-ue - - - - Terminate_eNB - Terminate eNB - 0 - 0 - lte - - - - Terminate_eNB - Terminate gNB - 1 - 1 - nr - - - - From 6fc492819e7d5d3436361f73ccf077c08bb78600 Mon Sep 17 00:00:00 2001 From: hardy Date: Tue, 16 Mar 2021 09:50:51 +0100 Subject: [PATCH 194/231] dummy test files cleanup --- ci-scripts/Jenkinsfile-tmp-multi-enb-dummy | 73 ---------------------- 1 file changed, 73 deletions(-) delete mode 100644 ci-scripts/Jenkinsfile-tmp-multi-enb-dummy diff --git a/ci-scripts/Jenkinsfile-tmp-multi-enb-dummy b/ci-scripts/Jenkinsfile-tmp-multi-enb-dummy deleted file mode 100644 index 64dba90f36..0000000000 --- a/ci-scripts/Jenkinsfile-tmp-multi-enb-dummy +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/groovy -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -// Template Jenkins Declarative Pipeline script to run Test w/ RF HW - -// Location of the python executor node shall be in the same subnet as the others servers -def pythonExecutor = params.pythonExecutor - -// Location of the test XML file to be run -def testXMLFile = params.pythonTestXmlFile -def mainPythonAllXmlFiles = "" -def buildStageStatus = true - -// Name of the test stage -def testStageName = params.pipelineTestStageName - -// Name of the phone resource -def ciSmartPhoneResource = params.smartphonesResource - -// Global Parameters. Normally they should be populated when the master job -// triggers the slave job with parameters -def eNB_Repository -def eNB_Branch -def eNB_CommitID -def eNB_AllowMergeRequestProcess = false -def eNB_TargetBranch - -pipeline { - agent { - label pythonExecutor - } - options { - disableConcurrentBuilds() - ansiColor('xterm') - } - stages { - stage("Build Init") { - steps { - // update the build name and description - buildName "${params.eNB_MR}" - buildDescription "Branch : ${params.eNB_Branch}" - } - } - stage ("Verify Parameters") { - steps { - script { - echo "eNB_Branch : ${params.eNB_Branch}" - echo "eNB_CommitID : ${params.eNB_CommitID}" - } - } - } - } -} - \ No newline at end of file From 986a9fac1d2e251e4de27aadadf6dc92dd9959a4 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Tue, 16 Mar 2021 16:00:37 +0000 Subject: [PATCH 195/231] Fixed issues to allow coexistence of CFRA and CBRA implementations --- openair2/LAYER2/NR_MAC_UE/nr_l1_helpers.c | 14 +- openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c | 268 ++++++++---------- openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c | 4 +- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 6 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 49 ++-- openair2/RRC/NR/rrc_gNB_reconfig.c | 98 +++---- 6 files changed, 213 insertions(+), 226 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_UE/nr_l1_helpers.c b/openair2/LAYER2/NR_MAC_UE/nr_l1_helpers.c index 27623fe5be..2f4697c25d 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_l1_helpers.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_l1_helpers.c @@ -146,17 +146,11 @@ int nr_get_Po_NOMINAL_PUSCH(NR_PRACH_RESOURCES_t *prach_resources, module_id_t m NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id); NR_ServingCellConfigCommon_t *scc = mac->scc; - int8_t receivedTargerPower, delta_preamble; - long preambleReceivedTargetPower = 0; - - if (prach_resources->RA_TYPE == RA_4STEP){ - NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup; - preambleReceivedTargetPower = nr_rach_ConfigCommon->rach_ConfigGeneric.preambleReceivedTargetPower; - } else if (prach_resources->RA_TYPE == RA_2STEP){ - // msgA-PreambleReceivedTargetPower - LOG_E(MAC, "In %s:%d: missing implementation for 2-step RA...\n", __FUNCTION__, __LINE__); - } + int8_t receivedTargerPower; + int8_t delta_preamble; + NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup; + long preambleReceivedTargetPower = nr_rach_ConfigCommon->rach_ConfigGeneric.preambleReceivedTargetPower; delta_preamble = nr_get_DELTA_PREAMBLE(mod_id, CC_id, prach_resources->prach_format); receivedTargerPower = preambleReceivedTargetPower + delta_preamble + (prach_resources->RA_PREAMBLE_POWER_RAMPING_COUNTER - 1) * prach_resources->RA_PREAMBLE_POWER_RAMPING_STEP + prach_resources->POWER_OFFSET_2STEP_RA; diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c index 0d234c2163..080a09ad51 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c @@ -103,150 +103,137 @@ void init_RA(module_id_t mod_id, LOG_E(MAC, "In %s: config not handled\n", __FUNCTION__); } - if (prach_resources->RA_TYPE == RA_2STEP){ - LOG_E(MAC, "Missing implementation of initialization of 2-step RA specific variables...\n"); - } else if (prach_resources->RA_TYPE == RA_4STEP){ - LOG_D(MAC, "Initialization of 4-step RA specific variables...\n"); - switch (rach_ConfigGeneric->powerRampingStep){ // in dB - case 0: + switch (rach_ConfigGeneric->powerRampingStep){ // in dB + case 0: prach_resources->RA_PREAMBLE_POWER_RAMPING_STEP = 0; break; - case 1: + case 1: prach_resources->RA_PREAMBLE_POWER_RAMPING_STEP = 2; break; - case 2: + case 2: prach_resources->RA_PREAMBLE_POWER_RAMPING_STEP = 4; break; - case 3: + case 3: prach_resources->RA_PREAMBLE_POWER_RAMPING_STEP = 6; break; - } - - switch (rach_ConfigGeneric->preambleTransMax) { - case 0: - ra->preambleTransMax = 3; - break; - case 1: - ra->preambleTransMax = 4; - break; - case 2: - ra->preambleTransMax = 5; - break; - case 3: - ra->preambleTransMax = 6; - break; - case 4: - ra->preambleTransMax = 7; - break; - case 5: - ra->preambleTransMax = 8; - break; - case 6: - ra->preambleTransMax = 10; - break; - case 7: - ra->preambleTransMax = 20; - break; - case 8: - ra->preambleTransMax = 50; - break; - case 9: - ra->preambleTransMax = 100; - break; - case 10: - ra->preambleTransMax = 200; - break; - } - if (nr_rach_ConfigCommon->ext1) { - if (nr_rach_ConfigCommon->ext1->ra_PrioritizationForAccessIdentity){ - LOG_D(MAC, "In %s:%d: Missing implementation for Access Identity initialization procedures\n", __FUNCTION__, __LINE__); - } - } } - return; + switch (rach_ConfigGeneric->preambleTransMax) { + case 0: + ra->preambleTransMax = 3; + break; + case 1: + ra->preambleTransMax = 4; + break; + case 2: + ra->preambleTransMax = 5; + break; + case 3: + ra->preambleTransMax = 6; + break; + case 4: + ra->preambleTransMax = 7; + break; + case 5: + ra->preambleTransMax = 8; + break; + case 6: + ra->preambleTransMax = 10; + break; + case 7: + ra->preambleTransMax = 20; + break; + case 8: + ra->preambleTransMax = 50; + break; + case 9: + ra->preambleTransMax = 100; + break; + case 10: + ra->preambleTransMax = 200; + break; + } + if (nr_rach_ConfigCommon->ext1) { + if (nr_rach_ConfigCommon->ext1->ra_PrioritizationForAccessIdentity){ + LOG_D(MAC, "In %s:%d: Missing implementation for Access Identity initialization procedures\n", __FUNCTION__, __LINE__); + } + } } void ssb_rach_config(RA_config_t *ra, NR_PRACH_RESOURCES_t *prach_resources, NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon, fapi_nr_ul_config_prach_pdu *prach_pdu){ // Determine the SSB to RACH mapping ratio // ======================================= - if (prach_resources->RA_TYPE == RA_4STEP){ - NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR ssb_perRACH_config = nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present; - boolean_t multiple_ssb_per_ro; // true if more than one or exactly one SSB per RACH occasion, false if more than one RO per SSB - uint8_t ssb_rach_ratio; // Nb of SSBs per RACH or RACHs per SSB - int total_preambles_per_ssb; - uint8_t ssb_nb_in_ro; - int numberOfRA_Preambles = 64; - switch (ssb_perRACH_config){ - case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneEighth: - multiple_ssb_per_ro = false; - ssb_rach_ratio = 8; - ra->cb_preambles_per_ssb = 4 * (nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.oneEighth + 1); - break; - case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneFourth: - multiple_ssb_per_ro = false; - ssb_rach_ratio = 4; - ra->cb_preambles_per_ssb = 4 * (nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.oneFourth + 1); - break; - case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneHalf: - multiple_ssb_per_ro = false; - ssb_rach_ratio = 2; - ra->cb_preambles_per_ssb = 4 * (nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.oneHalf + 1); - break; - case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_one: - multiple_ssb_per_ro = true; - ssb_rach_ratio = 1; - ra->cb_preambles_per_ssb = 4 * (nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.one + 1); - break; - case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_two: - multiple_ssb_per_ro = true; - ssb_rach_ratio = 2; - ra->cb_preambles_per_ssb = 4 * (nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.two + 1); - break; - case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_four: - multiple_ssb_per_ro = true; - ssb_rach_ratio = 4; - ra->cb_preambles_per_ssb = nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.four; - break; - case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_eight: - multiple_ssb_per_ro = true; - ssb_rach_ratio = 8; - ra->cb_preambles_per_ssb = nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.eight; - break; - case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_sixteen: - multiple_ssb_per_ro = true; - ssb_rach_ratio = 16; - ra->cb_preambles_per_ssb = nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.sixteen; - break; - default: - AssertFatal(1 == 0, "Unsupported ssb_perRACH_config %d\n", ssb_perRACH_config); - break; - } + NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR ssb_perRACH_config = nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present; + boolean_t multiple_ssb_per_ro; // true if more than one or exactly one SSB per RACH occasion, false if more than one RO per SSB + uint8_t ssb_rach_ratio; // Nb of SSBs per RACH or RACHs per SSB + int total_preambles_per_ssb; + uint8_t ssb_nb_in_ro; + int numberOfRA_Preambles = 64; - if (nr_rach_ConfigCommon->totalNumberOfRA_Preambles) - numberOfRA_Preambles = *(nr_rach_ConfigCommon->totalNumberOfRA_Preambles); + switch (ssb_perRACH_config){ + case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneEighth: + multiple_ssb_per_ro = false; + ssb_rach_ratio = 8; + ra->cb_preambles_per_ssb = 4 * (nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.oneEighth + 1); + break; + case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneFourth: + multiple_ssb_per_ro = false; + ssb_rach_ratio = 4; + ra->cb_preambles_per_ssb = 4 * (nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.oneFourth + 1); + break; + case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneHalf: + multiple_ssb_per_ro = false; + ssb_rach_ratio = 2; + ra->cb_preambles_per_ssb = 4 * (nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.oneHalf + 1); + break; + case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_one: + multiple_ssb_per_ro = true; + ssb_rach_ratio = 1; + ra->cb_preambles_per_ssb = 4 * (nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.one + 1); + break; + case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_two: + multiple_ssb_per_ro = true; + ssb_rach_ratio = 2; + ra->cb_preambles_per_ssb = 4 * (nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.two + 1); + break; + case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_four: + multiple_ssb_per_ro = true; + ssb_rach_ratio = 4; + ra->cb_preambles_per_ssb = nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.four; + break; + case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_eight: + multiple_ssb_per_ro = true; + ssb_rach_ratio = 8; + ra->cb_preambles_per_ssb = nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.eight; + break; + case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_sixteen: + multiple_ssb_per_ro = true; + ssb_rach_ratio = 16; + ra->cb_preambles_per_ssb = nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.sixteen; + break; + default: + AssertFatal(1 == 0, "Unsupported ssb_perRACH_config %d\n", ssb_perRACH_config); + } - // Compute the proper Preamble selection params according to the selected SSB and the ssb_perRACH_OccasionAndCB_PreamblesPerSSB configuration - if ((true == multiple_ssb_per_ro) && - (ssb_rach_ratio > 1)) { - total_preambles_per_ssb = numberOfRA_Preambles / ssb_rach_ratio; + if (nr_rach_ConfigCommon->totalNumberOfRA_Preambles) + numberOfRA_Preambles = *(nr_rach_ConfigCommon->totalNumberOfRA_Preambles); - ssb_nb_in_ro = prach_pdu->ssb_nb_in_ro; - ra->starting_preamble_nb = total_preambles_per_ssb * ssb_nb_in_ro; - } - else { - total_preambles_per_ssb = numberOfRA_Preambles; - ra->starting_preamble_nb = 0; - } + // Compute the proper Preamble selection params according to the selected SSB and the ssb_perRACH_OccasionAndCB_PreamblesPerSSB configuration + if ((true == multiple_ssb_per_ro) && (ssb_rach_ratio > 1)) { + total_preambles_per_ssb = numberOfRA_Preambles / ssb_rach_ratio; + + ssb_nb_in_ro = prach_pdu->ssb_nb_in_ro; + ra->starting_preamble_nb = total_preambles_per_ssb * ssb_nb_in_ro; } else { - LOG_E(MAC, "In %s:%d: missing implementation for 2-step RA...\n", __FUNCTION__, __LINE__); + total_preambles_per_ssb = numberOfRA_Preambles; + ra->starting_preamble_nb = 0; } } -// This routine implements RA premable configuration according to +// This routine implements RA preamble configuration according to // section 5.1 (Random Access procedure) of 3GPP TS 38.321 version 16.2.1 Release 16 void ra_preambles_config(NR_PRACH_RESOURCES_t *prach_resources, NR_UE_MAC_INST_t *mac, int16_t dl_pathloss){ @@ -261,23 +248,21 @@ void ra_preambles_config(NR_PRACH_RESOURCES_t *prach_resources, NR_UE_MAC_INST_t NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup; NR_RACH_ConfigGeneric_t *rach_ConfigGeneric = &nr_rach_ConfigCommon->rach_ConfigGeneric; - if (prach_resources->RA_TYPE == RA_4STEP){ + if (scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->msg3_DeltaPreamble){ + deltaPreamble_Msg3 = (*scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->msg3_DeltaPreamble) * 2; // dB + LOG_D(MAC, "In %s: deltaPreamble_Msg3 set to %ld\n", __FUNCTION__, deltaPreamble_Msg3); + } - if (scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->msg3_DeltaPreamble){ - deltaPreamble_Msg3 = (*scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->msg3_DeltaPreamble) * 2; // dB - LOG_D(MAC, "In %s: deltaPreamble_Msg3 set to %ld\n", __FUNCTION__, deltaPreamble_Msg3); - } - - if (!nr_rach_ConfigCommon->groupBconfigured) { - noGroupB = 1; - LOG_D(MAC, "In %s:%d: preambles group B is not configured...\n", __FUNCTION__, __LINE__); - } else { - // RA preambles group B is configured - // - Random Access Preambles group B is configured for 4-step RA type - // - Defining the number of RA preambles in RA Preamble Group A for each SSB - LOG_D(MAC, "In %s:%d: preambles group B is configured...\n", __FUNCTION__, __LINE__); - sizeOfRA_PreamblesGroupA = nr_rach_ConfigCommon->groupBconfigured->numberOfRA_PreamblesGroupA; - switch (nr_rach_ConfigCommon->groupBconfigured->ra_Msg3SizeGroupA){ + if (!nr_rach_ConfigCommon->groupBconfigured) { + noGroupB = 1; + LOG_D(MAC, "In %s:%d: preambles group B is not configured...\n", __FUNCTION__, __LINE__); + } else { + // RA preambles group B is configured + // - Random Access Preambles group B is configured for 4-step RA type + // - Defining the number of RA preambles in RA Preamble Group A for each SSB + LOG_D(MAC, "In %s:%d: preambles group B is configured...\n", __FUNCTION__, __LINE__); + sizeOfRA_PreamblesGroupA = nr_rach_ConfigCommon->groupBconfigured->numberOfRA_PreamblesGroupA; + switch (nr_rach_ConfigCommon->groupBconfigured->ra_Msg3SizeGroupA){ /* - Threshold to determine the groups of RA preambles */ case 0: messageSizeGroupA = 56; @@ -343,17 +328,12 @@ void ra_preambles_config(NR_PRACH_RESOURCES_t *prach_resources, NR_UE_MAC_INST_t break; default: AssertFatal(1 == 0,"Unknown messagePowerOffsetGroupB %lu\n", nr_rach_ConfigCommon->groupBconfigured->messagePowerOffsetGroupB); - } - - PLThreshold = prach_resources->RA_PCMAX - rach_ConfigGeneric->preambleReceivedTargetPower - deltaPreamble_Msg3 - messagePowerOffsetGroupB; - } - } else { - // todo: - // - groupB-ConfiguredTwoStepRA - // - msgA-DeltaPreamble - LOG_E(MAC, "In %s:%d: missing implementation for 2-step RA...\n", __FUNCTION__, __LINE__); + + PLThreshold = prach_resources->RA_PCMAX - rach_ConfigGeneric->preambleReceivedTargetPower - deltaPreamble_Msg3 - messagePowerOffsetGroupB; + } + /* Msg3 has not been transmitted yet */ if (ra->first_Msg3) { if(ra->ra_PreambleIndex < 0 || ra->ra_PreambleIndex > 63) { diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index 0c2504149c..8e8a16948b 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -891,13 +891,12 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in uint16_t TBS_bytes = ulcfg_pdu->pusch_config_pdu.pusch_data.tb_size; - if (ra->ra_state == WAIT_RAR){ + if (ra->ra_state == WAIT_RAR && !ra->cfra){ memcpy(ulsch_input_buffer, mac->ulsch_pdu.payload, TBS_bytes); LOG_D(NR_MAC,"[RAPROC] Msg3 to be transmitted:\n"); for (int k = 0; k < TBS_bytes; k++) { LOG_D(NR_MAC,"(%i): 0x%x\n",k,mac->ulsch_pdu.payload[k]); } - LOG_I(NR_MAC,"[RAPROC] RA-Msg3 transmitted\n"); } else { if (IS_SOFTMODEM_NOS1 && (mac->UL_ndi[ulcfg_pdu->pusch_config_pdu.pusch_data.harq_process_id] != ulcfg_pdu->pusch_config_pdu.pusch_data.new_data_indicator)){ // Getting IP traffic to be transmitted @@ -947,6 +946,7 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in tx_req.tx_request_body[0].pdu = ulsch_input_buffer; if (ra->ra_state != RA_SUCCEEDED && !ra->cfra){ + LOG_I(NR_MAC,"[RAPROC] RA-Msg3 transmitted\n"); nr_Msg3_transmitted(ul_info->module_id, ul_info->cc_id, ul_info->frame_tx, ul_info->gNB_index); } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index d3f8cf9693..394893a15e 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -1033,7 +1033,9 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra nr_get_Msg3alloc(module_idP, CC_id, scc, ubwp, slotP, frameP, ra); nr_add_msg3(module_idP, CC_id, frameP, slotP, ra, (uint8_t *) &tx_req->TLVs[0].value.direct[0]); - LOG_I(MAC, "Frame %d, Subframe %d: Setting RA-Msg3 reception for Frame %d Subframe %d\n", frameP, slotP, ra->Msg3_frame, ra->Msg3_slot); + if(ra->cfra) { + LOG_I(MAC, "Frame %d, Subframe %d: Setting RA-Msg3 reception for Frame %d Subframe %d\n", frameP, slotP, ra->Msg3_frame, ra->Msg3_slot); + } T(T_GNB_MAC_DL_RAR_PDU_WITH_DATA, T_INT(module_idP), T_INT(CC_id), T_INT(ra->RA_rnti), T_INT(frameP), T_INT(slotP), T_INT(0), T_BUFFER(&tx_req->TLVs[0].value.direct[0], tx_req->TLVs[0].length)); @@ -1364,7 +1366,7 @@ void nr_check_Msg4_Ack(module_id_t module_id, int CC_id, frame_t frame, sub_fram nr_clear_ra_proc(module_id, CC_id, frame, ra); free(ra->preambles.preamble_list); UE_info->active[UE_id] = true; - LOG_I(NR_MAC, "(ue %i, rnti 0x%04x) Received Ack of RA-Msg4. RA procedure succeeded!\n", UE_id, ra->rnti); + LOG_I(NR_MAC, "(ue %i, rnti 0x%04x) Received Ack of RA-Msg4. CBRA procedure succeeded!\n", UE_id, ra->rnti); } else { diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 7af74c931d..1a330da02c 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -513,26 +513,37 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, UE_id, ra->rnti); - LOG_I(NR_MAC,"[RAPROC] RA-Msg3 received\n"); - LOG_D(NR_MAC,"[RAPROC] Received Msg3:\n"); - for (int k = 0; k < sdu_lenP; k++) { - LOG_D(NR_MAC,"(%i): 0x%x\n",k,sduP[k]); + if(ra->cfra) { + + LOG_I(NR_MAC, "(ue %i, rnti 0x%04x) CFRA procedure succeeded!\n", UE_id, ra->rnti); + nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra); + free(ra->preambles.preamble_list); + UE_info->active[UE_id] = true; + + } else { + + LOG_I(NR_MAC,"[RAPROC] RA-Msg3 received\n"); + LOG_I(NR_MAC,"[RAPROC] Received Msg3:\n"); + for (int k = 0; k < sdu_lenP; k++) { + LOG_I(NR_MAC,"(%i): 0x%x\n",k,sduP[k]); + } + + // UE Contention Resolution Identity + // Store the first 48 bits belonging to the uplink CCCH SDU within Msg3 to fill in Msg4 + // First byte corresponds to R/LCID MAC sub-header + memcpy(ra->cont_res_id, &sduP[1], sizeof(uint8_t) * 6); + + // re-initialize ta update variables afrer RA procedure completion + UE_info->UE_sched_ctrl[UE_id].ta_frame = frameP; + + nr_process_mac_pdu(gnb_mod_idP, current_rnti, CC_idP, frameP, sduP, sdu_lenP); + + ra->state = Msg4; + ra->Msg4_frame = ( frameP +2 ) % 1024; + ra->Msg4_slot = 1; + LOG_I(MAC, "Scheduling RA-Msg4 for TC-RNTI %04x (state %d, frame %d, slot %d)\n", ra->rnti, ra->state, ra->Msg4_frame, ra->Msg4_slot); + } - - // UE Contention Resolution Identity - // Store the first 48 bits belonging to the uplink CCCH SDU within Msg3 to fill in Msg4 - // First byte corresponds to R/LCID MAC sub-header - memcpy(ra->cont_res_id, &sduP[1], sizeof(uint8_t) * 6); - - // re-initialize ta update variables afrer RA procedure completion - UE_info->UE_sched_ctrl[UE_id].ta_frame = frameP; - - nr_process_mac_pdu(gnb_mod_idP, current_rnti, CC_idP, frameP, sduP, sdu_lenP); - - ra->state = Msg4; - ra->Msg4_frame = ( frameP +2 ) % 1024; - ra->Msg4_slot = 1; - LOG_I(MAC, "Scheduling RA-Msg4 for TC-RNTI %04x (state %d, frame %d, slot %d)\n", ra->rnti, ra->state, ra->Msg4_frame, ra->Msg4_slot); return; } diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index 051352590a..e6780ed29e 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -228,58 +228,58 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco secondaryCellGroup->spCellConfig->reconfigurationWithSync->ext1 = NULL; // For 2-step contention-free random access procedure -#if 0 - secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated = calloc(1,sizeof(struct NR_ReconfigurationWithSync__rach_ConfigDedicated)); - secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->present= NR_ReconfigurationWithSync__rach_ConfigDedicated_PR_uplink; - secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink= calloc(1,sizeof(struct NR_RACH_ConfigDedicated)); - secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra= calloc(1,sizeof(struct NR_CFRA)); - secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->ra_Prioritization= NULL; - secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->occasions= calloc(1,sizeof(struct NR_CFRA__occasions)); - memcpy(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->occasions->rach_ConfigGeneric, - &servingcellconfigcommon->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric, sizeof(NR_RACH_ConfigGeneric_t)); - secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->occasions->ssb_perRACH_Occasion= calloc(1,sizeof(long)); - *secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->occasions->ssb_perRACH_Occasion = NR_CFRA__occasions__ssb_perRACH_Occasion_one; - secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.present = NR_CFRA__resources_PR_ssb; - secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb = calloc(1,sizeof(struct NR_CFRA__resources__ssb)); - secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ra_ssb_OccasionMaskIndex = 0; + if(get_softmodem_params()->sa == 0) { + secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated = calloc(1,sizeof(struct NR_ReconfigurationWithSync__rach_ConfigDedicated)); + secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->present= NR_ReconfigurationWithSync__rach_ConfigDedicated_PR_uplink; + secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink= calloc(1,sizeof(struct NR_RACH_ConfigDedicated)); + secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra= calloc(1,sizeof(struct NR_CFRA)); + secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->ra_Prioritization= NULL; + secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->occasions= calloc(1,sizeof(struct NR_CFRA__occasions)); + memcpy(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->occasions->rach_ConfigGeneric, + &servingcellconfigcommon->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric, sizeof(NR_RACH_ConfigGeneric_t)); + secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->occasions->ssb_perRACH_Occasion= calloc(1,sizeof(long)); + *secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->occasions->ssb_perRACH_Occasion = NR_CFRA__occasions__ssb_perRACH_Occasion_one; + secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.present = NR_CFRA__resources_PR_ssb; + secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb = calloc(1,sizeof(struct NR_CFRA__resources__ssb)); + secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ra_ssb_OccasionMaskIndex = 0; - struct NR_CFRA_SSB_Resource *ssbElem[8]; + struct NR_CFRA_SSB_Resource *ssbElem[8]; - ssbElem[0] = calloc(1,sizeof(struct NR_CFRA_SSB_Resource)); - ssbElem[0]->ssb = 0; - ssbElem[0]->ra_PreambleIndex = 63; - ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem[0]); - ssbElem[1] = calloc(1,sizeof(struct NR_CFRA_SSB_Resource)); - ssbElem[1]->ssb = 1; - ssbElem[1]->ra_PreambleIndex = 62; - ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem[1]); - ssbElem[2] = calloc(1,sizeof(struct NR_CFRA_SSB_Resource)); - ssbElem[2]->ssb = 2; - ssbElem[2]->ra_PreambleIndex = 63; - ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem[2]); - ssbElem[3] = calloc(1,sizeof(struct NR_CFRA_SSB_Resource)); - ssbElem[3]->ssb = 3; - ssbElem[3]->ra_PreambleIndex = 63; - ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem[3]); - ssbElem[4] = calloc(1,sizeof(struct NR_CFRA_SSB_Resource)); - ssbElem[4]->ssb = 4; - ssbElem[4]->ra_PreambleIndex = 63; - ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem[4]); - ssbElem[5] = calloc(1,sizeof(struct NR_CFRA_SSB_Resource)); - ssbElem[5]->ssb = 5; - ssbElem[5]->ra_PreambleIndex = 63; - ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem[5]); - ssbElem[6] = calloc(1,sizeof(struct NR_CFRA_SSB_Resource)); - ssbElem[6]->ssb = 6; - ssbElem[6]->ra_PreambleIndex = 63; - ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem[6]); - ssbElem[7] = calloc(1,sizeof(struct NR_CFRA_SSB_Resource)); - ssbElem[7]->ssb = 7; - ssbElem[7]->ra_PreambleIndex = 63; - ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem[7]); + ssbElem[0] = calloc(1,sizeof(struct NR_CFRA_SSB_Resource)); + ssbElem[0]->ssb = 0; + ssbElem[0]->ra_PreambleIndex = 63; + ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem[0]); + ssbElem[1] = calloc(1,sizeof(struct NR_CFRA_SSB_Resource)); + ssbElem[1]->ssb = 1; + ssbElem[1]->ra_PreambleIndex = 62; + ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem[1]); + ssbElem[2] = calloc(1,sizeof(struct NR_CFRA_SSB_Resource)); + ssbElem[2]->ssb = 2; + ssbElem[2]->ra_PreambleIndex = 63; + ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem[2]); + ssbElem[3] = calloc(1,sizeof(struct NR_CFRA_SSB_Resource)); + ssbElem[3]->ssb = 3; + ssbElem[3]->ra_PreambleIndex = 63; + ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem[3]); + ssbElem[4] = calloc(1,sizeof(struct NR_CFRA_SSB_Resource)); + ssbElem[4]->ssb = 4; + ssbElem[4]->ra_PreambleIndex = 63; + ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem[4]); + ssbElem[5] = calloc(1,sizeof(struct NR_CFRA_SSB_Resource)); + ssbElem[5]->ssb = 5; + ssbElem[5]->ra_PreambleIndex = 63; + ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem[5]); + ssbElem[6] = calloc(1,sizeof(struct NR_CFRA_SSB_Resource)); + ssbElem[6]->ssb = 6; + ssbElem[6]->ra_PreambleIndex = 63; + ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem[6]); + ssbElem[7] = calloc(1,sizeof(struct NR_CFRA_SSB_Resource)); + ssbElem[7]->ssb = 7; + ssbElem[7]->ra_PreambleIndex = 63; + ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem[7]); - secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->ext1 = NULL; -#endif + secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->ext1 = NULL; + } secondaryCellGroup->spCellConfig->rlf_TimersAndConstants = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->rlf_TimersAndConstants)); secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->present = NR_SetupRelease_RLF_TimersAndConstants_PR_setup; From 27f0414e60ace2c9db95c6b6f9e99357aae22b17 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Tue, 16 Mar 2021 16:49:30 +0000 Subject: [PATCH 196/231] Fill pusch_proc_threads in config files --- .../CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf | 5 +++-- .../CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf index cbdd205d30..dd18cf624e 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf @@ -250,10 +250,11 @@ MACRLCs = ( ); L1s = ( - { + { num_cc = 1; tr_n_preference = "local_mac"; - } + pusch_proc_threads = 8; + } ); RUs = ( diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf index 35eb694c2b..001e5b917a 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf @@ -250,10 +250,11 @@ MACRLCs = ( ); L1s = ( - { + { num_cc = 1; tr_n_preference = "local_mac"; - } + pusch_proc_threads = 8; + } ); RUs = ( From d4cd65f6c6645b937cc4f4e9f6b78e25082bc1c9 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Wed, 17 Mar 2021 14:31:38 +0100 Subject: [PATCH 197/231] CI: initial draft for new container pipeline Signed-off-by: Raphael Defosseux --- ci-scripts/Jenkinsfile-GitLab-Container | 217 ++++++++++++++++++++++++ 1 file changed, 217 insertions(+) create mode 100644 ci-scripts/Jenkinsfile-GitLab-Container diff --git a/ci-scripts/Jenkinsfile-GitLab-Container b/ci-scripts/Jenkinsfile-GitLab-Container new file mode 100644 index 0000000000..ed13fcd1db --- /dev/null +++ b/ci-scripts/Jenkinsfile-GitLab-Container @@ -0,0 +1,217 @@ +#!/bin/groovy +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +// Location of the executor node +def nodeExecutor = params.nodeExecutor + +// Tags to shorten pipeline duration +def doMandatoryTests = false +def doFullTestsuite = false + +pipeline { + agent { + label nodeExecutor + } + options { + disableConcurrentBuilds() + timestamps() + gitLabConnection('OAI GitLab') + ansiColor('xterm') + } + + stages { + stage ("Verify Parameters") { + steps { + script { + JOB_TIMESTAMP = sh returnStdout: true, script: 'date --utc --rfc-3339=seconds | sed -e "s#+00:00##"' + JOB_TIMESTAMP = JOB_TIMESTAMP.trim() + + echo '\u2705 \u001B[32mVerify Parameters\u001B[0m' + def allParametersPresent = true + + echo '\u2705 \u001B[32mVerify Labels\u001B[0m' + if ("MERGE".equals(env.gitlabActionType)) { + LABEL_CHECK = sh returnStdout: true, script: 'ci-scripts/checkGitLabMergeRequestLabels.sh --mr-id ' + env.gitlabMergeRequestIid + LABEL_CHECK = LABEL_CHECK.trim() + if (LABEL_CHECK == 'NONE') { + def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): Your merge request has none of the mandatory labels:\n\n" + message += " - BUILD-ONLY\n" + message += " - 4G-LTE\n" + message += " - 5G-NR\n" + message += " - CI\n\n" + message += "Not performing CI due to lack of labels" + addGitLabMRComment comment: message + error('Not performing CI due to lack of labels') + } else if (LABEL_CHECK == 'FULL') { + doMandatoryTests = true + doFullTestsuite = true + } else if (LABEL_CHECK == 'SHORTEN-5G') { + doMandatoryTests = true + } else { + def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): We will perform only build stages on your Merge Request" + addGitLabMRComment comment: message + } + } else { + doMandatoryTests = true + doFullTestsuite = true + } + } + } + } + stage ("Verify Guidelines") { + steps { + echo "Git URL is ${GIT_URL}" + echo "GitLab Act is ${env.gitlabActionType}" + script { + if ("MERGE".equals(env.gitlabActionType)) { + // since a bit, in push events, gitlabUserEmail is not populated + gitCommitAuthorEmailAddr = env.gitlabUserEmail + echo "GitLab Usermail is ${gitCommitAuthorEmailAddr}" + // GitLab-Jenkins plugin integration is lacking to perform the merge by itself + // Doing it manually --> it may have merge conflicts + sh "./ci-scripts/doGitLabMerge.sh --src-branch ${env.gitlabSourceBranch} --src-commit ${env.gitlabMergeRequestLastCommit} --target-branch ${env.gitlabTargetBranch} --target-commit ${GIT_COMMIT}" + } else { + echo "Git Branch is ${GIT_BRANCH}" + echo "Git Commit is ${GIT_COMMIT}" + // since a bit, in push events, gitlabUserEmail is not populated + gitCommitAuthorEmailAddr = sh returnStdout: true, script: 'git log -n1 --pretty=format:%ae ${GIT_COMMIT}' + gitCommitAuthorEmailAddr = gitCommitAuthorEmailAddr.trim() + echo "GitLab Usermail is ${gitCommitAuthorEmailAddr}" + sh "git log -n1 --pretty=format:\"%s\" > .git/CI_COMMIT_MSG" + } + } + } + post { + failure { + script { + def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): Merge Conflicts -- Cannot perform CI" + addGitLabMRComment comment: message + currentBuild.result = 'FAILURE' + } + } + } + } + } + post { + always { + script { + emailext attachmentsPattern: '*results*.html', + body: '''Hi, + +Here are attached HTML report files for $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS! + +Regards, +OAI CI Team''', + replyTo: 'no-reply@openairinterface.org', + subject: '$PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!', + to: gitCommitAuthorEmailAddr + + if (fileExists('.git/CI_COMMIT_MSG')) { + sh "rm -f .git/CI_COMMIT_MSG" + } + } + } + success { + script { + def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): passed (" + BUILD_URL + ")" + if ("MERGE".equals(env.gitlabActionType)) { + echo "This is a MERGE event" + addGitLabMRComment comment: message + } + } + } + failure { + script { + def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): failed (" + BUILD_URL + ")" + if ("MERGE".equals(env.gitlabActionType)) { + echo "This is a MERGE event" + addGitLabMRComment comment: message + } + } + } + } +} + +// ---- Slave Job functions + +def triggerSlaveJob (jobName, gitlabStatusName) { + // Workaround for the "cancelled" GitLab pipeline notification + // The slave job is triggered with the propagate false so the following commands are executed + // Its status is now PASS/SUCCESS from a stage pipeline point of view + // localStatus variable MUST be analyzed to properly assess the status + localStatus = build job: jobName, + parameters: [ + string(name: 'eNB_Repository', value: String.valueOf(GIT_URL)), + string(name: 'eNB_Branch', value: String.valueOf(env.gitlabSourceBranch)), + string(name: 'eNB_CommitID', value: String.valueOf(env.gitlabMergeRequestLastCommit)), + booleanParam(name: 'eNB_mergeRequest', value: "MERGE".equals(env.gitlabActionType)), + string(name: 'eNB_TargetBranch', value: String.valueOf(env.gitlabTargetBranch)) + ], propagate: false + localResult = localStatus.getResult() + echo "${jobName} Slave Job status is ${localResult}" + gitlabCommitStatus(name: gitlabStatusName) { + if (localStatus.resultIsBetterOrEqualTo('SUCCESS')) { + echo "${jobName} Slave Job is OK" + } else { + echo "${jobName} Slave Job is KO" + sh "ci-scripts/fail.sh" + } + } +} + +def triggerSlaveJobNoGitLab (jobName) { + // Workaround for the "cancelled" GitLab pipeline notification + // The slave job is triggered with the propagate false so the following commands are executed + // Its status is now PASS/SUCCESS from a stage pipeline point of view + // localStatus variable MUST be analyzed to properly assess the status + localStatus = build job: jobName, + parameters: [ + string(name: 'eNB_Repository', value: String.valueOf(GIT_URL)), + string(name: 'eNB_Branch', value: String.valueOf(env.gitlabSourceBranch)), + string(name: 'eNB_CommitID', value: String.valueOf(env.gitlabMergeRequestLastCommit)), + booleanParam(name: 'eNB_mergeRequest', value: "MERGE".equals(env.gitlabActionType)), + string(name: 'eNB_TargetBranch', value: String.valueOf(env.gitlabTargetBranch)) + ], propagate: false + localResult = localStatus.getResult() + echo "${jobName} Slave Job status is ${localResult}" + if (localStatus.resultIsBetterOrEqualTo('SUCCESS')) { + echo "${jobName} Slave Job is OK" + } else { + echo "${jobName} Slave Job is KO" + sh "ci-scripts/fail.sh" + } +} + +def finalizeSlaveJob(jobName) { + // In case of any non-success, we are retrieving the HTML report of the last completed + // slave job. The only drop-back is that we may retrieve the HTML report of a previous build + fileName = "test_results-${jobName}.html" + if (!fileExists(fileName)) { + copyArtifacts(projectName: jobName, + filter: 'test_results*.html', + selector: lastCompleted()) + if (fileExists(fileName)) { + sh "sed -i -e 's#TEMPLATE_BUILD_TIME#${JOB_TIMESTAMP}#' ${fileName}" + archiveArtifacts artifacts: fileName + } + } +} From 9efe4187e72f25fd2936be5b9e4daa5473383afb Mon Sep 17 00:00:00 2001 From: rmagueta Date: Thu, 18 Mar 2021 01:20:59 +0000 Subject: [PATCH 198/231] Fix preamble sequence --- openair1/PHY/NR_TRANSPORT/nr_prach.c | 2 +- openair1/PHY/NR_TRANSPORT/nr_prach.h | 285 ++++++++++++++++++ openair1/PHY/NR_TRANSPORT/nr_prach_common.c | 27 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 4 +- 4 files changed, 313 insertions(+), 5 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/nr_prach.c b/openair1/PHY/NR_TRANSPORT/nr_prach.c index 1d971a8831..0c1fde07a2 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_prach.c +++ b/openair1/PHY/NR_TRANSPORT/nr_prach.c @@ -681,7 +681,7 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, preamble_shift -= NCS; if (preamble_shift < 0) - preamble_shift+=N_ZC; + preamble_shift+=((N_ZC/NCS)*NCS); } } else { // This is the high-speed case new_dft = 0; diff --git a/openair1/PHY/NR_TRANSPORT/nr_prach.h b/openair1/PHY/NR_TRANSPORT/nr_prach.h index d158e04c79..d97689a5a6 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_prach.h +++ b/openair1/PHY/NR_TRANSPORT/nr_prach.h @@ -93,3 +93,288 @@ uint16_t prach_root_sequence_map_abc[138] = { 51, 88 , 52, 87 , 53, 86 , 54, 85 , 55, 84 , 56, 83 , 57, 82 , 58, 81 , 59, 80 , 60, 79 , 61, 78 , 62, 77 , 63, 76 , 64, 75 , 65, 74 , 66, 73 , 67, 72 , 68, 71 , 69, 70 }; + +int16_t prach_fft139_re[139][139] = { +{32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767}, +{32767, 32733, 32633, 32466, 32232, 31933, 31569, 31140, 30647, 30092, 29475, 28799, 28063, 27270, 26421, 25519, 24564, 23559, 22506, 21406, 20264, 19079, 17856, 16596, 15303, 13978, 12624, 11245, 9843, 8421, 6981, 5527, 4062, 2589, 1110, -371, -1851, -3327, -4797, -6257, -7704, -9135, -10548, -11939, -13305, -14645, -15955, -17232, -18473, -19677, -20841, -21963, -23039, -24068, -25049, -25978, -26853, -27675, -28439, -29146, -29792, -30378, -30902, -31363, -31760, -32092, -32358, -32558, -32692, -32759, -32759, -32692, -32558, -32358, -32092, -31760, -31363, -30902, -30378, -29792, -29146, -28439, -27675, -26853, -25978, -25049, -24068, -23039, -21963, -20841, -19677, -18473, -17232, -15955, -14645, -13305, -11939, -10548, -9135, -7704, -6257, -4797, -3327, -1851, -371, 1110, 2589, 4062, 5527, 6981, 8421, 9843, 11245, 12624, 13978, 15303, 16596, 17856, 19079, 20264, 21406, 22506, 23559, 24564, 25519, 26421, 27270, 28063, 28799, 29475, 30092, 30647, 31140, 31569, 31933, 32232, 32466, 32633, 32733}, +{32767, 32633, 32232, 31569, 30647, 29475, 28063, 26421, 24564, 22506, 20264, 17856, 15303, 12624, 9843, 6981, 4062, 1110, -1851, -4797, -7704, -10548, -13305, -15955, -18473, -20841, -23039, -25049, -26853, -28439, -29792, -30902, -31760, -32358, -32692, -32759, -32558, -32092, -31363, -30378, -29146, -27675, -25978, -24068, -21963, -19677, -17232, -14645, -11939, -9135, -6257, -3327, -371, 2589, 5527, 8421, 11245, 13978, 16596, 19079, 21406, 23559, 25519, 27270, 28799, 30092, 31140, 31933, 32466, 32733, 32733, 32466, 31933, 31140, 30092, 28799, 27270, 25519, 23559, 21406, 19079, 16596, 13978, 11245, 8421, 5527, 2589, -371, -3327, -6257, -9135, -11939, -14645, -17232, -19677, -21963, -24068, -25978, -27675, -29146, -30378, -31363, -32092, -32558, -32759, -32692, -32358, -31760, -30902, -29792, -28439, -26853, -25049, -23039, -20841, -18473, -15955, -13305, -10548, -7704, -4797, -1851, 1110, 4062, 6981, 9843, 12624, 15303, 17856, 20264, 22506, 24564, 26421, 28063, 29475, 30647, 31569, 32232, 32633}, +{32767, 32466, 31569, 30092, 28063, 25519, 22506, 19079, 15303, 11245, 6981, 2589, -1851, -6257, -10548, -14645, -18473, -21963, -25049, -27675, -29792, -31363, -32358, -32759, -32558, -31760, -30378, -28439, -25978, -23039, -19677, -15955, -11939, -7704, -3327, 1110, 5527, 9843, 13978, 17856, 21406, 24564, 27270, 29475, 31140, 32232, 32733, 32633, 31933, 30647, 28799, 26421, 23559, 20264, 16596, 12624, 8421, 4062, -371, -4797, -9135, -13305, -17232, -20841, -24068, -26853, -29146, -30902, -32092, -32692, -32692, -32092, -30902, -29146, -26853, -24068, -20841, -17232, -13305, -9135, -4797, -371, 4062, 8421, 12624, 16596, 20264, 23559, 26421, 28799, 30647, 31933, 32633, 32733, 32232, 31140, 29475, 27270, 24564, 21406, 17856, 13978, 9843, 5527, 1110, -3327, -7704, -11939, -15955, -19677, -23039, -25978, -28439, -30378, -31760, -32558, -32759, -32358, -31363, -29792, -27675, -25049, -21963, -18473, -14645, -10548, -6257, -1851, 2589, 6981, 11245, 15303, 19079, 22506, 25519, 28063, 30092, 31569, 32466}, +{32767, 32232, 30647, 28063, 24564, 20264, 15303, 9843, 4062, -1851, -7704, -13305, -18473, -23039, -26853, -29792, -31760, -32692, -32558, -31363, -29146, -25978, -21963, -17232, -11939, -6257, -371, 5527, 11245, 16596, 21406, 25519, 28799, 31140, 32466, 32733, 31933, 30092, 27270, 23559, 19079, 13978, 8421, 2589, -3327, -9135, -14645, -19677, -24068, -27675, -30378, -32092, -32759, -32358, -30902, -28439, -25049, -20841, -15955, -10548, -4797, 1110, 6981, 12624, 17856, 22506, 26421, 29475, 31569, 32633, 32633, 31569, 29475, 26421, 22506, 17856, 12624, 6981, 1110, -4797, -10548, -15955, -20841, -25049, -28439, -30902, -32358, -32759, -32092, -30378, -27675, -24068, -19677, -14645, -9135, -3327, 2589, 8421, 13978, 19079, 23559, 27270, 30092, 31933, 32733, 32466, 31140, 28799, 25519, 21406, 16596, 11245, 5527, -371, -6257, -11939, -17232, -21963, -25978, -29146, -31363, -32558, -32692, -31760, -29792, -26853, -23039, -18473, -13305, -7704, -1851, 4062, 9843, 15303, 20264, 24564, 28063, 30647, 32232}, +{32767, 31933, 29475, 25519, 20264, 13978, 6981, -371, -7704, -14645, -20841, -25978, -29792, -32092, -32759, -31760, -29146, -25049, -19677, -13305, -6257, 1110, 8421, 15303, 21406, 26421, 30092, 32232, 32733, 31569, 28799, 24564, 19079, 12624, 5527, -1851, -9135, -15955, -21963, -26853, -30378, -32358, -32692, -31363, -28439, -24068, -18473, -11939, -4797, 2589, 9843, 16596, 22506, 27270, 30647, 32466, 32633, 31140, 28063, 23559, 17856, 11245, 4062, -3327, -10548, -17232, -23039, -27675, -30902, -32558, -32558, -30902, -27675, -23039, -17232, -10548, -3327, 4062, 11245, 17856, 23559, 28063, 31140, 32633, 32466, 30647, 27270, 22506, 16596, 9843, 2589, -4797, -11939, -18473, -24068, -28439, -31363, -32692, -32358, -30378, -26853, -21963, -15955, -9135, -1851, 5527, 12624, 19079, 24564, 28799, 31569, 32733, 32232, 30092, 26421, 21406, 15303, 8421, 1110, -6257, -13305, -19677, -25049, -29146, -31760, -32759, -32092, -29792, -25978, -20841, -14645, -7704, -371, 6981, 13978, 20264, 25519, 29475, 31933}, +{32767, 31569, 28063, 22506, 15303, 6981, -1851, -10548, -18473, -25049, -29792, -32358, -32558, -30378, -25978, -19677, -11939, -3327, 5527, 13978, 21406, 27270, 31140, 32733, 31933, 28799, 23559, 16596, 8421, -371, -9135, -17232, -24068, -29146, -32092, -32692, -30902, -26853, -20841, -13305, -4797, 4062, 12624, 20264, 26421, 30647, 32633, 32232, 29475, 24564, 17856, 9843, 1110, -7704, -15955, -23039, -28439, -31760, -32759, -31363, -27675, -21963, -14645, -6257, 2589, 11245, 19079, 25519, 30092, 32466, 32466, 30092, 25519, 19079, 11245, 2589, -6257, -14645, -21963, -27675, -31363, -32759, -31760, -28439, -23039, -15955, -7704, 1110, 9843, 17856, 24564, 29475, 32232, 32633, 30647, 26421, 20264, 12624, 4062, -4797, -13305, -20841, -26853, -30902, -32692, -32092, -29146, -24068, -17232, -9135, -371, 8421, 16596, 23559, 28799, 31933, 32733, 31140, 27270, 21406, 13978, 5527, -3327, -11939, -19677, -25978, -30378, -32558, -32358, -29792, -25049, -18473, -10548, -1851, 6981, 15303, 22506, 28063, 31569}, +{32767, 31140, 26421, 19079, 9843, -371, -10548, -19677, -26853, -31363, -32759, -30902, -25978, -18473, -9135, 1110, 11245, 20264, 27270, 31569, 32733, 30647, 25519, 17856, 8421, -1851, -11939, -20841, -27675, -31760, -32692, -30378, -25049, -17232, -7704, 2589, 12624, 21406, 28063, 31933, 32633, 30092, 24564, 16596, 6981, -3327, -13305, -21963, -28439, -32092, -32558, -29792, -24068, -15955, -6257, 4062, 13978, 22506, 28799, 32232, 32466, 29475, 23559, 15303, 5527, -4797, -14645, -23039, -29146, -32358, -32358, -29146, -23039, -14645, -4797, 5527, 15303, 23559, 29475, 32466, 32232, 28799, 22506, 13978, 4062, -6257, -15955, -24068, -29792, -32558, -32092, -28439, -21963, -13305, -3327, 6981, 16596, 24564, 30092, 32633, 31933, 28063, 21406, 12624, 2589, -7704, -17232, -25049, -30378, -32692, -31760, -27675, -20841, -11939, -1851, 8421, 17856, 25519, 30647, 32733, 31569, 27270, 20264, 11245, 1110, -9135, -18473, -25978, -30902, -32759, -31363, -26853, -19677, -10548, -371, 9843, 19079, 26421, 31140}, +{32767, 30647, 24564, 15303, 4062, -7704, -18473, -26853, -31760, -32558, -29146, -21963, -11939, -371, 11245, 21406, 28799, 32466, 31933, 27270, 19079, 8421, -3327, -14645, -24068, -30378, -32759, -30902, -25049, -15955, -4797, 6981, 17856, 26421, 31569, 32633, 29475, 22506, 12624, 1110, -10548, -20841, -28439, -32358, -32092, -27675, -19677, -9135, 2589, 13978, 23559, 30092, 32733, 31140, 25519, 16596, 5527, -6257, -17232, -25978, -31363, -32692, -29792, -23039, -13305, -1851, 9843, 20264, 28063, 32232, 32232, 28063, 20264, 9843, -1851, -13305, -23039, -29792, -32692, -31363, -25978, -17232, -6257, 5527, 16596, 25519, 31140, 32733, 30092, 23559, 13978, 2589, -9135, -19677, -27675, -32092, -32358, -28439, -20841, -10548, 1110, 12624, 22506, 29475, 32633, 31569, 26421, 17856, 6981, -4797, -15955, -25049, -30902, -32759, -30378, -24068, -14645, -3327, 8421, 19079, 27270, 31933, 32466, 28799, 21406, 11245, -371, -11939, -21963, -29146, -32558, -31760, -26853, -18473, -7704, 4062, 15303, 24564, 30647}, +{32767, 30092, 22506, 11245, -1851, -14645, -25049, -31363, -32558, -28439, -19677, -7704, 5527, 17856, 27270, 32232, 31933, 26421, 16596, 4062, -9135, -20841, -29146, -32692, -30902, -24068, -13305, -371, 12624, 23559, 30647, 32733, 29475, 21406, 9843, -3327, -15955, -25978, -31760, -32358, -27675, -18473, -6257, 6981, 19079, 28063, 32466, 31569, 25519, 15303, 2589, -10548, -21963, -29792, -32759, -30378, -23039, -11939, 1110, 13978, 24564, 31140, 32633, 28799, 20264, 8421, -4797, -17232, -26853, -32092, -32092, -26853, -17232, -4797, 8421, 20264, 28799, 32633, 31140, 24564, 13978, 1110, -11939, -23039, -30378, -32759, -29792, -21963, -10548, 2589, 15303, 25519, 31569, 32466, 28063, 19079, 6981, -6257, -18473, -27675, -32358, -31760, -25978, -15955, -3327, 9843, 21406, 29475, 32733, 30647, 23559, 12624, -371, -13305, -24068, -30902, -32692, -29146, -20841, -9135, 4062, 16596, 26421, 31933, 32232, 27270, 17856, 5527, -7704, -19677, -28439, -32558, -31363, -25049, -14645, -1851, 11245, 22506, 30092}, +{32767, 29475, 20264, 6981, -7704, -20841, -29792, -32759, -29146, -19677, -6257, 8421, 21406, 30092, 32733, 28799, 19079, 5527, -9135, -21963, -30378, -32692, -28439, -18473, -4797, 9843, 22506, 30647, 32633, 28063, 17856, 4062, -10548, -23039, -30902, -32558, -27675, -17232, -3327, 11245, 23559, 31140, 32466, 27270, 16596, 2589, -11939, -24068, -31363, -32358, -26853, -15955, -1851, 12624, 24564, 31569, 32232, 26421, 15303, 1110, -13305, -25049, -31760, -32092, -25978, -14645, -371, 13978, 25519, 31933, 31933, 25519, 13978, -371, -14645, -25978, -32092, -31760, -25049, -13305, 1110, 15303, 26421, 32232, 31569, 24564, 12624, -1851, -15955, -26853, -32358, -31363, -24068, -11939, 2589, 16596, 27270, 32466, 31140, 23559, 11245, -3327, -17232, -27675, -32558, -30902, -23039, -10548, 4062, 17856, 28063, 32633, 30647, 22506, 9843, -4797, -18473, -28439, -32692, -30378, -21963, -9135, 5527, 19079, 28799, 32733, 30092, 21406, 8421, -6257, -19677, -29146, -32759, -29792, -20841, -7704, 6981, 20264, 29475}, +{32767, 28799, 17856, 2589, -13305, -25978, -32358, -30902, -21963, -7704, 8421, 22506, 31140, 32232, 25519, 12624, -3327, -18473, -29146, -32759, -28439, -17232, -1851, 13978, 26421, 32466, 30647, 21406, 6981, -9135, -23039, -31363, -32092, -25049, -11939, 4062, 19079, 29475, 32733, 28063, 16596, 1110, -14645, -26853, -32558, -30378, -20841, -6257, 9843, 23559, 31569, 31933, 24564, 11245, -4797, -19677, -29792, -32692, -27675, -15955, -371, 15303, 27270, 32633, 30092, 20264, 5527, -10548, -24068, -31760, -31760, -24068, -10548, 5527, 20264, 30092, 32633, 27270, 15303, -371, -15955, -27675, -32692, -29792, -19677, -4797, 11245, 24564, 31933, 31569, 23559, 9843, -6257, -20841, -30378, -32558, -26853, -14645, 1110, 16596, 28063, 32733, 29475, 19079, 4062, -11939, -25049, -32092, -31363, -23039, -9135, 6981, 21406, 30647, 32466, 26421, 13978, -1851, -17232, -28439, -32759, -29146, -18473, -3327, 12624, 25519, 32232, 31140, 22506, 8421, -7704, -21963, -30902, -32358, -25978, -13305, 2589, 17856, 28799}, +{32767, 28063, 15303, -1851, -18473, -29792, -32558, -25978, -11939, 5527, 21406, 31140, 31933, 23559, 8421, -9135, -24068, -32092, -30902, -20841, -4797, 12624, 26421, 32633, 29475, 17856, 1110, -15955, -28439, -32759, -27675, -14645, 2589, 19079, 30092, 32466, 25519, 11245, -6257, -21963, -31363, -31760, -23039, -7704, 9843, 24564, 32232, 30647, 20264, 4062, -13305, -26853, -32692, -29146, -17232, -371, 16596, 28799, 32733, 27270, 13978, -3327, -19677, -30378, -32358, -25049, -10548, 6981, 22506, 31569, 31569, 22506, 6981, -10548, -25049, -32358, -30378, -19677, -3327, 13978, 27270, 32733, 28799, 16596, -371, -17232, -29146, -32692, -26853, -13305, 4062, 20264, 30647, 32232, 24564, 9843, -7704, -23039, -31760, -31363, -21963, -6257, 11245, 25519, 32466, 30092, 19079, 2589, -14645, -27675, -32759, -28439, -15955, 1110, 17856, 29475, 32633, 26421, 12624, -4797, -20841, -30902, -32092, -24068, -9135, 8421, 23559, 31933, 31140, 21406, 5527, -11939, -25978, -32558, -29792, -18473, -1851, 15303, 28063}, +{32767, 27270, 12624, -6257, -23039, -32092, -30378, -18473, -371, 17856, 30092, 32232, 23559, 6981, -11939, -26853, -32759, -27675, -13305, 5527, 22506, 31933, 30647, 19079, 1110, -17232, -29792, -32358, -24068, -7704, 11245, 26421, 32733, 28063, 13978, -4797, -21963, -31760, -30902, -19677, -1851, 16596, 29475, 32466, 24564, 8421, -10548, -25978, -32692, -28439, -14645, 4062, 21406, 31569, 31140, 20264, 2589, -15955, -29146, -32558, -25049, -9135, 9843, 25519, 32633, 28799, 15303, -3327, -20841, -31363, -31363, -20841, -3327, 15303, 28799, 32633, 25519, 9843, -9135, -25049, -32558, -29146, -15955, 2589, 20264, 31140, 31569, 21406, 4062, -14645, -28439, -32692, -25978, -10548, 8421, 24564, 32466, 29475, 16596, -1851, -19677, -30902, -31760, -21963, -4797, 13978, 28063, 32733, 26421, 11245, -7704, -24068, -32358, -29792, -17232, 1110, 19079, 30647, 31933, 22506, 5527, -13305, -27675, -32759, -26853, -11939, 6981, 23559, 32232, 30092, 17856, -371, -18473, -30378, -32092, -23039, -6257, 12624, 27270}, +{32767, 26421, 9843, -10548, -26853, -32759, -25978, -9135, 11245, 27270, 32733, 25519, 8421, -11939, -27675, -32692, -25049, -7704, 12624, 28063, 32633, 24564, 6981, -13305, -28439, -32558, -24068, -6257, 13978, 28799, 32466, 23559, 5527, -14645, -29146, -32358, -23039, -4797, 15303, 29475, 32232, 22506, 4062, -15955, -29792, -32092, -21963, -3327, 16596, 30092, 31933, 21406, 2589, -17232, -30378, -31760, -20841, -1851, 17856, 30647, 31569, 20264, 1110, -18473, -30902, -31363, -19677, -371, 19079, 31140, 31140, 19079, -371, -19677, -31363, -30902, -18473, 1110, 20264, 31569, 30647, 17856, -1851, -20841, -31760, -30378, -17232, 2589, 21406, 31933, 30092, 16596, -3327, -21963, -32092, -29792, -15955, 4062, 22506, 32232, 29475, 15303, -4797, -23039, -32358, -29146, -14645, 5527, 23559, 32466, 28799, 13978, -6257, -24068, -32558, -28439, -13305, 6981, 24564, 32633, 28063, 12624, -7704, -25049, -32692, -27675, -11939, 8421, 25519, 32733, 27270, 11245, -9135, -25978, -32759, -26853, -10548, 9843, 26421}, +{32767, 25519, 6981, -14645, -29792, -31760, -19677, 1110, 21406, 32232, 28799, 12624, -9135, -26853, -32692, -24068, -4797, 16596, 30647, 31140, 17856, -3327, -23039, -32558, -27675, -10548, 11245, 28063, 32466, 22506, 2589, -18473, -31363, -30378, -15955, 5527, 24564, 32733, 26421, 8421, -13305, -29146, -32092, -20841, -371, 20264, 31933, 29475, 13978, -7704, -25978, -32759, -25049, -6257, 15303, 30092, 31569, 19079, -1851, -21963, -32358, -28439, -11939, 9843, 27270, 32633, 23559, 4062, -17232, -30902, -30902, -17232, 4062, 23559, 32633, 27270, 9843, -11939, -28439, -32358, -21963, -1851, 19079, 31569, 30092, 15303, -6257, -25049, -32759, -25978, -7704, 13978, 29475, 31933, 20264, -371, -20841, -32092, -29146, -13305, 8421, 26421, 32733, 24564, 5527, -15955, -30378, -31363, -18473, 2589, 22506, 32466, 28063, 11245, -10548, -27675, -32558, -23039, -3327, 17856, 31140, 30647, 16596, -4797, -24068, -32692, -26853, -9135, 12624, 28799, 32232, 21406, 1110, -19677, -31760, -29792, -14645, 6981, 25519}, +{32767, 24564, 4062, -18473, -31760, -29146, -11939, 11245, 28799, 31933, 19079, -3327, -24068, -32759, -25049, -4797, 17856, 31569, 29475, 12624, -10548, -28439, -32092, -19677, 2589, 23559, 32733, 25519, 5527, -17232, -31363, -29792, -13305, 9843, 28063, 32232, 20264, -1851, -23039, -32692, -25978, -6257, 16596, 31140, 30092, 13978, -9135, -27675, -32358, -20841, 1110, 22506, 32633, 26421, 6981, -15955, -30902, -30378, -14645, 8421, 27270, 32466, 21406, -371, -21963, -32558, -26853, -7704, 15303, 30647, 30647, 15303, -7704, -26853, -32558, -21963, -371, 21406, 32466, 27270, 8421, -14645, -30378, -30902, -15955, 6981, 26421, 32633, 22506, 1110, -20841, -32358, -27675, -9135, 13978, 30092, 31140, 16596, -6257, -25978, -32692, -23039, -1851, 20264, 32232, 28063, 9843, -13305, -29792, -31363, -17232, 5527, 25519, 32733, 23559, 2589, -19677, -32092, -28439, -10548, 12624, 29475, 31569, 17856, -4797, -25049, -32759, -24068, -3327, 19079, 31933, 28799, 11245, -11939, -29146, -31760, -18473, 4062, 24564}, +{32767, 23559, 1110, -21963, -32692, -25049, -3327, 20264, 32466, 26421, 5527, -18473, -32092, -27675, -7704, 16596, 31569, 28799, 9843, -14645, -30902, -29792, -11939, 12624, 30092, 30647, 13978, -10548, -29146, -31363, -15955, 8421, 28063, 31933, 17856, -6257, -26853, -32358, -19677, 4062, 25519, 32633, 21406, -1851, -24068, -32759, -23039, -371, 22506, 32733, 24564, 2589, -20841, -32558, -25978, -4797, 19079, 32232, 27270, 6981, -17232, -31760, -28439, -9135, 15303, 31140, 29475, 11245, -13305, -30378, -30378, -13305, 11245, 29475, 31140, 15303, -9135, -28439, -31760, -17232, 6981, 27270, 32232, 19079, -4797, -25978, -32558, -20841, 2589, 24564, 32733, 22506, -371, -23039, -32759, -24068, -1851, 21406, 32633, 25519, 4062, -19677, -32358, -26853, -6257, 17856, 31933, 28063, 8421, -15955, -31363, -29146, -10548, 13978, 30647, 30092, 12624, -11939, -29792, -30902, -14645, 9843, 28799, 31569, 16596, -7704, -27675, -32092, -18473, 5527, 26421, 32466, 20264, -3327, -25049, -32692, -21963, 1110, 23559}, +{32767, 22506, -1851, -25049, -32558, -19677, 5527, 27270, 31933, 16596, -9135, -29146, -30902, -13305, 12624, 30647, 29475, 9843, -15955, -31760, -27675, -6257, 19079, 32466, 25519, 2589, -21963, -32759, -23039, 1110, 24564, 32633, 20264, -4797, -26853, -32092, -17232, 8421, 28799, 31140, 13978, -11939, -30378, -29792, -10548, 15303, 31569, 28063, 6981, -18473, -32358, -25978, -3327, 21406, 32733, 23559, -371, -24068, -32692, -20841, 4062, 26421, 32232, 17856, -7704, -28439, -31363, -14645, 11245, 30092, 30092, 11245, -14645, -31363, -28439, -7704, 17856, 32232, 26421, 4062, -20841, -32692, -24068, -371, 23559, 32733, 21406, -3327, -25978, -32358, -18473, 6981, 28063, 31569, 15303, -10548, -29792, -30378, -11939, 13978, 31140, 28799, 8421, -17232, -32092, -26853, -4797, 20264, 32633, 24564, 1110, -23039, -32759, -21963, 2589, 25519, 32466, 19079, -6257, -27675, -31760, -15955, 9843, 29475, 30647, 12624, -13305, -30902, -29146, -9135, 16596, 31933, 27270, 5527, -19677, -32558, -25049, -1851, 22506}, +{32767, 21406, -4797, -27675, -31363, -13305, 13978, 31569, 27270, 4062, -21963, -32759, -20841, 5527, 28063, 31140, 12624, -14645, -31760, -26853, -3327, 22506, 32733, 20264, -6257, -28439, -30902, -11939, 15303, 31933, 26421, 2589, -23039, -32692, -19677, 6981, 28799, 30647, 11245, -15955, -32092, -25978, -1851, 23559, 32633, 19079, -7704, -29146, -30378, -10548, 16596, 32232, 25519, 1110, -24068, -32558, -18473, 8421, 29475, 30092, 9843, -17232, -32358, -25049, -371, 24564, 32466, 17856, -9135, -29792, -29792, -9135, 17856, 32466, 24564, -371, -25049, -32358, -17232, 9843, 30092, 29475, 8421, -18473, -32558, -24068, 1110, 25519, 32232, 16596, -10548, -30378, -29146, -7704, 19079, 32633, 23559, -1851, -25978, -32092, -15955, 11245, 30647, 28799, 6981, -19677, -32692, -23039, 2589, 26421, 31933, 15303, -11939, -30902, -28439, -6257, 20264, 32733, 22506, -3327, -26853, -31760, -14645, 12624, 31140, 28063, 5527, -20841, -32759, -21963, 4062, 27270, 31569, 13978, -13305, -31363, -27675, -4797, 21406}, +{32767, 20264, -7704, -29792, -29146, -6257, 21406, 32733, 19079, -9135, -30378, -28439, -4797, 22506, 32633, 17856, -10548, -30902, -27675, -3327, 23559, 32466, 16596, -11939, -31363, -26853, -1851, 24564, 32232, 15303, -13305, -31760, -25978, -371, 25519, 31933, 13978, -14645, -32092, -25049, 1110, 26421, 31569, 12624, -15955, -32358, -24068, 2589, 27270, 31140, 11245, -17232, -32558, -23039, 4062, 28063, 30647, 9843, -18473, -32692, -21963, 5527, 28799, 30092, 8421, -19677, -32759, -20841, 6981, 29475, 29475, 6981, -20841, -32759, -19677, 8421, 30092, 28799, 5527, -21963, -32692, -18473, 9843, 30647, 28063, 4062, -23039, -32558, -17232, 11245, 31140, 27270, 2589, -24068, -32358, -15955, 12624, 31569, 26421, 1110, -25049, -32092, -14645, 13978, 31933, 25519, -371, -25978, -31760, -13305, 15303, 32232, 24564, -1851, -26853, -31363, -11939, 16596, 32466, 23559, -3327, -27675, -30902, -10548, 17856, 32633, 22506, -4797, -28439, -30378, -9135, 19079, 32733, 21406, -6257, -29146, -29792, -7704, 20264}, +{32767, 19079, -10548, -31363, -25978, 1110, 27270, 30647, 8421, -20841, -32692, -17232, 12624, 31933, 24564, -3327, -28439, -29792, -6257, 22506, 32466, 15303, -14645, -32358, -23039, 5527, 29475, 28799, 4062, -24068, -32092, -13305, 16596, 32633, 21406, -7704, -30378, -27675, -1851, 25519, 31569, 11245, -18473, -32759, -19677, 9843, 31140, 26421, -371, -26853, -30902, -9135, 20264, 32733, 17856, -11939, -31760, -25049, 2589, 28063, 30092, 6981, -21963, -32558, -15955, 13978, 32232, 23559, -4797, -29146, -29146, -4797, 23559, 32232, 13978, -15955, -32558, -21963, 6981, 30092, 28063, 2589, -25049, -31760, -11939, 17856, 32733, 20264, -9135, -30902, -26853, -371, 26421, 31140, 9843, -19677, -32759, -18473, 11245, 31569, 25519, -1851, -27675, -30378, -7704, 21406, 32633, 16596, -13305, -32092, -24068, 4062, 28799, 29475, 5527, -23039, -32358, -14645, 15303, 32466, 22506, -6257, -29792, -28439, -3327, 24564, 31933, 12624, -17232, -32692, -20841, 8421, 30647, 27270, 1110, -25978, -31363, -10548, 19079}, +{32767, 17856, -13305, -32358, -21963, 8421, 31140, 25519, -3327, -29146, -28439, -1851, 26421, 30647, 6981, -23039, -32092, -11939, 19079, 32733, 16596, -14645, -32558, -20841, 9843, 31569, 24564, -4797, -29792, -27675, -371, 27270, 30092, 5527, -24068, -31760, -10548, 20264, 32633, 15303, -15955, -32692, -19677, 11245, 31933, 23559, -6257, -30378, -26853, 1110, 28063, 29475, 4062, -25049, -31363, -9135, 21406, 32466, 13978, -17232, -32759, -18473, 12624, 32232, 22506, -7704, -30902, -25978, 2589, 28799, 28799, 2589, -25978, -30902, -7704, 22506, 32232, 12624, -18473, -32759, -17232, 13978, 32466, 21406, -9135, -31363, -25049, 4062, 29475, 28063, 1110, -26853, -30378, -6257, 23559, 31933, 11245, -19677, -32692, -15955, 15303, 32633, 20264, -10548, -31760, -24068, 5527, 30092, 27270, -371, -27675, -29792, -4797, 24564, 31569, 9843, -20841, -32558, -14645, 16596, 32733, 19079, -11939, -32092, -23039, 6981, 30647, 26421, -1851, -28439, -29146, -3327, 25519, 31140, 8421, -21963, -32358, -13305, 17856}, +{32767, 16596, -15955, -32759, -17232, 15303, 32733, 17856, -14645, -32692, -18473, 13978, 32633, 19079, -13305, -32558, -19677, 12624, 32466, 20264, -11939, -32358, -20841, 11245, 32232, 21406, -10548, -32092, -21963, 9843, 31933, 22506, -9135, -31760, -23039, 8421, 31569, 23559, -7704, -31363, -24068, 6981, 31140, 24564, -6257, -30902, -25049, 5527, 30647, 25519, -4797, -30378, -25978, 4062, 30092, 26421, -3327, -29792, -26853, 2589, 29475, 27270, -1851, -29146, -27675, 1110, 28799, 28063, -371, -28439, -28439, -371, 28063, 28799, 1110, -27675, -29146, -1851, 27270, 29475, 2589, -26853, -29792, -3327, 26421, 30092, 4062, -25978, -30378, -4797, 25519, 30647, 5527, -25049, -30902, -6257, 24564, 31140, 6981, -24068, -31363, -7704, 23559, 31569, 8421, -23039, -31760, -9135, 22506, 31933, 9843, -21963, -32092, -10548, 21406, 32232, 11245, -20841, -32358, -11939, 20264, 32466, 12624, -19677, -32558, -13305, 19079, 32633, 13978, -18473, -32692, -14645, 17856, 32733, 15303, -17232, -32759, -15955, 16596}, +{32767, 15303, -18473, -32558, -11939, 21406, 31933, 8421, -24068, -30902, -4797, 26421, 29475, 1110, -28439, -27675, 2589, 30092, 25519, -6257, -31363, -23039, 9843, 32232, 20264, -13305, -32692, -17232, 16596, 32733, 13978, -19677, -32358, -10548, 22506, 31569, 6981, -25049, -30378, -3327, 27270, 28799, -371, -29146, -26853, 4062, 30647, 24564, -7704, -31760, -21963, 11245, 32466, 19079, -14645, -32759, -15955, 17856, 32633, 12624, -20841, -32092, -9135, 23559, 31140, 5527, -25978, -29792, -1851, 28063, 28063, -1851, -29792, -25978, 5527, 31140, 23559, -9135, -32092, -20841, 12624, 32633, 17856, -15955, -32759, -14645, 19079, 32466, 11245, -21963, -31760, -7704, 24564, 30647, 4062, -26853, -29146, -371, 28799, 27270, -3327, -30378, -25049, 6981, 31569, 22506, -10548, -32358, -19677, 13978, 32733, 16596, -17232, -32692, -13305, 20264, 32232, 9843, -23039, -31363, -6257, 25519, 30092, 2589, -27675, -28439, 1110, 29475, 26421, -4797, -30902, -24068, 8421, 31933, 21406, -11939, -32558, -18473, 15303}, +{32767, 13978, -20841, -31760, -6257, 26421, 28799, -1851, -30378, -24068, 9843, 32466, 17856, -17232, -32558, -10548, 23559, 30647, 2589, -28439, -26853, 5527, 31569, 21406, -13305, -32759, -14645, 20264, 31933, 6981, -25978, -29146, 1110, 30092, 24564, -9135, -32358, -18473, 16596, 32633, 11245, -23039, -30902, -3327, 28063, 27270, -4797, -31363, -21963, 12624, 32733, 15303, -19677, -32092, -7704, 25519, 29475, -371, -29792, -25049, 8421, 32232, 19079, -15955, -32692, -11939, 22506, 31140, 4062, -27675, -27675, 4062, 31140, 22506, -11939, -32692, -15955, 19079, 32232, 8421, -25049, -29792, -371, 29475, 25519, -7704, -32092, -19677, 15303, 32733, 12624, -21963, -31363, -4797, 27270, 28063, -3327, -30902, -23039, 11245, 32633, 16596, -18473, -32358, -9135, 24564, 30092, 1110, -29146, -25978, 6981, 31933, 20264, -14645, -32759, -13305, 21406, 31569, 5527, -26853, -28439, 2589, 30647, 23559, -10548, -32558, -17232, 17856, 32466, 9843, -24068, -30378, -1851, 28799, 26421, -6257, -31760, -20841, 13978}, +{32767, 12624, -23039, -30378, -371, 30092, 23559, -11939, -32759, -13305, 22506, 30647, 1110, -29792, -24068, 11245, 32733, 13978, -21963, -30902, -1851, 29475, 24564, -10548, -32692, -14645, 21406, 31140, 2589, -29146, -25049, 9843, 32633, 15303, -20841, -31363, -3327, 28799, 25519, -9135, -32558, -15955, 20264, 31569, 4062, -28439, -25978, 8421, 32466, 16596, -19677, -31760, -4797, 28063, 26421, -7704, -32358, -17232, 19079, 31933, 5527, -27675, -26853, 6981, 32232, 17856, -18473, -32092, -6257, 27270, 27270, -6257, -32092, -18473, 17856, 32232, 6981, -26853, -27675, 5527, 31933, 19079, -17232, -32358, -7704, 26421, 28063, -4797, -31760, -19677, 16596, 32466, 8421, -25978, -28439, 4062, 31569, 20264, -15955, -32558, -9135, 25519, 28799, -3327, -31363, -20841, 15303, 32633, 9843, -25049, -29146, 2589, 31140, 21406, -14645, -32692, -10548, 24564, 29475, -1851, -30902, -21963, 13978, 32733, 11245, -24068, -29792, 1110, 30647, 22506, -13305, -32759, -11939, 23559, 30092, -371, -30378, -23039, 12624}, +{32767, 11245, -25049, -28439, 5527, 32232, 16596, -20841, -30902, -371, 30647, 21406, -15955, -32358, -6257, 28063, 25519, -10548, -32759, -11939, 24564, 28799, -4797, -32092, -17232, 20264, 31140, 1110, -30378, -21963, 15303, 32466, 6981, -27675, -25978, 9843, 32733, 12624, -24068, -29146, 4062, 31933, 17856, -19677, -31363, -1851, 30092, 22506, -14645, -32558, -7704, 27270, 26421, -9135, -32692, -13305, 23559, 29475, -3327, -31760, -18473, 19079, 31569, 2589, -29792, -23039, 13978, 32633, 8421, -26853, -26853, 8421, 32633, 13978, -23039, -29792, 2589, 31569, 19079, -18473, -31760, -3327, 29475, 23559, -13305, -32692, -9135, 26421, 27270, -7704, -32558, -14645, 22506, 30092, -1851, -31363, -19677, 17856, 31933, 4062, -29146, -24068, 12624, 32733, 9843, -25978, -27675, 6981, 32466, 15303, -21963, -30378, 1110, 31140, 20264, -17232, -32092, -4797, 28799, 24564, -11939, -32759, -10548, 25519, 28063, -6257, -32358, -15955, 21406, 30647, -371, -30902, -20841, 16596, 32232, 5527, -28439, -25049, 11245}, +{32767, 9843, -26853, -25978, 11245, 32733, 8421, -27675, -25049, 12624, 32633, 6981, -28439, -24068, 13978, 32466, 5527, -29146, -23039, 15303, 32232, 4062, -29792, -21963, 16596, 31933, 2589, -30378, -20841, 17856, 31569, 1110, -30902, -19677, 19079, 31140, -371, -31363, -18473, 20264, 30647, -1851, -31760, -17232, 21406, 30092, -3327, -32092, -15955, 22506, 29475, -4797, -32358, -14645, 23559, 28799, -6257, -32558, -13305, 24564, 28063, -7704, -32692, -11939, 25519, 27270, -9135, -32759, -10548, 26421, 26421, -10548, -32759, -9135, 27270, 25519, -11939, -32692, -7704, 28063, 24564, -13305, -32558, -6257, 28799, 23559, -14645, -32358, -4797, 29475, 22506, -15955, -32092, -3327, 30092, 21406, -17232, -31760, -1851, 30647, 20264, -18473, -31363, -371, 31140, 19079, -19677, -30902, 1110, 31569, 17856, -20841, -30378, 2589, 31933, 16596, -21963, -29792, 4062, 32232, 15303, -23039, -29146, 5527, 32466, 13978, -24068, -28439, 6981, 32633, 12624, -25049, -27675, 8421, 32733, 11245, -25978, -26853, 9843}, +{32767, 8421, -28439, -23039, 16596, 31569, -371, -31760, -15955, 23559, 28063, -9135, -32759, -7704, 28799, 22506, -17232, -31363, 1110, 31933, 15303, -24068, -27675, 9843, 32733, 6981, -29146, -21963, 17856, 31140, -1851, -32092, -14645, 24564, 27270, -10548, -32692, -6257, 29475, 21406, -18473, -30902, 2589, 32232, 13978, -25049, -26853, 11245, 32633, 5527, -29792, -20841, 19079, 30647, -3327, -32358, -13305, 25519, 26421, -11939, -32558, -4797, 30092, 20264, -19677, -30378, 4062, 32466, 12624, -25978, -25978, 12624, 32466, 4062, -30378, -19677, 20264, 30092, -4797, -32558, -11939, 26421, 25519, -13305, -32358, -3327, 30647, 19079, -20841, -29792, 5527, 32633, 11245, -26853, -25049, 13978, 32232, 2589, -30902, -18473, 21406, 29475, -6257, -32692, -10548, 27270, 24564, -14645, -32092, -1851, 31140, 17856, -21963, -29146, 6981, 32733, 9843, -27675, -24068, 15303, 31933, 1110, -31363, -17232, 22506, 28799, -7704, -32759, -9135, 28063, 23559, -15955, -31760, -371, 31569, 16596, -23039, -28439, 8421}, +{32767, 6981, -29792, -19677, 21406, 28799, -9135, -32692, -4797, 30647, 17856, -23039, -27675, 11245, 32466, 2589, -31363, -15955, 24564, 26421, -13305, -32092, -371, 31933, 13978, -25978, -25049, 15303, 31569, -1851, -32358, -11939, 27270, 23559, -17232, -30902, 4062, 32633, 9843, -28439, -21963, 19079, 30092, -6257, -32759, -7704, 29475, 20264, -20841, -29146, 8421, 32733, 5527, -30378, -18473, 22506, 28063, -10548, -32558, -3327, 31140, 16596, -24068, -26853, 12624, 32232, 1110, -31760, -14645, 25519, 25519, -14645, -31760, 1110, 32232, 12624, -26853, -24068, 16596, 31140, -3327, -32558, -10548, 28063, 22506, -18473, -30378, 5527, 32733, 8421, -29146, -20841, 20264, 29475, -7704, -32759, -6257, 30092, 19079, -21963, -28439, 9843, 32633, 4062, -30902, -17232, 23559, 27270, -11939, -32358, -1851, 31569, 15303, -25049, -25978, 13978, 31933, -371, -32092, -13305, 26421, 24564, -15955, -31363, 2589, 32466, 11245, -27675, -23039, 17856, 30647, -4797, -32692, -9135, 28799, 21406, -19677, -29792, 6981}, +{32767, 5527, -30902, -15955, 25519, 24564, -17232, -30378, 6981, 32733, 4062, -31363, -14645, 26421, 23559, -18473, -29792, 8421, 32633, 2589, -31760, -13305, 27270, 22506, -19677, -29146, 9843, 32466, 1110, -32092, -11939, 28063, 21406, -20841, -28439, 11245, 32232, -371, -32358, -10548, 28799, 20264, -21963, -27675, 12624, 31933, -1851, -32558, -9135, 29475, 19079, -23039, -26853, 13978, 31569, -3327, -32692, -7704, 30092, 17856, -24068, -25978, 15303, 31140, -4797, -32759, -6257, 30647, 16596, -25049, -25049, 16596, 30647, -6257, -32759, -4797, 31140, 15303, -25978, -24068, 17856, 30092, -7704, -32692, -3327, 31569, 13978, -26853, -23039, 19079, 29475, -9135, -32558, -1851, 31933, 12624, -27675, -21963, 20264, 28799, -10548, -32358, -371, 32232, 11245, -28439, -20841, 21406, 28063, -11939, -32092, 1110, 32466, 9843, -29146, -19677, 22506, 27270, -13305, -31760, 2589, 32633, 8421, -29792, -18473, 23559, 26421, -14645, -31363, 4062, 32733, 6981, -30378, -17232, 24564, 25519, -15955, -30902, 5527}, +{32767, 4062, -31760, -11939, 28799, 19079, -24068, -25049, 17856, 29475, -10548, -32092, 2589, 32733, 5527, -31363, -13305, 28063, 20264, -23039, -25978, 16596, 30092, -9135, -32358, 1110, 32633, 6981, -30902, -14645, 27270, 21406, -21963, -26853, 15303, 30647, -7704, -32558, -371, 32466, 8421, -30378, -15955, 26421, 22506, -20841, -27675, 13978, 31140, -6257, -32692, -1851, 32232, 9843, -29792, -17232, 25519, 23559, -19677, -28439, 12624, 31569, -4797, -32759, -3327, 31933, 11245, -29146, -18473, 24564, 24564, -18473, -29146, 11245, 31933, -3327, -32759, -4797, 31569, 12624, -28439, -19677, 23559, 25519, -17232, -29792, 9843, 32232, -1851, -32692, -6257, 31140, 13978, -27675, -20841, 22506, 26421, -15955, -30378, 8421, 32466, -371, -32558, -7704, 30647, 15303, -26853, -21963, 21406, 27270, -14645, -30902, 6981, 32633, 1110, -32358, -9135, 30092, 16596, -25978, -23039, 20264, 28063, -13305, -31363, 5527, 32733, 2589, -32092, -10548, 29475, 17856, -25049, -24068, 19079, 28799, -11939, -31760, 4062}, +{32767, 2589, -32358, -7704, 31140, 12624, -29146, -17232, 26421, 21406, -23039, -25049, 19079, 28063, -14645, -30378, 9843, 31933, -4797, -32692, -371, 32633, 5527, -31760, -10548, 30092, 15303, -27675, -19677, 24564, 23559, -20841, -26853, 16596, 29475, -11939, -31363, 6981, 32466, -1851, -32759, -3327, 32232, 8421, -30902, -13305, 28799, 17856, -25978, -21963, 22506, 25519, -18473, -28439, 13978, 30647, -9135, -32092, 4062, 32733, 1110, -32558, -6257, 31569, 11245, -29792, -15955, 27270, 20264, -24068, -24068, 20264, 27270, -15955, -29792, 11245, 31569, -6257, -32558, 1110, 32733, 4062, -32092, -9135, 30647, 13978, -28439, -18473, 25519, 22506, -21963, -25978, 17856, 28799, -13305, -30902, 8421, 32232, -3327, -32759, -1851, 32466, 6981, -31363, -11939, 29475, 16596, -26853, -20841, 23559, 24564, -19677, -27675, 15303, 30092, -10548, -31760, 5527, 32633, -371, -32692, -4797, 31933, 9843, -30378, -14645, 28063, 19079, -25049, -23039, 21406, 26421, -17232, -29146, 12624, 31140, -7704, -32358, 2589}, +{32767, 1110, -32692, -3327, 32466, 5527, -32092, -7704, 31569, 9843, -30902, -11939, 30092, 13978, -29146, -15955, 28063, 17856, -26853, -19677, 25519, 21406, -24068, -23039, 22506, 24564, -20841, -25978, 19079, 27270, -17232, -28439, 15303, 29475, -13305, -30378, 11245, 31140, -9135, -31760, 6981, 32232, -4797, -32558, 2589, 32733, -371, -32759, -1851, 32633, 4062, -32358, -6257, 31933, 8421, -31363, -10548, 30647, 12624, -29792, -14645, 28799, 16596, -27675, -18473, 26421, 20264, -25049, -21963, 23559, 23559, -21963, -25049, 20264, 26421, -18473, -27675, 16596, 28799, -14645, -29792, 12624, 30647, -10548, -31363, 8421, 31933, -6257, -32358, 4062, 32633, -1851, -32759, -371, 32733, 2589, -32558, -4797, 32232, 6981, -31760, -9135, 31140, 11245, -30378, -13305, 29475, 15303, -28439, -17232, 27270, 19079, -25978, -20841, 24564, 22506, -23039, -24068, 21406, 25519, -19677, -26853, 17856, 28063, -15955, -29146, 13978, 30092, -11939, -30902, 9843, 31569, -7704, -32092, 5527, 32466, -3327, -32692, 1110}, +{32767, -371, -32759, 1110, 32733, -1851, -32692, 2589, 32633, -3327, -32558, 4062, 32466, -4797, -32358, 5527, 32232, -6257, -32092, 6981, 31933, -7704, -31760, 8421, 31569, -9135, -31363, 9843, 31140, -10548, -30902, 11245, 30647, -11939, -30378, 12624, 30092, -13305, -29792, 13978, 29475, -14645, -29146, 15303, 28799, -15955, -28439, 16596, 28063, -17232, -27675, 17856, 27270, -18473, -26853, 19079, 26421, -19677, -25978, 20264, 25519, -20841, -25049, 21406, 24564, -21963, -24068, 22506, 23559, -23039, -23039, 23559, 22506, -24068, -21963, 24564, 21406, -25049, -20841, 25519, 20264, -25978, -19677, 26421, 19079, -26853, -18473, 27270, 17856, -27675, -17232, 28063, 16596, -28439, -15955, 28799, 15303, -29146, -14645, 29475, 13978, -29792, -13305, 30092, 12624, -30378, -11939, 30647, 11245, -30902, -10548, 31140, 9843, -31363, -9135, 31569, 8421, -31760, -7704, 31933, 6981, -32092, -6257, 32232, 5527, -32358, -4797, 32466, 4062, -32558, -3327, 32633, 2589, -32692, -1851, 32733, 1110, -32759, -371}, +{32767, -1851, -32558, 5527, 31933, -9135, -30902, 12624, 29475, -15955, -27675, 19079, 25519, -21963, -23039, 24564, 20264, -26853, -17232, 28799, 13978, -30378, -10548, 31569, 6981, -32358, -3327, 32733, -371, -32692, 4062, 32232, -7704, -31363, 11245, 30092, -14645, -28439, 17856, 26421, -20841, -24068, 23559, 21406, -25978, -18473, 28063, 15303, -29792, -11939, 31140, 8421, -32092, -4797, 32633, 1110, -32759, 2589, 32466, -6257, -31760, 9843, 30647, -13305, -29146, 16596, 27270, -19677, -25049, 22506, 22506, -25049, -19677, 27270, 16596, -29146, -13305, 30647, 9843, -31760, -6257, 32466, 2589, -32759, 1110, 32633, -4797, -32092, 8421, 31140, -11939, -29792, 15303, 28063, -18473, -25978, 21406, 23559, -24068, -20841, 26421, 17856, -28439, -14645, 30092, 11245, -31363, -7704, 32232, 4062, -32692, -371, 32733, -3327, -32358, 6981, 31569, -10548, -30378, 13978, 28799, -17232, -26853, 20264, 24564, -23039, -21963, 25519, 19079, -27675, -15955, 29475, 12624, -30902, -9135, 31933, 5527, -32558, -1851}, +{32767, -3327, -32092, 9843, 30092, -15955, -26853, 21406, 22506, -25978, -17232, 29475, 11245, -31760, -4797, 32733, -1851, -32358, 8421, 30647, -14645, -27675, 20264, 23559, -25049, -18473, 28799, 12624, -31363, -6257, 32633, -371, -32558, 6981, 31140, -13305, -28439, 19079, 24564, -24068, -19677, 28063, 13978, -30902, -7704, 32466, 1110, -32692, 5527, 31569, -11939, -29146, 17856, 25519, -23039, -20841, 27270, 15303, -30378, -9135, 32232, 2589, -32759, 4062, 31933, -10548, -29792, 16596, 26421, -21963, -21963, 26421, 16596, -29792, -10548, 31933, 4062, -32759, 2589, 32232, -9135, -30378, 15303, 27270, -20841, -23039, 25519, 17856, -29146, -11939, 31569, 5527, -32692, 1110, 32466, -7704, -30902, 13978, 28063, -19677, -24068, 24564, 19079, -28439, -13305, 31140, 6981, -32558, -371, 32633, -6257, -31363, 12624, 28799, -18473, -25049, 23559, 20264, -27675, -14645, 30647, 8421, -32358, -1851, 32733, -4797, -31760, 11245, 29475, -17232, -25978, 22506, 21406, -26853, -15955, 30092, 9843, -32092, -3327}, +{32767, -4797, -31363, 13978, 27270, -21963, -20841, 28063, 12624, -31760, -3327, 32733, -6257, -30902, 15303, 26421, -23039, -19677, 28799, 11245, -32092, -1851, 32633, -7704, -30378, 16596, 25519, -24068, -18473, 29475, 9843, -32358, -371, 32466, -9135, -29792, 17856, 24564, -25049, -17232, 30092, 8421, -32558, 1110, 32232, -10548, -29146, 19079, 23559, -25978, -15955, 30647, 6981, -32692, 2589, 31933, -11939, -28439, 20264, 22506, -26853, -14645, 31140, 5527, -32759, 4062, 31569, -13305, -27675, 21406, 21406, -27675, -13305, 31569, 4062, -32759, 5527, 31140, -14645, -26853, 22506, 20264, -28439, -11939, 31933, 2589, -32692, 6981, 30647, -15955, -25978, 23559, 19079, -29146, -10548, 32232, 1110, -32558, 8421, 30092, -17232, -25049, 24564, 17856, -29792, -9135, 32466, -371, -32358, 9843, 29475, -18473, -24068, 25519, 16596, -30378, -7704, 32633, -1851, -32092, 11245, 28799, -19677, -23039, 26421, 15303, -30902, -6257, 32733, -3327, -31760, 12624, 28063, -20841, -21963, 27270, 13978, -31363, -4797}, +{32767, -6257, -30378, 17856, 23559, -26853, -13305, 31933, 1110, -32358, 11245, 28063, -21963, -19677, 29475, 8421, -32692, 4062, 31140, -15955, -25049, 25519, 15303, -31363, -3327, 32633, -9135, -29146, 20264, 21406, -28439, -10548, 32466, -1851, -31760, 13978, 26421, -24068, -17232, 30647, 5527, -32759, 6981, 30092, -18473, -23039, 27270, 12624, -32092, -371, 32232, -11939, -27675, 22506, 19079, -29792, -7704, 32733, -4797, -30902, 16596, 24564, -25978, -14645, 31569, 2589, -32558, 9843, 28799, -20841, -20841, 28799, 9843, -32558, 2589, 31569, -14645, -25978, 24564, 16596, -30902, -4797, 32733, -7704, -29792, 19079, 22506, -27675, -11939, 32232, -371, -32092, 12624, 27270, -23039, -18473, 30092, 6981, -32759, 5527, 30647, -17232, -24068, 26421, 13978, -31760, -1851, 32466, -10548, -28439, 21406, 20264, -29146, -9135, 32633, -3327, -31363, 15303, 25519, -25049, -15955, 31140, 4062, -32692, 8421, 29475, -19677, -21963, 28063, 11245, -32358, 1110, 31933, -13305, -26853, 23559, 17856, -30378, -6257}, +{32767, -7704, -29146, 21406, 19079, -30378, -4797, 32633, -10548, -27675, 23559, 16596, -31363, -1851, 32232, -13305, -25978, 25519, 13978, -32092, 1110, 31569, -15955, -24068, 27270, 11245, -32558, 4062, 30647, -18473, -21963, 28799, 8421, -32759, 6981, 29475, -20841, -19677, 30092, 5527, -32692, 9843, 28063, -23039, -17232, 31140, 2589, -32358, 12624, 26421, -25049, -14645, 31933, -371, -31760, 15303, 24564, -26853, -11939, 32466, -3327, -30902, 17856, 22506, -28439, -9135, 32733, -6257, -29792, 20264, 20264, -29792, -6257, 32733, -9135, -28439, 22506, 17856, -30902, -3327, 32466, -11939, -26853, 24564, 15303, -31760, -371, 31933, -14645, -25049, 26421, 12624, -32358, 2589, 31140, -17232, -23039, 28063, 9843, -32692, 5527, 30092, -19677, -20841, 29475, 6981, -32759, 8421, 28799, -21963, -18473, 30647, 4062, -32558, 11245, 27270, -24068, -15955, 31569, 1110, -32092, 13978, 25519, -25978, -13305, 32232, -1851, -31363, 16596, 23559, -27675, -10548, 32633, -4797, -30378, 19079, 21406, -29146, -7704}, +{32767, -9135, -27675, 24564, 13978, -32358, 4062, 30092, -20841, -18473, 31140, 1110, -31760, 16596, 22506, -29146, -6257, 32633, -11939, -25978, 26421, 11245, -32692, 6981, 28799, -23039, -15955, 31933, -1851, -30902, 19079, 20264, -30378, -3327, 32232, -14645, -24068, 28063, 8421, -32759, 9843, 27270, -25049, -13305, 32466, -4797, -29792, 21406, 17856, -31363, -371, 31569, -17232, -21963, 29475, 5527, -32558, 12624, 25519, -26853, -10548, 32733, -7704, -28439, 23559, 15303, -32092, 2589, 30647, -19677, -19677, 30647, 2589, -32092, 15303, 23559, -28439, -7704, 32733, -10548, -26853, 25519, 12624, -32558, 5527, 29475, -21963, -17232, 31569, -371, -31363, 17856, 21406, -29792, -4797, 32466, -13305, -25049, 27270, 9843, -32759, 8421, 28063, -24068, -14645, 32232, -3327, -30378, 20264, 19079, -30902, -1851, 31933, -15955, -23039, 28799, 6981, -32692, 11245, 26421, -25978, -11939, 32633, -6257, -29146, 22506, 16596, -31760, 1110, 31140, -18473, -20841, 30092, 4062, -32358, 13978, 24564, -27675, -9135}, +{32767, -10548, -25978, 27270, 8421, -32692, 12624, 24564, -28439, -6257, 32466, -14645, -23039, 29475, 4062, -32092, 16596, 21406, -30378, -1851, 31569, -18473, -19677, 31140, -371, -30902, 20264, 17856, -31760, 2589, 30092, -21963, -15955, 32232, -4797, -29146, 23559, 13978, -32558, 6981, 28063, -25049, -11939, 32733, -9135, -26853, 26421, 9843, -32759, 11245, 25519, -27675, -7704, 32633, -13305, -24068, 28799, 5527, -32358, 15303, 22506, -29792, -3327, 31933, -17232, -20841, 30647, 1110, -31363, 19079, 19079, -31363, 1110, 30647, -20841, -17232, 31933, -3327, -29792, 22506, 15303, -32358, 5527, 28799, -24068, -13305, 32633, -7704, -27675, 25519, 11245, -32759, 9843, 26421, -26853, -9135, 32733, -11939, -25049, 28063, 6981, -32558, 13978, 23559, -29146, -4797, 32232, -15955, -21963, 30092, 2589, -31760, 17856, 20264, -30902, -371, 31140, -19677, -18473, 31569, -1851, -30378, 21406, 16596, -32092, 4062, 29475, -23039, -14645, 32466, -6257, -28439, 24564, 12624, -32692, 8421, 27270, -25978, -10548}, +{32767, -11939, -24068, 29475, 2589, -31363, 20264, 16596, -32358, 6981, 27270, -26853, -7704, 32466, -15955, -20841, 31140, -1851, -29792, 23559, 12624, -32759, 11245, 24564, -29146, -3327, 31569, -19677, -17232, 32232, -6257, -27675, 26421, 8421, -32558, 15303, 21406, -30902, 1110, 30092, -23039, -13305, 32733, -10548, -25049, 28799, 4062, -31760, 19079, 17856, -32092, 5527, 28063, -25978, -9135, 32633, -14645, -21963, 30647, -371, -30378, 22506, 13978, -32692, 9843, 25519, -28439, -4797, 31933, -18473, -18473, 31933, -4797, -28439, 25519, 9843, -32692, 13978, 22506, -30378, -371, 30647, -21963, -14645, 32633, -9135, -25978, 28063, 5527, -32092, 17856, 19079, -31760, 4062, 28799, -25049, -10548, 32733, -13305, -23039, 30092, 1110, -30902, 21406, 15303, -32558, 8421, 26421, -27675, -6257, 32232, -17232, -19677, 31569, -3327, -29146, 24564, 11245, -32759, 12624, 23559, -29792, -1851, 31140, -20841, -15955, 32466, -7704, -26853, 27270, 6981, -32358, 16596, 20264, -31363, 2589, 29475, -24068, -11939}, +{32767, -13305, -21963, 31140, -3327, -28439, 26421, 6981, -32092, 19079, 16596, -32558, 9843, 24564, -29792, -371, 30092, -24068, -10548, 32633, -15955, -19677, 31933, -6257, -26853, 28063, 4062, -31363, 21406, 13978, -32759, 12624, 22506, -30902, 2589, 28799, -25978, -7704, 32232, -18473, -17232, 32466, -9135, -25049, 29475, 1110, -30378, 23559, 11245, -32692, 15303, 20264, -31760, 5527, 27270, -27675, -4797, 31569, -20841, -14645, 32733, -11939, -23039, 30647, -1851, -29146, 25519, 8421, -32358, 17856, 17856, -32358, 8421, 25519, -29146, -1851, 30647, -23039, -11939, 32733, -14645, -20841, 31569, -4797, -27675, 27270, 5527, -31760, 20264, 15303, -32692, 11245, 23559, -30378, 1110, 29475, -25049, -9135, 32466, -17232, -18473, 32232, -7704, -25978, 28799, 2589, -30902, 22506, 12624, -32759, 13978, 21406, -31363, 4062, 28063, -26853, -6257, 31933, -19677, -15955, 32633, -10548, -24068, 30092, -371, -29792, 24564, 9843, -32558, 16596, 19079, -32092, 6981, 26421, -28439, -3327, 31140, -21963, -13305}, +{32767, -14645, -19677, 32232, -9135, -24068, 30647, -3327, -27675, 28063, 2589, -30378, 24564, 8421, -32092, 20264, 13978, -32759, 15303, 19079, -32358, 9843, 23559, -30902, 4062, 27270, -28439, -1851, 30092, -25049, -7704, 31933, -20841, -13305, 32733, -15955, -18473, 32466, -10548, -23039, 31140, -4797, -26853, 28799, 1110, -29792, 25519, 6981, -31760, 21406, 12624, -32692, 16596, 17856, -32558, 11245, 22506, -31363, 5527, 26421, -29146, -371, 29475, -25978, -6257, 31569, -21963, -11939, 32633, -17232, -17232, 32633, -11939, -21963, 31569, -6257, -25978, 29475, -371, -29146, 26421, 5527, -31363, 22506, 11245, -32558, 17856, 16596, -32692, 12624, 21406, -31760, 6981, 25519, -29792, 1110, 28799, -26853, -4797, 31140, -23039, -10548, 32466, -18473, -15955, 32733, -13305, -20841, 31933, -7704, -25049, 30092, -1851, -28439, 27270, 4062, -30902, 23559, 9843, -32358, 19079, 15303, -32759, 13978, 20264, -32092, 8421, 24564, -30378, 2589, 28063, -27675, -3327, 30647, -24068, -9135, 32232, -19677, -14645}, +{32767, -15955, -17232, 32733, -14645, -18473, 32633, -13305, -19677, 32466, -11939, -20841, 32232, -10548, -21963, 31933, -9135, -23039, 31569, -7704, -24068, 31140, -6257, -25049, 30647, -4797, -25978, 30092, -3327, -26853, 29475, -1851, -27675, 28799, -371, -28439, 28063, 1110, -29146, 27270, 2589, -29792, 26421, 4062, -30378, 25519, 5527, -30902, 24564, 6981, -31363, 23559, 8421, -31760, 22506, 9843, -32092, 21406, 11245, -32358, 20264, 12624, -32558, 19079, 13978, -32692, 17856, 15303, -32759, 16596, 16596, -32759, 15303, 17856, -32692, 13978, 19079, -32558, 12624, 20264, -32358, 11245, 21406, -32092, 9843, 22506, -31760, 8421, 23559, -31363, 6981, 24564, -30902, 5527, 25519, -30378, 4062, 26421, -29792, 2589, 27270, -29146, 1110, 28063, -28439, -371, 28799, -27675, -1851, 29475, -26853, -3327, 30092, -25978, -4797, 30647, -25049, -6257, 31140, -24068, -7704, 31569, -23039, -9135, 31933, -21963, -10548, 32232, -20841, -11939, 32466, -19677, -13305, 32633, -18473, -14645, 32733, -17232, -15955}, +{32767, -17232, -14645, 32633, -19677, -11939, 32232, -21963, -9135, 31569, -24068, -6257, 30647, -25978, -3327, 29475, -27675, -371, 28063, -29146, 2589, 26421, -30378, 5527, 24564, -31363, 8421, 22506, -32092, 11245, 20264, -32558, 13978, 17856, -32759, 16596, 15303, -32692, 19079, 12624, -32358, 21406, 9843, -31760, 23559, 6981, -30902, 25519, 4062, -29792, 27270, 1110, -28439, 28799, -1851, -26853, 30092, -4797, -25049, 31140, -7704, -23039, 31933, -10548, -20841, 32466, -13305, -18473, 32733, -15955, -15955, 32733, -18473, -13305, 32466, -20841, -10548, 31933, -23039, -7704, 31140, -25049, -4797, 30092, -26853, -1851, 28799, -28439, 1110, 27270, -29792, 4062, 25519, -30902, 6981, 23559, -31760, 9843, 21406, -32358, 12624, 19079, -32692, 15303, 16596, -32759, 17856, 13978, -32558, 20264, 11245, -32092, 22506, 8421, -31363, 24564, 5527, -30378, 26421, 2589, -29146, 28063, -371, -27675, 29475, -3327, -25978, 30647, -6257, -24068, 31569, -9135, -21963, 32232, -11939, -19677, 32633, -14645, -17232}, +{32767, -18473, -11939, 31933, -24068, -4797, 29475, -28439, 2589, 25519, -31363, 9843, 20264, -32692, 16596, 13978, -32358, 22506, 6981, -30378, 27270, -371, -26853, 30647, -7704, -21963, 32466, -14645, -15955, 32633, -20841, -9135, 31140, -25978, -1851, 28063, -29792, 5527, 23559, -32092, 12624, 17856, -32759, 19079, 11245, -31760, 24564, 4062, -29146, 28799, -3327, -25049, 31569, -10548, -19677, 32733, -17232, -13305, 32232, -23039, -6257, 30092, -27675, 1110, 26421, -30902, 8421, 21406, -32558, 15303, 15303, -32558, 21406, 8421, -30902, 26421, 1110, -27675, 30092, -6257, -23039, 32232, -13305, -17232, 32733, -19677, -10548, 31569, -25049, -3327, 28799, -29146, 4062, 24564, -31760, 11245, 19079, -32759, 17856, 12624, -32092, 23559, 5527, -29792, 28063, -1851, -25978, 31140, -9135, -20841, 32633, -15955, -14645, 32466, -21963, -7704, 30647, -26853, -371, 27270, -30378, 6981, 22506, -32358, 13978, 16596, -32692, 20264, 9843, -31363, 25519, 2589, -28439, 29475, -4797, -24068, 31933, -11939, -18473}, +{32767, -19677, -9135, 30647, -27675, 2589, 24564, -32092, 13978, 15303, -32358, 23559, 4062, -28439, 30092, -7704, -20841, 32733, -18473, -10548, 31140, -26853, 1110, 25519, -31760, 12624, 16596, -32558, 22506, 5527, -29146, 29475, -6257, -21963, 32633, -17232, -11939, 31569, -25978, -371, 26421, -31363, 11245, 17856, -32692, 21406, 6981, -29792, 28799, -4797, -23039, 32466, -15955, -13305, 31933, -25049, -1851, 27270, -30902, 9843, 19079, -32759, 20264, 8421, -30378, 28063, -3327, -24068, 32232, -14645, -14645, 32232, -24068, -3327, 28063, -30378, 8421, 20264, -32759, 19079, 9843, -30902, 27270, -1851, -25049, 31933, -13305, -15955, 32466, -23039, -4797, 28799, -29792, 6981, 21406, -32692, 17856, 11245, -31363, 26421, -371, -25978, 31569, -11939, -17232, 32633, -21963, -6257, 29475, -29146, 5527, 22506, -32558, 16596, 12624, -31760, 25519, 1110, -26853, 31140, -10548, -18473, 32733, -20841, -7704, 30092, -28439, 4062, 23559, -32358, 15303, 13978, -32092, 24564, 2589, -27675, 30647, -9135, -19677}, +{32767, -20841, -6257, 28799, -30378, 9843, 17856, -32558, 23559, 2589, -26853, 31569, -13305, -14645, 31933, -25978, 1110, 24564, -32358, 16596, 11245, -30902, 28063, -4797, -21963, 32733, -19677, -7704, 29475, -29792, 8421, 19079, -32692, 22506, 4062, -27675, 31140, -11939, -15955, 32232, -25049, -371, 25519, -32092, 15303, 12624, -31363, 27270, -3327, -23039, 32633, -18473, -9135, 30092, -29146, 6981, 20264, -32759, 21406, 5527, -28439, 30647, -10548, -17232, 32466, -24068, -1851, 26421, -31760, 13978, 13978, -31760, 26421, -1851, -24068, 32466, -17232, -10548, 30647, -28439, 5527, 21406, -32759, 20264, 6981, -29146, 30092, -9135, -18473, 32633, -23039, -3327, 27270, -31363, 12624, 15303, -32092, 25519, -371, -25049, 32232, -15955, -11939, 31140, -27675, 4062, 22506, -32692, 19079, 8421, -29792, 29475, -7704, -19677, 32733, -21963, -4797, 28063, -30902, 11245, 16596, -32358, 24564, 1110, -25978, 31933, -14645, -13305, 31569, -26853, 2589, 23559, -32558, 17856, 9843, -30378, 28799, -6257, -20841}, +{32767, -21963, -3327, 26421, -32092, 16596, 9843, -29792, 30092, -10548, -15955, 31933, -26853, 4062, 21406, -32759, 22506, 2589, -25978, 32232, -17232, -9135, 29475, -30378, 11245, 15303, -31760, 27270, -4797, -20841, 32733, -23039, -1851, 25519, -32358, 17856, 8421, -29146, 30647, -11939, -14645, 31569, -27675, 5527, 20264, -32692, 23559, 1110, -25049, 32466, -18473, -7704, 28799, -30902, 12624, 13978, -31363, 28063, -6257, -19677, 32633, -24068, -371, 24564, -32558, 19079, 6981, -28439, 31140, -13305, -13305, 31140, -28439, 6981, 19079, -32558, 24564, -371, -24068, 32633, -19677, -6257, 28063, -31363, 13978, 12624, -30902, 28799, -7704, -18473, 32466, -25049, 1110, 23559, -32692, 20264, 5527, -27675, 31569, -14645, -11939, 30647, -29146, 8421, 17856, -32358, 25519, -1851, -23039, 32733, -20841, -4797, 27270, -31760, 15303, 11245, -30378, 29475, -9135, -17232, 32232, -25978, 2589, 22506, -32759, 21406, 4062, -26853, 31933, -15955, -10548, 30092, -29792, 9843, 16596, -32092, 26421, -3327, -21963}, +{32767, -23039, -371, 23559, -32759, 22506, 1110, -24068, 32733, -21963, -1851, 24564, -32692, 21406, 2589, -25049, 32633, -20841, -3327, 25519, -32558, 20264, 4062, -25978, 32466, -19677, -4797, 26421, -32358, 19079, 5527, -26853, 32232, -18473, -6257, 27270, -32092, 17856, 6981, -27675, 31933, -17232, -7704, 28063, -31760, 16596, 8421, -28439, 31569, -15955, -9135, 28799, -31363, 15303, 9843, -29146, 31140, -14645, -10548, 29475, -30902, 13978, 11245, -29792, 30647, -13305, -11939, 30092, -30378, 12624, 12624, -30378, 30092, -11939, -13305, 30647, -29792, 11245, 13978, -30902, 29475, -10548, -14645, 31140, -29146, 9843, 15303, -31363, 28799, -9135, -15955, 31569, -28439, 8421, 16596, -31760, 28063, -7704, -17232, 31933, -27675, 6981, 17856, -32092, 27270, -6257, -18473, 32232, -26853, 5527, 19079, -32358, 26421, -4797, -19677, 32466, -25978, 4062, 20264, -32558, 25519, -3327, -20841, 32633, -25049, 2589, 21406, -32692, 24564, -1851, -21963, 32733, -24068, 1110, 22506, -32759, 23559, -371, -23039}, +{32767, -24068, 2589, 20264, -32358, 27270, -7704, -15955, 31140, -29792, 12624, 11245, -29146, 31569, -17232, -6257, 26421, -32558, 21406, 1110, -23039, 32733, -25049, 4062, 19079, -32092, 28063, -9135, -14645, 30647, -30378, 13978, 9843, -28439, 31933, -18473, -4797, 25519, -32692, 22506, -371, -21963, 32633, -25978, 5527, 17856, -31760, 28799, -10548, -13305, 30092, -30902, 15303, 8421, -27675, 32232, -19677, -3327, 24564, -32759, 23559, -1851, -20841, 32466, -26853, 6981, 16596, -31363, 29475, -11939, -11939, 29475, -31363, 16596, 6981, -26853, 32466, -20841, -1851, 23559, -32759, 24564, -3327, -19677, 32232, -27675, 8421, 15303, -30902, 30092, -13305, -10548, 28799, -31760, 17856, 5527, -25978, 32633, -21963, -371, 22506, -32692, 25519, -4797, -18473, 31933, -28439, 9843, 13978, -30378, 30647, -14645, -9135, 28063, -32092, 19079, 4062, -25049, 32733, -23039, 1110, 21406, -32558, 26421, -6257, -17232, 31569, -29146, 11245, 12624, -29792, 31140, -15955, -7704, 27270, -32358, 20264, 2589, -24068}, +{32767, -25049, 5527, 16596, -30902, 30647, -15955, -6257, 25519, -32759, 24564, -4797, -17232, 31140, -30378, 15303, 6981, -25978, 32733, -24068, 4062, 17856, -31363, 30092, -14645, -7704, 26421, -32692, 23559, -3327, -18473, 31569, -29792, 13978, 8421, -26853, 32633, -23039, 2589, 19079, -31760, 29475, -13305, -9135, 27270, -32558, 22506, -1851, -19677, 31933, -29146, 12624, 9843, -27675, 32466, -21963, 1110, 20264, -32092, 28799, -11939, -10548, 28063, -32358, 21406, -371, -20841, 32232, -28439, 11245, 11245, -28439, 32232, -20841, -371, 21406, -32358, 28063, -10548, -11939, 28799, -32092, 20264, 1110, -21963, 32466, -27675, 9843, 12624, -29146, 31933, -19677, -1851, 22506, -32558, 27270, -9135, -13305, 29475, -31760, 19079, 2589, -23039, 32633, -26853, 8421, 13978, -29792, 31569, -18473, -3327, 23559, -32692, 26421, -7704, -14645, 30092, -31363, 17856, 4062, -24068, 32733, -25978, 6981, 15303, -30378, 31140, -17232, -4797, 24564, -32759, 25519, -6257, -15955, 30647, -30902, 16596, 5527, -25049}, +{32767, -25978, 8421, 12624, -28439, 32466, -23039, 4062, 16596, -30378, 31569, -19677, -371, 20264, -31760, 30092, -15955, -4797, 23559, -32558, 28063, -11939, -9135, 26421, -32759, 25519, -7704, -13305, 28799, -32358, 22506, -3327, -17232, 30647, -31363, 19079, 1110, -20841, 31933, -29792, 15303, 5527, -24068, 32633, -27675, 11245, 9843, -26853, 32733, -25049, 6981, 13978, -29146, 32232, -21963, 2589, 17856, -30902, 31140, -18473, -1851, 21406, -32092, 29475, -14645, -6257, 24564, -32692, 27270, -10548, -10548, 27270, -32692, 24564, -6257, -14645, 29475, -32092, 21406, -1851, -18473, 31140, -30902, 17856, 2589, -21963, 32232, -29146, 13978, 6981, -25049, 32733, -26853, 9843, 11245, -27675, 32633, -24068, 5527, 15303, -29792, 31933, -20841, 1110, 19079, -31363, 30647, -17232, -3327, 22506, -32358, 28799, -13305, -7704, 25519, -32759, 26421, -9135, -11939, 28063, -32558, 23559, -4797, -15955, 30092, -31760, 20264, -371, -19677, 31569, -30378, 16596, 4062, -23039, 32466, -28439, 12624, 8421, -25978}, +{32767, -26853, 11245, 8421, -25049, 32633, -28439, 13978, 5527, -23039, 32232, -29792, 16596, 2589, -20841, 31569, -30902, 19079, -371, -18473, 30647, -31760, 21406, -3327, -15955, 29475, -32358, 23559, -6257, -13305, 28063, -32692, 25519, -9135, -10548, 26421, -32759, 27270, -11939, -7704, 24564, -32558, 28799, -14645, -4797, 22506, -32092, 30092, -17232, -1851, 20264, -31363, 31140, -19677, 1110, 17856, -30378, 31933, -21963, 4062, 15303, -29146, 32466, -24068, 6981, 12624, -27675, 32733, -25978, 9843, 9843, -25978, 32733, -27675, 12624, 6981, -24068, 32466, -29146, 15303, 4062, -21963, 31933, -30378, 17856, 1110, -19677, 31140, -31363, 20264, -1851, -17232, 30092, -32092, 22506, -4797, -14645, 28799, -32558, 24564, -7704, -11939, 27270, -32759, 26421, -10548, -9135, 25519, -32692, 28063, -13305, -6257, 23559, -32358, 29475, -15955, -3327, 21406, -31760, 30647, -18473, -371, 19079, -30902, 31569, -20841, 2589, 16596, -29792, 32232, -23039, 5527, 13978, -28439, 32633, -25049, 8421, 11245, -26853}, +{32767, -27675, 13978, 4062, -20841, 31140, -31760, 22506, -6257, -11939, 26421, -32692, 28799, -15955, -1851, 19079, -30378, 32232, -24068, 8421, 9843, -25049, 32466, -29792, 17856, -371, -17232, 29475, -32558, 25519, -10548, -7704, 23559, -32092, 30647, -19677, 2589, 15303, -28439, 32733, -26853, 12624, 5527, -21963, 31569, -31363, 21406, -4797, -13305, 27270, -32759, 28063, -14645, -3327, 20264, -30902, 31933, -23039, 6981, 11245, -25978, 32633, -29146, 16596, 1110, -18473, 30092, -32358, 24564, -9135, -9135, 24564, -32358, 30092, -18473, 1110, 16596, -29146, 32633, -25978, 11245, 6981, -23039, 31933, -30902, 20264, -3327, -14645, 28063, -32759, 27270, -13305, -4797, 21406, -31363, 31569, -21963, 5527, 12624, -26853, 32733, -28439, 15303, 2589, -19677, 30647, -32092, 23559, -7704, -10548, 25519, -32558, 29475, -17232, -371, 17856, -29792, 32466, -25049, 9843, 8421, -24068, 32232, -30378, 19079, -1851, -15955, 28799, -32692, 26421, -11939, -6257, 22506, -31760, 31140, -20841, 4062, 13978, -27675}, +{32767, -28439, 16596, -371, -15955, 28063, -32759, 28799, -17232, 1110, 15303, -27675, 32733, -29146, 17856, -1851, -14645, 27270, -32692, 29475, -18473, 2589, 13978, -26853, 32633, -29792, 19079, -3327, -13305, 26421, -32558, 30092, -19677, 4062, 12624, -25978, 32466, -30378, 20264, -4797, -11939, 25519, -32358, 30647, -20841, 5527, 11245, -25049, 32232, -30902, 21406, -6257, -10548, 24564, -32092, 31140, -21963, 6981, 9843, -24068, 31933, -31363, 22506, -7704, -9135, 23559, -31760, 31569, -23039, 8421, 8421, -23039, 31569, -31760, 23559, -9135, -7704, 22506, -31363, 31933, -24068, 9843, 6981, -21963, 31140, -32092, 24564, -10548, -6257, 21406, -30902, 32232, -25049, 11245, 5527, -20841, 30647, -32358, 25519, -11939, -4797, 20264, -30378, 32466, -25978, 12624, 4062, -19677, 30092, -32558, 26421, -13305, -3327, 19079, -29792, 32633, -26853, 13978, 2589, -18473, 29475, -32692, 27270, -14645, -1851, 17856, -29146, 32733, -27675, 15303, 1110, -17232, 28799, -32759, 28063, -15955, -371, 16596, -28439}, +{32767, -29146, 19079, -4797, -10548, 23559, -31363, 32232, -25978, 13978, 1110, -15955, 27270, -32558, 30647, -21963, 8421, 6981, -20841, 30092, -32692, 28063, -17232, 2589, 12624, -25049, 31933, -31760, 24564, -11939, -3327, 17856, -28439, 32733, -29792, 20264, -6257, -9135, 22506, -30902, 32466, -26853, 15303, -371, -14645, 26421, -32358, 31140, -23039, 9843, 5527, -19677, 29475, -32759, 28799, -18473, 4062, 11245, -24068, 31569, -32092, 25519, -13305, -1851, 16596, -27675, 32633, -30378, 21406, -7704, -7704, 21406, -30378, 32633, -27675, 16596, -1851, -13305, 25519, -32092, 31569, -24068, 11245, 4062, -18473, 28799, -32759, 29475, -19677, 5527, 9843, -23039, 31140, -32358, 26421, -14645, -371, 15303, -26853, 32466, -30902, 22506, -9135, -6257, 20264, -29792, 32733, -28439, 17856, -3327, -11939, 24564, -31760, 31933, -25049, 12624, 2589, -17232, 28063, -32692, 30092, -20841, 6981, 8421, -21963, 30647, -32558, 27270, -15955, 1110, 13978, -25978, 32232, -31363, 23559, -10548, -4797, 19079, -29146}, +{32767, -29792, 21406, -9135, -4797, 17856, -27675, 32466, -31363, 24564, -13305, -371, 13978, -25049, 31569, -32358, 27270, -17232, 4062, 9843, -21963, 30092, -32759, 29475, -20841, 8421, 5527, -18473, 28063, -32558, 31140, -24068, 12624, 1110, -14645, 25519, -31760, 32232, -26853, 16596, -3327, -10548, 22506, -30378, 32733, -29146, 20264, -7704, -6257, 19079, -28439, 32633, -30902, 23559, -11939, -1851, 15303, -25978, 31933, -32092, 26421, -15955, 2589, 11245, -23039, 30647, -32692, 28799, -19677, 6981, 6981, -19677, 28799, -32692, 30647, -23039, 11245, 2589, -15955, 26421, -32092, 31933, -25978, 15303, -1851, -11939, 23559, -30902, 32633, -28439, 19079, -6257, -7704, 20264, -29146, 32733, -30378, 22506, -10548, -3327, 16596, -26853, 32232, -31760, 25519, -14645, 1110, 12624, -24068, 31140, -32558, 28063, -18473, 5527, 8421, -20841, 29475, -32759, 30092, -21963, 9843, 4062, -17232, 27270, -32358, 31569, -25049, 13978, -371, -13305, 24564, -31363, 32466, -27675, 17856, -4797, -9135, 21406, -29792}, +{32767, -30378, 23559, -13305, 1110, 11245, -21963, 29475, -32692, 31140, -25049, 15303, -3327, -9135, 20264, -28439, 32466, -31760, 26421, -17232, 5527, 6981, -18473, 27270, -32092, 32232, -27675, 19079, -7704, -4797, 16596, -25978, 31569, -32558, 28799, -20841, 9843, 2589, -14645, 24564, -30902, 32733, -29792, 22506, -11939, -371, 12624, -23039, 30092, -32759, 30647, -24068, 13978, -1851, -10548, 21406, -29146, 32633, -31363, 25519, -15955, 4062, 8421, -19677, 28063, -32358, 31933, -26853, 17856, -6257, -6257, 17856, -26853, 31933, -32358, 28063, -19677, 8421, 4062, -15955, 25519, -31363, 32633, -29146, 21406, -10548, -1851, 13978, -24068, 30647, -32759, 30092, -23039, 12624, -371, -11939, 22506, -29792, 32733, -30902, 24564, -14645, 2589, 9843, -20841, 28799, -32558, 31569, -25978, 16596, -4797, -7704, 19079, -27675, 32232, -32092, 27270, -18473, 6981, 5527, -17232, 26421, -31760, 32466, -28439, 20264, -9135, -3327, 15303, -25049, 31140, -32692, 29475, -21963, 11245, 1110, -13305, 23559, -30378}, +{32767, -30902, 25519, -17232, 6981, 4062, -14645, 23559, -29792, 32633, -31760, 27270, -19677, 9843, 1110, -11939, 21406, -28439, 32232, -32358, 28799, -21963, 12624, -1851, -9135, 19079, -26853, 31569, -32692, 30092, -24068, 15303, -4797, -6257, 16596, -25049, 30647, -32759, 31140, -25978, 17856, -7704, -3327, 13978, -23039, 29475, -32558, 31933, -27675, 20264, -10548, -371, 11245, -20841, 28063, -32092, 32466, -29146, 22506, -13305, 2589, 8421, -18473, 26421, -31363, 32733, -30378, 24564, -15955, 5527, 5527, -15955, 24564, -30378, 32733, -31363, 26421, -18473, 8421, 2589, -13305, 22506, -29146, 32466, -32092, 28063, -20841, 11245, -371, -10548, 20264, -27675, 31933, -32558, 29475, -23039, 13978, -3327, -7704, 17856, -25978, 31140, -32759, 30647, -25049, 16596, -6257, -4797, 15303, -24068, 30092, -32692, 31569, -26853, 19079, -9135, -1851, 12624, -21963, 28799, -32358, 32232, -28439, 21406, -11939, 1110, 9843, -19677, 27270, -31760, 32633, -29792, 23559, -14645, 4062, 6981, -17232, 25519, -30902}, +{32767, -31363, 27270, -20841, 12624, -3327, -6257, 15303, -23039, 28799, -32092, 32633, -30378, 25519, -18473, 9843, -371, -9135, 17856, -25049, 30092, -32558, 32232, -29146, 23559, -15955, 6981, 2589, -11939, 20264, -26853, 31140, -32759, 31569, -27675, 21406, -13305, 4062, 5527, -14645, 22506, -28439, 31933, -32692, 30647, -25978, 19079, -10548, 1110, 8421, -17232, 24564, -29792, 32466, -32358, 29475, -24068, 16596, -7704, -1851, 11245, -19677, 26421, -30902, 32733, -31760, 28063, -21963, 13978, -4797, -4797, 13978, -21963, 28063, -31760, 32733, -30902, 26421, -19677, 11245, -1851, -7704, 16596, -24068, 29475, -32358, 32466, -29792, 24564, -17232, 8421, 1110, -10548, 19079, -25978, 30647, -32692, 31933, -28439, 22506, -14645, 5527, 4062, -13305, 21406, -27675, 31569, -32759, 31140, -26853, 20264, -11939, 2589, 6981, -15955, 23559, -29146, 32232, -32558, 30092, -25049, 17856, -9135, -371, 9843, -18473, 25519, -30378, 32633, -32092, 28799, -23039, 15303, -6257, -3327, 12624, -20841, 27270, -31363}, +{32767, -31760, 28799, -24068, 17856, -10548, 2589, 5527, -13305, 20264, -25978, 30092, -32358, 32633, -30902, 27270, -21963, 15303, -7704, -371, 8421, -15955, 22506, -27675, 31140, -32692, 32232, -29792, 25519, -19677, 12624, -4797, -3327, 11245, -18473, 24564, -29146, 31933, -32759, 31569, -28439, 23559, -17232, 9843, -1851, -6257, 13978, -20841, 26421, -30378, 32466, -32558, 30647, -26853, 21406, -14645, 6981, 1110, -9135, 16596, -23039, 28063, -31363, 32733, -32092, 29475, -25049, 19079, -11939, 4062, 4062, -11939, 19079, -25049, 29475, -32092, 32733, -31363, 28063, -23039, 16596, -9135, 1110, 6981, -14645, 21406, -26853, 30647, -32558, 32466, -30378, 26421, -20841, 13978, -6257, -1851, 9843, -17232, 23559, -28439, 31569, -32759, 31933, -29146, 24564, -18473, 11245, -3327, -4797, 12624, -19677, 25519, -29792, 32232, -32692, 31140, -27675, 22506, -15955, 8421, -371, -7704, 15303, -21963, 27270, -30902, 32633, -32358, 30092, -25978, 20264, -13305, 5527, 2589, -10548, 17856, -24068, 28799, -31760}, +{32767, -32092, 30092, -26853, 22506, -17232, 11245, -4797, -1851, 8421, -14645, 20264, -25049, 28799, -31363, 32633, -32558, 31140, -28439, 24564, -19677, 13978, -7704, 1110, 5527, -11939, 17856, -23039, 27270, -30378, 32232, -32759, 31933, -29792, 26421, -21963, 16596, -10548, 4062, 2589, -9135, 15303, -20841, 25519, -29146, 31569, -32692, 32466, -30902, 28063, -24068, 19079, -13305, 6981, -371, -6257, 12624, -18473, 23559, -27675, 30647, -32358, 32733, -31760, 29475, -25978, 21406, -15955, 9843, -3327, -3327, 9843, -15955, 21406, -25978, 29475, -31760, 32733, -32358, 30647, -27675, 23559, -18473, 12624, -6257, -371, 6981, -13305, 19079, -24068, 28063, -30902, 32466, -32692, 31569, -29146, 25519, -20841, 15303, -9135, 2589, 4062, -10548, 16596, -21963, 26421, -29792, 31933, -32759, 32232, -30378, 27270, -23039, 17856, -11939, 5527, 1110, -7704, 13978, -19677, 24564, -28439, 31140, -32558, 32633, -31363, 28799, -25049, 20264, -14645, 8421, -1851, -4797, 11245, -17232, 22506, -26853, 30092, -32092}, +{32767, -32358, 31140, -29146, 26421, -23039, 19079, -14645, 9843, -4797, -371, 5527, -10548, 15303, -19677, 23559, -26853, 29475, -31363, 32466, -32759, 32232, -30902, 28799, -25978, 22506, -18473, 13978, -9135, 4062, 1110, -6257, 11245, -15955, 20264, -24068, 27270, -29792, 31569, -32558, 32733, -32092, 30647, -28439, 25519, -21963, 17856, -13305, 8421, -3327, -1851, 6981, -11939, 16596, -20841, 24564, -27675, 30092, -31760, 32633, -32692, 31933, -30378, 28063, -25049, 21406, -17232, 12624, -7704, 2589, 2589, -7704, 12624, -17232, 21406, -25049, 28063, -30378, 31933, -32692, 32633, -31760, 30092, -27675, 24564, -20841, 16596, -11939, 6981, -1851, -3327, 8421, -13305, 17856, -21963, 25519, -28439, 30647, -32092, 32733, -32558, 31569, -29792, 27270, -24068, 20264, -15955, 11245, -6257, 1110, 4062, -9135, 13978, -18473, 22506, -25978, 28799, -30902, 32232, -32759, 32466, -31363, 29475, -26853, 23559, -19677, 15303, -10548, 5527, -371, -4797, 9843, -14645, 19079, -23039, 26421, -29146, 31140, -32358}, +{32767, -32558, 31933, -30902, 29475, -27675, 25519, -23039, 20264, -17232, 13978, -10548, 6981, -3327, -371, 4062, -7704, 11245, -14645, 17856, -20841, 23559, -25978, 28063, -29792, 31140, -32092, 32633, -32759, 32466, -31760, 30647, -29146, 27270, -25049, 22506, -19677, 16596, -13305, 9843, -6257, 2589, 1110, -4797, 8421, -11939, 15303, -18473, 21406, -24068, 26421, -28439, 30092, -31363, 32232, -32692, 32733, -32358, 31569, -30378, 28799, -26853, 24564, -21963, 19079, -15955, 12624, -9135, 5527, -1851, -1851, 5527, -9135, 12624, -15955, 19079, -21963, 24564, -26853, 28799, -30378, 31569, -32358, 32733, -32692, 32232, -31363, 30092, -28439, 26421, -24068, 21406, -18473, 15303, -11939, 8421, -4797, 1110, 2589, -6257, 9843, -13305, 16596, -19677, 22506, -25049, 27270, -29146, 30647, -31760, 32466, -32759, 32633, -32092, 31140, -29792, 28063, -25978, 23559, -20841, 17856, -14645, 11245, -7704, 4062, -371, -3327, 6981, -10548, 13978, -17232, 20264, -23039, 25519, -27675, 29475, -30902, 31933, -32558}, +{32767, -32692, 32466, -32092, 31569, -30902, 30092, -29146, 28063, -26853, 25519, -24068, 22506, -20841, 19079, -17232, 15303, -13305, 11245, -9135, 6981, -4797, 2589, -371, -1851, 4062, -6257, 8421, -10548, 12624, -14645, 16596, -18473, 20264, -21963, 23559, -25049, 26421, -27675, 28799, -29792, 30647, -31363, 31933, -32358, 32633, -32759, 32733, -32558, 32232, -31760, 31140, -30378, 29475, -28439, 27270, -25978, 24564, -23039, 21406, -19677, 17856, -15955, 13978, -11939, 9843, -7704, 5527, -3327, 1110, 1110, -3327, 5527, -7704, 9843, -11939, 13978, -15955, 17856, -19677, 21406, -23039, 24564, -25978, 27270, -28439, 29475, -30378, 31140, -31760, 32232, -32558, 32733, -32759, 32633, -32358, 31933, -31363, 30647, -29792, 28799, -27675, 26421, -25049, 23559, -21963, 20264, -18473, 16596, -14645, 12624, -10548, 8421, -6257, 4062, -1851, -371, 2589, -4797, 6981, -9135, 11245, -13305, 15303, -17232, 19079, -20841, 22506, -24068, 25519, -26853, 28063, -29146, 30092, -30902, 31569, -32092, 32466, -32692}, +{32767, -32759, 32733, -32692, 32633, -32558, 32466, -32358, 32232, -32092, 31933, -31760, 31569, -31363, 31140, -30902, 30647, -30378, 30092, -29792, 29475, -29146, 28799, -28439, 28063, -27675, 27270, -26853, 26421, -25978, 25519, -25049, 24564, -24068, 23559, -23039, 22506, -21963, 21406, -20841, 20264, -19677, 19079, -18473, 17856, -17232, 16596, -15955, 15303, -14645, 13978, -13305, 12624, -11939, 11245, -10548, 9843, -9135, 8421, -7704, 6981, -6257, 5527, -4797, 4062, -3327, 2589, -1851, 1110, -371, -371, 1110, -1851, 2589, -3327, 4062, -4797, 5527, -6257, 6981, -7704, 8421, -9135, 9843, -10548, 11245, -11939, 12624, -13305, 13978, -14645, 15303, -15955, 16596, -17232, 17856, -18473, 19079, -19677, 20264, -20841, 21406, -21963, 22506, -23039, 23559, -24068, 24564, -25049, 25519, -25978, 26421, -26853, 27270, -27675, 28063, -28439, 28799, -29146, 29475, -29792, 30092, -30378, 30647, -30902, 31140, -31363, 31569, -31760, 31933, -32092, 32232, -32358, 32466, -32558, 32633, -32692, 32733, -32759}, +{32767, -32759, 32733, -32692, 32633, -32558, 32466, -32358, 32232, -32092, 31933, -31760, 31569, -31363, 31140, -30902, 30647, -30378, 30092, -29792, 29475, -29146, 28799, -28439, 28063, -27675, 27270, -26853, 26421, -25978, 25519, -25049, 24564, -24068, 23559, -23039, 22506, -21963, 21406, -20841, 20264, -19677, 19079, -18473, 17856, -17232, 16596, -15955, 15303, -14645, 13978, -13305, 12624, -11939, 11245, -10548, 9843, -9135, 8421, -7704, 6981, -6257, 5527, -4797, 4062, -3327, 2589, -1851, 1110, -371, -371, 1110, -1851, 2589, -3327, 4062, -4797, 5527, -6257, 6981, -7704, 8421, -9135, 9843, -10548, 11245, -11939, 12624, -13305, 13978, -14645, 15303, -15955, 16596, -17232, 17856, -18473, 19079, -19677, 20264, -20841, 21406, -21963, 22506, -23039, 23559, -24068, 24564, -25049, 25519, -25978, 26421, -26853, 27270, -27675, 28063, -28439, 28799, -29146, 29475, -29792, 30092, -30378, 30647, -30902, 31140, -31363, 31569, -31760, 31933, -32092, 32232, -32358, 32466, -32558, 32633, -32692, 32733, -32759}, +{32767, -32692, 32466, -32092, 31569, -30902, 30092, -29146, 28063, -26853, 25519, -24068, 22506, -20841, 19079, -17232, 15303, -13305, 11245, -9135, 6981, -4797, 2589, -371, -1851, 4062, -6257, 8421, -10548, 12624, -14645, 16596, -18473, 20264, -21963, 23559, -25049, 26421, -27675, 28799, -29792, 30647, -31363, 31933, -32358, 32633, -32759, 32733, -32558, 32232, -31760, 31140, -30378, 29475, -28439, 27270, -25978, 24564, -23039, 21406, -19677, 17856, -15955, 13978, -11939, 9843, -7704, 5527, -3327, 1110, 1110, -3327, 5527, -7704, 9843, -11939, 13978, -15955, 17856, -19677, 21406, -23039, 24564, -25978, 27270, -28439, 29475, -30378, 31140, -31760, 32232, -32558, 32733, -32759, 32633, -32358, 31933, -31363, 30647, -29792, 28799, -27675, 26421, -25049, 23559, -21963, 20264, -18473, 16596, -14645, 12624, -10548, 8421, -6257, 4062, -1851, -371, 2589, -4797, 6981, -9135, 11245, -13305, 15303, -17232, 19079, -20841, 22506, -24068, 25519, -26853, 28063, -29146, 30092, -30902, 31569, -32092, 32466, -32692}, +{32767, -32558, 31933, -30902, 29475, -27675, 25519, -23039, 20264, -17232, 13978, -10548, 6981, -3327, -371, 4062, -7704, 11245, -14645, 17856, -20841, 23559, -25978, 28063, -29792, 31140, -32092, 32633, -32759, 32466, -31760, 30647, -29146, 27270, -25049, 22506, -19677, 16596, -13305, 9843, -6257, 2589, 1110, -4797, 8421, -11939, 15303, -18473, 21406, -24068, 26421, -28439, 30092, -31363, 32232, -32692, 32733, -32358, 31569, -30378, 28799, -26853, 24564, -21963, 19079, -15955, 12624, -9135, 5527, -1851, -1851, 5527, -9135, 12624, -15955, 19079, -21963, 24564, -26853, 28799, -30378, 31569, -32358, 32733, -32692, 32232, -31363, 30092, -28439, 26421, -24068, 21406, -18473, 15303, -11939, 8421, -4797, 1110, 2589, -6257, 9843, -13305, 16596, -19677, 22506, -25049, 27270, -29146, 30647, -31760, 32466, -32759, 32633, -32092, 31140, -29792, 28063, -25978, 23559, -20841, 17856, -14645, 11245, -7704, 4062, -371, -3327, 6981, -10548, 13978, -17232, 20264, -23039, 25519, -27675, 29475, -30902, 31933, -32558}, +{32767, -32358, 31140, -29146, 26421, -23039, 19079, -14645, 9843, -4797, -371, 5527, -10548, 15303, -19677, 23559, -26853, 29475, -31363, 32466, -32759, 32232, -30902, 28799, -25978, 22506, -18473, 13978, -9135, 4062, 1110, -6257, 11245, -15955, 20264, -24068, 27270, -29792, 31569, -32558, 32733, -32092, 30647, -28439, 25519, -21963, 17856, -13305, 8421, -3327, -1851, 6981, -11939, 16596, -20841, 24564, -27675, 30092, -31760, 32633, -32692, 31933, -30378, 28063, -25049, 21406, -17232, 12624, -7704, 2589, 2589, -7704, 12624, -17232, 21406, -25049, 28063, -30378, 31933, -32692, 32633, -31760, 30092, -27675, 24564, -20841, 16596, -11939, 6981, -1851, -3327, 8421, -13305, 17856, -21963, 25519, -28439, 30647, -32092, 32733, -32558, 31569, -29792, 27270, -24068, 20264, -15955, 11245, -6257, 1110, 4062, -9135, 13978, -18473, 22506, -25978, 28799, -30902, 32232, -32759, 32466, -31363, 29475, -26853, 23559, -19677, 15303, -10548, 5527, -371, -4797, 9843, -14645, 19079, -23039, 26421, -29146, 31140, -32358}, +{32767, -32092, 30092, -26853, 22506, -17232, 11245, -4797, -1851, 8421, -14645, 20264, -25049, 28799, -31363, 32633, -32558, 31140, -28439, 24564, -19677, 13978, -7704, 1110, 5527, -11939, 17856, -23039, 27270, -30378, 32232, -32759, 31933, -29792, 26421, -21963, 16596, -10548, 4062, 2589, -9135, 15303, -20841, 25519, -29146, 31569, -32692, 32466, -30902, 28063, -24068, 19079, -13305, 6981, -371, -6257, 12624, -18473, 23559, -27675, 30647, -32358, 32733, -31760, 29475, -25978, 21406, -15955, 9843, -3327, -3327, 9843, -15955, 21406, -25978, 29475, -31760, 32733, -32358, 30647, -27675, 23559, -18473, 12624, -6257, -371, 6981, -13305, 19079, -24068, 28063, -30902, 32466, -32692, 31569, -29146, 25519, -20841, 15303, -9135, 2589, 4062, -10548, 16596, -21963, 26421, -29792, 31933, -32759, 32232, -30378, 27270, -23039, 17856, -11939, 5527, 1110, -7704, 13978, -19677, 24564, -28439, 31140, -32558, 32633, -31363, 28799, -25049, 20264, -14645, 8421, -1851, -4797, 11245, -17232, 22506, -26853, 30092, -32092}, +{32767, -31760, 28799, -24068, 17856, -10548, 2589, 5527, -13305, 20264, -25978, 30092, -32358, 32633, -30902, 27270, -21963, 15303, -7704, -371, 8421, -15955, 22506, -27675, 31140, -32692, 32232, -29792, 25519, -19677, 12624, -4797, -3327, 11245, -18473, 24564, -29146, 31933, -32759, 31569, -28439, 23559, -17232, 9843, -1851, -6257, 13978, -20841, 26421, -30378, 32466, -32558, 30647, -26853, 21406, -14645, 6981, 1110, -9135, 16596, -23039, 28063, -31363, 32733, -32092, 29475, -25049, 19079, -11939, 4062, 4062, -11939, 19079, -25049, 29475, -32092, 32733, -31363, 28063, -23039, 16596, -9135, 1110, 6981, -14645, 21406, -26853, 30647, -32558, 32466, -30378, 26421, -20841, 13978, -6257, -1851, 9843, -17232, 23559, -28439, 31569, -32759, 31933, -29146, 24564, -18473, 11245, -3327, -4797, 12624, -19677, 25519, -29792, 32232, -32692, 31140, -27675, 22506, -15955, 8421, -371, -7704, 15303, -21963, 27270, -30902, 32633, -32358, 30092, -25978, 20264, -13305, 5527, 2589, -10548, 17856, -24068, 28799, -31760}, +{32767, -31363, 27270, -20841, 12624, -3327, -6257, 15303, -23039, 28799, -32092, 32633, -30378, 25519, -18473, 9843, -371, -9135, 17856, -25049, 30092, -32558, 32232, -29146, 23559, -15955, 6981, 2589, -11939, 20264, -26853, 31140, -32759, 31569, -27675, 21406, -13305, 4062, 5527, -14645, 22506, -28439, 31933, -32692, 30647, -25978, 19079, -10548, 1110, 8421, -17232, 24564, -29792, 32466, -32358, 29475, -24068, 16596, -7704, -1851, 11245, -19677, 26421, -30902, 32733, -31760, 28063, -21963, 13978, -4797, -4797, 13978, -21963, 28063, -31760, 32733, -30902, 26421, -19677, 11245, -1851, -7704, 16596, -24068, 29475, -32358, 32466, -29792, 24564, -17232, 8421, 1110, -10548, 19079, -25978, 30647, -32692, 31933, -28439, 22506, -14645, 5527, 4062, -13305, 21406, -27675, 31569, -32759, 31140, -26853, 20264, -11939, 2589, 6981, -15955, 23559, -29146, 32232, -32558, 30092, -25049, 17856, -9135, -371, 9843, -18473, 25519, -30378, 32633, -32092, 28799, -23039, 15303, -6257, -3327, 12624, -20841, 27270, -31363}, +{32767, -30902, 25519, -17232, 6981, 4062, -14645, 23559, -29792, 32633, -31760, 27270, -19677, 9843, 1110, -11939, 21406, -28439, 32232, -32358, 28799, -21963, 12624, -1851, -9135, 19079, -26853, 31569, -32692, 30092, -24068, 15303, -4797, -6257, 16596, -25049, 30647, -32759, 31140, -25978, 17856, -7704, -3327, 13978, -23039, 29475, -32558, 31933, -27675, 20264, -10548, -371, 11245, -20841, 28063, -32092, 32466, -29146, 22506, -13305, 2589, 8421, -18473, 26421, -31363, 32733, -30378, 24564, -15955, 5527, 5527, -15955, 24564, -30378, 32733, -31363, 26421, -18473, 8421, 2589, -13305, 22506, -29146, 32466, -32092, 28063, -20841, 11245, -371, -10548, 20264, -27675, 31933, -32558, 29475, -23039, 13978, -3327, -7704, 17856, -25978, 31140, -32759, 30647, -25049, 16596, -6257, -4797, 15303, -24068, 30092, -32692, 31569, -26853, 19079, -9135, -1851, 12624, -21963, 28799, -32358, 32232, -28439, 21406, -11939, 1110, 9843, -19677, 27270, -31760, 32633, -29792, 23559, -14645, 4062, 6981, -17232, 25519, -30902}, +{32767, -30378, 23559, -13305, 1110, 11245, -21963, 29475, -32692, 31140, -25049, 15303, -3327, -9135, 20264, -28439, 32466, -31760, 26421, -17232, 5527, 6981, -18473, 27270, -32092, 32232, -27675, 19079, -7704, -4797, 16596, -25978, 31569, -32558, 28799, -20841, 9843, 2589, -14645, 24564, -30902, 32733, -29792, 22506, -11939, -371, 12624, -23039, 30092, -32759, 30647, -24068, 13978, -1851, -10548, 21406, -29146, 32633, -31363, 25519, -15955, 4062, 8421, -19677, 28063, -32358, 31933, -26853, 17856, -6257, -6257, 17856, -26853, 31933, -32358, 28063, -19677, 8421, 4062, -15955, 25519, -31363, 32633, -29146, 21406, -10548, -1851, 13978, -24068, 30647, -32759, 30092, -23039, 12624, -371, -11939, 22506, -29792, 32733, -30902, 24564, -14645, 2589, 9843, -20841, 28799, -32558, 31569, -25978, 16596, -4797, -7704, 19079, -27675, 32232, -32092, 27270, -18473, 6981, 5527, -17232, 26421, -31760, 32466, -28439, 20264, -9135, -3327, 15303, -25049, 31140, -32692, 29475, -21963, 11245, 1110, -13305, 23559, -30378}, +{32767, -29792, 21406, -9135, -4797, 17856, -27675, 32466, -31363, 24564, -13305, -371, 13978, -25049, 31569, -32358, 27270, -17232, 4062, 9843, -21963, 30092, -32759, 29475, -20841, 8421, 5527, -18473, 28063, -32558, 31140, -24068, 12624, 1110, -14645, 25519, -31760, 32232, -26853, 16596, -3327, -10548, 22506, -30378, 32733, -29146, 20264, -7704, -6257, 19079, -28439, 32633, -30902, 23559, -11939, -1851, 15303, -25978, 31933, -32092, 26421, -15955, 2589, 11245, -23039, 30647, -32692, 28799, -19677, 6981, 6981, -19677, 28799, -32692, 30647, -23039, 11245, 2589, -15955, 26421, -32092, 31933, -25978, 15303, -1851, -11939, 23559, -30902, 32633, -28439, 19079, -6257, -7704, 20264, -29146, 32733, -30378, 22506, -10548, -3327, 16596, -26853, 32232, -31760, 25519, -14645, 1110, 12624, -24068, 31140, -32558, 28063, -18473, 5527, 8421, -20841, 29475, -32759, 30092, -21963, 9843, 4062, -17232, 27270, -32358, 31569, -25049, 13978, -371, -13305, 24564, -31363, 32466, -27675, 17856, -4797, -9135, 21406, -29792}, +{32767, -29146, 19079, -4797, -10548, 23559, -31363, 32232, -25978, 13978, 1110, -15955, 27270, -32558, 30647, -21963, 8421, 6981, -20841, 30092, -32692, 28063, -17232, 2589, 12624, -25049, 31933, -31760, 24564, -11939, -3327, 17856, -28439, 32733, -29792, 20264, -6257, -9135, 22506, -30902, 32466, -26853, 15303, -371, -14645, 26421, -32358, 31140, -23039, 9843, 5527, -19677, 29475, -32759, 28799, -18473, 4062, 11245, -24068, 31569, -32092, 25519, -13305, -1851, 16596, -27675, 32633, -30378, 21406, -7704, -7704, 21406, -30378, 32633, -27675, 16596, -1851, -13305, 25519, -32092, 31569, -24068, 11245, 4062, -18473, 28799, -32759, 29475, -19677, 5527, 9843, -23039, 31140, -32358, 26421, -14645, -371, 15303, -26853, 32466, -30902, 22506, -9135, -6257, 20264, -29792, 32733, -28439, 17856, -3327, -11939, 24564, -31760, 31933, -25049, 12624, 2589, -17232, 28063, -32692, 30092, -20841, 6981, 8421, -21963, 30647, -32558, 27270, -15955, 1110, 13978, -25978, 32232, -31363, 23559, -10548, -4797, 19079, -29146}, +{32767, -28439, 16596, -371, -15955, 28063, -32759, 28799, -17232, 1110, 15303, -27675, 32733, -29146, 17856, -1851, -14645, 27270, -32692, 29475, -18473, 2589, 13978, -26853, 32633, -29792, 19079, -3327, -13305, 26421, -32558, 30092, -19677, 4062, 12624, -25978, 32466, -30378, 20264, -4797, -11939, 25519, -32358, 30647, -20841, 5527, 11245, -25049, 32232, -30902, 21406, -6257, -10548, 24564, -32092, 31140, -21963, 6981, 9843, -24068, 31933, -31363, 22506, -7704, -9135, 23559, -31760, 31569, -23039, 8421, 8421, -23039, 31569, -31760, 23559, -9135, -7704, 22506, -31363, 31933, -24068, 9843, 6981, -21963, 31140, -32092, 24564, -10548, -6257, 21406, -30902, 32232, -25049, 11245, 5527, -20841, 30647, -32358, 25519, -11939, -4797, 20264, -30378, 32466, -25978, 12624, 4062, -19677, 30092, -32558, 26421, -13305, -3327, 19079, -29792, 32633, -26853, 13978, 2589, -18473, 29475, -32692, 27270, -14645, -1851, 17856, -29146, 32733, -27675, 15303, 1110, -17232, 28799, -32759, 28063, -15955, -371, 16596, -28439}, +{32767, -27675, 13978, 4062, -20841, 31140, -31760, 22506, -6257, -11939, 26421, -32692, 28799, -15955, -1851, 19079, -30378, 32232, -24068, 8421, 9843, -25049, 32466, -29792, 17856, -371, -17232, 29475, -32558, 25519, -10548, -7704, 23559, -32092, 30647, -19677, 2589, 15303, -28439, 32733, -26853, 12624, 5527, -21963, 31569, -31363, 21406, -4797, -13305, 27270, -32759, 28063, -14645, -3327, 20264, -30902, 31933, -23039, 6981, 11245, -25978, 32633, -29146, 16596, 1110, -18473, 30092, -32358, 24564, -9135, -9135, 24564, -32358, 30092, -18473, 1110, 16596, -29146, 32633, -25978, 11245, 6981, -23039, 31933, -30902, 20264, -3327, -14645, 28063, -32759, 27270, -13305, -4797, 21406, -31363, 31569, -21963, 5527, 12624, -26853, 32733, -28439, 15303, 2589, -19677, 30647, -32092, 23559, -7704, -10548, 25519, -32558, 29475, -17232, -371, 17856, -29792, 32466, -25049, 9843, 8421, -24068, 32232, -30378, 19079, -1851, -15955, 28799, -32692, 26421, -11939, -6257, 22506, -31760, 31140, -20841, 4062, 13978, -27675}, +{32767, -26853, 11245, 8421, -25049, 32633, -28439, 13978, 5527, -23039, 32232, -29792, 16596, 2589, -20841, 31569, -30902, 19079, -371, -18473, 30647, -31760, 21406, -3327, -15955, 29475, -32358, 23559, -6257, -13305, 28063, -32692, 25519, -9135, -10548, 26421, -32759, 27270, -11939, -7704, 24564, -32558, 28799, -14645, -4797, 22506, -32092, 30092, -17232, -1851, 20264, -31363, 31140, -19677, 1110, 17856, -30378, 31933, -21963, 4062, 15303, -29146, 32466, -24068, 6981, 12624, -27675, 32733, -25978, 9843, 9843, -25978, 32733, -27675, 12624, 6981, -24068, 32466, -29146, 15303, 4062, -21963, 31933, -30378, 17856, 1110, -19677, 31140, -31363, 20264, -1851, -17232, 30092, -32092, 22506, -4797, -14645, 28799, -32558, 24564, -7704, -11939, 27270, -32759, 26421, -10548, -9135, 25519, -32692, 28063, -13305, -6257, 23559, -32358, 29475, -15955, -3327, 21406, -31760, 30647, -18473, -371, 19079, -30902, 31569, -20841, 2589, 16596, -29792, 32232, -23039, 5527, 13978, -28439, 32633, -25049, 8421, 11245, -26853}, +{32767, -25978, 8421, 12624, -28439, 32466, -23039, 4062, 16596, -30378, 31569, -19677, -371, 20264, -31760, 30092, -15955, -4797, 23559, -32558, 28063, -11939, -9135, 26421, -32759, 25519, -7704, -13305, 28799, -32358, 22506, -3327, -17232, 30647, -31363, 19079, 1110, -20841, 31933, -29792, 15303, 5527, -24068, 32633, -27675, 11245, 9843, -26853, 32733, -25049, 6981, 13978, -29146, 32232, -21963, 2589, 17856, -30902, 31140, -18473, -1851, 21406, -32092, 29475, -14645, -6257, 24564, -32692, 27270, -10548, -10548, 27270, -32692, 24564, -6257, -14645, 29475, -32092, 21406, -1851, -18473, 31140, -30902, 17856, 2589, -21963, 32232, -29146, 13978, 6981, -25049, 32733, -26853, 9843, 11245, -27675, 32633, -24068, 5527, 15303, -29792, 31933, -20841, 1110, 19079, -31363, 30647, -17232, -3327, 22506, -32358, 28799, -13305, -7704, 25519, -32759, 26421, -9135, -11939, 28063, -32558, 23559, -4797, -15955, 30092, -31760, 20264, -371, -19677, 31569, -30378, 16596, 4062, -23039, 32466, -28439, 12624, 8421, -25978}, +{32767, -25049, 5527, 16596, -30902, 30647, -15955, -6257, 25519, -32759, 24564, -4797, -17232, 31140, -30378, 15303, 6981, -25978, 32733, -24068, 4062, 17856, -31363, 30092, -14645, -7704, 26421, -32692, 23559, -3327, -18473, 31569, -29792, 13978, 8421, -26853, 32633, -23039, 2589, 19079, -31760, 29475, -13305, -9135, 27270, -32558, 22506, -1851, -19677, 31933, -29146, 12624, 9843, -27675, 32466, -21963, 1110, 20264, -32092, 28799, -11939, -10548, 28063, -32358, 21406, -371, -20841, 32232, -28439, 11245, 11245, -28439, 32232, -20841, -371, 21406, -32358, 28063, -10548, -11939, 28799, -32092, 20264, 1110, -21963, 32466, -27675, 9843, 12624, -29146, 31933, -19677, -1851, 22506, -32558, 27270, -9135, -13305, 29475, -31760, 19079, 2589, -23039, 32633, -26853, 8421, 13978, -29792, 31569, -18473, -3327, 23559, -32692, 26421, -7704, -14645, 30092, -31363, 17856, 4062, -24068, 32733, -25978, 6981, 15303, -30378, 31140, -17232, -4797, 24564, -32759, 25519, -6257, -15955, 30647, -30902, 16596, 5527, -25049}, +{32767, -24068, 2589, 20264, -32358, 27270, -7704, -15955, 31140, -29792, 12624, 11245, -29146, 31569, -17232, -6257, 26421, -32558, 21406, 1110, -23039, 32733, -25049, 4062, 19079, -32092, 28063, -9135, -14645, 30647, -30378, 13978, 9843, -28439, 31933, -18473, -4797, 25519, -32692, 22506, -371, -21963, 32633, -25978, 5527, 17856, -31760, 28799, -10548, -13305, 30092, -30902, 15303, 8421, -27675, 32232, -19677, -3327, 24564, -32759, 23559, -1851, -20841, 32466, -26853, 6981, 16596, -31363, 29475, -11939, -11939, 29475, -31363, 16596, 6981, -26853, 32466, -20841, -1851, 23559, -32759, 24564, -3327, -19677, 32232, -27675, 8421, 15303, -30902, 30092, -13305, -10548, 28799, -31760, 17856, 5527, -25978, 32633, -21963, -371, 22506, -32692, 25519, -4797, -18473, 31933, -28439, 9843, 13978, -30378, 30647, -14645, -9135, 28063, -32092, 19079, 4062, -25049, 32733, -23039, 1110, 21406, -32558, 26421, -6257, -17232, 31569, -29146, 11245, 12624, -29792, 31140, -15955, -7704, 27270, -32358, 20264, 2589, -24068}, +{32767, -23039, -371, 23559, -32759, 22506, 1110, -24068, 32733, -21963, -1851, 24564, -32692, 21406, 2589, -25049, 32633, -20841, -3327, 25519, -32558, 20264, 4062, -25978, 32466, -19677, -4797, 26421, -32358, 19079, 5527, -26853, 32232, -18473, -6257, 27270, -32092, 17856, 6981, -27675, 31933, -17232, -7704, 28063, -31760, 16596, 8421, -28439, 31569, -15955, -9135, 28799, -31363, 15303, 9843, -29146, 31140, -14645, -10548, 29475, -30902, 13978, 11245, -29792, 30647, -13305, -11939, 30092, -30378, 12624, 12624, -30378, 30092, -11939, -13305, 30647, -29792, 11245, 13978, -30902, 29475, -10548, -14645, 31140, -29146, 9843, 15303, -31363, 28799, -9135, -15955, 31569, -28439, 8421, 16596, -31760, 28063, -7704, -17232, 31933, -27675, 6981, 17856, -32092, 27270, -6257, -18473, 32232, -26853, 5527, 19079, -32358, 26421, -4797, -19677, 32466, -25978, 4062, 20264, -32558, 25519, -3327, -20841, 32633, -25049, 2589, 21406, -32692, 24564, -1851, -21963, 32733, -24068, 1110, 22506, -32759, 23559, -371, -23039}, +{32767, -21963, -3327, 26421, -32092, 16596, 9843, -29792, 30092, -10548, -15955, 31933, -26853, 4062, 21406, -32759, 22506, 2589, -25978, 32232, -17232, -9135, 29475, -30378, 11245, 15303, -31760, 27270, -4797, -20841, 32733, -23039, -1851, 25519, -32358, 17856, 8421, -29146, 30647, -11939, -14645, 31569, -27675, 5527, 20264, -32692, 23559, 1110, -25049, 32466, -18473, -7704, 28799, -30902, 12624, 13978, -31363, 28063, -6257, -19677, 32633, -24068, -371, 24564, -32558, 19079, 6981, -28439, 31140, -13305, -13305, 31140, -28439, 6981, 19079, -32558, 24564, -371, -24068, 32633, -19677, -6257, 28063, -31363, 13978, 12624, -30902, 28799, -7704, -18473, 32466, -25049, 1110, 23559, -32692, 20264, 5527, -27675, 31569, -14645, -11939, 30647, -29146, 8421, 17856, -32358, 25519, -1851, -23039, 32733, -20841, -4797, 27270, -31760, 15303, 11245, -30378, 29475, -9135, -17232, 32232, -25978, 2589, 22506, -32759, 21406, 4062, -26853, 31933, -15955, -10548, 30092, -29792, 9843, 16596, -32092, 26421, -3327, -21963}, +{32767, -20841, -6257, 28799, -30378, 9843, 17856, -32558, 23559, 2589, -26853, 31569, -13305, -14645, 31933, -25978, 1110, 24564, -32358, 16596, 11245, -30902, 28063, -4797, -21963, 32733, -19677, -7704, 29475, -29792, 8421, 19079, -32692, 22506, 4062, -27675, 31140, -11939, -15955, 32232, -25049, -371, 25519, -32092, 15303, 12624, -31363, 27270, -3327, -23039, 32633, -18473, -9135, 30092, -29146, 6981, 20264, -32759, 21406, 5527, -28439, 30647, -10548, -17232, 32466, -24068, -1851, 26421, -31760, 13978, 13978, -31760, 26421, -1851, -24068, 32466, -17232, -10548, 30647, -28439, 5527, 21406, -32759, 20264, 6981, -29146, 30092, -9135, -18473, 32633, -23039, -3327, 27270, -31363, 12624, 15303, -32092, 25519, -371, -25049, 32232, -15955, -11939, 31140, -27675, 4062, 22506, -32692, 19079, 8421, -29792, 29475, -7704, -19677, 32733, -21963, -4797, 28063, -30902, 11245, 16596, -32358, 24564, 1110, -25978, 31933, -14645, -13305, 31569, -26853, 2589, 23559, -32558, 17856, 9843, -30378, 28799, -6257, -20841}, +{32767, -19677, -9135, 30647, -27675, 2589, 24564, -32092, 13978, 15303, -32358, 23559, 4062, -28439, 30092, -7704, -20841, 32733, -18473, -10548, 31140, -26853, 1110, 25519, -31760, 12624, 16596, -32558, 22506, 5527, -29146, 29475, -6257, -21963, 32633, -17232, -11939, 31569, -25978, -371, 26421, -31363, 11245, 17856, -32692, 21406, 6981, -29792, 28799, -4797, -23039, 32466, -15955, -13305, 31933, -25049, -1851, 27270, -30902, 9843, 19079, -32759, 20264, 8421, -30378, 28063, -3327, -24068, 32232, -14645, -14645, 32232, -24068, -3327, 28063, -30378, 8421, 20264, -32759, 19079, 9843, -30902, 27270, -1851, -25049, 31933, -13305, -15955, 32466, -23039, -4797, 28799, -29792, 6981, 21406, -32692, 17856, 11245, -31363, 26421, -371, -25978, 31569, -11939, -17232, 32633, -21963, -6257, 29475, -29146, 5527, 22506, -32558, 16596, 12624, -31760, 25519, 1110, -26853, 31140, -10548, -18473, 32733, -20841, -7704, 30092, -28439, 4062, 23559, -32358, 15303, 13978, -32092, 24564, 2589, -27675, 30647, -9135, -19677}, +{32767, -18473, -11939, 31933, -24068, -4797, 29475, -28439, 2589, 25519, -31363, 9843, 20264, -32692, 16596, 13978, -32358, 22506, 6981, -30378, 27270, -371, -26853, 30647, -7704, -21963, 32466, -14645, -15955, 32633, -20841, -9135, 31140, -25978, -1851, 28063, -29792, 5527, 23559, -32092, 12624, 17856, -32759, 19079, 11245, -31760, 24564, 4062, -29146, 28799, -3327, -25049, 31569, -10548, -19677, 32733, -17232, -13305, 32232, -23039, -6257, 30092, -27675, 1110, 26421, -30902, 8421, 21406, -32558, 15303, 15303, -32558, 21406, 8421, -30902, 26421, 1110, -27675, 30092, -6257, -23039, 32232, -13305, -17232, 32733, -19677, -10548, 31569, -25049, -3327, 28799, -29146, 4062, 24564, -31760, 11245, 19079, -32759, 17856, 12624, -32092, 23559, 5527, -29792, 28063, -1851, -25978, 31140, -9135, -20841, 32633, -15955, -14645, 32466, -21963, -7704, 30647, -26853, -371, 27270, -30378, 6981, 22506, -32358, 13978, 16596, -32692, 20264, 9843, -31363, 25519, 2589, -28439, 29475, -4797, -24068, 31933, -11939, -18473}, +{32767, -17232, -14645, 32633, -19677, -11939, 32232, -21963, -9135, 31569, -24068, -6257, 30647, -25978, -3327, 29475, -27675, -371, 28063, -29146, 2589, 26421, -30378, 5527, 24564, -31363, 8421, 22506, -32092, 11245, 20264, -32558, 13978, 17856, -32759, 16596, 15303, -32692, 19079, 12624, -32358, 21406, 9843, -31760, 23559, 6981, -30902, 25519, 4062, -29792, 27270, 1110, -28439, 28799, -1851, -26853, 30092, -4797, -25049, 31140, -7704, -23039, 31933, -10548, -20841, 32466, -13305, -18473, 32733, -15955, -15955, 32733, -18473, -13305, 32466, -20841, -10548, 31933, -23039, -7704, 31140, -25049, -4797, 30092, -26853, -1851, 28799, -28439, 1110, 27270, -29792, 4062, 25519, -30902, 6981, 23559, -31760, 9843, 21406, -32358, 12624, 19079, -32692, 15303, 16596, -32759, 17856, 13978, -32558, 20264, 11245, -32092, 22506, 8421, -31363, 24564, 5527, -30378, 26421, 2589, -29146, 28063, -371, -27675, 29475, -3327, -25978, 30647, -6257, -24068, 31569, -9135, -21963, 32232, -11939, -19677, 32633, -14645, -17232}, +{32767, -15955, -17232, 32733, -14645, -18473, 32633, -13305, -19677, 32466, -11939, -20841, 32232, -10548, -21963, 31933, -9135, -23039, 31569, -7704, -24068, 31140, -6257, -25049, 30647, -4797, -25978, 30092, -3327, -26853, 29475, -1851, -27675, 28799, -371, -28439, 28063, 1110, -29146, 27270, 2589, -29792, 26421, 4062, -30378, 25519, 5527, -30902, 24564, 6981, -31363, 23559, 8421, -31760, 22506, 9843, -32092, 21406, 11245, -32358, 20264, 12624, -32558, 19079, 13978, -32692, 17856, 15303, -32759, 16596, 16596, -32759, 15303, 17856, -32692, 13978, 19079, -32558, 12624, 20264, -32358, 11245, 21406, -32092, 9843, 22506, -31760, 8421, 23559, -31363, 6981, 24564, -30902, 5527, 25519, -30378, 4062, 26421, -29792, 2589, 27270, -29146, 1110, 28063, -28439, -371, 28799, -27675, -1851, 29475, -26853, -3327, 30092, -25978, -4797, 30647, -25049, -6257, 31140, -24068, -7704, 31569, -23039, -9135, 31933, -21963, -10548, 32232, -20841, -11939, 32466, -19677, -13305, 32633, -18473, -14645, 32733, -17232, -15955}, +{32767, -14645, -19677, 32232, -9135, -24068, 30647, -3327, -27675, 28063, 2589, -30378, 24564, 8421, -32092, 20264, 13978, -32759, 15303, 19079, -32358, 9843, 23559, -30902, 4062, 27270, -28439, -1851, 30092, -25049, -7704, 31933, -20841, -13305, 32733, -15955, -18473, 32466, -10548, -23039, 31140, -4797, -26853, 28799, 1110, -29792, 25519, 6981, -31760, 21406, 12624, -32692, 16596, 17856, -32558, 11245, 22506, -31363, 5527, 26421, -29146, -371, 29475, -25978, -6257, 31569, -21963, -11939, 32633, -17232, -17232, 32633, -11939, -21963, 31569, -6257, -25978, 29475, -371, -29146, 26421, 5527, -31363, 22506, 11245, -32558, 17856, 16596, -32692, 12624, 21406, -31760, 6981, 25519, -29792, 1110, 28799, -26853, -4797, 31140, -23039, -10548, 32466, -18473, -15955, 32733, -13305, -20841, 31933, -7704, -25049, 30092, -1851, -28439, 27270, 4062, -30902, 23559, 9843, -32358, 19079, 15303, -32759, 13978, 20264, -32092, 8421, 24564, -30378, 2589, 28063, -27675, -3327, 30647, -24068, -9135, 32232, -19677, -14645}, +{32767, -13305, -21963, 31140, -3327, -28439, 26421, 6981, -32092, 19079, 16596, -32558, 9843, 24564, -29792, -371, 30092, -24068, -10548, 32633, -15955, -19677, 31933, -6257, -26853, 28063, 4062, -31363, 21406, 13978, -32759, 12624, 22506, -30902, 2589, 28799, -25978, -7704, 32232, -18473, -17232, 32466, -9135, -25049, 29475, 1110, -30378, 23559, 11245, -32692, 15303, 20264, -31760, 5527, 27270, -27675, -4797, 31569, -20841, -14645, 32733, -11939, -23039, 30647, -1851, -29146, 25519, 8421, -32358, 17856, 17856, -32358, 8421, 25519, -29146, -1851, 30647, -23039, -11939, 32733, -14645, -20841, 31569, -4797, -27675, 27270, 5527, -31760, 20264, 15303, -32692, 11245, 23559, -30378, 1110, 29475, -25049, -9135, 32466, -17232, -18473, 32232, -7704, -25978, 28799, 2589, -30902, 22506, 12624, -32759, 13978, 21406, -31363, 4062, 28063, -26853, -6257, 31933, -19677, -15955, 32633, -10548, -24068, 30092, -371, -29792, 24564, 9843, -32558, 16596, 19079, -32092, 6981, 26421, -28439, -3327, 31140, -21963, -13305}, +{32767, -11939, -24068, 29475, 2589, -31363, 20264, 16596, -32358, 6981, 27270, -26853, -7704, 32466, -15955, -20841, 31140, -1851, -29792, 23559, 12624, -32759, 11245, 24564, -29146, -3327, 31569, -19677, -17232, 32232, -6257, -27675, 26421, 8421, -32558, 15303, 21406, -30902, 1110, 30092, -23039, -13305, 32733, -10548, -25049, 28799, 4062, -31760, 19079, 17856, -32092, 5527, 28063, -25978, -9135, 32633, -14645, -21963, 30647, -371, -30378, 22506, 13978, -32692, 9843, 25519, -28439, -4797, 31933, -18473, -18473, 31933, -4797, -28439, 25519, 9843, -32692, 13978, 22506, -30378, -371, 30647, -21963, -14645, 32633, -9135, -25978, 28063, 5527, -32092, 17856, 19079, -31760, 4062, 28799, -25049, -10548, 32733, -13305, -23039, 30092, 1110, -30902, 21406, 15303, -32558, 8421, 26421, -27675, -6257, 32232, -17232, -19677, 31569, -3327, -29146, 24564, 11245, -32759, 12624, 23559, -29792, -1851, 31140, -20841, -15955, 32466, -7704, -26853, 27270, 6981, -32358, 16596, 20264, -31363, 2589, 29475, -24068, -11939}, +{32767, -10548, -25978, 27270, 8421, -32692, 12624, 24564, -28439, -6257, 32466, -14645, -23039, 29475, 4062, -32092, 16596, 21406, -30378, -1851, 31569, -18473, -19677, 31140, -371, -30902, 20264, 17856, -31760, 2589, 30092, -21963, -15955, 32232, -4797, -29146, 23559, 13978, -32558, 6981, 28063, -25049, -11939, 32733, -9135, -26853, 26421, 9843, -32759, 11245, 25519, -27675, -7704, 32633, -13305, -24068, 28799, 5527, -32358, 15303, 22506, -29792, -3327, 31933, -17232, -20841, 30647, 1110, -31363, 19079, 19079, -31363, 1110, 30647, -20841, -17232, 31933, -3327, -29792, 22506, 15303, -32358, 5527, 28799, -24068, -13305, 32633, -7704, -27675, 25519, 11245, -32759, 9843, 26421, -26853, -9135, 32733, -11939, -25049, 28063, 6981, -32558, 13978, 23559, -29146, -4797, 32232, -15955, -21963, 30092, 2589, -31760, 17856, 20264, -30902, -371, 31140, -19677, -18473, 31569, -1851, -30378, 21406, 16596, -32092, 4062, 29475, -23039, -14645, 32466, -6257, -28439, 24564, 12624, -32692, 8421, 27270, -25978, -10548}, +{32767, -9135, -27675, 24564, 13978, -32358, 4062, 30092, -20841, -18473, 31140, 1110, -31760, 16596, 22506, -29146, -6257, 32633, -11939, -25978, 26421, 11245, -32692, 6981, 28799, -23039, -15955, 31933, -1851, -30902, 19079, 20264, -30378, -3327, 32232, -14645, -24068, 28063, 8421, -32759, 9843, 27270, -25049, -13305, 32466, -4797, -29792, 21406, 17856, -31363, -371, 31569, -17232, -21963, 29475, 5527, -32558, 12624, 25519, -26853, -10548, 32733, -7704, -28439, 23559, 15303, -32092, 2589, 30647, -19677, -19677, 30647, 2589, -32092, 15303, 23559, -28439, -7704, 32733, -10548, -26853, 25519, 12624, -32558, 5527, 29475, -21963, -17232, 31569, -371, -31363, 17856, 21406, -29792, -4797, 32466, -13305, -25049, 27270, 9843, -32759, 8421, 28063, -24068, -14645, 32232, -3327, -30378, 20264, 19079, -30902, -1851, 31933, -15955, -23039, 28799, 6981, -32692, 11245, 26421, -25978, -11939, 32633, -6257, -29146, 22506, 16596, -31760, 1110, 31140, -18473, -20841, 30092, 4062, -32358, 13978, 24564, -27675, -9135}, +{32767, -7704, -29146, 21406, 19079, -30378, -4797, 32633, -10548, -27675, 23559, 16596, -31363, -1851, 32232, -13305, -25978, 25519, 13978, -32092, 1110, 31569, -15955, -24068, 27270, 11245, -32558, 4062, 30647, -18473, -21963, 28799, 8421, -32759, 6981, 29475, -20841, -19677, 30092, 5527, -32692, 9843, 28063, -23039, -17232, 31140, 2589, -32358, 12624, 26421, -25049, -14645, 31933, -371, -31760, 15303, 24564, -26853, -11939, 32466, -3327, -30902, 17856, 22506, -28439, -9135, 32733, -6257, -29792, 20264, 20264, -29792, -6257, 32733, -9135, -28439, 22506, 17856, -30902, -3327, 32466, -11939, -26853, 24564, 15303, -31760, -371, 31933, -14645, -25049, 26421, 12624, -32358, 2589, 31140, -17232, -23039, 28063, 9843, -32692, 5527, 30092, -19677, -20841, 29475, 6981, -32759, 8421, 28799, -21963, -18473, 30647, 4062, -32558, 11245, 27270, -24068, -15955, 31569, 1110, -32092, 13978, 25519, -25978, -13305, 32232, -1851, -31363, 16596, 23559, -27675, -10548, 32633, -4797, -30378, 19079, 21406, -29146, -7704}, +{32767, -6257, -30378, 17856, 23559, -26853, -13305, 31933, 1110, -32358, 11245, 28063, -21963, -19677, 29475, 8421, -32692, 4062, 31140, -15955, -25049, 25519, 15303, -31363, -3327, 32633, -9135, -29146, 20264, 21406, -28439, -10548, 32466, -1851, -31760, 13978, 26421, -24068, -17232, 30647, 5527, -32759, 6981, 30092, -18473, -23039, 27270, 12624, -32092, -371, 32232, -11939, -27675, 22506, 19079, -29792, -7704, 32733, -4797, -30902, 16596, 24564, -25978, -14645, 31569, 2589, -32558, 9843, 28799, -20841, -20841, 28799, 9843, -32558, 2589, 31569, -14645, -25978, 24564, 16596, -30902, -4797, 32733, -7704, -29792, 19079, 22506, -27675, -11939, 32232, -371, -32092, 12624, 27270, -23039, -18473, 30092, 6981, -32759, 5527, 30647, -17232, -24068, 26421, 13978, -31760, -1851, 32466, -10548, -28439, 21406, 20264, -29146, -9135, 32633, -3327, -31363, 15303, 25519, -25049, -15955, 31140, 4062, -32692, 8421, 29475, -19677, -21963, 28063, 11245, -32358, 1110, 31933, -13305, -26853, 23559, 17856, -30378, -6257}, +{32767, -4797, -31363, 13978, 27270, -21963, -20841, 28063, 12624, -31760, -3327, 32733, -6257, -30902, 15303, 26421, -23039, -19677, 28799, 11245, -32092, -1851, 32633, -7704, -30378, 16596, 25519, -24068, -18473, 29475, 9843, -32358, -371, 32466, -9135, -29792, 17856, 24564, -25049, -17232, 30092, 8421, -32558, 1110, 32232, -10548, -29146, 19079, 23559, -25978, -15955, 30647, 6981, -32692, 2589, 31933, -11939, -28439, 20264, 22506, -26853, -14645, 31140, 5527, -32759, 4062, 31569, -13305, -27675, 21406, 21406, -27675, -13305, 31569, 4062, -32759, 5527, 31140, -14645, -26853, 22506, 20264, -28439, -11939, 31933, 2589, -32692, 6981, 30647, -15955, -25978, 23559, 19079, -29146, -10548, 32232, 1110, -32558, 8421, 30092, -17232, -25049, 24564, 17856, -29792, -9135, 32466, -371, -32358, 9843, 29475, -18473, -24068, 25519, 16596, -30378, -7704, 32633, -1851, -32092, 11245, 28799, -19677, -23039, 26421, 15303, -30902, -6257, 32733, -3327, -31760, 12624, 28063, -20841, -21963, 27270, 13978, -31363, -4797}, +{32767, -3327, -32092, 9843, 30092, -15955, -26853, 21406, 22506, -25978, -17232, 29475, 11245, -31760, -4797, 32733, -1851, -32358, 8421, 30647, -14645, -27675, 20264, 23559, -25049, -18473, 28799, 12624, -31363, -6257, 32633, -371, -32558, 6981, 31140, -13305, -28439, 19079, 24564, -24068, -19677, 28063, 13978, -30902, -7704, 32466, 1110, -32692, 5527, 31569, -11939, -29146, 17856, 25519, -23039, -20841, 27270, 15303, -30378, -9135, 32232, 2589, -32759, 4062, 31933, -10548, -29792, 16596, 26421, -21963, -21963, 26421, 16596, -29792, -10548, 31933, 4062, -32759, 2589, 32232, -9135, -30378, 15303, 27270, -20841, -23039, 25519, 17856, -29146, -11939, 31569, 5527, -32692, 1110, 32466, -7704, -30902, 13978, 28063, -19677, -24068, 24564, 19079, -28439, -13305, 31140, 6981, -32558, -371, 32633, -6257, -31363, 12624, 28799, -18473, -25049, 23559, 20264, -27675, -14645, 30647, 8421, -32358, -1851, 32733, -4797, -31760, 11245, 29475, -17232, -25978, 22506, 21406, -26853, -15955, 30092, 9843, -32092, -3327}, +{32767, -1851, -32558, 5527, 31933, -9135, -30902, 12624, 29475, -15955, -27675, 19079, 25519, -21963, -23039, 24564, 20264, -26853, -17232, 28799, 13978, -30378, -10548, 31569, 6981, -32358, -3327, 32733, -371, -32692, 4062, 32232, -7704, -31363, 11245, 30092, -14645, -28439, 17856, 26421, -20841, -24068, 23559, 21406, -25978, -18473, 28063, 15303, -29792, -11939, 31140, 8421, -32092, -4797, 32633, 1110, -32759, 2589, 32466, -6257, -31760, 9843, 30647, -13305, -29146, 16596, 27270, -19677, -25049, 22506, 22506, -25049, -19677, 27270, 16596, -29146, -13305, 30647, 9843, -31760, -6257, 32466, 2589, -32759, 1110, 32633, -4797, -32092, 8421, 31140, -11939, -29792, 15303, 28063, -18473, -25978, 21406, 23559, -24068, -20841, 26421, 17856, -28439, -14645, 30092, 11245, -31363, -7704, 32232, 4062, -32692, -371, 32733, -3327, -32358, 6981, 31569, -10548, -30378, 13978, 28799, -17232, -26853, 20264, 24564, -23039, -21963, 25519, 19079, -27675, -15955, 29475, 12624, -30902, -9135, 31933, 5527, -32558, -1851}, +{32767, -371, -32759, 1110, 32733, -1851, -32692, 2589, 32633, -3327, -32558, 4062, 32466, -4797, -32358, 5527, 32232, -6257, -32092, 6981, 31933, -7704, -31760, 8421, 31569, -9135, -31363, 9843, 31140, -10548, -30902, 11245, 30647, -11939, -30378, 12624, 30092, -13305, -29792, 13978, 29475, -14645, -29146, 15303, 28799, -15955, -28439, 16596, 28063, -17232, -27675, 17856, 27270, -18473, -26853, 19079, 26421, -19677, -25978, 20264, 25519, -20841, -25049, 21406, 24564, -21963, -24068, 22506, 23559, -23039, -23039, 23559, 22506, -24068, -21963, 24564, 21406, -25049, -20841, 25519, 20264, -25978, -19677, 26421, 19079, -26853, -18473, 27270, 17856, -27675, -17232, 28063, 16596, -28439, -15955, 28799, 15303, -29146, -14645, 29475, 13978, -29792, -13305, 30092, 12624, -30378, -11939, 30647, 11245, -30902, -10548, 31140, 9843, -31363, -9135, 31569, 8421, -31760, -7704, 31933, 6981, -32092, -6257, 32232, 5527, -32358, -4797, 32466, 4062, -32558, -3327, 32633, 2589, -32692, -1851, 32733, 1110, -32759, -371}, +{32767, 1110, -32692, -3327, 32466, 5527, -32092, -7704, 31569, 9843, -30902, -11939, 30092, 13978, -29146, -15955, 28063, 17856, -26853, -19677, 25519, 21406, -24068, -23039, 22506, 24564, -20841, -25978, 19079, 27270, -17232, -28439, 15303, 29475, -13305, -30378, 11245, 31140, -9135, -31760, 6981, 32232, -4797, -32558, 2589, 32733, -371, -32759, -1851, 32633, 4062, -32358, -6257, 31933, 8421, -31363, -10548, 30647, 12624, -29792, -14645, 28799, 16596, -27675, -18473, 26421, 20264, -25049, -21963, 23559, 23559, -21963, -25049, 20264, 26421, -18473, -27675, 16596, 28799, -14645, -29792, 12624, 30647, -10548, -31363, 8421, 31933, -6257, -32358, 4062, 32633, -1851, -32759, -371, 32733, 2589, -32558, -4797, 32232, 6981, -31760, -9135, 31140, 11245, -30378, -13305, 29475, 15303, -28439, -17232, 27270, 19079, -25978, -20841, 24564, 22506, -23039, -24068, 21406, 25519, -19677, -26853, 17856, 28063, -15955, -29146, 13978, 30092, -11939, -30902, 9843, 31569, -7704, -32092, 5527, 32466, -3327, -32692, 1110}, +{32767, 2589, -32358, -7704, 31140, 12624, -29146, -17232, 26421, 21406, -23039, -25049, 19079, 28063, -14645, -30378, 9843, 31933, -4797, -32692, -371, 32633, 5527, -31760, -10548, 30092, 15303, -27675, -19677, 24564, 23559, -20841, -26853, 16596, 29475, -11939, -31363, 6981, 32466, -1851, -32759, -3327, 32232, 8421, -30902, -13305, 28799, 17856, -25978, -21963, 22506, 25519, -18473, -28439, 13978, 30647, -9135, -32092, 4062, 32733, 1110, -32558, -6257, 31569, 11245, -29792, -15955, 27270, 20264, -24068, -24068, 20264, 27270, -15955, -29792, 11245, 31569, -6257, -32558, 1110, 32733, 4062, -32092, -9135, 30647, 13978, -28439, -18473, 25519, 22506, -21963, -25978, 17856, 28799, -13305, -30902, 8421, 32232, -3327, -32759, -1851, 32466, 6981, -31363, -11939, 29475, 16596, -26853, -20841, 23559, 24564, -19677, -27675, 15303, 30092, -10548, -31760, 5527, 32633, -371, -32692, -4797, 31933, 9843, -30378, -14645, 28063, 19079, -25049, -23039, 21406, 26421, -17232, -29146, 12624, 31140, -7704, -32358, 2589}, +{32767, 4062, -31760, -11939, 28799, 19079, -24068, -25049, 17856, 29475, -10548, -32092, 2589, 32733, 5527, -31363, -13305, 28063, 20264, -23039, -25978, 16596, 30092, -9135, -32358, 1110, 32633, 6981, -30902, -14645, 27270, 21406, -21963, -26853, 15303, 30647, -7704, -32558, -371, 32466, 8421, -30378, -15955, 26421, 22506, -20841, -27675, 13978, 31140, -6257, -32692, -1851, 32232, 9843, -29792, -17232, 25519, 23559, -19677, -28439, 12624, 31569, -4797, -32759, -3327, 31933, 11245, -29146, -18473, 24564, 24564, -18473, -29146, 11245, 31933, -3327, -32759, -4797, 31569, 12624, -28439, -19677, 23559, 25519, -17232, -29792, 9843, 32232, -1851, -32692, -6257, 31140, 13978, -27675, -20841, 22506, 26421, -15955, -30378, 8421, 32466, -371, -32558, -7704, 30647, 15303, -26853, -21963, 21406, 27270, -14645, -30902, 6981, 32633, 1110, -32358, -9135, 30092, 16596, -25978, -23039, 20264, 28063, -13305, -31363, 5527, 32733, 2589, -32092, -10548, 29475, 17856, -25049, -24068, 19079, 28799, -11939, -31760, 4062}, +{32767, 5527, -30902, -15955, 25519, 24564, -17232, -30378, 6981, 32733, 4062, -31363, -14645, 26421, 23559, -18473, -29792, 8421, 32633, 2589, -31760, -13305, 27270, 22506, -19677, -29146, 9843, 32466, 1110, -32092, -11939, 28063, 21406, -20841, -28439, 11245, 32232, -371, -32358, -10548, 28799, 20264, -21963, -27675, 12624, 31933, -1851, -32558, -9135, 29475, 19079, -23039, -26853, 13978, 31569, -3327, -32692, -7704, 30092, 17856, -24068, -25978, 15303, 31140, -4797, -32759, -6257, 30647, 16596, -25049, -25049, 16596, 30647, -6257, -32759, -4797, 31140, 15303, -25978, -24068, 17856, 30092, -7704, -32692, -3327, 31569, 13978, -26853, -23039, 19079, 29475, -9135, -32558, -1851, 31933, 12624, -27675, -21963, 20264, 28799, -10548, -32358, -371, 32232, 11245, -28439, -20841, 21406, 28063, -11939, -32092, 1110, 32466, 9843, -29146, -19677, 22506, 27270, -13305, -31760, 2589, 32633, 8421, -29792, -18473, 23559, 26421, -14645, -31363, 4062, 32733, 6981, -30378, -17232, 24564, 25519, -15955, -30902, 5527}, +{32767, 6981, -29792, -19677, 21406, 28799, -9135, -32692, -4797, 30647, 17856, -23039, -27675, 11245, 32466, 2589, -31363, -15955, 24564, 26421, -13305, -32092, -371, 31933, 13978, -25978, -25049, 15303, 31569, -1851, -32358, -11939, 27270, 23559, -17232, -30902, 4062, 32633, 9843, -28439, -21963, 19079, 30092, -6257, -32759, -7704, 29475, 20264, -20841, -29146, 8421, 32733, 5527, -30378, -18473, 22506, 28063, -10548, -32558, -3327, 31140, 16596, -24068, -26853, 12624, 32232, 1110, -31760, -14645, 25519, 25519, -14645, -31760, 1110, 32232, 12624, -26853, -24068, 16596, 31140, -3327, -32558, -10548, 28063, 22506, -18473, -30378, 5527, 32733, 8421, -29146, -20841, 20264, 29475, -7704, -32759, -6257, 30092, 19079, -21963, -28439, 9843, 32633, 4062, -30902, -17232, 23559, 27270, -11939, -32358, -1851, 31569, 15303, -25049, -25978, 13978, 31933, -371, -32092, -13305, 26421, 24564, -15955, -31363, 2589, 32466, 11245, -27675, -23039, 17856, 30647, -4797, -32692, -9135, 28799, 21406, -19677, -29792, 6981}, +{32767, 8421, -28439, -23039, 16596, 31569, -371, -31760, -15955, 23559, 28063, -9135, -32759, -7704, 28799, 22506, -17232, -31363, 1110, 31933, 15303, -24068, -27675, 9843, 32733, 6981, -29146, -21963, 17856, 31140, -1851, -32092, -14645, 24564, 27270, -10548, -32692, -6257, 29475, 21406, -18473, -30902, 2589, 32232, 13978, -25049, -26853, 11245, 32633, 5527, -29792, -20841, 19079, 30647, -3327, -32358, -13305, 25519, 26421, -11939, -32558, -4797, 30092, 20264, -19677, -30378, 4062, 32466, 12624, -25978, -25978, 12624, 32466, 4062, -30378, -19677, 20264, 30092, -4797, -32558, -11939, 26421, 25519, -13305, -32358, -3327, 30647, 19079, -20841, -29792, 5527, 32633, 11245, -26853, -25049, 13978, 32232, 2589, -30902, -18473, 21406, 29475, -6257, -32692, -10548, 27270, 24564, -14645, -32092, -1851, 31140, 17856, -21963, -29146, 6981, 32733, 9843, -27675, -24068, 15303, 31933, 1110, -31363, -17232, 22506, 28799, -7704, -32759, -9135, 28063, 23559, -15955, -31760, -371, 31569, 16596, -23039, -28439, 8421}, +{32767, 9843, -26853, -25978, 11245, 32733, 8421, -27675, -25049, 12624, 32633, 6981, -28439, -24068, 13978, 32466, 5527, -29146, -23039, 15303, 32232, 4062, -29792, -21963, 16596, 31933, 2589, -30378, -20841, 17856, 31569, 1110, -30902, -19677, 19079, 31140, -371, -31363, -18473, 20264, 30647, -1851, -31760, -17232, 21406, 30092, -3327, -32092, -15955, 22506, 29475, -4797, -32358, -14645, 23559, 28799, -6257, -32558, -13305, 24564, 28063, -7704, -32692, -11939, 25519, 27270, -9135, -32759, -10548, 26421, 26421, -10548, -32759, -9135, 27270, 25519, -11939, -32692, -7704, 28063, 24564, -13305, -32558, -6257, 28799, 23559, -14645, -32358, -4797, 29475, 22506, -15955, -32092, -3327, 30092, 21406, -17232, -31760, -1851, 30647, 20264, -18473, -31363, -371, 31140, 19079, -19677, -30902, 1110, 31569, 17856, -20841, -30378, 2589, 31933, 16596, -21963, -29792, 4062, 32232, 15303, -23039, -29146, 5527, 32466, 13978, -24068, -28439, 6981, 32633, 12624, -25049, -27675, 8421, 32733, 11245, -25978, -26853, 9843}, +{32767, 11245, -25049, -28439, 5527, 32232, 16596, -20841, -30902, -371, 30647, 21406, -15955, -32358, -6257, 28063, 25519, -10548, -32759, -11939, 24564, 28799, -4797, -32092, -17232, 20264, 31140, 1110, -30378, -21963, 15303, 32466, 6981, -27675, -25978, 9843, 32733, 12624, -24068, -29146, 4062, 31933, 17856, -19677, -31363, -1851, 30092, 22506, -14645, -32558, -7704, 27270, 26421, -9135, -32692, -13305, 23559, 29475, -3327, -31760, -18473, 19079, 31569, 2589, -29792, -23039, 13978, 32633, 8421, -26853, -26853, 8421, 32633, 13978, -23039, -29792, 2589, 31569, 19079, -18473, -31760, -3327, 29475, 23559, -13305, -32692, -9135, 26421, 27270, -7704, -32558, -14645, 22506, 30092, -1851, -31363, -19677, 17856, 31933, 4062, -29146, -24068, 12624, 32733, 9843, -25978, -27675, 6981, 32466, 15303, -21963, -30378, 1110, 31140, 20264, -17232, -32092, -4797, 28799, 24564, -11939, -32759, -10548, 25519, 28063, -6257, -32358, -15955, 21406, 30647, -371, -30902, -20841, 16596, 32232, 5527, -28439, -25049, 11245}, +{32767, 12624, -23039, -30378, -371, 30092, 23559, -11939, -32759, -13305, 22506, 30647, 1110, -29792, -24068, 11245, 32733, 13978, -21963, -30902, -1851, 29475, 24564, -10548, -32692, -14645, 21406, 31140, 2589, -29146, -25049, 9843, 32633, 15303, -20841, -31363, -3327, 28799, 25519, -9135, -32558, -15955, 20264, 31569, 4062, -28439, -25978, 8421, 32466, 16596, -19677, -31760, -4797, 28063, 26421, -7704, -32358, -17232, 19079, 31933, 5527, -27675, -26853, 6981, 32232, 17856, -18473, -32092, -6257, 27270, 27270, -6257, -32092, -18473, 17856, 32232, 6981, -26853, -27675, 5527, 31933, 19079, -17232, -32358, -7704, 26421, 28063, -4797, -31760, -19677, 16596, 32466, 8421, -25978, -28439, 4062, 31569, 20264, -15955, -32558, -9135, 25519, 28799, -3327, -31363, -20841, 15303, 32633, 9843, -25049, -29146, 2589, 31140, 21406, -14645, -32692, -10548, 24564, 29475, -1851, -30902, -21963, 13978, 32733, 11245, -24068, -29792, 1110, 30647, 22506, -13305, -32759, -11939, 23559, 30092, -371, -30378, -23039, 12624}, +{32767, 13978, -20841, -31760, -6257, 26421, 28799, -1851, -30378, -24068, 9843, 32466, 17856, -17232, -32558, -10548, 23559, 30647, 2589, -28439, -26853, 5527, 31569, 21406, -13305, -32759, -14645, 20264, 31933, 6981, -25978, -29146, 1110, 30092, 24564, -9135, -32358, -18473, 16596, 32633, 11245, -23039, -30902, -3327, 28063, 27270, -4797, -31363, -21963, 12624, 32733, 15303, -19677, -32092, -7704, 25519, 29475, -371, -29792, -25049, 8421, 32232, 19079, -15955, -32692, -11939, 22506, 31140, 4062, -27675, -27675, 4062, 31140, 22506, -11939, -32692, -15955, 19079, 32232, 8421, -25049, -29792, -371, 29475, 25519, -7704, -32092, -19677, 15303, 32733, 12624, -21963, -31363, -4797, 27270, 28063, -3327, -30902, -23039, 11245, 32633, 16596, -18473, -32358, -9135, 24564, 30092, 1110, -29146, -25978, 6981, 31933, 20264, -14645, -32759, -13305, 21406, 31569, 5527, -26853, -28439, 2589, 30647, 23559, -10548, -32558, -17232, 17856, 32466, 9843, -24068, -30378, -1851, 28799, 26421, -6257, -31760, -20841, 13978}, +{32767, 15303, -18473, -32558, -11939, 21406, 31933, 8421, -24068, -30902, -4797, 26421, 29475, 1110, -28439, -27675, 2589, 30092, 25519, -6257, -31363, -23039, 9843, 32232, 20264, -13305, -32692, -17232, 16596, 32733, 13978, -19677, -32358, -10548, 22506, 31569, 6981, -25049, -30378, -3327, 27270, 28799, -371, -29146, -26853, 4062, 30647, 24564, -7704, -31760, -21963, 11245, 32466, 19079, -14645, -32759, -15955, 17856, 32633, 12624, -20841, -32092, -9135, 23559, 31140, 5527, -25978, -29792, -1851, 28063, 28063, -1851, -29792, -25978, 5527, 31140, 23559, -9135, -32092, -20841, 12624, 32633, 17856, -15955, -32759, -14645, 19079, 32466, 11245, -21963, -31760, -7704, 24564, 30647, 4062, -26853, -29146, -371, 28799, 27270, -3327, -30378, -25049, 6981, 31569, 22506, -10548, -32358, -19677, 13978, 32733, 16596, -17232, -32692, -13305, 20264, 32232, 9843, -23039, -31363, -6257, 25519, 30092, 2589, -27675, -28439, 1110, 29475, 26421, -4797, -30902, -24068, 8421, 31933, 21406, -11939, -32558, -18473, 15303}, +{32767, 16596, -15955, -32759, -17232, 15303, 32733, 17856, -14645, -32692, -18473, 13978, 32633, 19079, -13305, -32558, -19677, 12624, 32466, 20264, -11939, -32358, -20841, 11245, 32232, 21406, -10548, -32092, -21963, 9843, 31933, 22506, -9135, -31760, -23039, 8421, 31569, 23559, -7704, -31363, -24068, 6981, 31140, 24564, -6257, -30902, -25049, 5527, 30647, 25519, -4797, -30378, -25978, 4062, 30092, 26421, -3327, -29792, -26853, 2589, 29475, 27270, -1851, -29146, -27675, 1110, 28799, 28063, -371, -28439, -28439, -371, 28063, 28799, 1110, -27675, -29146, -1851, 27270, 29475, 2589, -26853, -29792, -3327, 26421, 30092, 4062, -25978, -30378, -4797, 25519, 30647, 5527, -25049, -30902, -6257, 24564, 31140, 6981, -24068, -31363, -7704, 23559, 31569, 8421, -23039, -31760, -9135, 22506, 31933, 9843, -21963, -32092, -10548, 21406, 32232, 11245, -20841, -32358, -11939, 20264, 32466, 12624, -19677, -32558, -13305, 19079, 32633, 13978, -18473, -32692, -14645, 17856, 32733, 15303, -17232, -32759, -15955, 16596}, +{32767, 17856, -13305, -32358, -21963, 8421, 31140, 25519, -3327, -29146, -28439, -1851, 26421, 30647, 6981, -23039, -32092, -11939, 19079, 32733, 16596, -14645, -32558, -20841, 9843, 31569, 24564, -4797, -29792, -27675, -371, 27270, 30092, 5527, -24068, -31760, -10548, 20264, 32633, 15303, -15955, -32692, -19677, 11245, 31933, 23559, -6257, -30378, -26853, 1110, 28063, 29475, 4062, -25049, -31363, -9135, 21406, 32466, 13978, -17232, -32759, -18473, 12624, 32232, 22506, -7704, -30902, -25978, 2589, 28799, 28799, 2589, -25978, -30902, -7704, 22506, 32232, 12624, -18473, -32759, -17232, 13978, 32466, 21406, -9135, -31363, -25049, 4062, 29475, 28063, 1110, -26853, -30378, -6257, 23559, 31933, 11245, -19677, -32692, -15955, 15303, 32633, 20264, -10548, -31760, -24068, 5527, 30092, 27270, -371, -27675, -29792, -4797, 24564, 31569, 9843, -20841, -32558, -14645, 16596, 32733, 19079, -11939, -32092, -23039, 6981, 30647, 26421, -1851, -28439, -29146, -3327, 25519, 31140, 8421, -21963, -32358, -13305, 17856}, +{32767, 19079, -10548, -31363, -25978, 1110, 27270, 30647, 8421, -20841, -32692, -17232, 12624, 31933, 24564, -3327, -28439, -29792, -6257, 22506, 32466, 15303, -14645, -32358, -23039, 5527, 29475, 28799, 4062, -24068, -32092, -13305, 16596, 32633, 21406, -7704, -30378, -27675, -1851, 25519, 31569, 11245, -18473, -32759, -19677, 9843, 31140, 26421, -371, -26853, -30902, -9135, 20264, 32733, 17856, -11939, -31760, -25049, 2589, 28063, 30092, 6981, -21963, -32558, -15955, 13978, 32232, 23559, -4797, -29146, -29146, -4797, 23559, 32232, 13978, -15955, -32558, -21963, 6981, 30092, 28063, 2589, -25049, -31760, -11939, 17856, 32733, 20264, -9135, -30902, -26853, -371, 26421, 31140, 9843, -19677, -32759, -18473, 11245, 31569, 25519, -1851, -27675, -30378, -7704, 21406, 32633, 16596, -13305, -32092, -24068, 4062, 28799, 29475, 5527, -23039, -32358, -14645, 15303, 32466, 22506, -6257, -29792, -28439, -3327, 24564, 31933, 12624, -17232, -32692, -20841, 8421, 30647, 27270, 1110, -25978, -31363, -10548, 19079}, +{32767, 20264, -7704, -29792, -29146, -6257, 21406, 32733, 19079, -9135, -30378, -28439, -4797, 22506, 32633, 17856, -10548, -30902, -27675, -3327, 23559, 32466, 16596, -11939, -31363, -26853, -1851, 24564, 32232, 15303, -13305, -31760, -25978, -371, 25519, 31933, 13978, -14645, -32092, -25049, 1110, 26421, 31569, 12624, -15955, -32358, -24068, 2589, 27270, 31140, 11245, -17232, -32558, -23039, 4062, 28063, 30647, 9843, -18473, -32692, -21963, 5527, 28799, 30092, 8421, -19677, -32759, -20841, 6981, 29475, 29475, 6981, -20841, -32759, -19677, 8421, 30092, 28799, 5527, -21963, -32692, -18473, 9843, 30647, 28063, 4062, -23039, -32558, -17232, 11245, 31140, 27270, 2589, -24068, -32358, -15955, 12624, 31569, 26421, 1110, -25049, -32092, -14645, 13978, 31933, 25519, -371, -25978, -31760, -13305, 15303, 32232, 24564, -1851, -26853, -31363, -11939, 16596, 32466, 23559, -3327, -27675, -30902, -10548, 17856, 32633, 22506, -4797, -28439, -30378, -9135, 19079, 32733, 21406, -6257, -29146, -29792, -7704, 20264}, +{32767, 21406, -4797, -27675, -31363, -13305, 13978, 31569, 27270, 4062, -21963, -32759, -20841, 5527, 28063, 31140, 12624, -14645, -31760, -26853, -3327, 22506, 32733, 20264, -6257, -28439, -30902, -11939, 15303, 31933, 26421, 2589, -23039, -32692, -19677, 6981, 28799, 30647, 11245, -15955, -32092, -25978, -1851, 23559, 32633, 19079, -7704, -29146, -30378, -10548, 16596, 32232, 25519, 1110, -24068, -32558, -18473, 8421, 29475, 30092, 9843, -17232, -32358, -25049, -371, 24564, 32466, 17856, -9135, -29792, -29792, -9135, 17856, 32466, 24564, -371, -25049, -32358, -17232, 9843, 30092, 29475, 8421, -18473, -32558, -24068, 1110, 25519, 32232, 16596, -10548, -30378, -29146, -7704, 19079, 32633, 23559, -1851, -25978, -32092, -15955, 11245, 30647, 28799, 6981, -19677, -32692, -23039, 2589, 26421, 31933, 15303, -11939, -30902, -28439, -6257, 20264, 32733, 22506, -3327, -26853, -31760, -14645, 12624, 31140, 28063, 5527, -20841, -32759, -21963, 4062, 27270, 31569, 13978, -13305, -31363, -27675, -4797, 21406}, +{32767, 22506, -1851, -25049, -32558, -19677, 5527, 27270, 31933, 16596, -9135, -29146, -30902, -13305, 12624, 30647, 29475, 9843, -15955, -31760, -27675, -6257, 19079, 32466, 25519, 2589, -21963, -32759, -23039, 1110, 24564, 32633, 20264, -4797, -26853, -32092, -17232, 8421, 28799, 31140, 13978, -11939, -30378, -29792, -10548, 15303, 31569, 28063, 6981, -18473, -32358, -25978, -3327, 21406, 32733, 23559, -371, -24068, -32692, -20841, 4062, 26421, 32232, 17856, -7704, -28439, -31363, -14645, 11245, 30092, 30092, 11245, -14645, -31363, -28439, -7704, 17856, 32232, 26421, 4062, -20841, -32692, -24068, -371, 23559, 32733, 21406, -3327, -25978, -32358, -18473, 6981, 28063, 31569, 15303, -10548, -29792, -30378, -11939, 13978, 31140, 28799, 8421, -17232, -32092, -26853, -4797, 20264, 32633, 24564, 1110, -23039, -32759, -21963, 2589, 25519, 32466, 19079, -6257, -27675, -31760, -15955, 9843, 29475, 30647, 12624, -13305, -30902, -29146, -9135, 16596, 31933, 27270, 5527, -19677, -32558, -25049, -1851, 22506}, +{32767, 23559, 1110, -21963, -32692, -25049, -3327, 20264, 32466, 26421, 5527, -18473, -32092, -27675, -7704, 16596, 31569, 28799, 9843, -14645, -30902, -29792, -11939, 12624, 30092, 30647, 13978, -10548, -29146, -31363, -15955, 8421, 28063, 31933, 17856, -6257, -26853, -32358, -19677, 4062, 25519, 32633, 21406, -1851, -24068, -32759, -23039, -371, 22506, 32733, 24564, 2589, -20841, -32558, -25978, -4797, 19079, 32232, 27270, 6981, -17232, -31760, -28439, -9135, 15303, 31140, 29475, 11245, -13305, -30378, -30378, -13305, 11245, 29475, 31140, 15303, -9135, -28439, -31760, -17232, 6981, 27270, 32232, 19079, -4797, -25978, -32558, -20841, 2589, 24564, 32733, 22506, -371, -23039, -32759, -24068, -1851, 21406, 32633, 25519, 4062, -19677, -32358, -26853, -6257, 17856, 31933, 28063, 8421, -15955, -31363, -29146, -10548, 13978, 30647, 30092, 12624, -11939, -29792, -30902, -14645, 9843, 28799, 31569, 16596, -7704, -27675, -32092, -18473, 5527, 26421, 32466, 20264, -3327, -25049, -32692, -21963, 1110, 23559}, +{32767, 24564, 4062, -18473, -31760, -29146, -11939, 11245, 28799, 31933, 19079, -3327, -24068, -32759, -25049, -4797, 17856, 31569, 29475, 12624, -10548, -28439, -32092, -19677, 2589, 23559, 32733, 25519, 5527, -17232, -31363, -29792, -13305, 9843, 28063, 32232, 20264, -1851, -23039, -32692, -25978, -6257, 16596, 31140, 30092, 13978, -9135, -27675, -32358, -20841, 1110, 22506, 32633, 26421, 6981, -15955, -30902, -30378, -14645, 8421, 27270, 32466, 21406, -371, -21963, -32558, -26853, -7704, 15303, 30647, 30647, 15303, -7704, -26853, -32558, -21963, -371, 21406, 32466, 27270, 8421, -14645, -30378, -30902, -15955, 6981, 26421, 32633, 22506, 1110, -20841, -32358, -27675, -9135, 13978, 30092, 31140, 16596, -6257, -25978, -32692, -23039, -1851, 20264, 32232, 28063, 9843, -13305, -29792, -31363, -17232, 5527, 25519, 32733, 23559, 2589, -19677, -32092, -28439, -10548, 12624, 29475, 31569, 17856, -4797, -25049, -32759, -24068, -3327, 19079, 31933, 28799, 11245, -11939, -29146, -31760, -18473, 4062, 24564}, +{32767, 25519, 6981, -14645, -29792, -31760, -19677, 1110, 21406, 32232, 28799, 12624, -9135, -26853, -32692, -24068, -4797, 16596, 30647, 31140, 17856, -3327, -23039, -32558, -27675, -10548, 11245, 28063, 32466, 22506, 2589, -18473, -31363, -30378, -15955, 5527, 24564, 32733, 26421, 8421, -13305, -29146, -32092, -20841, -371, 20264, 31933, 29475, 13978, -7704, -25978, -32759, -25049, -6257, 15303, 30092, 31569, 19079, -1851, -21963, -32358, -28439, -11939, 9843, 27270, 32633, 23559, 4062, -17232, -30902, -30902, -17232, 4062, 23559, 32633, 27270, 9843, -11939, -28439, -32358, -21963, -1851, 19079, 31569, 30092, 15303, -6257, -25049, -32759, -25978, -7704, 13978, 29475, 31933, 20264, -371, -20841, -32092, -29146, -13305, 8421, 26421, 32733, 24564, 5527, -15955, -30378, -31363, -18473, 2589, 22506, 32466, 28063, 11245, -10548, -27675, -32558, -23039, -3327, 17856, 31140, 30647, 16596, -4797, -24068, -32692, -26853, -9135, 12624, 28799, 32232, 21406, 1110, -19677, -31760, -29792, -14645, 6981, 25519}, +{32767, 26421, 9843, -10548, -26853, -32759, -25978, -9135, 11245, 27270, 32733, 25519, 8421, -11939, -27675, -32692, -25049, -7704, 12624, 28063, 32633, 24564, 6981, -13305, -28439, -32558, -24068, -6257, 13978, 28799, 32466, 23559, 5527, -14645, -29146, -32358, -23039, -4797, 15303, 29475, 32232, 22506, 4062, -15955, -29792, -32092, -21963, -3327, 16596, 30092, 31933, 21406, 2589, -17232, -30378, -31760, -20841, -1851, 17856, 30647, 31569, 20264, 1110, -18473, -30902, -31363, -19677, -371, 19079, 31140, 31140, 19079, -371, -19677, -31363, -30902, -18473, 1110, 20264, 31569, 30647, 17856, -1851, -20841, -31760, -30378, -17232, 2589, 21406, 31933, 30092, 16596, -3327, -21963, -32092, -29792, -15955, 4062, 22506, 32232, 29475, 15303, -4797, -23039, -32358, -29146, -14645, 5527, 23559, 32466, 28799, 13978, -6257, -24068, -32558, -28439, -13305, 6981, 24564, 32633, 28063, 12624, -7704, -25049, -32692, -27675, -11939, 8421, 25519, 32733, 27270, 11245, -9135, -25978, -32759, -26853, -10548, 9843, 26421}, +{32767, 27270, 12624, -6257, -23039, -32092, -30378, -18473, -371, 17856, 30092, 32232, 23559, 6981, -11939, -26853, -32759, -27675, -13305, 5527, 22506, 31933, 30647, 19079, 1110, -17232, -29792, -32358, -24068, -7704, 11245, 26421, 32733, 28063, 13978, -4797, -21963, -31760, -30902, -19677, -1851, 16596, 29475, 32466, 24564, 8421, -10548, -25978, -32692, -28439, -14645, 4062, 21406, 31569, 31140, 20264, 2589, -15955, -29146, -32558, -25049, -9135, 9843, 25519, 32633, 28799, 15303, -3327, -20841, -31363, -31363, -20841, -3327, 15303, 28799, 32633, 25519, 9843, -9135, -25049, -32558, -29146, -15955, 2589, 20264, 31140, 31569, 21406, 4062, -14645, -28439, -32692, -25978, -10548, 8421, 24564, 32466, 29475, 16596, -1851, -19677, -30902, -31760, -21963, -4797, 13978, 28063, 32733, 26421, 11245, -7704, -24068, -32358, -29792, -17232, 1110, 19079, 30647, 31933, 22506, 5527, -13305, -27675, -32759, -26853, -11939, 6981, 23559, 32232, 30092, 17856, -371, -18473, -30378, -32092, -23039, -6257, 12624, 27270}, +{32767, 28063, 15303, -1851, -18473, -29792, -32558, -25978, -11939, 5527, 21406, 31140, 31933, 23559, 8421, -9135, -24068, -32092, -30902, -20841, -4797, 12624, 26421, 32633, 29475, 17856, 1110, -15955, -28439, -32759, -27675, -14645, 2589, 19079, 30092, 32466, 25519, 11245, -6257, -21963, -31363, -31760, -23039, -7704, 9843, 24564, 32232, 30647, 20264, 4062, -13305, -26853, -32692, -29146, -17232, -371, 16596, 28799, 32733, 27270, 13978, -3327, -19677, -30378, -32358, -25049, -10548, 6981, 22506, 31569, 31569, 22506, 6981, -10548, -25049, -32358, -30378, -19677, -3327, 13978, 27270, 32733, 28799, 16596, -371, -17232, -29146, -32692, -26853, -13305, 4062, 20264, 30647, 32232, 24564, 9843, -7704, -23039, -31760, -31363, -21963, -6257, 11245, 25519, 32466, 30092, 19079, 2589, -14645, -27675, -32759, -28439, -15955, 1110, 17856, 29475, 32633, 26421, 12624, -4797, -20841, -30902, -32092, -24068, -9135, 8421, 23559, 31933, 31140, 21406, 5527, -11939, -25978, -32558, -29792, -18473, -1851, 15303, 28063}, +{32767, 28799, 17856, 2589, -13305, -25978, -32358, -30902, -21963, -7704, 8421, 22506, 31140, 32232, 25519, 12624, -3327, -18473, -29146, -32759, -28439, -17232, -1851, 13978, 26421, 32466, 30647, 21406, 6981, -9135, -23039, -31363, -32092, -25049, -11939, 4062, 19079, 29475, 32733, 28063, 16596, 1110, -14645, -26853, -32558, -30378, -20841, -6257, 9843, 23559, 31569, 31933, 24564, 11245, -4797, -19677, -29792, -32692, -27675, -15955, -371, 15303, 27270, 32633, 30092, 20264, 5527, -10548, -24068, -31760, -31760, -24068, -10548, 5527, 20264, 30092, 32633, 27270, 15303, -371, -15955, -27675, -32692, -29792, -19677, -4797, 11245, 24564, 31933, 31569, 23559, 9843, -6257, -20841, -30378, -32558, -26853, -14645, 1110, 16596, 28063, 32733, 29475, 19079, 4062, -11939, -25049, -32092, -31363, -23039, -9135, 6981, 21406, 30647, 32466, 26421, 13978, -1851, -17232, -28439, -32759, -29146, -18473, -3327, 12624, 25519, 32232, 31140, 22506, 8421, -7704, -21963, -30902, -32358, -25978, -13305, 2589, 17856, 28799}, +{32767, 29475, 20264, 6981, -7704, -20841, -29792, -32759, -29146, -19677, -6257, 8421, 21406, 30092, 32733, 28799, 19079, 5527, -9135, -21963, -30378, -32692, -28439, -18473, -4797, 9843, 22506, 30647, 32633, 28063, 17856, 4062, -10548, -23039, -30902, -32558, -27675, -17232, -3327, 11245, 23559, 31140, 32466, 27270, 16596, 2589, -11939, -24068, -31363, -32358, -26853, -15955, -1851, 12624, 24564, 31569, 32232, 26421, 15303, 1110, -13305, -25049, -31760, -32092, -25978, -14645, -371, 13978, 25519, 31933, 31933, 25519, 13978, -371, -14645, -25978, -32092, -31760, -25049, -13305, 1110, 15303, 26421, 32232, 31569, 24564, 12624, -1851, -15955, -26853, -32358, -31363, -24068, -11939, 2589, 16596, 27270, 32466, 31140, 23559, 11245, -3327, -17232, -27675, -32558, -30902, -23039, -10548, 4062, 17856, 28063, 32633, 30647, 22506, 9843, -4797, -18473, -28439, -32692, -30378, -21963, -9135, 5527, 19079, 28799, 32733, 30092, 21406, 8421, -6257, -19677, -29146, -32759, -29792, -20841, -7704, 6981, 20264, 29475}, +{32767, 30092, 22506, 11245, -1851, -14645, -25049, -31363, -32558, -28439, -19677, -7704, 5527, 17856, 27270, 32232, 31933, 26421, 16596, 4062, -9135, -20841, -29146, -32692, -30902, -24068, -13305, -371, 12624, 23559, 30647, 32733, 29475, 21406, 9843, -3327, -15955, -25978, -31760, -32358, -27675, -18473, -6257, 6981, 19079, 28063, 32466, 31569, 25519, 15303, 2589, -10548, -21963, -29792, -32759, -30378, -23039, -11939, 1110, 13978, 24564, 31140, 32633, 28799, 20264, 8421, -4797, -17232, -26853, -32092, -32092, -26853, -17232, -4797, 8421, 20264, 28799, 32633, 31140, 24564, 13978, 1110, -11939, -23039, -30378, -32759, -29792, -21963, -10548, 2589, 15303, 25519, 31569, 32466, 28063, 19079, 6981, -6257, -18473, -27675, -32358, -31760, -25978, -15955, -3327, 9843, 21406, 29475, 32733, 30647, 23559, 12624, -371, -13305, -24068, -30902, -32692, -29146, -20841, -9135, 4062, 16596, 26421, 31933, 32232, 27270, 17856, 5527, -7704, -19677, -28439, -32558, -31363, -25049, -14645, -1851, 11245, 22506, 30092}, +{32767, 30647, 24564, 15303, 4062, -7704, -18473, -26853, -31760, -32558, -29146, -21963, -11939, -371, 11245, 21406, 28799, 32466, 31933, 27270, 19079, 8421, -3327, -14645, -24068, -30378, -32759, -30902, -25049, -15955, -4797, 6981, 17856, 26421, 31569, 32633, 29475, 22506, 12624, 1110, -10548, -20841, -28439, -32358, -32092, -27675, -19677, -9135, 2589, 13978, 23559, 30092, 32733, 31140, 25519, 16596, 5527, -6257, -17232, -25978, -31363, -32692, -29792, -23039, -13305, -1851, 9843, 20264, 28063, 32232, 32232, 28063, 20264, 9843, -1851, -13305, -23039, -29792, -32692, -31363, -25978, -17232, -6257, 5527, 16596, 25519, 31140, 32733, 30092, 23559, 13978, 2589, -9135, -19677, -27675, -32092, -32358, -28439, -20841, -10548, 1110, 12624, 22506, 29475, 32633, 31569, 26421, 17856, 6981, -4797, -15955, -25049, -30902, -32759, -30378, -24068, -14645, -3327, 8421, 19079, 27270, 31933, 32466, 28799, 21406, 11245, -371, -11939, -21963, -29146, -32558, -31760, -26853, -18473, -7704, 4062, 15303, 24564, 30647}, +{32767, 31140, 26421, 19079, 9843, -371, -10548, -19677, -26853, -31363, -32759, -30902, -25978, -18473, -9135, 1110, 11245, 20264, 27270, 31569, 32733, 30647, 25519, 17856, 8421, -1851, -11939, -20841, -27675, -31760, -32692, -30378, -25049, -17232, -7704, 2589, 12624, 21406, 28063, 31933, 32633, 30092, 24564, 16596, 6981, -3327, -13305, -21963, -28439, -32092, -32558, -29792, -24068, -15955, -6257, 4062, 13978, 22506, 28799, 32232, 32466, 29475, 23559, 15303, 5527, -4797, -14645, -23039, -29146, -32358, -32358, -29146, -23039, -14645, -4797, 5527, 15303, 23559, 29475, 32466, 32232, 28799, 22506, 13978, 4062, -6257, -15955, -24068, -29792, -32558, -32092, -28439, -21963, -13305, -3327, 6981, 16596, 24564, 30092, 32633, 31933, 28063, 21406, 12624, 2589, -7704, -17232, -25049, -30378, -32692, -31760, -27675, -20841, -11939, -1851, 8421, 17856, 25519, 30647, 32733, 31569, 27270, 20264, 11245, 1110, -9135, -18473, -25978, -30902, -32759, -31363, -26853, -19677, -10548, -371, 9843, 19079, 26421, 31140}, +{32767, 31569, 28063, 22506, 15303, 6981, -1851, -10548, -18473, -25049, -29792, -32358, -32558, -30378, -25978, -19677, -11939, -3327, 5527, 13978, 21406, 27270, 31140, 32733, 31933, 28799, 23559, 16596, 8421, -371, -9135, -17232, -24068, -29146, -32092, -32692, -30902, -26853, -20841, -13305, -4797, 4062, 12624, 20264, 26421, 30647, 32633, 32232, 29475, 24564, 17856, 9843, 1110, -7704, -15955, -23039, -28439, -31760, -32759, -31363, -27675, -21963, -14645, -6257, 2589, 11245, 19079, 25519, 30092, 32466, 32466, 30092, 25519, 19079, 11245, 2589, -6257, -14645, -21963, -27675, -31363, -32759, -31760, -28439, -23039, -15955, -7704, 1110, 9843, 17856, 24564, 29475, 32232, 32633, 30647, 26421, 20264, 12624, 4062, -4797, -13305, -20841, -26853, -30902, -32692, -32092, -29146, -24068, -17232, -9135, -371, 8421, 16596, 23559, 28799, 31933, 32733, 31140, 27270, 21406, 13978, 5527, -3327, -11939, -19677, -25978, -30378, -32558, -32358, -29792, -25049, -18473, -10548, -1851, 6981, 15303, 22506, 28063, 31569}, +{32767, 31933, 29475, 25519, 20264, 13978, 6981, -371, -7704, -14645, -20841, -25978, -29792, -32092, -32759, -31760, -29146, -25049, -19677, -13305, -6257, 1110, 8421, 15303, 21406, 26421, 30092, 32232, 32733, 31569, 28799, 24564, 19079, 12624, 5527, -1851, -9135, -15955, -21963, -26853, -30378, -32358, -32692, -31363, -28439, -24068, -18473, -11939, -4797, 2589, 9843, 16596, 22506, 27270, 30647, 32466, 32633, 31140, 28063, 23559, 17856, 11245, 4062, -3327, -10548, -17232, -23039, -27675, -30902, -32558, -32558, -30902, -27675, -23039, -17232, -10548, -3327, 4062, 11245, 17856, 23559, 28063, 31140, 32633, 32466, 30647, 27270, 22506, 16596, 9843, 2589, -4797, -11939, -18473, -24068, -28439, -31363, -32692, -32358, -30378, -26853, -21963, -15955, -9135, -1851, 5527, 12624, 19079, 24564, 28799, 31569, 32733, 32232, 30092, 26421, 21406, 15303, 8421, 1110, -6257, -13305, -19677, -25049, -29146, -31760, -32759, -32092, -29792, -25978, -20841, -14645, -7704, -371, 6981, 13978, 20264, 25519, 29475, 31933}, +{32767, 32232, 30647, 28063, 24564, 20264, 15303, 9843, 4062, -1851, -7704, -13305, -18473, -23039, -26853, -29792, -31760, -32692, -32558, -31363, -29146, -25978, -21963, -17232, -11939, -6257, -371, 5527, 11245, 16596, 21406, 25519, 28799, 31140, 32466, 32733, 31933, 30092, 27270, 23559, 19079, 13978, 8421, 2589, -3327, -9135, -14645, -19677, -24068, -27675, -30378, -32092, -32759, -32358, -30902, -28439, -25049, -20841, -15955, -10548, -4797, 1110, 6981, 12624, 17856, 22506, 26421, 29475, 31569, 32633, 32633, 31569, 29475, 26421, 22506, 17856, 12624, 6981, 1110, -4797, -10548, -15955, -20841, -25049, -28439, -30902, -32358, -32759, -32092, -30378, -27675, -24068, -19677, -14645, -9135, -3327, 2589, 8421, 13978, 19079, 23559, 27270, 30092, 31933, 32733, 32466, 31140, 28799, 25519, 21406, 16596, 11245, 5527, -371, -6257, -11939, -17232, -21963, -25978, -29146, -31363, -32558, -32692, -31760, -29792, -26853, -23039, -18473, -13305, -7704, -1851, 4062, 9843, 15303, 20264, 24564, 28063, 30647, 32232}, +{32767, 32466, 31569, 30092, 28063, 25519, 22506, 19079, 15303, 11245, 6981, 2589, -1851, -6257, -10548, -14645, -18473, -21963, -25049, -27675, -29792, -31363, -32358, -32759, -32558, -31760, -30378, -28439, -25978, -23039, -19677, -15955, -11939, -7704, -3327, 1110, 5527, 9843, 13978, 17856, 21406, 24564, 27270, 29475, 31140, 32232, 32733, 32633, 31933, 30647, 28799, 26421, 23559, 20264, 16596, 12624, 8421, 4062, -371, -4797, -9135, -13305, -17232, -20841, -24068, -26853, -29146, -30902, -32092, -32692, -32692, -32092, -30902, -29146, -26853, -24068, -20841, -17232, -13305, -9135, -4797, -371, 4062, 8421, 12624, 16596, 20264, 23559, 26421, 28799, 30647, 31933, 32633, 32733, 32232, 31140, 29475, 27270, 24564, 21406, 17856, 13978, 9843, 5527, 1110, -3327, -7704, -11939, -15955, -19677, -23039, -25978, -28439, -30378, -31760, -32558, -32759, -32358, -31363, -29792, -27675, -25049, -21963, -18473, -14645, -10548, -6257, -1851, 2589, 6981, 11245, 15303, 19079, 22506, 25519, 28063, 30092, 31569, 32466}, +{32767, 32633, 32232, 31569, 30647, 29475, 28063, 26421, 24564, 22506, 20264, 17856, 15303, 12624, 9843, 6981, 4062, 1110, -1851, -4797, -7704, -10548, -13305, -15955, -18473, -20841, -23039, -25049, -26853, -28439, -29792, -30902, -31760, -32358, -32692, -32759, -32558, -32092, -31363, -30378, -29146, -27675, -25978, -24068, -21963, -19677, -17232, -14645, -11939, -9135, -6257, -3327, -371, 2589, 5527, 8421, 11245, 13978, 16596, 19079, 21406, 23559, 25519, 27270, 28799, 30092, 31140, 31933, 32466, 32733, 32733, 32466, 31933, 31140, 30092, 28799, 27270, 25519, 23559, 21406, 19079, 16596, 13978, 11245, 8421, 5527, 2589, -371, -3327, -6257, -9135, -11939, -14645, -17232, -19677, -21963, -24068, -25978, -27675, -29146, -30378, -31363, -32092, -32558, -32759, -32692, -32358, -31760, -30902, -29792, -28439, -26853, -25049, -23039, -20841, -18473, -15955, -13305, -10548, -7704, -4797, -1851, 1110, 4062, 6981, 9843, 12624, 15303, 17856, 20264, 22506, 24564, 26421, 28063, 29475, 30647, 31569, 32232, 32633}, +{32767, 32733, 32633, 32466, 32232, 31933, 31569, 31140, 30647, 30092, 29475, 28799, 28063, 27270, 26421, 25519, 24564, 23559, 22506, 21406, 20264, 19079, 17856, 16596, 15303, 13978, 12624, 11245, 9843, 8421, 6981, 5527, 4062, 2589, 1110, -371, -1851, -3327, -4797, -6257, -7704, -9135, -10548, -11939, -13305, -14645, -15955, -17232, -18473, -19677, -20841, -21963, -23039, -24068, -25049, -25978, -26853, -27675, -28439, -29146, -29792, -30378, -30902, -31363, -31760, -32092, -32358, -32558, -32692, -32759, -32759, -32692, -32558, -32358, -32092, -31760, -31363, -30902, -30378, -29792, -29146, -28439, -27675, -26853, -25978, -25049, -24068, -23039, -21963, -20841, -19677, -18473, -17232, -15955, -14645, -13305, -11939, -10548, -9135, -7704, -6257, -4797, -3327, -1851, -371, 1110, 2589, 4062, 5527, 6981, 8421, 9843, 11245, 12624, 13978, 15303, 16596, 17856, 19079, 20264, 21406, 22506, 23559, 24564, 25519, 26421, 27270, 28063, 28799, 29475, 30092, 30647, 31140, 31569, 31933, 32232, 32466, 32633, 32733} +}; + + +int16_t prach_fft139_im[139][139] = { +{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, +{0, -1481, -2959, -4430, -5893, -7343, -8779, -10196, -11593, -12966, -14313, -15630, -16916, -18166, -19380, -20554, -21686, -22774, -23816, -24808, -25750, -26640, -27474, -28253, -28974, -29636, -30238, -30777, -31254, -31667, -32015, -32298, -32515, -32665, -32749, -32765, -32715, -32598, -32415, -32165, -31849, -31469, -31024, -30515, -29945, -29313, -28621, -27871, -27064, -26202, -25286, -24318, -23301, -22236, -21126, -19972, -18778, -17545, -16277, -14975, -13643, -12283, -10898, -9490, -8063, -6620, -5163, -3696, -2221, -741, 740, 2220, 3695, 5162, 6619, 8062, 9489, 10897, 12282, 13642, 14974, 16276, 17544, 18777, 19971, 21125, 22235, 23300, 24317, 25285, 26201, 27063, 27870, 28620, 29312, 29944, 30514, 31023, 31468, 31848, 32164, 32414, 32597, 32714, 32764, 32748, 32664, 32514, 32297, 32014, 31666, 31253, 30776, 30237, 29635, 28973, 28252, 27473, 26639, 25749, 24807, 23815, 22773, 21685, 20553, 19379, 18165, 16915, 15629, 14312, 12965, 11592, 10195, 8778, 7342, 5892, 4429, 2958, 1480}, +{0, -2959, -5893, -8779, -11593, -14313, -16916, -19380, -21686, -23816, -25750, -27474, -28974, -30238, -31254, -32015, -32515, -32749, -32715, -32415, -31849, -31024, -29945, -28621, -27064, -25286, -23301, -21126, -18778, -16277, -13643, -10898, -8063, -5163, -2221, 740, 3695, 6619, 9489, 12282, 14974, 17544, 19971, 22235, 24317, 26201, 27870, 29312, 30514, 31468, 32164, 32597, 32764, 32664, 32297, 31666, 30776, 29635, 28252, 26639, 24807, 22773, 20553, 18165, 15629, 12965, 10195, 7342, 4429, 1480, -1481, -4430, -7343, -10196, -12966, -15630, -18166, -20554, -22774, -24808, -26640, -28253, -29636, -30777, -31667, -32298, -32665, -32765, -32598, -32165, -31469, -30515, -29313, -27871, -26202, -24318, -22236, -19972, -17545, -14975, -12283, -9490, -6620, -3696, -741, 2220, 5162, 8062, 10897, 13642, 16276, 18777, 21125, 23300, 25285, 27063, 28620, 29944, 31023, 31848, 32414, 32714, 32748, 32514, 32014, 31253, 30237, 28973, 27473, 25749, 23815, 21685, 19379, 16915, 14312, 11592, 8778, 5892, 2958}, +{0, -4430, -8779, -12966, -16916, -20554, -23816, -26640, -28974, -30777, -32015, -32665, -32715, -32165, -31024, -29313, -27064, -24318, -21126, -17545, -13643, -9490, -5163, -741, 3695, 8062, 12282, 16276, 19971, 23300, 26201, 28620, 30514, 31848, 32597, 32748, 32297, 31253, 29635, 27473, 24807, 21685, 18165, 14312, 10195, 5892, 1480, -2959, -7343, -11593, -15630, -19380, -22774, -25750, -28253, -30238, -31667, -32515, -32765, -32415, -31469, -29945, -27871, -25286, -22236, -18778, -14975, -10898, -6620, -2221, 2220, 6619, 10897, 14974, 18777, 22235, 25285, 27870, 29944, 31468, 32414, 32764, 32514, 31666, 30237, 28252, 25749, 22773, 19379, 15629, 11592, 7342, 2958, -1481, -5893, -10196, -14313, -18166, -21686, -24808, -27474, -29636, -31254, -32298, -32749, -32598, -31849, -30515, -28621, -26202, -23301, -19972, -16277, -12283, -8063, -3696, 740, 5162, 9489, 13642, 17544, 21125, 24317, 27063, 29312, 31023, 32164, 32714, 32664, 32014, 30776, 28973, 26639, 23815, 20553, 16915, 12965, 8778, 4429}, +{0, -5893, -11593, -16916, -21686, -25750, -28974, -31254, -32515, -32715, -31849, -29945, -27064, -23301, -18778, -13643, -8063, -2221, 3695, 9489, 14974, 19971, 24317, 27870, 30514, 32164, 32764, 32297, 30776, 28252, 24807, 20553, 15629, 10195, 4429, -1481, -7343, -12966, -18166, -22774, -26640, -29636, -31667, -32665, -32598, -31469, -29313, -26202, -22236, -17545, -12283, -6620, -741, 5162, 10897, 16276, 21125, 25285, 28620, 31023, 32414, 32748, 32014, 30237, 27473, 23815, 19379, 14312, 8778, 2958, -2959, -8779, -14313, -19380, -23816, -27474, -30238, -32015, -32749, -32415, -31024, -28621, -25286, -21126, -16277, -10898, -5163, 740, 6619, 12282, 17544, 22235, 26201, 29312, 31468, 32597, 32664, 31666, 29635, 26639, 22773, 18165, 12965, 7342, 1480, -4430, -10196, -15630, -20554, -24808, -28253, -30777, -32298, -32765, -32165, -30515, -27871, -24318, -19972, -14975, -9490, -3696, 2220, 8062, 13642, 18777, 23300, 27063, 29944, 31848, 32714, 32514, 31253, 28973, 25749, 21685, 16915, 11592, 5892}, +{0, -7343, -14313, -20554, -25750, -29636, -32015, -32765, -31849, -29313, -25286, -19972, -13643, -6620, 740, 8062, 14974, 21125, 26201, 29944, 32164, 32748, 31666, 28973, 24807, 19379, 12965, 5892, -1481, -8779, -15630, -21686, -26640, -30238, -32298, -32715, -31469, -28621, -24318, -18778, -12283, -5163, 2220, 9489, 16276, 22235, 27063, 30514, 32414, 32664, 31253, 28252, 23815, 18165, 11592, 4429, -2959, -10196, -16916, -22774, -27474, -30777, -32515, -32598, -31024, -27871, -23301, -17545, -10898, -3696, 3695, 10897, 17544, 23300, 27870, 31023, 32597, 32514, 30776, 27473, 22773, 16915, 10195, 2958, -4430, -11593, -18166, -23816, -28253, -31254, -32665, -32415, -30515, -27064, -22236, -16277, -9490, -2221, 5162, 12282, 18777, 24317, 28620, 31468, 32714, 32297, 30237, 26639, 21685, 15629, 8778, 1480, -5893, -12966, -19380, -24808, -28974, -31667, -32749, -32165, -29945, -26202, -21126, -14975, -8063, -741, 6619, 13642, 19971, 25285, 29312, 31848, 32764, 32014, 29635, 25749, 20553, 14312, 7342}, +{0, -8779, -16916, -23816, -28974, -32015, -32715, -31024, -27064, -21126, -13643, -5163, 3695, 12282, 19971, 26201, 30514, 32597, 32297, 29635, 24807, 18165, 10195, 1480, -7343, -15630, -22774, -28253, -31667, -32765, -31469, -27871, -22236, -14975, -6620, 2220, 10897, 18777, 25285, 29944, 32414, 32514, 30237, 25749, 19379, 11592, 2958, -5893, -14313, -21686, -27474, -31254, -32749, -31849, -28621, -23301, -16277, -8063, 740, 9489, 17544, 24317, 29312, 32164, 32664, 30776, 26639, 20553, 12965, 4429, -4430, -12966, -20554, -26640, -30777, -32665, -32165, -29313, -24318, -17545, -9490, -741, 8062, 16276, 23300, 28620, 31848, 32748, 31253, 27473, 21685, 14312, 5892, -2959, -11593, -19380, -25750, -30238, -32515, -32415, -29945, -25286, -18778, -10898, -2221, 6619, 14974, 22235, 27870, 31468, 32764, 31666, 28252, 22773, 15629, 7342, -1481, -10196, -18166, -24808, -29636, -32298, -32598, -30515, -26202, -19972, -12283, -3696, 5162, 13642, 21125, 27063, 31023, 32714, 32014, 28973, 23815, 16915, 8778}, +{0, -10196, -19380, -26640, -31254, -32765, -31024, -26202, -18778, -9490, 740, 10897, 19971, 27063, 31468, 32748, 30776, 25749, 18165, 8778, -1481, -11593, -20554, -27474, -31667, -32715, -30515, -25286, -17545, -8063, 2220, 12282, 21125, 27870, 31848, 32664, 30237, 24807, 16915, 7342, -2959, -12966, -21686, -28253, -32015, -32598, -29945, -24318, -16277, -6620, 3695, 13642, 22235, 28620, 32164, 32514, 29635, 23815, 15629, 5892, -4430, -14313, -22774, -28974, -32298, -32415, -29313, -23301, -14975, -5163, 5162, 14974, 23300, 29312, 32414, 32297, 28973, 22773, 14312, 4429, -5893, -15630, -23816, -29636, -32515, -32165, -28621, -22236, -13643, -3696, 6619, 16276, 24317, 29944, 32597, 32014, 28252, 21685, 12965, 2958, -7343, -16916, -24808, -30238, -32665, -31849, -27871, -21126, -12283, -2221, 8062, 17544, 25285, 30514, 32714, 31666, 27473, 20553, 11592, 1480, -8779, -18166, -25750, -30777, -32749, -31469, -27064, -19972, -10898, -741, 9489, 18777, 26201, 31023, 32764, 31253, 26639, 19379, 10195}, +{0, -11593, -21686, -28974, -32515, -31849, -27064, -18778, -8063, 3695, 14974, 24317, 30514, 32764, 30776, 24807, 15629, 4429, -7343, -18166, -26640, -31667, -32598, -29313, -22236, -12283, -741, 10897, 21125, 28620, 32414, 32014, 27473, 19379, 8778, -2959, -14313, -23816, -30238, -32749, -31024, -25286, -16277, -5163, 6619, 17544, 26201, 31468, 32664, 29635, 22773, 12965, 1480, -10196, -20554, -28253, -32298, -32165, -27871, -19972, -9490, 2220, 13642, 23300, 29944, 32714, 31253, 25749, 16915, 5892, -5893, -16916, -25750, -31254, -32715, -29945, -23301, -13643, -2221, 9489, 19971, 27870, 32164, 32297, 28252, 20553, 10195, -1481, -12966, -22774, -29636, -32665, -31469, -26202, -17545, -6620, 5162, 16276, 25285, 31023, 32748, 30237, 23815, 14312, 2958, -8779, -19380, -27474, -32015, -32415, -28621, -21126, -10898, 740, 12282, 22235, 29312, 32597, 31666, 26639, 18165, 7342, -4430, -15630, -24808, -30777, -32765, -30515, -24318, -14975, -3696, 8062, 18777, 27063, 31848, 32514, 28973, 21685, 11592}, +{0, -12966, -23816, -30777, -32715, -29313, -21126, -9490, 3695, 16276, 26201, 31848, 32297, 27473, 18165, 5892, -7343, -19380, -28253, -32515, -31469, -25286, -14975, -2221, 10897, 22235, 29944, 32764, 30237, 22773, 11592, -1481, -14313, -24808, -31254, -32598, -28621, -19972, -8063, 5162, 17544, 27063, 32164, 32014, 26639, 16915, 4429, -8779, -20554, -28974, -32665, -31024, -24318, -13643, -741, 12282, 23300, 30514, 32748, 29635, 21685, 10195, -2959, -15630, -25750, -31667, -32415, -27871, -18778, -6620, 6619, 18777, 27870, 32414, 31666, 25749, 15629, 2958, -10196, -21686, -29636, -32749, -30515, -23301, -12283, 740, 13642, 24317, 31023, 32664, 28973, 20553, 8778, -4430, -16916, -26640, -32015, -32165, -27064, -17545, -5163, 8062, 19971, 28620, 32597, 31253, 24807, 14312, 1480, -11593, -22774, -30238, -32765, -29945, -22236, -10898, 2220, 14974, 25285, 31468, 32514, 28252, 19379, 7342, -5893, -18166, -27474, -32298, -31849, -26202, -16277, -3696, 9489, 21125, 29312, 32714, 30776, 23815, 12965}, +{0, -14313, -25750, -32015, -31849, -25286, -13643, 740, 14974, 26201, 32164, 31666, 24807, 12965, -1481, -15630, -26640, -32298, -31469, -24318, -12283, 2220, 16276, 27063, 32414, 31253, 23815, 11592, -2959, -16916, -27474, -32515, -31024, -23301, -10898, 3695, 17544, 27870, 32597, 30776, 22773, 10195, -4430, -18166, -28253, -32665, -30515, -22236, -9490, 5162, 18777, 28620, 32714, 30237, 21685, 8778, -5893, -19380, -28974, -32749, -29945, -21126, -8063, 6619, 19971, 29312, 32764, 29635, 20553, 7342, -7343, -20554, -29636, -32765, -29313, -19972, -6620, 8062, 21125, 29944, 32748, 28973, 19379, 5892, -8779, -21686, -30238, -32715, -28621, -18778, -5163, 9489, 22235, 30514, 32664, 28252, 18165, 4429, -10196, -22774, -30777, -32598, -27871, -17545, -3696, 10897, 23300, 31023, 32514, 27473, 16915, 2958, -11593, -23816, -31254, -32415, -27064, -16277, -2221, 12282, 24317, 31468, 32297, 26639, 15629, 1480, -12966, -24808, -31667, -32165, -26202, -14975, -741, 13642, 25285, 31848, 32014, 25749, 14312}, +{0, -15630, -27474, -32665, -29945, -19972, -5163, 10897, 24317, 31848, 31666, 23815, 10195, -5893, -20554, -30238, -32598, -27064, -14975, 740, 16276, 27870, 32714, 29635, 19379, 4429, -11593, -24808, -32015, -31469, -23301, -9490, 6619, 21125, 30514, 32514, 26639, 14312, -1481, -16916, -28253, -32749, -29313, -18778, -3696, 12282, 25285, 32164, 31253, 22773, 8778, -7343, -21686, -30777, -32415, -26202, -13643, 2220, 17544, 28620, 32764, 28973, 18165, 2958, -12966, -25750, -32298, -31024, -22236, -8063, 8062, 22235, 31023, 32297, 25749, 12965, -2959, -18166, -28974, -32765, -28621, -17545, -2221, 13642, 26201, 32414, 30776, 21685, 7342, -8779, -22774, -31254, -32165, -25286, -12283, 3695, 18777, 29312, 32748, 28252, 16915, 1480, -14313, -26640, -32515, -30515, -21126, -6620, 9489, 23300, 31468, 32014, 24807, 11592, -4430, -19380, -29636, -32715, -27871, -16277, -741, 14974, 27063, 32597, 30237, 20553, 5892, -10196, -23816, -31667, -31849, -24318, -10898, 5162, 19971, 29944, 32664, 27473, 15629}, +{0, -16916, -28974, -32715, -27064, -13643, 3695, 19971, 30514, 32297, 24807, 10195, -7343, -22774, -31667, -31469, -22236, -6620, 10897, 25285, 32414, 30237, 19379, 2958, -14313, -27474, -32749, -28621, -16277, 740, 17544, 29312, 32664, 26639, 12965, -4430, -20554, -30777, -32165, -24318, -9490, 8062, 23300, 31848, 31253, 21685, 5892, -11593, -25750, -32515, -29945, -18778, -2221, 14974, 27870, 32764, 28252, 15629, -1481, -18166, -29636, -32598, -26202, -12283, 5162, 21125, 31023, 32014, 23815, 8778, -8779, -23816, -32015, -31024, -21126, -5163, 12282, 26201, 32597, 29635, 18165, 1480, -15630, -28253, -32765, -27871, -14975, 2220, 18777, 29944, 32514, 25749, 11592, -5893, -21686, -31254, -31849, -23301, -8063, 9489, 24317, 32164, 30776, 20553, 4429, -12966, -26640, -32665, -29313, -17545, -741, 16276, 28620, 32748, 27473, 14312, -2959, -19380, -30238, -32415, -25286, -10898, 6619, 22235, 31468, 31666, 22773, 7342, -10196, -24808, -32298, -30515, -19972, -3696, 13642, 27063, 32714, 28973, 16915}, +{0, -18166, -30238, -32165, -23301, -6620, 12282, 27063, 32764, 27473, 12965, -5893, -22774, -32015, -30515, -18778, -741, 17544, 29944, 32297, 23815, 7342, -11593, -26640, -32749, -27871, -13643, 5162, 22235, 31848, 30776, 19379, 1480, -16916, -29636, -32415, -24318, -8063, 10897, 26201, 32714, 28252, 14312, -4430, -21686, -31667, -31024, -19972, -2221, 16276, 29312, 32514, 24807, 8778, -10196, -25750, -32665, -28621, -14975, 3695, 21125, 31468, 31253, 20553, 2958, -15630, -28974, -32598, -25286, -9490, 9489, 25285, 32597, 28973, 15629, -2959, -20554, -31254, -31469, -21126, -3696, 14974, 28620, 32664, 25749, 10195, -8779, -24808, -32515, -29313, -16277, 2220, 19971, 31023, 31666, 21685, 4429, -14313, -28253, -32715, -26202, -10898, 8062, 24317, 32414, 29635, 16915, -1481, -19380, -30777, -31849, -22236, -5163, 13642, 27870, 32748, 26639, 11592, -7343, -23816, -32298, -29945, -17545, 740, 18777, 30514, 32014, 22773, 5892, -12966, -27474, -32765, -27064, -12283, 6619, 23300, 32164, 30237, 18165}, +{0, -19380, -31254, -31024, -18778, 740, 19971, 31468, 30776, 18165, -1481, -20554, -31667, -30515, -17545, 2220, 21125, 31848, 30237, 16915, -2959, -21686, -32015, -29945, -16277, 3695, 22235, 32164, 29635, 15629, -4430, -22774, -32298, -29313, -14975, 5162, 23300, 32414, 28973, 14312, -5893, -23816, -32515, -28621, -13643, 6619, 24317, 32597, 28252, 12965, -7343, -24808, -32665, -27871, -12283, 8062, 25285, 32714, 27473, 11592, -8779, -25750, -32749, -27064, -10898, 9489, 26201, 32764, 26639, 10195, -10196, -26640, -32765, -26202, -9490, 10897, 27063, 32748, 25749, 8778, -11593, -27474, -32715, -25286, -8063, 12282, 27870, 32664, 24807, 7342, -12966, -28253, -32598, -24318, -6620, 13642, 28620, 32514, 23815, 5892, -14313, -28974, -32415, -23301, -5163, 14974, 29312, 32297, 22773, 4429, -15630, -29636, -32165, -22236, -3696, 16276, 29944, 32014, 21685, 2958, -16916, -30238, -31849, -21126, -2221, 17544, 30514, 31666, 20553, 1480, -18166, -30777, -31469, -19972, -741, 18777, 31023, 31253, 19379}, +{0, -20554, -32015, -29313, -13643, 8062, 26201, 32748, 24807, 5892, -15630, -30238, -31469, -18778, 2220, 22235, 32414, 28252, 11592, -10196, -27474, -32598, -23301, -3696, 17544, 31023, 30776, 16915, -4430, -23816, -32665, -27064, -9490, 12282, 28620, 32297, 21685, 1480, -19380, -31667, -29945, -14975, 6619, 25285, 32764, 25749, 7342, -14313, -29636, -31849, -19972, 740, 21125, 32164, 28973, 12965, -8779, -26640, -32715, -24318, -5163, 16276, 30514, 31253, 18165, -2959, -22774, -32515, -27871, -10898, 10897, 27870, 32514, 22773, 2958, -18166, -31254, -30515, -16277, 5162, 24317, 32714, 26639, 8778, -12966, -28974, -32165, -21126, -741, 19971, 31848, 29635, 14312, -7343, -25750, -32765, -25286, -6620, 14974, 29944, 31666, 19379, -1481, -21686, -32298, -28621, -12283, 9489, 27063, 32664, 23815, 4429, -16916, -30777, -31024, -17545, 3695, 23300, 32597, 27473, 10195, -11593, -28253, -32415, -22236, -2221, 18777, 31468, 30237, 15629, -5893, -24808, -32749, -26202, -8063, 13642, 29312, 32014, 20553}, +{0, -21686, -32515, -27064, -8063, 14974, 30514, 30776, 15629, -7343, -26640, -32598, -22236, -741, 21125, 32414, 27473, 8778, -14313, -30238, -31024, -16277, 6619, 26201, 32664, 22773, 1480, -20554, -32298, -27871, -9490, 13642, 29944, 31253, 16915, -5893, -25750, -32715, -23301, -2221, 19971, 32164, 28252, 10195, -12966, -29636, -31469, -17545, 5162, 25285, 32748, 23815, 2958, -19380, -32015, -28621, -10898, 12282, 29312, 31666, 18165, -4430, -24808, -32765, -24318, -3696, 18777, 31848, 28973, 11592, -11593, -28974, -31849, -18778, 3695, 24317, 32764, 24807, 4429, -18166, -31667, -29313, -12283, 10897, 28620, 32014, 19379, -2959, -23816, -32749, -25286, -5163, 17544, 31468, 29635, 12965, -10196, -28253, -32165, -19972, 2220, 23300, 32714, 25749, 5892, -16916, -31254, -29945, -13643, 9489, 27870, 32297, 20553, -1481, -22774, -32665, -26202, -6620, 16276, 31023, 30237, 14312, -8779, -27474, -32415, -21126, 740, 22235, 32597, 26639, 7342, -15630, -30777, -30515, -14975, 8062, 27063, 32514, 21685}, +{0, -22774, -32749, -24318, -2221, 21125, 32597, 25749, 4429, -19380, -32298, -27064, -6620, 17544, 31848, 28252, 8778, -15630, -31254, -29313, -10898, 13642, 30514, 30237, 12965, -11593, -29636, -31024, -14975, 9489, 28620, 31666, 16915, -7343, -27474, -32165, -18778, 5162, 26201, 32514, 20553, -2959, -24808, -32715, -22236, 740, 23300, 32764, 23815, 1480, -21686, -32665, -25286, -3696, 19971, 32414, 26639, 5892, -18166, -32015, -27871, -8063, 16276, 31468, 28973, 10195, -14313, -30777, -29945, -12283, 12282, 29944, 30776, 14312, -10196, -28974, -31469, -16277, 8062, 27870, 32014, 18165, -5893, -26640, -32415, -19972, 3695, 25285, 32664, 21685, -1481, -23816, -32765, -23301, -741, 22235, 32714, 24807, 2958, -20554, -32515, -26202, -5163, 18777, 32164, 27473, 7342, -16916, -31667, -28621, -9490, 14974, 31023, 29635, 11592, -12966, -30238, -30515, -13643, 10897, 29312, 31253, 15629, -8779, -28253, -31849, -17545, 6619, 27063, 32297, 19379, -4430, -25750, -32598, -21126, 2220, 24317, 32748, 22773}, +{0, -23816, -32715, -21126, 3695, 26201, 32297, 18165, -7343, -28253, -31469, -14975, 10897, 29944, 30237, 11592, -14313, -31254, -28621, -8063, 17544, 32164, 26639, 4429, -20554, -32665, -24318, -741, 23300, 32748, 21685, -2959, -25750, -32415, -18778, 6619, 27870, 31666, 15629, -10196, -29636, -30515, -12283, 13642, 31023, 28973, 8778, -16916, -32015, -27064, -5163, 19971, 32597, 24807, 1480, -22774, -32765, -22236, 2220, 25285, 32514, 19379, -5893, -27474, -31849, -16277, 9489, 29312, 30776, 12965, -12966, -30777, -29313, -9490, 16276, 31848, 27473, 5892, -19380, -32515, -25286, -2221, 22235, 32764, 22773, -1481, -24808, -32598, -19972, 5162, 27063, 32014, 16915, -8779, -28974, -31024, -13643, 12282, 30514, 29635, 10195, -15630, -31667, -27871, -6620, 18777, 32414, 25749, 2958, -21686, -32749, -23301, 740, 24317, 32664, 20553, -4430, -26640, -32165, -17545, 8062, 28620, 31253, 14312, -11593, -30238, -29945, -10898, 14974, 31468, 28252, 7342, -18166, -32298, -26202, -3696, 21125, 32714, 23815}, +{0, -24808, -32415, -17545, 9489, 29944, 29635, 8778, -18166, -32515, -24318, 740, 25285, 32297, 16915, -10196, -30238, -29313, -8063, 18777, 32597, 23815, -1481, -25750, -32165, -16277, 10897, 30514, 28973, 7342, -19380, -32665, -23301, 2220, 26201, 32014, 15629, -11593, -30777, -28621, -6620, 19971, 32714, 22773, -2959, -26640, -31849, -14975, 12282, 31023, 28252, 5892, -20554, -32749, -22236, 3695, 27063, 31666, 14312, -12966, -31254, -27871, -5163, 21125, 32764, 21685, -4430, -27474, -31469, -13643, 13642, 31468, 27473, 4429, -21686, -32765, -21126, 5162, 27870, 31253, 12965, -14313, -31667, -27064, -3696, 22235, 32748, 20553, -5893, -28253, -31024, -12283, 14974, 31848, 26639, 2958, -22774, -32715, -19972, 6619, 28620, 30776, 11592, -15630, -32015, -26202, -2221, 23300, 32664, 19379, -7343, -28974, -30515, -10898, 16276, 32164, 25749, 1480, -23816, -32598, -18778, 8062, 29312, 30237, 10195, -16916, -32298, -25286, -741, 24317, 32514, 18165, -8779, -29636, -29945, -9490, 17544, 32414, 24807}, +{0, -25750, -31849, -13643, 14974, 32164, 24807, -1481, -26640, -31469, -12283, 16276, 32414, 23815, -2959, -27474, -31024, -10898, 17544, 32597, 22773, -4430, -28253, -30515, -9490, 18777, 32714, 21685, -5893, -28974, -29945, -8063, 19971, 32764, 20553, -7343, -29636, -29313, -6620, 21125, 32748, 19379, -8779, -30238, -28621, -5163, 22235, 32664, 18165, -10196, -30777, -27871, -3696, 23300, 32514, 16915, -11593, -31254, -27064, -2221, 24317, 32297, 15629, -12966, -31667, -26202, -741, 25285, 32014, 14312, -14313, -32015, -25286, 740, 26201, 31666, 12965, -15630, -32298, -24318, 2220, 27063, 31253, 11592, -16916, -32515, -23301, 3695, 27870, 30776, 10195, -18166, -32665, -22236, 5162, 28620, 30237, 8778, -19380, -32749, -21126, 6619, 29312, 29635, 7342, -20554, -32765, -19972, 8062, 29944, 28973, 5892, -21686, -32715, -18778, 9489, 30514, 28252, 4429, -22774, -32598, -17545, 10897, 31023, 27473, 2958, -23816, -32415, -16277, 12282, 31468, 26639, 1480, -24808, -32165, -14975, 13642, 31848, 25749}, +{0, -26640, -31024, -9490, 19971, 32748, 18165, -11593, -31667, -25286, 2220, 27870, 30237, 7342, -21686, -32598, -16277, 13642, 32164, 23815, -4430, -28974, -29313, -5163, 23300, 32297, 14312, -15630, -32515, -22236, 6619, 29944, 28252, 2958, -24808, -31849, -12283, 17544, 32714, 20553, -8779, -30777, -27064, -741, 26201, 31253, 10195, -19380, -32765, -18778, 10897, 31468, 25749, -1481, -27474, -30515, -8063, 21125, 32664, 16915, -12966, -32015, -24318, 3695, 28620, 29635, 5892, -22774, -32415, -14975, 14974, 32414, 22773, -5893, -29636, -28621, -3696, 24317, 32014, 12965, -16916, -32665, -21126, 8062, 30514, 27473, 1480, -25750, -31469, -10898, 18777, 32764, 19379, -10196, -31254, -26202, 740, 27063, 30776, 8778, -20554, -32715, -17545, 12282, 31848, 24807, -2959, -28253, -29945, -6620, 22235, 32514, 15629, -14313, -32298, -23301, 5162, 29312, 28973, 4429, -23816, -32165, -13643, 16276, 32597, 21685, -7343, -30238, -27871, -2221, 25285, 31666, 11592, -18166, -32749, -19972, 9489, 31023, 26639}, +{0, -27474, -29945, -5163, 24317, 31666, 10195, -20554, -32598, -14975, 16276, 32714, 19379, -11593, -32015, -23301, 6619, 30514, 26639, -1481, -28253, -29313, -3696, 25285, 31253, 8778, -21686, -32415, -13643, 17544, 32764, 18165, -12966, -32298, -22236, 8062, 31023, 25749, -2959, -28974, -28621, -2221, 26201, 30776, 7342, -22774, -32165, -12283, 18777, 32748, 16915, -14313, -32515, -21126, 9489, 31468, 24807, -4430, -29636, -27871, -741, 27063, 30237, 5892, -23816, -31849, -10898, 19971, 32664, 15629, -15630, -32665, -19972, 10897, 31848, 23815, -5893, -30238, -27064, 740, 27870, 29635, 4429, -24808, -31469, -9490, 21125, 32514, 14312, -16916, -32749, -18778, 12282, 32164, 22773, -7343, -30777, -26202, 2220, 28620, 28973, 2958, -25750, -31024, -8063, 22235, 32297, 12965, -18166, -32765, -17545, 13642, 32414, 21685, -8779, -31254, -25286, 3695, 29312, 28252, 1480, -26640, -30515, -6620, 23300, 32014, 11592, -19380, -32715, -16277, 14974, 32597, 20553, -10196, -31667, -24318, 5162, 29944, 27473}, +{0, -28253, -28621, -741, 27870, 28973, 1480, -27474, -29313, -2221, 27063, 29635, 2958, -26640, -29945, -3696, 26201, 30237, 4429, -25750, -30515, -5163, 25285, 30776, 5892, -24808, -31024, -6620, 24317, 31253, 7342, -23816, -31469, -8063, 23300, 31666, 8778, -22774, -31849, -9490, 22235, 32014, 10195, -21686, -32165, -10898, 21125, 32297, 11592, -20554, -32415, -12283, 19971, 32514, 12965, -19380, -32598, -13643, 18777, 32664, 14312, -18166, -32715, -14975, 17544, 32748, 15629, -16916, -32765, -16277, 16276, 32764, 16915, -15630, -32749, -17545, 14974, 32714, 18165, -14313, -32665, -18778, 13642, 32597, 19379, -12966, -32515, -19972, 12282, 32414, 20553, -11593, -32298, -21126, 10897, 32164, 21685, -10196, -32015, -22236, 9489, 31848, 22773, -8779, -31667, -23301, 8062, 31468, 23815, -7343, -31254, -24318, 6619, 31023, 24807, -5893, -30777, -25286, 5162, 30514, 25749, -4430, -30238, -26202, 3695, 29944, 26639, -2959, -29636, -27064, 2220, 29312, 27473, -1481, -28974, -27871, 740, 28620, 28252}, +{0, -28974, -27064, 3695, 30514, 24807, -7343, -31667, -22236, 10897, 32414, 19379, -14313, -32749, -16277, 17544, 32664, 12965, -20554, -32165, -9490, 23300, 31253, 5892, -25750, -29945, -2221, 27870, 28252, -1481, -29636, -26202, 5162, 31023, 23815, -8779, -32015, -21126, 12282, 32597, 18165, -15630, -32765, -14975, 18777, 32514, 11592, -21686, -31849, -8063, 24317, 30776, 4429, -26640, -29313, -741, 28620, 27473, -2959, -30238, -25286, 6619, 31468, 22773, -10196, -32298, -19972, 13642, 32714, 16915, -16916, -32715, -13643, 19971, 32297, 10195, -22774, -31469, -6620, 25285, 30237, 2958, -27474, -28621, 740, 29312, 26639, -4430, -30777, -24318, 8062, 31848, 21685, -11593, -32515, -18778, 14974, 32764, 15629, -18166, -32598, -12283, 21125, 32014, 8778, -23816, -31024, -5163, 26201, 29635, 1480, -28253, -27871, 2220, 29944, 25749, -5893, -31254, -23301, 9489, 32164, 20553, -12966, -32665, -17545, 16276, 32748, 14312, -19380, -32415, -10898, 22235, 31666, 7342, -24808, -30515, -3696, 27063, 28973}, +{0, -29636, -25286, 8062, 32164, 19379, -15630, -32715, -12283, 22235, 31253, 4429, -27474, -27871, 3695, 31023, 22773, -11593, -32665, -16277, 18777, 32297, 8778, -24808, -29945, -741, 29312, 25749, -7343, -32015, -19972, 14974, 32748, 12965, -21686, -31469, -5163, 27063, 28252, -2959, -30777, -23301, 10897, 32597, 16915, -18166, -32415, -9490, 24317, 30237, 1480, -28974, -26202, 6619, 31848, 20553, -14313, -32765, -13643, 21125, 31666, 5892, -26640, -28621, 2220, 30514, 23815, -10196, -32515, -17545, 17544, 32514, 10195, -23816, -30515, -2221, 28620, 26639, -5893, -31667, -21126, 13642, 32764, 14312, -20554, -31849, -6620, 26201, 28973, -1481, -30238, -24318, 9489, 32414, 18165, -16916, -32598, -10898, 23300, 30776, 2958, -28253, -27064, 5162, 31468, 21685, -12966, -32749, -14975, 19971, 32014, 7342, -25750, -29313, 740, 29944, 24807, -8779, -32298, -18778, 16276, 32664, 11592, -22774, -31024, -3696, 27870, 27473, -4430, -31254, -22236, 12282, 32714, 15629, -19380, -32165, -8063, 25285, 29635}, +{0, -30238, -23301, 12282, 32764, 12965, -22774, -30515, -741, 29944, 23815, -11593, -32749, -13643, 22235, 30776, 1480, -29636, -24318, 10897, 32714, 14312, -21686, -31024, -2221, 29312, 24807, -10196, -32665, -14975, 21125, 31253, 2958, -28974, -25286, 9489, 32597, 15629, -20554, -31469, -3696, 28620, 25749, -8779, -32515, -16277, 19971, 31666, 4429, -28253, -26202, 8062, 32414, 16915, -19380, -31849, -5163, 27870, 26639, -7343, -32298, -17545, 18777, 32014, 5892, -27474, -27064, 6619, 32164, 18165, -18166, -32165, -6620, 27063, 27473, -5893, -32015, -18778, 17544, 32297, 7342, -26640, -27871, 5162, 31848, 19379, -16916, -32415, -8063, 26201, 28252, -4430, -31667, -19972, 16276, 32514, 8778, -25750, -28621, 3695, 31468, 20553, -15630, -32598, -9490, 25285, 28973, -2959, -31254, -21126, 14974, 32664, 10195, -24808, -29313, 2220, 31023, 21685, -14313, -32715, -10898, 24317, 29635, -1481, -30777, -22236, 13642, 32748, 11592, -23816, -29945, 740, 30514, 22773, -12966, -32765, -12283, 23300, 30237}, +{0, -30777, -21126, 16276, 32297, 5892, -28253, -25286, 10897, 32764, 11592, -24808, -28621, 5162, 32164, 16915, -20554, -31024, -741, 30514, 21685, -15630, -32415, -6620, 27870, 25749, -10196, -32749, -12283, 24317, 28973, -4430, -32015, -17545, 19971, 31253, 1480, -30238, -22236, 14974, 32514, 7342, -27474, -26202, 9489, 32714, 12965, -23816, -29313, 3695, 31848, 18165, -19380, -31469, -2221, 29944, 22773, -14313, -32598, -8063, 27063, 26639, -8779, -32665, -13643, 23300, 29635, -2959, -31667, -18778, 18777, 31666, 2958, -29636, -23301, 13642, 32664, 8778, -26640, -27064, 8062, 32597, 14312, -22774, -29945, 2220, 31468, 19379, -18166, -31849, -3696, 29312, 23815, -12966, -32715, -9490, 26201, 27473, -7343, -32515, -14975, 22235, 30237, -1481, -31254, -19972, 17544, 32014, 4429, -28974, -24318, 12282, 32748, 10195, -25750, -27871, 6619, 32414, 15629, -21686, -30515, 740, 31023, 20553, -16916, -32165, -5163, 28620, 24807, -11593, -32765, -10898, 25285, 28252, -5893, -32298, -16277, 21125, 30776}, +{0, -31254, -18778, 19971, 30776, -1481, -31667, -17545, 21125, 30237, -2959, -32015, -16277, 22235, 29635, -4430, -32298, -14975, 23300, 28973, -5893, -32515, -13643, 24317, 28252, -7343, -32665, -12283, 25285, 27473, -8779, -32749, -10898, 26201, 26639, -10196, -32765, -9490, 27063, 25749, -11593, -32715, -8063, 27870, 24807, -12966, -32598, -6620, 28620, 23815, -14313, -32415, -5163, 29312, 22773, -15630, -32165, -3696, 29944, 21685, -16916, -31849, -2221, 30514, 20553, -18166, -31469, -741, 31023, 19379, -19380, -31024, 740, 31468, 18165, -20554, -30515, 2220, 31848, 16915, -21686, -29945, 3695, 32164, 15629, -22774, -29313, 5162, 32414, 14312, -23816, -28621, 6619, 32597, 12965, -24808, -27871, 8062, 32714, 11592, -25750, -27064, 9489, 32764, 10195, -26640, -26202, 10897, 32748, 8778, -27474, -25286, 12282, 32664, 7342, -28253, -24318, 13642, 32514, 5892, -28974, -23301, 14974, 32297, 4429, -29636, -22236, 16276, 32014, 2958, -30238, -21126, 17544, 31666, 1480, -30777, -19972, 18777, 31253}, +{0, -31667, -16277, 23300, 28252, -8779, -32765, -8063, 28620, 22773, -16916, -31469, 740, 31848, 15629, -23816, -27871, 9489, 32748, 7342, -28974, -22236, 17544, 31253, -1481, -32015, -14975, 24317, 27473, -10196, -32715, -6620, 29312, 21685, -18166, -31024, 2220, 32164, 14312, -24808, -27064, 10897, 32664, 5892, -29636, -21126, 18777, 30776, -2959, -32298, -13643, 25285, 26639, -11593, -32598, -5163, 29944, 20553, -19380, -30515, 3695, 32414, 12965, -25750, -26202, 12282, 32514, 4429, -30238, -19972, 19971, 30237, -4430, -32515, -12283, 26201, 25749, -12966, -32415, -3696, 30514, 19379, -20554, -29945, 5162, 32597, 11592, -26640, -25286, 13642, 32297, 2958, -30777, -18778, 21125, 29635, -5893, -32665, -10898, 27063, 24807, -14313, -32165, -2221, 31023, 18165, -21686, -29313, 6619, 32714, 10195, -27474, -24318, 14974, 32014, 1480, -31254, -17545, 22235, 28973, -7343, -32749, -9490, 27870, 23815, -15630, -31849, -741, 31468, 16915, -22774, -28621, 8062, 32764, 8778, -28253, -23301, 16276, 31666}, +{0, -32015, -13643, 26201, 24807, -15630, -31469, 2220, 32414, 11592, -27474, -23301, 17544, 30776, -4430, -32665, -9490, 28620, 21685, -19380, -29945, 6619, 32764, 7342, -29636, -19972, 21125, 28973, -8779, -32715, -5163, 30514, 18165, -22774, -27871, 10897, 32514, 2958, -31254, -16277, 24317, 26639, -12966, -32165, -741, 31848, 14312, -25750, -25286, 14974, 31666, -1481, -32298, -12283, 27063, 23815, -16916, -31024, 3695, 32597, 10195, -28253, -22236, 18777, 30237, -5893, -32749, -8063, 29312, 20553, -20554, -29313, 8062, 32748, 5892, -30238, -18778, 22235, 28252, -10196, -32598, -3696, 31023, 16915, -23816, -27064, 12282, 32297, 1480, -31667, -14975, 25285, 25749, -14313, -31849, 740, 32164, 12965, -26640, -24318, 16276, 31253, -2959, -32515, -10898, 27870, 22773, -18166, -30515, 5162, 32714, 8778, -28974, -21126, 19971, 29635, -7343, -32765, -6620, 29944, 19379, -21686, -28621, 9489, 32664, 4429, -30777, -17545, 23300, 27473, -11593, -32415, -2221, 31468, 15629, -24808, -26202, 13642, 32014}, +{0, -32298, -10898, 28620, 20553, -21686, -27871, 12282, 32014, -1481, -32515, -9490, 29312, 19379, -22774, -27064, 13642, 31666, -2959, -32665, -8063, 29944, 18165, -23816, -26202, 14974, 31253, -4430, -32749, -6620, 30514, 16915, -24808, -25286, 16276, 30776, -5893, -32765, -5163, 31023, 15629, -25750, -24318, 17544, 30237, -7343, -32715, -3696, 31468, 14312, -26640, -23301, 18777, 29635, -8779, -32598, -2221, 31848, 12965, -27474, -22236, 19971, 28973, -10196, -32415, -741, 32164, 11592, -28253, -21126, 21125, 28252, -11593, -32165, 740, 32414, 10195, -28974, -19972, 22235, 27473, -12966, -31849, 2220, 32597, 8778, -29636, -18778, 23300, 26639, -14313, -31469, 3695, 32714, 7342, -30238, -17545, 24317, 25749, -15630, -31024, 5162, 32764, 5892, -30777, -16277, 25285, 24807, -16916, -30515, 6619, 32748, 4429, -31254, -14975, 26201, 23815, -18166, -29945, 8062, 32664, 2958, -31667, -13643, 27063, 22773, -19380, -29313, 9489, 32514, 1480, -32015, -12283, 27870, 21685, -20554, -28621, 10897, 32297}, +{0, -32515, -8063, 30514, 15629, -26640, -22236, 21125, 27473, -14313, -31024, 6619, 32664, 1480, -32298, -9490, 29944, 16915, -25750, -23301, 19971, 28252, -12966, -31469, 5162, 32748, 2958, -32015, -10898, 29312, 18165, -24808, -24318, 18777, 28973, -11593, -31849, 3695, 32764, 4429, -31667, -12283, 28620, 19379, -23816, -25286, 17544, 29635, -10196, -32165, 2220, 32714, 5892, -31254, -13643, 27870, 20553, -22774, -26202, 16276, 30237, -8779, -32415, 740, 32597, 7342, -30777, -14975, 27063, 21685, -21686, -27064, 14974, 30776, -7343, -32598, -741, 32414, 8778, -30238, -16277, 26201, 22773, -20554, -27871, 13642, 31253, -5893, -32715, -2221, 32164, 10195, -29636, -17545, 25285, 23815, -19380, -28621, 12282, 31666, -4430, -32765, -3696, 31848, 11592, -28974, -18778, 24317, 24807, -18166, -29313, 10897, 32014, -2959, -32749, -5163, 31468, 12965, -28253, -19972, 23300, 25749, -16916, -29945, 9489, 32297, -1481, -32665, -6620, 31023, 14312, -27474, -21126, 22235, 26639, -15630, -30515, 8062, 32514}, +{0, -32665, -5163, 31848, 10195, -30238, -14975, 27870, 19379, -24808, -23301, 21125, 26639, -16916, -29313, 12282, 31253, -7343, -32415, 2220, 32764, 2958, -32298, -8063, 31023, 12965, -28974, -17545, 26201, 21685, -22774, -25286, 18777, 28252, -14313, -30515, 9489, 32014, -4430, -32715, -741, 32597, 5892, -31667, -10898, 29944, 15629, -27474, -19972, 24317, 23815, -20554, -27064, 16276, 29635, -11593, -31469, 6619, 32514, -1481, -32749, -3696, 32164, 8778, -30777, -13643, 28620, 18165, -25750, -22236, 22235, 25749, -18166, -28621, 13642, 30776, -8779, -32165, 3695, 32748, 1480, -32515, -6620, 31468, 11592, -29636, -16277, 27063, 20553, -23816, -24318, 19971, 27473, -15630, -29945, 10897, 31666, -5893, -32598, 740, 32714, 4429, -32015, -9490, 30514, 14312, -28253, -18778, 25285, 22773, -21686, -26202, 17544, 28973, -12966, -31024, 8062, 32297, -2959, -32765, -2221, 32414, 7342, -31254, -12283, 29312, 16915, -26640, -21126, 23300, 24807, -19380, -27871, 14974, 30237, -10196, -31849, 5162, 32664}, +{0, -32749, -2221, 32597, 4429, -32298, -6620, 31848, 8778, -31254, -10898, 30514, 12965, -29636, -14975, 28620, 16915, -27474, -18778, 26201, 20553, -24808, -22236, 23300, 23815, -21686, -25286, 19971, 26639, -18166, -27871, 16276, 28973, -14313, -29945, 12282, 30776, -10196, -31469, 8062, 32014, -5893, -32415, 3695, 32664, -1481, -32765, -741, 32714, 2958, -32515, -5163, 32164, 7342, -31667, -9490, 31023, 11592, -30238, -13643, 29312, 15629, -28253, -17545, 27063, 19379, -25750, -21126, 24317, 22773, -22774, -24318, 21125, 25749, -19380, -27064, 17544, 28252, -15630, -29313, 13642, 30237, -11593, -31024, 9489, 31666, -7343, -32165, 5162, 32514, -2959, -32715, 740, 32764, 1480, -32665, -3696, 32414, 5892, -32015, -8063, 31468, 10195, -30777, -12283, 29944, 14312, -28974, -16277, 27870, 18165, -26640, -19972, 25285, 21685, -23816, -23301, 22235, 24807, -20554, -26202, 18777, 27473, -16916, -28621, 14974, 29635, -12966, -30515, 10897, 31253, -8779, -31849, 6619, 32297, -4430, -32598, 2220, 32748}, +{0, -32765, 740, 32748, -1481, -32715, 2220, 32664, -2959, -32598, 3695, 32514, -4430, -32415, 5162, 32297, -5893, -32165, 6619, 32014, -7343, -31849, 8062, 31666, -8779, -31469, 9489, 31253, -10196, -31024, 10897, 30776, -11593, -30515, 12282, 30237, -12966, -29945, 13642, 29635, -14313, -29313, 14974, 28973, -15630, -28621, 16276, 28252, -16916, -27871, 17544, 27473, -18166, -27064, 18777, 26639, -19380, -26202, 19971, 25749, -20554, -25286, 21125, 24807, -21686, -24318, 22235, 23815, -22774, -23301, 23300, 22773, -23816, -22236, 24317, 21685, -24808, -21126, 25285, 20553, -25750, -19972, 26201, 19379, -26640, -18778, 27063, 18165, -27474, -17545, 27870, 16915, -28253, -16277, 28620, 15629, -28974, -14975, 29312, 14312, -29636, -13643, 29944, 12965, -30238, -12283, 30514, 11592, -30777, -10898, 31023, 10195, -31254, -9490, 31468, 8778, -31667, -8063, 31848, 7342, -32015, -6620, 32164, 5892, -32298, -5163, 32414, 4429, -32515, -3696, 32597, 2958, -32665, -2221, 32714, 1480, -32749, -741, 32764}, +{0, -32715, 3695, 32297, -7343, -31469, 10897, 30237, -14313, -28621, 17544, 26639, -20554, -24318, 23300, 21685, -25750, -18778, 27870, 15629, -29636, -12283, 31023, 8778, -32015, -5163, 32597, 1480, -32765, 2220, 32514, -5893, -31849, 9489, 30776, -12966, -29313, 16276, 27473, -19380, -25286, 22235, 22773, -24808, -19972, 27063, 16915, -28974, -13643, 30514, 10195, -31667, -6620, 32414, 2958, -32749, 740, 32664, -4430, -32165, 8062, 31253, -11593, -29945, 14974, 28252, -18166, -26202, 21125, 23815, -23816, -21126, 26201, 18165, -28253, -14975, 29944, 11592, -31254, -8063, 32164, 4429, -32665, -741, 32748, -2959, -32415, 6619, 31666, -10196, -30515, 13642, 28973, -16916, -27064, 19971, 24807, -22774, -22236, 25285, 19379, -27474, -16277, 29312, 12965, -30777, -9490, 31848, 5892, -32515, -2221, 32764, -1481, -32598, 5162, 32014, -8779, -31024, 12282, 29635, -15630, -27871, 18777, 25749, -21686, -23301, 24317, 20553, -26640, -17545, 28620, 14312, -30238, -10898, 31468, 7342, -32298, -3696, 32714}, +{0, -32598, 6619, 31253, -12966, -28621, 18777, 24807, -23816, -19972, 27870, 14312, -30777, -8063, 32414, 1480, -32715, 5162, 31666, -11593, -29313, 17544, 25749, -22774, -21126, 27063, 15629, -30238, -9490, 32164, 2958, -32765, 3695, 32014, -10196, -29945, 16276, 26639, -21686, -22236, 26201, 16915, -29636, -10898, 31848, 4429, -32749, 2220, 32297, -8779, -30515, 14974, 27473, -20554, -23301, 25285, 18165, -28974, -12283, 31468, 5892, -32665, 740, 32514, -7343, -31024, 13642, 28252, -19380, -24318, 24317, 19379, -28253, -13643, 31023, 7342, -32515, -741, 32664, -5893, -31469, 12282, 28973, -18166, -25286, 23300, 20553, -27474, -14975, 30514, 8778, -32298, -2221, 32748, -4430, -31849, 10897, 29635, -16916, -26202, 22235, 21685, -26640, -16277, 29944, 10195, -32015, -3696, 32764, -2959, -32165, 9489, 30237, -15630, -27064, 21125, 22773, -25750, -17545, 29312, 11592, -31667, -5163, 32714, -1481, -32415, 8062, 30776, -14313, -27871, 19971, 23815, -24808, -18778, 28620, 12965, -31254, -6620, 32597}, +{0, -32415, 9489, 29635, -18166, -24318, 25285, 16915, -30238, -8063, 32597, -1481, -32165, 10897, 28973, -19380, -23301, 26201, 15629, -30777, -6620, 32714, -2959, -31849, 12282, 28252, -20554, -22236, 27063, 14312, -31254, -5163, 32764, -4430, -31469, 13642, 27473, -21686, -21126, 27870, 12965, -31667, -3696, 32748, -5893, -31024, 14974, 26639, -22774, -19972, 28620, 11592, -32015, -2221, 32664, -7343, -30515, 16276, 25749, -23816, -18778, 29312, 10195, -32298, -741, 32514, -8779, -29945, 17544, 24807, -24808, -17545, 29944, 8778, -32515, 740, 32297, -10196, -29313, 18777, 23815, -25750, -16277, 30514, 7342, -32665, 2220, 32014, -11593, -28621, 19971, 22773, -26640, -14975, 31023, 5892, -32749, 3695, 31666, -12966, -27871, 21125, 21685, -27474, -13643, 31468, 4429, -32765, 5162, 31253, -14313, -27064, 22235, 20553, -28253, -12283, 31848, 2958, -32715, 6619, 30776, -15630, -26202, 23300, 19379, -28974, -10898, 32164, 1480, -32598, 8062, 30237, -16916, -25286, 24317, 18165, -29636, -9490, 32414}, +{0, -32165, 12282, 27473, -22774, -18778, 29944, 7342, -32749, 5162, 30776, -16916, -24318, 26201, 14312, -31667, -2221, 32514, -10196, -28621, 21125, 20553, -28974, -9490, 32597, -2959, -31469, 14974, 25749, -24808, -16277, 31023, 4429, -32715, 8062, 29635, -19380, -22236, 27870, 11592, -32298, 740, 32014, -12966, -27064, 23300, 18165, -30238, -6620, 32764, -5893, -30515, 17544, 23815, -26640, -13643, 31848, 1480, -32415, 10897, 28252, -21686, -19972, 29312, 8778, -32665, 3695, 31253, -15630, -25286, 25285, 15629, -31254, -3696, 32664, -8779, -29313, 19971, 21685, -28253, -10898, 32414, -1481, -31849, 13642, 26639, -23816, -17545, 30514, 5892, -32765, 6619, 30237, -18166, -23301, 27063, 12965, -32015, -741, 32297, -11593, -27871, 22235, 19379, -29636, -8063, 32714, -4430, -31024, 16276, 24807, -25750, -14975, 31468, 2958, -32598, 9489, 28973, -20554, -21126, 28620, 10195, -32515, 2220, 31666, -14313, -26202, 24317, 16915, -30777, -5163, 32748, -7343, -29945, 18777, 22773, -27474, -12283, 32164}, +{0, -31849, 14974, 24807, -26640, -12283, 32414, -2959, -31024, 17544, 22773, -28253, -9490, 32714, -5893, -29945, 19971, 20553, -29636, -6620, 32748, -8779, -28621, 22235, 18165, -30777, -3696, 32514, -11593, -27064, 24317, 15629, -31667, -741, 32014, -14313, -25286, 26201, 12965, -32298, 2220, 31253, -16916, -23301, 27870, 10195, -32665, 5162, 30237, -19380, -21126, 29312, 7342, -32765, 8062, 28973, -21686, -18778, 30514, 4429, -32598, 10897, 27473, -23816, -16277, 31468, 1480, -32165, 13642, 25749, -25750, -13643, 32164, -1481, -31469, 16276, 23815, -27474, -10898, 32597, -4430, -30515, 18777, 21685, -28974, -8063, 32764, -7343, -29313, 21125, 19379, -30238, -5163, 32664, -10196, -27871, 23300, 16915, -31254, -2221, 32297, -12966, -26202, 25285, 14312, -32015, 740, 31666, -15630, -24318, 27063, 11592, -32515, 3695, 30776, -18166, -22236, 28620, 8778, -32749, 6619, 29635, -20554, -19972, 29944, 5892, -32715, 9489, 28252, -22774, -17545, 31023, 2958, -32415, 12282, 26639, -24808, -14975, 31848}, +{0, -31469, 17544, 21685, -29636, -5163, 32514, -12966, -25286, 27063, 10195, -32749, 8062, 28252, -23816, -14975, 32164, -2959, -30515, 19971, 19379, -30777, -2221, 32014, -15630, -23301, 28620, 7342, -32715, 10897, 26639, -25750, -12283, 32597, -5893, -29313, 22235, 16915, -31667, 740, 31253, -18166, -21126, 29944, 4429, -32415, 13642, 24807, -27474, -9490, 32764, -8779, -27871, 24317, 14312, -32298, 3695, 30237, -20554, -18778, 31023, 1480, -31849, 16276, 22773, -28974, -6620, 32664, -11593, -26202, 26201, 11592, -32665, 6619, 28973, -22774, -16277, 31848, -1481, -31024, 18777, 20553, -30238, -3696, 32297, -14313, -24318, 27870, 8778, -32765, 9489, 27473, -24808, -13643, 32414, -4430, -29945, 21125, 18165, -31254, -741, 31666, -16916, -22236, 29312, 5892, -32598, 12282, 25749, -26640, -10898, 32714, -7343, -28621, 23300, 15629, -32015, 2220, 30776, -19380, -19972, 30514, 2958, -32165, 14974, 23815, -28253, -8063, 32748, -10196, -27064, 25285, 12965, -32515, 5162, 29635, -21686, -17545, 31468}, +{0, -31024, 19971, 18165, -31667, 2220, 30237, -21686, -16277, 32164, -4430, -29313, 23300, 14312, -32515, 6619, 28252, -24808, -12283, 32714, -8779, -27064, 26201, 10195, -32765, 10897, 25749, -27474, -8063, 32664, -12966, -24318, 28620, 5892, -32415, 14974, 22773, -29636, -3696, 32014, -16916, -21126, 30514, 1480, -31469, 18777, 19379, -31254, 740, 30776, -20554, -17545, 31848, -2959, -29945, 22235, 15629, -32298, 5162, 28973, -23816, -13643, 32597, -7343, -27871, 25285, 11592, -32749, 9489, 26639, -26640, -9490, 32748, -11593, -25286, 27870, 7342, -32598, 13642, 23815, -28974, -5163, 32297, -15630, -22236, 29944, 2958, -31849, 17544, 20553, -30777, -741, 31253, -19380, -18778, 31468, -1481, -30515, 21125, 16915, -32015, 3695, 29635, -22774, -14975, 32414, -5893, -28621, 24317, 12965, -32665, 8062, 27473, -25750, -10898, 32764, -10196, -26202, 27063, 8778, -32715, 12282, 24807, -28253, -6620, 32514, -14313, -23301, 29312, 4429, -32165, 16276, 21685, -30238, -2221, 31666, -18166, -19972, 31023}, +{0, -30515, 22235, 14312, -32665, 9489, 25749, -28253, -5163, 32014, -18166, -18778, 31848, -4430, -28621, 25285, 10195, -32715, 13642, 22773, -30238, -741, 30776, -21686, -14975, 32597, -8779, -26202, 27870, 5892, -32165, 17544, 19379, -31667, 3695, 28973, -24808, -10898, 32748, -12966, -23301, 29944, 1480, -31024, 21125, 15629, -32515, 8062, 26639, -27474, -6620, 32297, -16916, -19972, 31468, -2959, -29313, 24317, 11592, -32765, 12282, 23815, -29636, -2221, 31253, -20554, -16277, 32414, -7343, -27064, 27063, 7342, -32415, 16276, 20553, -31254, 2220, 29635, -23816, -12283, 32764, -11593, -24318, 29312, 2958, -31469, 19971, 16915, -32298, 6619, 27473, -26640, -8063, 32514, -15630, -21126, 31023, -1481, -29945, 23300, 12965, -32749, 10897, 24807, -28974, -3696, 31666, -19380, -17545, 32164, -5893, -27871, 26201, 8778, -32598, 14974, 21685, -30777, 740, 30237, -22774, -13643, 32714, -10196, -25286, 28620, 4429, -31849, 18777, 18165, -32015, 5162, 28252, -25750, -9490, 32664, -14313, -22236, 30514}, +{0, -29945, 24317, 10195, -32598, 16276, 19379, -32015, 6619, 26639, -28253, -3696, 31253, -21686, -13643, 32764, -12966, -22236, 31023, -2959, -28621, 26201, 7342, -32165, 18777, 16915, -32515, 9489, 24807, -29636, -741, 30237, -23816, -10898, 32664, -15630, -19972, 31848, -5893, -27064, 27870, 4429, -31469, 21125, 14312, -32749, 12282, 22773, -30777, 2220, 28973, -25750, -8063, 32297, -18166, -17545, 32414, -8779, -25286, 29312, 1480, -30515, 23300, 11592, -32715, 14974, 20553, -31667, 5162, 27473, -27474, -5163, 31666, -20554, -14975, 32714, -11593, -23301, 30514, -1481, -29313, 25285, 8778, -32415, 17544, 18165, -32298, 8062, 25749, -28974, -2221, 30776, -22774, -12283, 32748, -14313, -21126, 31468, -4430, -27871, 27063, 5892, -31849, 19971, 15629, -32665, 10897, 23815, -30238, 740, 29635, -24808, -9490, 32514, -16916, -18778, 32164, -7343, -26202, 28620, 2958, -31024, 22235, 12965, -32765, 13642, 21685, -31254, 3695, 28252, -26640, -6620, 32014, -19380, -16277, 32597, -10196, -24318, 29944}, +{0, -29313, 26201, 5892, -31469, 22235, 11592, -32598, 17544, 16915, -32665, 12282, 21685, -31667, 6619, 25749, -29636, 740, 28973, -26640, -5163, 31253, -22774, -10898, 32514, -18166, -16277, 32714, -12966, -21126, 31848, -7343, -25286, 29944, -1481, -28621, 27063, 4429, -31024, 23300, 10195, -32415, 18777, 15629, -32749, 13642, 20553, -32015, 8062, 24807, -30238, 2220, 28252, -27474, -3696, 30776, -23816, -9490, 32297, -19380, -14975, 32764, -14313, -19972, 32164, -8779, -24318, 30514, -2959, -27871, 27870, 2958, -30515, 24317, 8778, -32165, 19971, 14312, -32765, 14974, 19379, -32298, 9489, 23815, -30777, 3695, 27473, -28253, -2221, 30237, -24808, -8063, 32014, -20554, -13643, 32748, -15630, -18778, 32414, -10196, -23301, 31023, -4430, -27064, 28620, 1480, -29945, 25285, 7342, -31849, 21125, 12965, -32715, 16276, 18165, -32515, 10897, 22773, -31254, 5162, 26639, -28974, -741, 29635, -25750, -6620, 31666, -21686, -12283, 32664, -16916, -17545, 32597, -11593, -22236, 31468, -5893, -26202, 29312}, +{0, -28621, 27870, 1480, -29313, 27063, 2958, -29945, 26201, 4429, -30515, 25285, 5892, -31024, 24317, 7342, -31469, 23300, 8778, -31849, 22235, 10195, -32165, 21125, 11592, -32415, 19971, 12965, -32598, 18777, 14312, -32715, 17544, 15629, -32765, 16276, 16915, -32749, 14974, 18165, -32665, 13642, 19379, -32515, 12282, 20553, -32298, 10897, 21685, -32015, 9489, 22773, -31667, 8062, 23815, -31254, 6619, 24807, -30777, 5162, 25749, -30238, 3695, 26639, -29636, 2220, 27473, -28974, 740, 28252, -28253, -741, 28973, -27474, -2221, 29635, -26640, -3696, 30237, -25750, -5163, 30776, -24808, -6620, 31253, -23816, -8063, 31666, -22774, -9490, 32014, -21686, -10898, 32297, -20554, -12283, 32514, -19380, -13643, 32664, -18166, -14975, 32748, -16916, -16277, 32764, -15630, -17545, 32714, -14313, -18778, 32597, -12966, -19972, 32414, -11593, -21126, 32164, -10196, -22236, 31848, -8779, -23301, 31468, -7343, -24318, 31023, -5893, -25286, 30514, -4430, -26202, 29944, -2959, -27064, 29312, -1481, -27871, 28620}, +{0, -27871, 29312, -2959, -26202, 30514, -5893, -24318, 31468, -8779, -22236, 32164, -11593, -19972, 32597, -14313, -17545, 32764, -16916, -14975, 32664, -19380, -12283, 32297, -21686, -9490, 31666, -23816, -6620, 30776, -25750, -3696, 29635, -27474, -741, 28252, -28974, 2220, 26639, -30238, 5162, 24807, -31254, 8062, 22773, -32015, 10897, 20553, -32515, 13642, 18165, -32749, 16276, 15629, -32715, 18777, 12965, -32415, 21125, 10195, -31849, 23300, 7342, -31024, 25285, 4429, -29945, 27063, 1480, -28621, 28620, -1481, -27064, 29944, -4430, -25286, 31023, -7343, -23301, 31848, -10196, -21126, 32414, -12966, -18778, 32714, -15630, -16277, 32748, -18166, -13643, 32514, -20554, -10898, 32014, -22774, -8063, 31253, -24808, -5163, 30237, -26640, -2221, 28973, -28253, 740, 27473, -29636, 3695, 25749, -30777, 6619, 23815, -31667, 9489, 21685, -32298, 12282, 19379, -32665, 14974, 16915, -32765, 17544, 14312, -32598, 19971, 11592, -32165, 22235, 8778, -31469, 24317, 5892, -30515, 26201, 2958, -29313, 27870}, +{0, -27064, 30514, -7343, -22236, 32414, -14313, -16277, 32664, -20554, -9490, 31253, -25750, -2221, 28252, -29636, 5162, 23815, -32015, 12282, 18165, -32765, 18777, 11592, -31849, 24317, 4429, -29313, 28620, -2959, -25286, 31468, -10196, -19972, 32714, -16916, -13643, 32297, -22774, -6620, 30237, -27474, 740, 26639, -30777, 8062, 21685, -32515, 14974, 15629, -32598, 21125, 8778, -31024, 26201, 1480, -27871, 29944, -5893, -23301, 32164, -12966, -17545, 32748, -19380, -10898, 31666, -24808, -3696, 28973, -28974, 3695, 24807, -31667, 10897, 19379, -32749, 17544, 12965, -32165, 23300, 5892, -29945, 27870, -1481, -26202, 31023, -8779, -21126, 32597, -15630, -14975, 32514, -21686, -8063, 30776, -26640, -741, 27473, -30238, 6619, 22773, -32298, 13642, 16915, -32715, 19971, 10195, -31469, 25285, 2958, -28621, 29312, -4430, -24318, 31848, -11593, -18778, 32764, -18166, -12283, 32014, -23816, -5163, 29635, -28253, 2220, 25749, -31254, 9489, 20553, -32665, 16276, 14312, -32415, 22235, 7342, -30515, 27063}, +{0, -26202, 31468, -11593, -17545, 32664, -21686, -6620, 29635, -28974, 5162, 22773, -32515, 16276, 12965, -31849, 25285, 1480, -27064, 31023, -10196, -18778, 32748, -20554, -8063, 30237, -28253, 3695, 23815, -32298, 14974, 14312, -32165, 24317, 2958, -27871, 30514, -8779, -19972, 32764, -19380, -9490, 30776, -27474, 2220, 24807, -32015, 13642, 15629, -32415, 23300, 4429, -28621, 29944, -7343, -21126, 32714, -18166, -10898, 31253, -26640, 740, 25749, -31667, 12282, 16915, -32598, 22235, 5892, -29313, 29312, -5893, -22236, 32597, -16916, -12283, 31666, -25750, -741, 26639, -31254, 10897, 18165, -32715, 21125, 7342, -29945, 28620, -4430, -23301, 32414, -15630, -13643, 32014, -24808, -2221, 27473, -30777, 9489, 19379, -32765, 19971, 8778, -30515, 27870, -2959, -24318, 32164, -14313, -14975, 32297, -23816, -3696, 28252, -30238, 8062, 20553, -32749, 18777, 10195, -31024, 27063, -1481, -25286, 31848, -12966, -16277, 32514, -22774, -5163, 28973, -29636, 6619, 21685, -32665, 17544, 11592, -31469, 26201}, +{0, -25286, 32164, -15630, -12283, 31253, -27474, 3695, 22773, -32665, 18777, 8778, -29945, 29312, -7343, -19972, 32748, -21686, -5163, 28252, -30777, 10897, 16915, -32415, 24317, 1480, -26202, 31848, -14313, -13643, 31666, -26640, 2220, 23815, -32515, 17544, 10195, -30515, 28620, -5893, -21126, 32764, -20554, -6620, 28973, -30238, 9489, 18165, -32598, 23300, 2958, -27064, 31468, -12966, -14975, 32014, -25750, 740, 24807, -32298, 16276, 11592, -31024, 27870, -4430, -22236, 32714, -19380, -8063, 29635, -29636, 8062, 19379, -32715, 22235, 4429, -27871, 31023, -11593, -16277, 32297, -24808, -741, 25749, -32015, 14974, 12965, -31469, 27063, -2959, -23301, 32597, -18166, -9490, 30237, -28974, 6619, 20553, -32765, 21125, 5892, -28621, 30514, -10196, -17545, 32514, -23816, -2221, 26639, -31667, 13642, 14312, -31849, 26201, -1481, -24318, 32414, -16916, -10898, 30776, -28253, 5162, 21685, -32749, 19971, 7342, -29313, 29944, -8779, -18778, 32664, -22774, -3696, 27473, -31254, 12282, 15629, -32165, 25285}, +{0, -24318, 32597, -19380, -6620, 28252, -31254, 13642, 12965, -31024, 28620, -7343, -18778, 32514, -24808, 740, 23815, -32665, 19971, 5892, -27871, 31468, -14313, -12283, 30776, -28974, 8062, 18165, -32415, 25285, -1481, -23301, 32714, -20554, -5163, 27473, -31667, 14974, 11592, -30515, 29312, -8779, -17545, 32297, -25750, 2220, 22773, -32749, 21125, 4429, -27064, 31848, -15630, -10898, 30237, -29636, 9489, 16915, -32165, 26201, -2959, -22236, 32764, -21686, -3696, 26639, -32015, 16276, 10195, -29945, 29944, -10196, -16277, 32014, -26640, 3695, 21685, -32765, 22235, 2958, -26202, 32164, -16916, -9490, 29635, -30238, 10897, 15629, -31849, 27063, -4430, -21126, 32748, -22774, -2221, 25749, -32298, 17544, 8778, -29313, 30514, -11593, -14975, 31666, -27474, 5162, 20553, -32715, 23300, 1480, -25286, 32414, -18166, -8063, 28973, -30777, 12282, 14312, -31469, 27870, -5893, -19972, 32664, -23816, -741, 24807, -32515, 18777, 7342, -28621, 31023, -12966, -13643, 31253, -28253, 6619, 19379, -32598, 24317}, +{0, -23301, 32764, -22774, -741, 23815, -32749, 22235, 1480, -24318, 32714, -21686, -2221, 24807, -32665, 21125, 2958, -25286, 32597, -20554, -3696, 25749, -32515, 19971, 4429, -26202, 32414, -19380, -5163, 26639, -32298, 18777, 5892, -27064, 32164, -18166, -6620, 27473, -32015, 17544, 7342, -27871, 31848, -16916, -8063, 28252, -31667, 16276, 8778, -28621, 31468, -15630, -9490, 28973, -31254, 14974, 10195, -29313, 31023, -14313, -10898, 29635, -30777, 13642, 11592, -29945, 30514, -12966, -12283, 30237, -30238, 12282, 12965, -30515, 29944, -11593, -13643, 30776, -29636, 10897, 14312, -31024, 29312, -10196, -14975, 31253, -28974, 9489, 15629, -31469, 28620, -8779, -16277, 31666, -28253, 8062, 16915, -31849, 27870, -7343, -17545, 32014, -27474, 6619, 18165, -32165, 27063, -5893, -18778, 32297, -26640, 5162, 19379, -32415, 26201, -4430, -19972, 32514, -25750, 3695, 20553, -32598, 25285, -2959, -21126, 32664, -24808, 2220, 21685, -32715, 24317, -1481, -22236, 32748, -23816, 740, 22773, -32765, 23300}, +{0, -22236, 32664, -25750, 5162, 18165, -31849, 28620, -10196, -13643, 30237, -30777, 14974, 8778, -27871, 32164, -19380, -3696, 24807, -32749, 23300, -1481, -21126, 32514, -26640, 6619, 16915, -31469, 29312, -11593, -12283, 29635, -31254, 16276, 7342, -27064, 32414, -20554, -2221, 23815, -32765, 24317, -2959, -19972, 32297, -27474, 8062, 15629, -31024, 29944, -12966, -10898, 28973, -31667, 17544, 5892, -26202, 32597, -21686, -741, 22773, -32715, 25285, -4430, -18778, 32014, -28253, 9489, 14312, -30515, 30514, -14313, -9490, 28252, -32015, 18777, 4429, -25286, 32714, -22774, 740, 21685, -32598, 26201, -5893, -17545, 31666, -28974, 10897, 12965, -29945, 31023, -15630, -8063, 27473, -32298, 19971, 2958, -24318, 32764, -23816, 2220, 20553, -32415, 27063, -7343, -16277, 31253, -29636, 12282, 11592, -29313, 31468, -16916, -6620, 26639, -32515, 21125, 1480, -23301, 32748, -24808, 3695, 19379, -32165, 27870, -8779, -14975, 30776, -30238, 13642, 10195, -28621, 31848, -18166, -5163, 25749, -32665, 22235}, +{0, -21126, 32297, -28253, 10897, 11592, -28621, 32164, -20554, -741, 21685, -32415, 27870, -10196, -12283, 28973, -32015, 19971, 1480, -22236, 32514, -27474, 9489, 12965, -29313, 31848, -19380, -2221, 22773, -32598, 27063, -8779, -13643, 29635, -31667, 18777, 2958, -23301, 32664, -26640, 8062, 14312, -29945, 31468, -18166, -3696, 23815, -32715, 26201, -7343, -14975, 30237, -31254, 17544, 4429, -24318, 32748, -25750, 6619, 15629, -30515, 31023, -16916, -5163, 24807, -32765, 25285, -5893, -16277, 30776, -30777, 16276, 5892, -25286, 32764, -24808, 5162, 16915, -31024, 30514, -15630, -6620, 25749, -32749, 24317, -4430, -17545, 31253, -30238, 14974, 7342, -26202, 32714, -23816, 3695, 18165, -31469, 29944, -14313, -8063, 26639, -32665, 23300, -2959, -18778, 31666, -29636, 13642, 8778, -27064, 32597, -22774, 2220, 19379, -31849, 29312, -12966, -9490, 27473, -32515, 22235, -1481, -19972, 32014, -28974, 12282, 10195, -27871, 32414, -21686, 740, 20553, -32165, 28620, -11593, -10898, 28252, -32298, 21125}, +{0, -19972, 31666, -30238, 16276, 4429, -23301, 32514, -28253, 12282, 8778, -26202, 32764, -25750, 8062, 12965, -28621, 32414, -22774, 3695, 16915, -30515, 31468, -19380, -741, 20553, -31849, 29944, -15630, -5163, 23815, -32598, 27870, -11593, -9490, 26639, -32749, 25285, -7343, -13643, 28973, -32298, 22235, -2959, -17545, 30776, -31254, 18777, 1480, -21126, 32014, -29636, 14974, 5892, -24318, 32664, -27474, 10897, 10195, -27064, 32714, -24808, 6619, 14312, -29313, 32164, -21686, 2220, 18165, -31024, 31023, -18166, -2221, 21685, -32165, 29312, -14313, -6620, 24807, -32715, 27063, -10196, -10898, 27473, -32665, 24317, -5893, -14975, 29635, -32015, 21125, -1481, -18778, 31253, -30777, 17544, 2958, -22236, 32297, -28974, 13642, 7342, -25286, 32748, -26640, 9489, 11592, -27871, 32597, -23816, 5162, 15629, -29945, 31848, -20554, 740, 19379, -31469, 30514, -16916, -3696, 22773, -32415, 28620, -12966, -8063, 25749, -32765, 26201, -8779, -12283, 28252, -32515, 23300, -4430, -16277, 30237, -31667, 19971}, +{0, -18778, 30776, -31667, 21125, -2959, -16277, 29635, -32298, 23300, -5893, -13643, 28252, -32665, 25285, -8779, -10898, 26639, -32765, 27063, -11593, -8063, 24807, -32598, 28620, -14313, -5163, 22773, -32165, 29944, -16916, -2221, 20553, -31469, 31023, -19380, 740, 18165, -30515, 31848, -21686, 3695, 15629, -29313, 32414, -23816, 6619, 12965, -27871, 32714, -25750, 9489, 10195, -26202, 32748, -27474, 12282, 7342, -24318, 32514, -28974, 14974, 4429, -22236, 32014, -30238, 17544, 1480, -19972, 31253, -31254, 19971, -1481, -17545, 30237, -32015, 22235, -4430, -14975, 28973, -32515, 24317, -7343, -12283, 27473, -32749, 26201, -10196, -9490, 25749, -32715, 27870, -12966, -6620, 23815, -32415, 29312, -15630, -3696, 21685, -31849, 30514, -18166, -741, 19379, -31024, 31468, -20554, 2220, 16915, -29945, 32164, -22774, 5162, 14312, -28621, 32597, -24808, 8062, 11592, -27064, 32764, -26640, 10897, 8778, -25286, 32664, -28253, 13642, 5892, -23301, 32297, -29636, 16276, 2958, -21126, 31666, -30777, 18777}, +{0, -17545, 29635, -32515, 25285, -10196, -8063, 23815, -32165, 30514, -19380, 2220, 15629, -28621, 32714, -26640, 12282, 5892, -22236, 31666, -31254, 21125, -4430, -13643, 27473, -32765, 27870, -14313, -3696, 20553, -31024, 31848, -22774, 6619, 11592, -26202, 32664, -28974, 16276, 1480, -18778, 30237, -32298, 24317, -8779, -9490, 24807, -32415, 29944, -18166, 740, 16915, -29313, 32597, -25750, 10897, 7342, -23301, 32014, -30777, 19971, -2959, -14975, 28252, -32749, 27063, -12966, -5163, 21685, -31469, 31468, -21686, 5162, 12965, -27064, 32748, -28253, 14974, 2958, -19972, 30776, -32015, 23300, -7343, -10898, 25749, -32598, 29312, -16916, -741, 18165, -29945, 32414, -24808, 9489, 8778, -24318, 32297, -30238, 18777, -1481, -16277, 28973, -32665, 26201, -11593, -6620, 22773, -31849, 31023, -20554, 3695, 14312, -27871, 32764, -27474, 13642, 4429, -21126, 31253, -31667, 22235, -5893, -12283, 26639, -32715, 28620, -15630, -2221, 19379, -30515, 32164, -23816, 8062, 10195, -25286, 32514, -29636, 17544}, +{0, -16277, 28252, -32765, 28620, -16916, 740, 15629, -27871, 32748, -28974, 17544, -1481, -14975, 27473, -32715, 29312, -18166, 2220, 14312, -27064, 32664, -29636, 18777, -2959, -13643, 26639, -32598, 29944, -19380, 3695, 12965, -26202, 32514, -30238, 19971, -4430, -12283, 25749, -32415, 30514, -20554, 5162, 11592, -25286, 32297, -30777, 21125, -5893, -10898, 24807, -32165, 31023, -21686, 6619, 10195, -24318, 32014, -31254, 22235, -7343, -9490, 23815, -31849, 31468, -22774, 8062, 8778, -23301, 31666, -31667, 23300, -8779, -8063, 22773, -31469, 31848, -23816, 9489, 7342, -22236, 31253, -32015, 24317, -10196, -6620, 21685, -31024, 32164, -24808, 10897, 5892, -21126, 30776, -32298, 25285, -11593, -5163, 20553, -30515, 32414, -25750, 12282, 4429, -19972, 30237, -32515, 26201, -12966, -3696, 19379, -29945, 32597, -26640, 13642, 2958, -18778, 29635, -32665, 27063, -14313, -2221, 18165, -29313, 32714, -27474, 14974, 1480, -17545, 28973, -32749, 27870, -15630, -741, 16915, -28621, 32764, -28253, 16276}, +{0, -14975, 26639, -32415, 31023, -22774, 9489, 5892, -19972, 29635, -32749, 28620, -18166, 3695, 11592, -24318, 31666, -32015, 25285, -12966, -2221, 16915, -27871, 32664, -30238, 21125, -7343, -8063, 21685, -30515, 32597, -27474, 16276, -1481, -13643, 25749, -32165, 31468, -23816, 10897, 4429, -18778, 28973, -32765, 29312, -19380, 5162, 10195, -23301, 31253, -32298, 26201, -14313, -741, 15629, -27064, 32514, -30777, 22235, -8779, -6620, 20553, -29945, 32714, -28253, 17544, -2959, -12283, 24807, -31849, 31848, -24808, 12282, 2958, -17545, 28252, -32715, 29944, -20554, 6619, 8778, -22236, 30776, -32515, 27063, -15630, 740, 14312, -26202, 32297, -31254, 23300, -10196, -5163, 19379, -29313, 32764, -28974, 18777, -4430, -10898, 23815, -31469, 32164, -25750, 13642, 1480, -16277, 27473, -32598, 30514, -21686, 8062, 7342, -21126, 30237, -32665, 27870, -16916, 2220, 12965, -25286, 32014, -31667, 24317, -11593, -3696, 18165, -28621, 32748, -29636, 19971, -5893, -9490, 22773, -31024, 32414, -26640, 14974}, +{0, -13643, 24807, -31469, 32414, -27474, 17544, -4430, -9490, 21685, -29945, 32764, -29636, 21125, -8779, -5163, 18165, -27871, 32514, -31254, 24317, -12966, -741, 14312, -25286, 31666, -32298, 27063, -16916, 3695, 10195, -22236, 30237, -32749, 29312, -20554, 8062, 5892, -18778, 28252, -32598, 31023, -23816, 12282, 1480, -14975, 25749, -31849, 32164, -26640, 16276, -2959, -10898, 22773, -30515, 32714, -28974, 19971, -7343, -6620, 19379, -28621, 32664, -30777, 23300, -11593, -2221, 15629, -26202, 32014, -32015, 26201, -15630, 2220, 11592, -23301, 30776, -32665, 28620, -19380, 6619, 7342, -19972, 28973, -32715, 30514, -22774, 10897, 2958, -16277, 26639, -32165, 31848, -25750, 14974, -1481, -12283, 23815, -31024, 32597, -28253, 18777, -5893, -8063, 20553, -29313, 32748, -30238, 22235, -10196, -3696, 16915, -27064, 32297, -31667, 25285, -14313, 740, 12965, -24318, 31253, -32515, 27870, -18166, 5162, 8778, -21126, 29635, -32765, 29944, -21686, 9489, 4429, -17545, 27473, -32415, 31468, -24808, 13642}, +{0, -12283, 22773, -29945, 32748, -30777, 24317, -14313, 2220, 10195, -21126, 28973, -32598, 31468, -25750, 16276, -4430, -8063, 19379, -27871, 32297, -32015, 27063, -18166, 6619, 5892, -17545, 26639, -31849, 32414, -28253, 19971, -8779, -3696, 15629, -25286, 31253, -32665, 29312, -21686, 10897, 1480, -13643, 23815, -30515, 32764, -30238, 23300, -12966, 740, 11592, -22236, 29635, -32715, 31023, -24808, 14974, -2959, -9490, 20553, -28621, 32514, -31667, 26201, -16916, 5162, 7342, -18778, 27473, -32165, 32164, -27474, 18777, -7343, -5163, 16915, -26202, 31666, -32515, 28620, -20554, 9489, 2958, -14975, 24807, -31024, 32714, -29636, 22235, -11593, -741, 12965, -23301, 30237, -32765, 30514, -23816, 13642, -1481, -10898, 21685, -29313, 32664, -31254, 25285, -15630, 3695, 8778, -19972, 28252, -32415, 31848, -26640, 17544, -5893, -6620, 18165, -27064, 32014, -32298, 27870, -19380, 8062, 4429, -16277, 25749, -31469, 32597, -28974, 21125, -10196, -2221, 14312, -24318, 30776, -32749, 29944, -22774, 12282}, +{0, -10898, 20553, -27871, 32014, -32515, 29312, -22774, 13642, -2959, -8063, 18165, -26202, 31253, -32749, 30514, -24808, 16276, -5893, -5163, 15629, -24318, 30237, -32715, 31468, -26640, 18777, -8779, -2221, 12965, -22236, 28973, -32415, 32164, -28253, 21125, -11593, 740, 10195, -19972, 27473, -31849, 32597, -29636, 23300, -14313, 3695, 7342, -17545, 25749, -31024, 32764, -30777, 25285, -16916, 6619, 4429, -14975, 23815, -29945, 32664, -31667, 27063, -19380, 9489, 1480, -12283, 21685, -28621, 32297, -32298, 28620, -21686, 12282, -1481, -9490, 19379, -27064, 31666, -32665, 29944, -23816, 14974, -4430, -6620, 16915, -25286, 30776, -32765, 31023, -25750, 17544, -7343, -3696, 14312, -23301, 29635, -32598, 31848, -27474, 19971, -10196, -741, 11592, -21126, 28252, -32165, 32414, -28974, 22235, -12966, 2220, 8778, -18778, 26639, -31469, 32714, -30238, 24317, -15630, 5162, 5892, -16277, 24807, -30515, 32748, -31254, 26201, -18166, 8062, 2958, -13643, 22773, -29313, 32514, -32015, 27870, -20554, 10897}, +{0, -9490, 18165, -25286, 30237, -32598, 32164, -28974, 23300, -15630, 6619, 2958, -12283, 20553, -27064, 31253, -32765, 31468, -27474, 21125, -12966, 3695, 5892, -14975, 22773, -28621, 32014, -32665, 30514, -25750, 18777, -10196, 740, 8778, -17545, 24807, -29945, 32514, -32298, 29312, -23816, 16276, -7343, -2221, 11592, -19972, 26639, -31024, 32748, -31667, 27870, -21686, 13642, -4430, -5163, 14312, -22236, 28252, -31849, 32714, -30777, 26201, -19380, 10897, -1481, -8063, 16915, -24318, 29635, -32415, 32414, -29636, 24317, -16916, 8062, 1480, -10898, 19379, -26202, 30776, -32715, 31848, -28253, 22235, -14313, 5162, 4429, -13643, 21685, -27871, 31666, -32749, 31023, -26640, 19971, -11593, 2220, 7342, -16277, 23815, -29313, 32297, -32515, 29944, -24808, 17544, -8779, -741, 10195, -18778, 25749, -30515, 32664, -32015, 28620, -22774, 14974, -5893, -3696, 12965, -21126, 27473, -31469, 32764, -31254, 27063, -20554, 12282, -2959, -6620, 15629, -23301, 28973, -32165, 32597, -30238, 25285, -18166, 9489}, +{0, -8063, 15629, -22236, 27473, -31024, 32664, -32298, 29944, -25750, 19971, -12966, 5162, 2958, -10898, 18165, -24318, 28973, -31849, 32764, -31667, 28620, -23816, 17544, -10196, 2220, 5892, -13643, 20553, -26202, 30237, -32415, 32597, -30777, 27063, -21686, 14974, -7343, -741, 8778, -16277, 22773, -27871, 31253, -32715, 32164, -29636, 25285, -19380, 12282, -4430, -3696, 11592, -18778, 24807, -29313, 32014, -32749, 31468, -28253, 23300, -16916, 9489, -1481, -6620, 14312, -21126, 26639, -30515, 32514, -32515, 30514, -26640, 21125, -14313, 6619, 1480, -9490, 16915, -23301, 28252, -31469, 32748, -32015, 29312, -24808, 18777, -11593, 3695, 4429, -12283, 19379, -25286, 29635, -32165, 32714, -31254, 27870, -22774, 16276, -8779, 740, 7342, -14975, 21685, -27064, 30776, -32598, 32414, -30238, 26201, -20554, 13642, -5893, -2221, 10195, -17545, 23815, -28621, 31666, -32765, 31848, -28974, 24317, -18166, 10897, -2959, -5163, 12965, -19972, 25749, -29945, 32297, -32665, 31023, -27474, 22235, -15630, 8062}, +{0, -6620, 12965, -18778, 23815, -27871, 30776, -32415, 32714, -31667, 29312, -25750, 21125, -15630, 9489, -2959, -3696, 10195, -16277, 21685, -26202, 29635, -31849, 32748, -32298, 30514, -27474, 23300, -18166, 12282, -5893, -741, 7342, -13643, 19379, -24318, 28252, -31024, 32514, -32665, 31468, -28974, 25285, -20554, 14974, -8779, 2220, 4429, -10898, 16915, -22236, 26639, -29945, 32014, -32765, 32164, -30238, 27063, -22774, 17544, -11593, 5162, 1480, -8063, 14312, -19972, 24807, -28621, 31253, -32598, 32597, -31254, 28620, -24808, 19971, -14313, 8062, -1481, -5163, 11592, -17545, 22773, -27064, 30237, -32165, 32764, -32015, 29944, -26640, 22235, -16916, 10897, -4430, -2221, 8778, -14975, 20553, -25286, 28973, -31469, 32664, -32515, 31023, -28253, 24317, -19380, 13642, -7343, 740, 5892, -12283, 18165, -23301, 27473, -30515, 32297, -32749, 31848, -29636, 26201, -21686, 16276, -10196, 3695, 2958, -9490, 15629, -21126, 25749, -29313, 31666, -32715, 32414, -30777, 27870, -23816, 18777, -12966, 6619}, +{0, -5163, 10195, -14975, 19379, -23301, 26639, -29313, 31253, -32415, 32764, -32298, 31023, -28974, 26201, -22774, 18777, -14313, 9489, -4430, -741, 5892, -10898, 15629, -19972, 23815, -27064, 29635, -31469, 32514, -32749, 32164, -30777, 28620, -25750, 22235, -18166, 13642, -8779, 3695, 1480, -6620, 11592, -16277, 20553, -24318, 27473, -29945, 31666, -32598, 32714, -32015, 30514, -28253, 25285, -21686, 17544, -12966, 8062, -2959, -2221, 7342, -12283, 16915, -21126, 24807, -27871, 30237, -31849, 32664, -32665, 31848, -30238, 27870, -24808, 21125, -16916, 12282, -7343, 2220, 2958, -8063, 12965, -17545, 21685, -25286, 28252, -30515, 32014, -32715, 32597, -31667, 29944, -27474, 24317, -20554, 16276, -11593, 6619, -1481, -3696, 8778, -13643, 18165, -22236, 25749, -28621, 30776, -32165, 32748, -32515, 31468, -29636, 27063, -23816, 19971, -15630, 10897, -5893, 740, 4429, -9490, 14312, -18778, 22773, -26202, 28973, -31024, 32297, -32765, 32414, -31254, 29312, -26640, 23300, -19380, 14974, -10196, 5162}, +{0, -3696, 7342, -10898, 14312, -17545, 20553, -23301, 25749, -27871, 29635, -31024, 32014, -32598, 32764, -32515, 31848, -30777, 29312, -27474, 25285, -22774, 19971, -16916, 13642, -10196, 6619, -2959, -741, 4429, -8063, 11592, -14975, 18165, -21126, 23815, -26202, 28252, -29945, 31253, -32165, 32664, -32749, 32414, -31667, 30514, -28974, 27063, -24808, 22235, -19380, 16276, -12966, 9489, -5893, 2220, 1480, -5163, 8778, -12283, 15629, -18778, 21685, -24318, 26639, -28621, 30237, -31469, 32297, -32715, 32714, -32298, 31468, -30238, 28620, -26640, 24317, -21686, 18777, -15630, 12282, -8779, 5162, -1481, -2221, 5892, -9490, 12965, -16277, 19379, -22236, 24807, -27064, 28973, -30515, 31666, -32415, 32748, -32665, 32164, -31254, 29944, -28253, 26201, -23816, 21125, -18166, 14974, -11593, 8062, -4430, 740, 2958, -6620, 10195, -13643, 16915, -19972, 22773, -25286, 27473, -29313, 30776, -31849, 32514, -32765, 32597, -32015, 31023, -29636, 27870, -25750, 23300, -20554, 17544, -14313, 10897, -7343, 3695}, +{0, -2221, 4429, -6620, 8778, -10898, 12965, -14975, 16915, -18778, 20553, -22236, 23815, -25286, 26639, -27871, 28973, -29945, 30776, -31469, 32014, -32415, 32664, -32765, 32714, -32515, 32164, -31667, 31023, -30238, 29312, -28253, 27063, -25750, 24317, -22774, 21125, -19380, 17544, -15630, 13642, -11593, 9489, -7343, 5162, -2959, 740, 1480, -3696, 5892, -8063, 10195, -12283, 14312, -16277, 18165, -19972, 21685, -23301, 24807, -26202, 27473, -28621, 29635, -30515, 31253, -31849, 32297, -32598, 32748, -32749, 32597, -32298, 31848, -31254, 30514, -29636, 28620, -27474, 26201, -24808, 23300, -21686, 19971, -18166, 16276, -14313, 12282, -10196, 8062, -5893, 3695, -1481, -741, 2958, -5163, 7342, -9490, 11592, -13643, 15629, -17545, 19379, -21126, 22773, -24318, 25749, -27064, 28252, -29313, 30237, -31024, 31666, -32165, 32514, -32715, 32764, -32665, 32414, -32015, 31468, -30777, 29944, -28974, 27870, -26640, 25285, -23816, 22235, -20554, 18777, -16916, 14974, -12966, 10897, -8779, 6619, -4430, 2220}, +{0, -741, 1480, -2221, 2958, -3696, 4429, -5163, 5892, -6620, 7342, -8063, 8778, -9490, 10195, -10898, 11592, -12283, 12965, -13643, 14312, -14975, 15629, -16277, 16915, -17545, 18165, -18778, 19379, -19972, 20553, -21126, 21685, -22236, 22773, -23301, 23815, -24318, 24807, -25286, 25749, -26202, 26639, -27064, 27473, -27871, 28252, -28621, 28973, -29313, 29635, -29945, 30237, -30515, 30776, -31024, 31253, -31469, 31666, -31849, 32014, -32165, 32297, -32415, 32514, -32598, 32664, -32715, 32748, -32765, 32764, -32749, 32714, -32665, 32597, -32515, 32414, -32298, 32164, -32015, 31848, -31667, 31468, -31254, 31023, -30777, 30514, -30238, 29944, -29636, 29312, -28974, 28620, -28253, 27870, -27474, 27063, -26640, 26201, -25750, 25285, -24808, 24317, -23816, 23300, -22774, 22235, -21686, 21125, -20554, 19971, -19380, 18777, -18166, 17544, -16916, 16276, -15630, 14974, -14313, 13642, -12966, 12282, -11593, 10897, -10196, 9489, -8779, 8062, -7343, 6619, -5893, 5162, -4430, 3695, -2959, 2220, -1481, 740}, +{0, 740, -1481, 2220, -2959, 3695, -4430, 5162, -5893, 6619, -7343, 8062, -8779, 9489, -10196, 10897, -11593, 12282, -12966, 13642, -14313, 14974, -15630, 16276, -16916, 17544, -18166, 18777, -19380, 19971, -20554, 21125, -21686, 22235, -22774, 23300, -23816, 24317, -24808, 25285, -25750, 26201, -26640, 27063, -27474, 27870, -28253, 28620, -28974, 29312, -29636, 29944, -30238, 30514, -30777, 31023, -31254, 31468, -31667, 31848, -32015, 32164, -32298, 32414, -32515, 32597, -32665, 32714, -32749, 32764, -32765, 32748, -32715, 32664, -32598, 32514, -32415, 32297, -32165, 32014, -31849, 31666, -31469, 31253, -31024, 30776, -30515, 30237, -29945, 29635, -29313, 28973, -28621, 28252, -27871, 27473, -27064, 26639, -26202, 25749, -25286, 24807, -24318, 23815, -23301, 22773, -22236, 21685, -21126, 20553, -19972, 19379, -18778, 18165, -17545, 16915, -16277, 15629, -14975, 14312, -13643, 12965, -12283, 11592, -10898, 10195, -9490, 8778, -8063, 7342, -6620, 5892, -5163, 4429, -3696, 2958, -2221, 1480, -741}, +{0, 2220, -4430, 6619, -8779, 10897, -12966, 14974, -16916, 18777, -20554, 22235, -23816, 25285, -26640, 27870, -28974, 29944, -30777, 31468, -32015, 32414, -32665, 32764, -32715, 32514, -32165, 31666, -31024, 30237, -29313, 28252, -27064, 25749, -24318, 22773, -21126, 19379, -17545, 15629, -13643, 11592, -9490, 7342, -5163, 2958, -741, -1481, 3695, -5893, 8062, -10196, 12282, -14313, 16276, -18166, 19971, -21686, 23300, -24808, 26201, -27474, 28620, -29636, 30514, -31254, 31848, -32298, 32597, -32749, 32748, -32598, 32297, -31849, 31253, -30515, 29635, -28621, 27473, -26202, 24807, -23301, 21685, -19972, 18165, -16277, 14312, -12283, 10195, -8063, 5892, -3696, 1480, 740, -2959, 5162, -7343, 9489, -11593, 13642, -15630, 17544, -19380, 21125, -22774, 24317, -25750, 27063, -28253, 29312, -30238, 31023, -31667, 32164, -32515, 32714, -32765, 32664, -32415, 32014, -31469, 30776, -29945, 28973, -27871, 26639, -25286, 23815, -22236, 20553, -18778, 16915, -14975, 12965, -10898, 8778, -6620, 4429, -2221}, +{0, 3695, -7343, 10897, -14313, 17544, -20554, 23300, -25750, 27870, -29636, 31023, -32015, 32597, -32765, 32514, -31849, 30776, -29313, 27473, -25286, 22773, -19972, 16915, -13643, 10195, -6620, 2958, 740, -4430, 8062, -11593, 14974, -18166, 21125, -23816, 26201, -28253, 29944, -31254, 32164, -32665, 32748, -32415, 31666, -30515, 28973, -27064, 24807, -22236, 19379, -16277, 12965, -9490, 5892, -2221, -1481, 5162, -8779, 12282, -15630, 18777, -21686, 24317, -26640, 28620, -30238, 31468, -32298, 32714, -32715, 32297, -31469, 30237, -28621, 26639, -24318, 21685, -18778, 15629, -12283, 8778, -5163, 1480, 2220, -5893, 9489, -12966, 16276, -19380, 22235, -24808, 27063, -28974, 30514, -31667, 32414, -32749, 32664, -32165, 31253, -29945, 28252, -26202, 23815, -21126, 18165, -14975, 11592, -8063, 4429, -741, -2959, 6619, -10196, 13642, -16916, 19971, -22774, 25285, -27474, 29312, -30777, 31848, -32515, 32764, -32598, 32014, -31024, 29635, -27871, 25749, -23301, 20553, -17545, 14312, -10898, 7342, -3696}, +{0, 5162, -10196, 14974, -19380, 23300, -26640, 29312, -31254, 32414, -32765, 32297, -31024, 28973, -26202, 22773, -18778, 14312, -9490, 4429, 740, -5893, 10897, -15630, 19971, -23816, 27063, -29636, 31468, -32515, 32748, -32165, 30776, -28621, 25749, -22236, 18165, -13643, 8778, -3696, -1481, 6619, -11593, 16276, -20554, 24317, -27474, 29944, -31667, 32597, -32715, 32014, -30515, 28252, -25286, 21685, -17545, 12965, -8063, 2958, 2220, -7343, 12282, -16916, 21125, -24808, 27870, -30238, 31848, -32665, 32664, -31849, 30237, -27871, 24807, -21126, 16915, -12283, 7342, -2221, -2959, 8062, -12966, 17544, -21686, 25285, -28253, 30514, -32015, 32714, -32598, 31666, -29945, 27473, -24318, 20553, -16277, 11592, -6620, 1480, 3695, -8779, 13642, -18166, 22235, -25750, 28620, -30777, 32164, -32749, 32514, -31469, 29635, -27064, 23815, -19972, 15629, -10898, 5892, -741, -4430, 9489, -14313, 18777, -22774, 26201, -28974, 31023, -32298, 32764, -32415, 31253, -29313, 26639, -23301, 19379, -14975, 10195, -5163}, +{0, 6619, -12966, 18777, -23816, 27870, -30777, 32414, -32715, 31666, -29313, 25749, -21126, 15629, -9490, 2958, 3695, -10196, 16276, -21686, 26201, -29636, 31848, -32749, 32297, -30515, 27473, -23301, 18165, -12283, 5892, 740, -7343, 13642, -19380, 24317, -28253, 31023, -32515, 32664, -31469, 28973, -25286, 20553, -14975, 8778, -2221, -4430, 10897, -16916, 22235, -26640, 29944, -32015, 32764, -32165, 30237, -27064, 22773, -17545, 11592, -5163, -1481, 8062, -14313, 19971, -24808, 28620, -31254, 32597, -32598, 31253, -28621, 24807, -19972, 14312, -8063, 1480, 5162, -11593, 17544, -22774, 27063, -30238, 32164, -32765, 32014, -29945, 26639, -22236, 16915, -10898, 4429, 2220, -8779, 14974, -20554, 25285, -28974, 31468, -32665, 32514, -31024, 28252, -24318, 19379, -13643, 7342, -741, -5893, 12282, -18166, 23300, -27474, 30514, -32298, 32748, -31849, 29635, -26202, 21685, -16277, 10195, -3696, -2959, 9489, -15630, 21125, -25750, 29312, -31667, 32714, -32415, 30776, -27871, 23815, -18778, 12965, -6620}, +{0, 8062, -15630, 22235, -27474, 31023, -32665, 32297, -29945, 25749, -19972, 12965, -5163, -2959, 10897, -18166, 24317, -28974, 31848, -32765, 31666, -28621, 23815, -17545, 10195, -2221, -5893, 13642, -20554, 26201, -30238, 32414, -32598, 30776, -27064, 21685, -14975, 7342, 740, -8779, 16276, -22774, 27870, -31254, 32714, -32165, 29635, -25286, 19379, -12283, 4429, 3695, -11593, 18777, -24808, 29312, -32015, 32748, -31469, 28252, -23301, 16915, -9490, 1480, 6619, -14313, 21125, -26640, 30514, -32515, 32514, -30515, 26639, -21126, 14312, -6620, -1481, 9489, -16916, 23300, -28253, 31468, -32749, 32014, -29313, 24807, -18778, 11592, -3696, -4430, 12282, -19380, 25285, -29636, 32164, -32715, 31253, -27871, 22773, -16277, 8778, -741, -7343, 14974, -21686, 27063, -30777, 32597, -32415, 30237, -26202, 20553, -13643, 5892, 2220, -10196, 17544, -23816, 28620, -31667, 32764, -31849, 28973, -24318, 18165, -10898, 2958, 5162, -12966, 19971, -25750, 29944, -32298, 32664, -31024, 27473, -22236, 15629, -8063}, +{0, 9489, -18166, 25285, -30238, 32597, -32165, 28973, -23301, 15629, -6620, -2959, 12282, -20554, 27063, -31254, 32764, -31469, 27473, -21126, 12965, -3696, -5893, 14974, -22774, 28620, -32015, 32664, -30515, 25749, -18778, 10195, -741, -8779, 17544, -24808, 29944, -32515, 32297, -29313, 23815, -16277, 7342, 2220, -11593, 19971, -26640, 31023, -32749, 31666, -27871, 21685, -13643, 4429, 5162, -14313, 22235, -28253, 31848, -32715, 30776, -26202, 19379, -10898, 1480, 8062, -16916, 24317, -29636, 32414, -32415, 29635, -24318, 16915, -8063, -1481, 10897, -19380, 26201, -30777, 32714, -31849, 28252, -22236, 14312, -5163, -4430, 13642, -21686, 27870, -31667, 32748, -31024, 26639, -19972, 11592, -2221, -7343, 16276, -23816, 29312, -32298, 32514, -29945, 24807, -17545, 8778, 740, -10196, 18777, -25750, 30514, -32665, 32014, -28621, 22773, -14975, 5892, 3695, -12966, 21125, -27474, 31468, -32765, 31253, -27064, 20553, -12283, 2958, 6619, -15630, 23300, -28974, 32164, -32598, 30237, -25286, 18165, -9490}, +{0, 10897, -20554, 27870, -32015, 32514, -29313, 22773, -13643, 2958, 8062, -18166, 26201, -31254, 32748, -30515, 24807, -16277, 5892, 5162, -15630, 24317, -30238, 32714, -31469, 26639, -18778, 8778, 2220, -12966, 22235, -28974, 32414, -32165, 28252, -21126, 11592, -741, -10196, 19971, -27474, 31848, -32598, 29635, -23301, 14312, -3696, -7343, 17544, -25750, 31023, -32765, 30776, -25286, 16915, -6620, -4430, 14974, -23816, 29944, -32665, 31666, -27064, 19379, -9490, -1481, 12282, -21686, 28620, -32298, 32297, -28621, 21685, -12283, 1480, 9489, -19380, 27063, -31667, 32664, -29945, 23815, -14975, 4429, 6619, -16916, 25285, -30777, 32764, -31024, 25749, -17545, 7342, 3695, -14313, 23300, -29636, 32597, -31849, 27473, -19972, 10195, 740, -11593, 21125, -28253, 32164, -32415, 28973, -22236, 12965, -2221, -8779, 18777, -26640, 31468, -32715, 30237, -24318, 15629, -5163, -5893, 16276, -24808, 30514, -32749, 31253, -26202, 18165, -8063, -2959, 13642, -22774, 29312, -32515, 32014, -27871, 20553, -10898}, +{0, 12282, -22774, 29944, -32749, 30776, -24318, 14312, -2221, -10196, 21125, -28974, 32597, -31469, 25749, -16277, 4429, 8062, -19380, 27870, -32298, 32014, -27064, 18165, -6620, -5893, 17544, -26640, 31848, -32415, 28252, -19972, 8778, 3695, -15630, 25285, -31254, 32664, -29313, 21685, -10898, -1481, 13642, -23816, 30514, -32765, 30237, -23301, 12965, -741, -11593, 22235, -29636, 32714, -31024, 24807, -14975, 2958, 9489, -20554, 28620, -32515, 31666, -26202, 16915, -5163, -7343, 18777, -27474, 32164, -32165, 27473, -18778, 7342, 5162, -16916, 26201, -31667, 32514, -28621, 20553, -9490, -2959, 14974, -24808, 31023, -32715, 29635, -22236, 11592, 740, -12966, 23300, -30238, 32764, -30515, 23815, -13643, 1480, 10897, -21686, 29312, -32665, 31253, -25286, 15629, -3696, -8779, 19971, -28253, 32414, -31849, 26639, -17545, 5892, 6619, -18166, 27063, -32015, 32297, -27871, 19379, -8063, -4430, 16276, -25750, 31468, -32598, 28973, -21126, 10195, 2220, -14313, 24317, -30777, 32748, -29945, 22773, -12283}, +{0, 13642, -24808, 31468, -32415, 27473, -17545, 4429, 9489, -21686, 29944, -32765, 29635, -21126, 8778, 5162, -18166, 27870, -32515, 31253, -24318, 12965, 740, -14313, 25285, -31667, 32297, -27064, 16915, -3696, -10196, 22235, -30238, 32748, -29313, 20553, -8063, -5893, 18777, -28253, 32597, -31024, 23815, -12283, -1481, 14974, -25750, 31848, -32165, 26639, -16277, 2958, 10897, -22774, 30514, -32715, 28973, -19972, 7342, 6619, -19380, 28620, -32665, 30776, -23301, 11592, 2220, -15630, 26201, -32015, 32014, -26202, 15629, -2221, -11593, 23300, -30777, 32664, -28621, 19379, -6620, -7343, 19971, -28974, 32714, -30515, 22773, -10898, -2959, 16276, -26640, 32164, -31849, 25749, -14975, 1480, 12282, -23816, 31023, -32598, 28252, -18778, 5892, 8062, -20554, 29312, -32749, 30237, -22236, 10195, 3695, -16916, 27063, -32298, 31666, -25286, 14312, -741, -12966, 24317, -31254, 32514, -27871, 18165, -5163, -8779, 21125, -29636, 32764, -29945, 21685, -9490, -4430, 17544, -27474, 32414, -31469, 24807, -13643}, +{0, 14974, -26640, 32414, -31024, 22773, -9490, -5893, 19971, -29636, 32748, -28621, 18165, -3696, -11593, 24317, -31667, 32014, -25286, 12965, 2220, -16916, 27870, -32665, 30237, -21126, 7342, 8062, -21686, 30514, -32598, 27473, -16277, 1480, 13642, -25750, 32164, -31469, 23815, -10898, -4430, 18777, -28974, 32764, -29313, 19379, -5163, -10196, 23300, -31254, 32297, -26202, 14312, 740, -15630, 27063, -32515, 30776, -22236, 8778, 6619, -20554, 29944, -32715, 28252, -17545, 2958, 12282, -24808, 31848, -31849, 24807, -12283, -2959, 17544, -28253, 32714, -29945, 20553, -6620, -8779, 22235, -30777, 32514, -27064, 15629, -741, -14313, 26201, -32298, 31253, -23301, 10195, 5162, -19380, 29312, -32765, 28973, -18778, 4429, 10897, -23816, 31468, -32165, 25749, -13643, -1481, 16276, -27474, 32597, -30515, 21685, -8063, -7343, 21125, -30238, 32664, -27871, 16915, -2221, -12966, 25285, -32015, 31666, -24318, 11592, 3695, -18166, 28620, -32749, 29635, -19972, 5892, 9489, -22774, 31023, -32415, 26639, -14975}, +{0, 16276, -28253, 32764, -28621, 16915, -741, -15630, 27870, -32749, 28973, -17545, 1480, 14974, -27474, 32714, -29313, 18165, -2221, -14313, 27063, -32665, 29635, -18778, 2958, 13642, -26640, 32597, -29945, 19379, -3696, -12966, 26201, -32515, 30237, -19972, 4429, 12282, -25750, 32414, -30515, 20553, -5163, -11593, 25285, -32298, 30776, -21126, 5892, 10897, -24808, 32164, -31024, 21685, -6620, -10196, 24317, -32015, 31253, -22236, 7342, 9489, -23816, 31848, -31469, 22773, -8063, -8779, 23300, -31667, 31666, -23301, 8778, 8062, -22774, 31468, -31849, 23815, -9490, -7343, 22235, -31254, 32014, -24318, 10195, 6619, -21686, 31023, -32165, 24807, -10898, -5893, 21125, -30777, 32297, -25286, 11592, 5162, -20554, 30514, -32415, 25749, -12283, -4430, 19971, -30238, 32514, -26202, 12965, 3695, -19380, 29944, -32598, 26639, -13643, -2959, 18777, -29636, 32664, -27064, 14312, 2220, -18166, 29312, -32715, 27473, -14975, -1481, 17544, -28974, 32748, -27871, 15629, 740, -16916, 28620, -32765, 28252, -16277}, +{0, 17544, -29636, 32514, -25286, 10195, 8062, -23816, 32164, -30515, 19379, -2221, -15630, 28620, -32715, 26639, -12283, -5893, 22235, -31667, 31253, -21126, 4429, 13642, -27474, 32764, -27871, 14312, 3695, -20554, 31023, -31849, 22773, -6620, -11593, 26201, -32665, 28973, -16277, -1481, 18777, -30238, 32297, -24318, 8778, 9489, -24808, 32414, -29945, 18165, -741, -16916, 29312, -32598, 25749, -10898, -7343, 23300, -32015, 30776, -19972, 2958, 14974, -28253, 32748, -27064, 12965, 5162, -21686, 31468, -31469, 21685, -5163, -12966, 27063, -32749, 28252, -14975, -2959, 19971, -30777, 32014, -23301, 7342, 10897, -25750, 32597, -29313, 16915, 740, -18166, 29944, -32415, 24807, -9490, -8779, 24317, -32298, 30237, -18778, 1480, 16276, -28974, 32664, -26202, 11592, 6619, -22774, 31848, -31024, 20553, -3696, -14313, 27870, -32765, 27473, -13643, -4430, 21125, -31254, 31666, -22236, 5892, 12282, -26640, 32714, -28621, 15629, 2220, -19380, 30514, -32165, 23815, -8063, -10196, 25285, -32515, 29635, -17545}, +{0, 18777, -30777, 31666, -21126, 2958, 16276, -29636, 32297, -23301, 5892, 13642, -28253, 32664, -25286, 8778, 10897, -26640, 32764, -27064, 11592, 8062, -24808, 32597, -28621, 14312, 5162, -22774, 32164, -29945, 16915, 2220, -20554, 31468, -31024, 19379, -741, -18166, 30514, -31849, 21685, -3696, -15630, 29312, -32415, 23815, -6620, -12966, 27870, -32715, 25749, -9490, -10196, 26201, -32749, 27473, -12283, -7343, 24317, -32515, 28973, -14975, -4430, 22235, -32015, 30237, -17545, -1481, 19971, -31254, 31253, -19972, 1480, 17544, -30238, 32014, -22236, 4429, 14974, -28974, 32514, -24318, 7342, 12282, -27474, 32748, -26202, 10195, 9489, -25750, 32714, -27871, 12965, 6619, -23816, 32414, -29313, 15629, 3695, -21686, 31848, -30515, 18165, 740, -19380, 31023, -31469, 20553, -2221, -16916, 29944, -32165, 22773, -5163, -14313, 28620, -32598, 24807, -8063, -11593, 27063, -32765, 26639, -10898, -8779, 25285, -32665, 28252, -13643, -5893, 23300, -32298, 29635, -16277, -2959, 21125, -31667, 30776, -18778}, +{0, 19971, -31667, 30237, -16277, -4430, 23300, -32515, 28252, -12283, -8779, 26201, -32765, 25749, -8063, -12966, 28620, -32415, 22773, -3696, -16916, 30514, -31469, 19379, 740, -20554, 31848, -29945, 15629, 5162, -23816, 32597, -27871, 11592, 9489, -26640, 32748, -25286, 7342, 13642, -28974, 32297, -22236, 2958, 17544, -30777, 31253, -18778, -1481, 21125, -32015, 29635, -14975, -5893, 24317, -32665, 27473, -10898, -10196, 27063, -32715, 24807, -6620, -14313, 29312, -32165, 21685, -2221, -18166, 31023, -31024, 18165, 2220, -21686, 32164, -29313, 14312, 6619, -24808, 32714, -27064, 10195, 10897, -27474, 32664, -24318, 5892, 14974, -29636, 32014, -21126, 1480, 18777, -31254, 30776, -17545, -2959, 22235, -32298, 28973, -13643, -7343, 25285, -32749, 26639, -9490, -11593, 27870, -32598, 23815, -5163, -15630, 29944, -31849, 20553, -741, -19380, 31468, -30515, 16915, 3695, -22774, 32414, -28621, 12965, 8062, -25750, 32764, -26202, 8778, 12282, -28253, 32514, -23301, 4429, 16276, -30238, 31666, -19972}, +{0, 21125, -32298, 28252, -10898, -11593, 28620, -32165, 20553, 740, -21686, 32414, -27871, 10195, 12282, -28974, 32014, -19972, -1481, 22235, -32515, 27473, -9490, -12966, 29312, -31849, 19379, 2220, -22774, 32597, -27064, 8778, 13642, -29636, 31666, -18778, -2959, 23300, -32665, 26639, -8063, -14313, 29944, -31469, 18165, 3695, -23816, 32714, -26202, 7342, 14974, -30238, 31253, -17545, -4430, 24317, -32749, 25749, -6620, -15630, 30514, -31024, 16915, 5162, -24808, 32764, -25286, 5892, 16276, -30777, 30776, -16277, -5893, 25285, -32765, 24807, -5163, -16916, 31023, -30515, 15629, 6619, -25750, 32748, -24318, 4429, 17544, -31254, 30237, -14975, -7343, 26201, -32715, 23815, -3696, -18166, 31468, -29945, 14312, 8062, -26640, 32664, -23301, 2958, 18777, -31667, 29635, -13643, -8779, 27063, -32598, 22773, -2221, -19380, 31848, -29313, 12965, 9489, -27474, 32514, -22236, 1480, 19971, -32015, 28973, -12283, -10196, 27870, -32415, 21685, -741, -20554, 32164, -28621, 11592, 10897, -28253, 32297, -21126}, +{0, 22235, -32665, 25749, -5163, -18166, 31848, -28621, 10195, 13642, -30238, 30776, -14975, -8779, 27870, -32165, 19379, 3695, -24808, 32748, -23301, 1480, 21125, -32515, 26639, -6620, -16916, 31468, -29313, 11592, 12282, -29636, 31253, -16277, -7343, 27063, -32415, 20553, 2220, -23816, 32764, -24318, 2958, 19971, -32298, 27473, -8063, -15630, 31023, -29945, 12965, 10897, -28974, 31666, -17545, -5893, 26201, -32598, 21685, 740, -22774, 32714, -25286, 4429, 18777, -32015, 28252, -9490, -14313, 30514, -30515, 14312, 9489, -28253, 32014, -18778, -4430, 25285, -32715, 22773, -741, -21686, 32597, -26202, 5892, 17544, -31667, 28973, -10898, -12966, 29944, -31024, 15629, 8062, -27474, 32297, -19972, -2959, 24317, -32765, 23815, -2221, -20554, 32414, -27064, 7342, 16276, -31254, 29635, -12283, -11593, 29312, -31469, 16915, 6619, -26640, 32514, -21126, -1481, 23300, -32749, 24807, -3696, -19380, 32164, -27871, 8778, 14974, -30777, 30237, -13643, -10196, 28620, -31849, 18165, 5162, -25750, 32664, -22236}, +{0, 23300, -32765, 22773, 740, -23816, 32748, -22236, -1481, 24317, -32715, 21685, 2220, -24808, 32664, -21126, -2959, 25285, -32598, 20553, 3695, -25750, 32514, -19972, -4430, 26201, -32415, 19379, 5162, -26640, 32297, -18778, -5893, 27063, -32165, 18165, 6619, -27474, 32014, -17545, -7343, 27870, -31849, 16915, 8062, -28253, 31666, -16277, -8779, 28620, -31469, 15629, 9489, -28974, 31253, -14975, -10196, 29312, -31024, 14312, 10897, -29636, 30776, -13643, -11593, 29944, -30515, 12965, 12282, -30238, 30237, -12283, -12966, 30514, -29945, 11592, 13642, -30777, 29635, -10898, -14313, 31023, -29313, 10195, 14974, -31254, 28973, -9490, -15630, 31468, -28621, 8778, 16276, -31667, 28252, -8063, -16916, 31848, -27871, 7342, 17544, -32015, 27473, -6620, -18166, 32164, -27064, 5892, 18777, -32298, 26639, -5163, -19380, 32414, -26202, 4429, 19971, -32515, 25749, -3696, -20554, 32597, -25286, 2958, 21125, -32665, 24807, -2221, -21686, 32714, -24318, 1480, 22235, -32749, 23815, -741, -22774, 32764, -23301}, +{0, 24317, -32598, 19379, 6619, -28253, 31253, -13643, -12966, 31023, -28621, 7342, 18777, -32515, 24807, -741, -23816, 32664, -19972, -5893, 27870, -31469, 14312, 12282, -30777, 28973, -8063, -18166, 32414, -25286, 1480, 23300, -32715, 20553, 5162, -27474, 31666, -14975, -11593, 30514, -29313, 8778, 17544, -32298, 25749, -2221, -22774, 32748, -21126, -4430, 27063, -31849, 15629, 10897, -30238, 29635, -9490, -16916, 32164, -26202, 2958, 22235, -32765, 21685, 3695, -26640, 32014, -16277, -10196, 29944, -29945, 10195, 16276, -32015, 26639, -3696, -21686, 32764, -22236, -2959, 26201, -32165, 16915, 9489, -29636, 30237, -10898, -15630, 31848, -27064, 4429, 21125, -32749, 22773, 2220, -25750, 32297, -17545, -8779, 29312, -30515, 11592, 14974, -31667, 27473, -5163, -20554, 32714, -23301, -1481, 25285, -32415, 18165, 8062, -28974, 30776, -12283, -14313, 31468, -27871, 5892, 19971, -32665, 23815, 740, -24808, 32514, -18778, -7343, 28620, -31024, 12965, 13642, -31254, 28252, -6620, -19380, 32597, -24318}, +{0, 25285, -32165, 15629, 12282, -31254, 27473, -3696, -22774, 32664, -18778, -8779, 29944, -29313, 7342, 19971, -32749, 21685, 5162, -28253, 30776, -10898, -16916, 32414, -24318, -1481, 26201, -31849, 14312, 13642, -31667, 26639, -2221, -23816, 32514, -17545, -10196, 30514, -28621, 5892, 21125, -32765, 20553, 6619, -28974, 30237, -9490, -18166, 32597, -23301, -2959, 27063, -31469, 12965, 14974, -32015, 25749, -741, -24808, 32297, -16277, -11593, 31023, -27871, 4429, 22235, -32715, 19379, 8062, -29636, 29635, -8063, -19380, 32714, -22236, -4430, 27870, -31024, 11592, 16276, -32298, 24807, 740, -25750, 32014, -14975, -12966, 31468, -27064, 2958, 23300, -32598, 18165, 9489, -30238, 28973, -6620, -20554, 32764, -21126, -5893, 28620, -30515, 10195, 17544, -32515, 23815, 2220, -26640, 31666, -13643, -14313, 31848, -26202, 1480, 24317, -32415, 16915, 10897, -30777, 28252, -5163, -21686, 32748, -19972, -7343, 29312, -29945, 8778, 18777, -32665, 22773, 3695, -27474, 31253, -12283, -15630, 32164, -25286}, +{0, 26201, -31469, 11592, 17544, -32665, 21685, 6619, -29636, 28973, -5163, -22774, 32514, -16277, -12966, 31848, -25286, -1481, 27063, -31024, 10195, 18777, -32749, 20553, 8062, -30238, 28252, -3696, -23816, 32297, -14975, -14313, 32164, -24318, -2959, 27870, -30515, 8778, 19971, -32765, 19379, 9489, -30777, 27473, -2221, -24808, 32014, -13643, -15630, 32414, -23301, -4430, 28620, -29945, 7342, 21125, -32715, 18165, 10897, -31254, 26639, -741, -25750, 31666, -12283, -16916, 32597, -22236, -5893, 29312, -29313, 5892, 22235, -32598, 16915, 12282, -31667, 25749, 740, -26640, 31253, -10898, -18166, 32714, -21126, -7343, 29944, -28621, 4429, 23300, -32415, 15629, 13642, -32015, 24807, 2220, -27474, 30776, -9490, -19380, 32764, -19972, -8779, 30514, -27871, 2958, 24317, -32165, 14312, 14974, -32298, 23815, 3695, -28253, 30237, -8063, -20554, 32748, -18778, -10196, 31023, -27064, 1480, 25285, -31849, 12965, 16276, -32515, 22773, 5162, -28974, 29635, -6620, -21686, 32664, -17545, -11593, 31468, -26202}, +{0, 27063, -30515, 7342, 22235, -32415, 14312, 16276, -32665, 20553, 9489, -31254, 25749, 2220, -28253, 29635, -5163, -23816, 32014, -12283, -18166, 32764, -18778, -11593, 31848, -24318, -4430, 29312, -28621, 2958, 25285, -31469, 10195, 19971, -32715, 16915, 13642, -32298, 22773, 6619, -30238, 27473, -741, -26640, 30776, -8063, -21686, 32514, -14975, -15630, 32597, -21126, -8779, 31023, -26202, -1481, 27870, -29945, 5892, 23300, -32165, 12965, 17544, -32749, 19379, 10897, -31667, 24807, 3695, -28974, 28973, -3696, -24808, 31666, -10898, -19380, 32748, -17545, -12966, 32164, -23301, -5893, 29944, -27871, 1480, 26201, -31024, 8778, 21125, -32598, 15629, 14974, -32515, 21685, 8062, -30777, 26639, 740, -27474, 30237, -6620, -22774, 32297, -13643, -16916, 32714, -19972, -10196, 31468, -25286, -2959, 28620, -29313, 4429, 24317, -31849, 11592, 18777, -32765, 18165, 12282, -32015, 23815, 5162, -29636, 28252, -2221, -25750, 31253, -9490, -20554, 32664, -16277, -14313, 32414, -22236, -7343, 30514, -27064}, +{0, 27870, -29313, 2958, 26201, -30515, 5892, 24317, -31469, 8778, 22235, -32165, 11592, 19971, -32598, 14312, 17544, -32765, 16915, 14974, -32665, 19379, 12282, -32298, 21685, 9489, -31667, 23815, 6619, -30777, 25749, 3695, -29636, 27473, 740, -28253, 28973, -2221, -26640, 30237, -5163, -24808, 31253, -8063, -22774, 32014, -10898, -20554, 32514, -13643, -18166, 32748, -16277, -15630, 32714, -18778, -12966, 32414, -21126, -10196, 31848, -23301, -7343, 31023, -25286, -4430, 29944, -27064, -1481, 28620, -28621, 1480, 27063, -29945, 4429, 25285, -31024, 7342, 23300, -31849, 10195, 21125, -32415, 12965, 18777, -32715, 15629, 16276, -32749, 18165, 13642, -32515, 20553, 10897, -32015, 22773, 8062, -31254, 24807, 5162, -30238, 26639, 2220, -28974, 28252, -741, -27474, 29635, -3696, -25750, 30776, -6620, -23816, 31666, -9490, -21686, 32297, -12283, -19380, 32664, -14975, -16916, 32764, -17545, -14313, 32597, -19972, -11593, 32164, -22236, -8779, 31468, -24318, -5893, 30514, -26202, -2959, 29312, -27871}, +{0, 28620, -27871, -1481, 29312, -27064, -2959, 29944, -26202, -4430, 30514, -25286, -5893, 31023, -24318, -7343, 31468, -23301, -8779, 31848, -22236, -10196, 32164, -21126, -11593, 32414, -19972, -12966, 32597, -18778, -14313, 32714, -17545, -15630, 32764, -16277, -16916, 32748, -14975, -18166, 32664, -13643, -19380, 32514, -12283, -20554, 32297, -10898, -21686, 32014, -9490, -22774, 31666, -8063, -23816, 31253, -6620, -24808, 30776, -5163, -25750, 30237, -3696, -26640, 29635, -2221, -27474, 28973, -741, -28253, 28252, 740, -28974, 27473, 2220, -29636, 26639, 3695, -30238, 25749, 5162, -30777, 24807, 6619, -31254, 23815, 8062, -31667, 22773, 9489, -32015, 21685, 10897, -32298, 20553, 12282, -32515, 19379, 13642, -32665, 18165, 14974, -32749, 16915, 16276, -32765, 15629, 17544, -32715, 14312, 18777, -32598, 12965, 19971, -32415, 11592, 21125, -32165, 10195, 22235, -31849, 8778, 23300, -31469, 7342, 24317, -31024, 5892, 25285, -30515, 4429, 26201, -29945, 2958, 27063, -29313, 1480, 27870, -28621}, +{0, 29312, -26202, -5893, 31468, -22236, -11593, 32597, -17545, -16916, 32664, -12283, -21686, 31666, -6620, -25750, 29635, -741, -28974, 26639, 5162, -31254, 22773, 10897, -32515, 18165, 16276, -32715, 12965, 21125, -31849, 7342, 25285, -29945, 1480, 28620, -27064, -4430, 31023, -23301, -10196, 32414, -18778, -15630, 32748, -13643, -20554, 32014, -8063, -24808, 30237, -2221, -28253, 27473, 3695, -30777, 23815, 9489, -32298, 19379, 14974, -32765, 14312, 19971, -32165, 8778, 24317, -30515, 2958, 27870, -27871, -2959, 30514, -24318, -8779, 32164, -19972, -14313, 32764, -14975, -19380, 32297, -9490, -23816, 30776, -3696, -27474, 28252, 2220, -30238, 24807, 8062, -32015, 20553, 13642, -32749, 15629, 18777, -32415, 10195, 23300, -31024, 4429, 27063, -28621, -1481, 29944, -25286, -7343, 31848, -21126, -12966, 32714, -16277, -18166, 32514, -10898, -22774, 31253, -5163, -26640, 28973, 740, -29636, 25749, 6619, -31667, 21685, 12282, -32665, 16915, 17544, -32598, 11592, 22235, -31469, 5892, 26201, -29313}, +{0, 29944, -24318, -10196, 32597, -16277, -19380, 32014, -6620, -26640, 28252, 3695, -31254, 21685, 13642, -32765, 12965, 22235, -31024, 2958, 28620, -26202, -7343, 32164, -18778, -16916, 32514, -9490, -24808, 29635, 740, -30238, 23815, 10897, -32665, 15629, 19971, -31849, 5892, 27063, -27871, -4430, 31468, -21126, -14313, 32748, -12283, -22774, 30776, -2221, -28974, 25749, 8062, -32298, 18165, 17544, -32415, 8778, 25285, -29313, -1481, 30514, -23301, -11593, 32714, -14975, -20554, 31666, -5163, -27474, 27473, 5162, -31667, 20553, 14974, -32715, 11592, 23300, -30515, 1480, 29312, -25286, -8779, 32414, -17545, -18166, 32297, -8063, -25750, 28973, 2220, -30777, 22773, 12282, -32749, 14312, 21125, -31469, 4429, 27870, -27064, -5893, 31848, -19972, -15630, 32664, -10898, -23816, 30237, -741, -29636, 24807, 9489, -32515, 16915, 18777, -32165, 7342, 26201, -28621, -2959, 31023, -22236, -12966, 32764, -13643, -21686, 31253, -3696, -28253, 26639, 6619, -32015, 19379, 16276, -32598, 10195, 24317, -29945}, +{0, 30514, -22236, -14313, 32664, -9490, -25750, 28252, 5162, -32015, 18165, 18777, -31849, 4429, 28620, -25286, -10196, 32714, -13643, -22774, 30237, 740, -30777, 21685, 14974, -32598, 8778, 26201, -27871, -5893, 32164, -17545, -19380, 31666, -3696, -28974, 24807, 10897, -32749, 12965, 23300, -29945, -1481, 31023, -21126, -15630, 32514, -8063, -26640, 27473, 6619, -32298, 16915, 19971, -31469, 2958, 29312, -24318, -11593, 32764, -12283, -23816, 29635, 2220, -31254, 20553, 16276, -32415, 7342, 27063, -27064, -7343, 32414, -16277, -20554, 31253, -2221, -29636, 23815, 12282, -32765, 11592, 24317, -29313, -2959, 31468, -19972, -16916, 32297, -6620, -27474, 26639, 8062, -32515, 15629, 21125, -31024, 1480, 29944, -23301, -12966, 32748, -10898, -24808, 28973, 3695, -31667, 19379, 17544, -32165, 5892, 27870, -26202, -8779, 32597, -14975, -21686, 30776, -741, -30238, 22773, 13642, -32715, 10195, 25285, -28621, -4430, 31848, -18778, -18166, 32014, -5163, -28253, 25749, 9489, -32665, 14312, 22235, -30515}, +{0, 31023, -19972, -18166, 31666, -2221, -30238, 21685, 16276, -32165, 4429, 29312, -23301, -14313, 32514, -6620, -28253, 24807, 12282, -32715, 8778, 27063, -26202, -10196, 32764, -10898, -25750, 27473, 8062, -32665, 12965, 24317, -28621, -5893, 32414, -14975, -22774, 29635, 3695, -32015, 16915, 21125, -30515, -1481, 31468, -18778, -19380, 31253, -741, -30777, 20553, 17544, -31849, 2958, 29944, -22236, -15630, 32297, -5163, -28974, 23815, 13642, -32598, 7342, 27870, -25286, -11593, 32748, -9490, -26640, 26639, 9489, -32749, 11592, 25285, -27871, -7343, 32597, -13643, -23816, 28973, 5162, -32298, 15629, 22235, -29945, -2959, 31848, -17545, -20554, 30776, 740, -31254, 19379, 18777, -31469, 1480, 30514, -21126, -16916, 32014, -3696, -29636, 22773, 14974, -32415, 5892, 28620, -24318, -12966, 32664, -8063, -27474, 25749, 10897, -32765, 10195, 26201, -27064, -8779, 32714, -12283, -24808, 28252, 6619, -32515, 14312, 23300, -29313, -4430, 32164, -16277, -21686, 30237, 2220, -31667, 18165, 19971, -31024}, +{0, 31468, -17545, -21686, 29635, 5162, -32515, 12965, 25285, -27064, -10196, 32748, -8063, -28253, 23815, 14974, -32165, 2958, 30514, -19972, -19380, 30776, 2220, -32015, 15629, 23300, -28621, -7343, 32714, -10898, -26640, 25749, 12282, -32598, 5892, 29312, -22236, -16916, 31666, -741, -31254, 18165, 21125, -29945, -4430, 32414, -13643, -24808, 27473, 9489, -32765, 8778, 27870, -24318, -14313, 32297, -3696, -30238, 20553, 18777, -31024, -1481, 31848, -16277, -22774, 28973, 6619, -32665, 11592, 26201, -26202, -11593, 32664, -6620, -28974, 22773, 16276, -31849, 1480, 31023, -18778, -20554, 30237, 3695, -32298, 14312, 24317, -27871, -8779, 32764, -9490, -27474, 24807, 13642, -32415, 4429, 29944, -21126, -18166, 31253, 740, -31667, 16915, 22235, -29313, -5893, 32597, -12283, -25750, 26639, 10897, -32715, 7342, 28620, -23301, -15630, 32014, -2221, -30777, 19379, 19971, -30515, -2959, 32164, -14975, -23816, 28252, 8062, -32749, 10195, 27063, -25286, -12966, 32514, -5163, -29636, 21685, 17544, -31469}, +{0, 31848, -14975, -24808, 26639, 12282, -32415, 2958, 31023, -17545, -22774, 28252, 9489, -32715, 5892, 29944, -19972, -20554, 29635, 6619, -32749, 8778, 28620, -22236, -18166, 30776, 3695, -32515, 11592, 27063, -24318, -15630, 31666, 740, -32015, 14312, 25285, -26202, -12966, 32297, -2221, -31254, 16915, 23300, -27871, -10196, 32664, -5163, -30238, 19379, 21125, -29313, -7343, 32764, -8063, -28974, 21685, 18777, -30515, -4430, 32597, -10898, -27474, 23815, 16276, -31469, -1481, 32164, -13643, -25750, 25749, 13642, -32165, 1480, 31468, -16277, -23816, 27473, 10897, -32598, 4429, 30514, -18778, -21686, 28973, 8062, -32765, 7342, 29312, -21126, -19380, 30237, 5162, -32665, 10195, 27870, -23301, -16916, 31253, 2220, -32298, 12965, 26201, -25286, -14313, 32014, -741, -31667, 15629, 24317, -27064, -11593, 32514, -3696, -30777, 18165, 22235, -28621, -8779, 32748, -6620, -29636, 20553, 19971, -29945, -5893, 32714, -9490, -28253, 22773, 17544, -31024, -2959, 32414, -12283, -26640, 24807, 14974, -31849}, +{0, 32164, -12283, -27474, 22773, 18777, -29945, -7343, 32748, -5163, -30777, 16915, 24317, -26202, -14313, 31666, 2220, -32515, 10195, 28620, -21126, -20554, 28973, 9489, -32598, 2958, 31468, -14975, -25750, 24807, 16276, -31024, -4430, 32714, -8063, -29636, 19379, 22235, -27871, -11593, 32297, -741, -32015, 12965, 27063, -23301, -18166, 30237, 6619, -32765, 5892, 30514, -17545, -23816, 26639, 13642, -31849, -1481, 32414, -10898, -28253, 21685, 19971, -29313, -8779, 32664, -3696, -31254, 15629, 25285, -25286, -15630, 31253, 3695, -32665, 8778, 29312, -19972, -21686, 28252, 10897, -32415, 1480, 31848, -13643, -26640, 23815, 17544, -30515, -5893, 32764, -6620, -30238, 18165, 23300, -27064, -12966, 32014, 740, -32298, 11592, 27870, -22236, -19380, 29635, 8062, -32715, 4429, 31023, -16277, -24808, 25749, 14974, -31469, -2959, 32597, -9490, -28974, 20553, 21125, -28621, -10196, 32514, -2221, -31667, 14312, 26201, -24318, -16916, 30776, 5162, -32749, 7342, 29944, -18778, -22774, 27473, 12282, -32165}, +{0, 32414, -9490, -29636, 18165, 24317, -25286, -16916, 30237, 8062, -32598, 1480, 32164, -10898, -28974, 19379, 23300, -26202, -15630, 30776, 6619, -32715, 2958, 31848, -12283, -28253, 20553, 22235, -27064, -14313, 31253, 5162, -32765, 4429, 31468, -13643, -27474, 21685, 21125, -27871, -12966, 31666, 3695, -32749, 5892, 31023, -14975, -26640, 22773, 19971, -28621, -11593, 32014, 2220, -32665, 7342, 30514, -16277, -25750, 23815, 18777, -29313, -10196, 32297, 740, -32515, 8778, 29944, -17545, -24808, 24807, 17544, -29945, -8779, 32514, -741, -32298, 10195, 29312, -18778, -23816, 25749, 16276, -30515, -7343, 32664, -2221, -32015, 11592, 28620, -19972, -22774, 26639, 14974, -31024, -5893, 32748, -3696, -31667, 12965, 27870, -21126, -21686, 27473, 13642, -31469, -4430, 32764, -5163, -31254, 14312, 27063, -22236, -20554, 28252, 12282, -31849, -2959, 32714, -6620, -30777, 15629, 26201, -23301, -19380, 28973, 10897, -32165, -1481, 32597, -8063, -30238, 16915, 25285, -24318, -18166, 29635, 9489, -32415}, +{0, 32597, -6620, -31254, 12965, 28620, -18778, -24808, 23815, 19971, -27871, -14313, 30776, 8062, -32415, -1481, 32714, -5163, -31667, 11592, 29312, -17545, -25750, 22773, 21125, -27064, -15630, 30237, 9489, -32165, -2959, 32764, -3696, -32015, 10195, 29944, -16277, -26640, 21685, 22235, -26202, -16916, 29635, 10897, -31849, -4430, 32748, -2221, -32298, 8778, 30514, -14975, -27474, 20553, 23300, -25286, -18166, 28973, 12282, -31469, -5893, 32664, -741, -32515, 7342, 31023, -13643, -28253, 19379, 24317, -24318, -19380, 28252, 13642, -31024, -7343, 32514, 740, -32665, 5892, 31468, -12283, -28974, 18165, 25285, -23301, -20554, 27473, 14974, -30515, -8779, 32297, 2220, -32749, 4429, 31848, -10898, -29636, 16915, 26201, -22236, -21686, 26639, 16276, -29945, -10196, 32014, 3695, -32765, 2958, 32164, -9490, -30238, 15629, 27063, -21126, -22774, 25749, 17544, -29313, -11593, 31666, 5162, -32715, 1480, 32414, -8063, -30777, 14312, 27870, -19972, -23816, 24807, 18777, -28621, -12966, 31253, 6619, -32598}, +{0, 32714, -3696, -32298, 7342, 31468, -10898, -30238, 14312, 28620, -17545, -26640, 20553, 24317, -23301, -21686, 25749, 18777, -27871, -15630, 29635, 12282, -31024, -8779, 32014, 5162, -32598, -1481, 32764, -2221, -32515, 5892, 31848, -9490, -30777, 12965, 29312, -16277, -27474, 19379, 25285, -22236, -22774, 24807, 19971, -27064, -16916, 28973, 13642, -30515, -10196, 31666, 6619, -32415, -2959, 32748, -741, -32665, 4429, 32164, -8063, -31254, 11592, 29944, -14975, -28253, 18165, 26201, -21126, -23816, 23815, 21125, -26202, -18166, 28252, 14974, -29945, -11593, 31253, 8062, -32165, -4430, 32664, 740, -32749, 2958, 32414, -6620, -31667, 10195, 30514, -13643, -28974, 16915, 27063, -19972, -24808, 22773, 22235, -25286, -19380, 27473, 16276, -29313, -12966, 30776, 9489, -31849, -5893, 32514, 2220, -32765, 1480, 32597, -5163, -32015, 8778, 31023, -12283, -29636, 15629, 27870, -18778, -25750, 21685, 23300, -24318, -20554, 26639, 17544, -28621, -14313, 30237, 10897, -31469, -7343, 32297, 3695, -32715}, +{0, 32764, -741, -32749, 1480, 32714, -2221, -32665, 2958, 32597, -3696, -32515, 4429, 32414, -5163, -32298, 5892, 32164, -6620, -32015, 7342, 31848, -8063, -31667, 8778, 31468, -9490, -31254, 10195, 31023, -10898, -30777, 11592, 30514, -12283, -30238, 12965, 29944, -13643, -29636, 14312, 29312, -14975, -28974, 15629, 28620, -16277, -28253, 16915, 27870, -17545, -27474, 18165, 27063, -18778, -26640, 19379, 26201, -19972, -25750, 20553, 25285, -21126, -24808, 21685, 24317, -22236, -23816, 22773, 23300, -23301, -22774, 23815, 22235, -24318, -21686, 24807, 21125, -25286, -20554, 25749, 19971, -26202, -19380, 26639, 18777, -27064, -18166, 27473, 17544, -27871, -16916, 28252, 16276, -28621, -15630, 28973, 14974, -29313, -14313, 29635, 13642, -29945, -12966, 30237, 12282, -30515, -11593, 30776, 10897, -31024, -10196, 31253, 9489, -31469, -8779, 31666, 8062, -31849, -7343, 32014, 6619, -32165, -5893, 32297, 5162, -32415, -4430, 32514, 3695, -32598, -2959, 32664, 2220, -32715, -1481, 32748, 740, -32765}, +{0, 32748, 2220, -32598, -4430, 32297, 6619, -31849, -8779, 31253, 10897, -30515, -12966, 29635, 14974, -28621, -16916, 27473, 18777, -26202, -20554, 24807, 22235, -23301, -23816, 21685, 25285, -19972, -26640, 18165, 27870, -16277, -28974, 14312, 29944, -12283, -30777, 10195, 31468, -8063, -32015, 5892, 32414, -3696, -32665, 1480, 32764, 740, -32715, -2959, 32514, 5162, -32165, -7343, 31666, 9489, -31024, -11593, 30237, 13642, -29313, -15630, 28252, 17544, -27064, -19380, 25749, 21125, -24318, -22774, 22773, 24317, -21126, -25750, 19379, 27063, -17545, -28253, 15629, 29312, -13643, -30238, 11592, 31023, -9490, -31667, 7342, 32164, -5163, -32515, 2958, 32714, -741, -32765, -1481, 32664, 3695, -32415, -5893, 32014, 8062, -31469, -10196, 30776, 12282, -29945, -14313, 28973, 16276, -27871, -18166, 26639, 19971, -25286, -21686, 23815, 23300, -22236, -24808, 20553, 26201, -18778, -27474, 16915, 28620, -14975, -29636, 12965, 30514, -10898, -31254, 8778, 31848, -6620, -32298, 4429, 32597, -2221, -32749}, +{0, 32664, 5162, -31849, -10196, 30237, 14974, -27871, -19380, 24807, 23300, -21126, -26640, 16915, 29312, -12283, -31254, 7342, 32414, -2221, -32765, -2959, 32297, 8062, -31024, -12966, 28973, 17544, -26202, -21686, 22773, 25285, -18778, -28253, 14312, 30514, -9490, -32015, 4429, 32714, 740, -32598, -5893, 31666, 10897, -29945, -15630, 27473, 19971, -24318, -23816, 20553, 27063, -16277, -29636, 11592, 31468, -6620, -32515, 1480, 32748, 3695, -32165, -8779, 30776, 13642, -28621, -18166, 25749, 22235, -22236, -25750, 18165, 28620, -13643, -30777, 8778, 32164, -3696, -32749, -1481, 32514, 6619, -31469, -11593, 29635, 16276, -27064, -20554, 23815, 24317, -19972, -27474, 15629, 29944, -10898, -31667, 5892, 32597, -741, -32715, -4430, 32014, 9489, -30515, -14313, 28252, 18777, -25286, -22774, 21685, 26201, -17545, -28974, 12965, 31023, -8063, -32298, 2958, 32764, 2220, -32415, -7343, 31253, 12282, -29313, -16916, 26639, 21125, -23301, -24808, 19379, 27870, -14975, -30238, 10195, 31848, -5163, -32665}, +{0, 32514, 8062, -30515, -15630, 26639, 22235, -21126, -27474, 14312, 31023, -6620, -32665, -1481, 32297, 9489, -29945, -16916, 25749, 23300, -19972, -28253, 12965, 31468, -5163, -32749, -2959, 32014, 10897, -29313, -18166, 24807, 24317, -18778, -28974, 11592, 31848, -3696, -32765, -4430, 31666, 12282, -28621, -19380, 23815, 25285, -17545, -29636, 10195, 32164, -2221, -32715, -5893, 31253, 13642, -27871, -20554, 22773, 26201, -16277, -30238, 8778, 32414, -741, -32598, -7343, 30776, 14974, -27064, -21686, 21685, 27063, -14975, -30777, 7342, 32597, 740, -32415, -8779, 30237, 16276, -26202, -22774, 20553, 27870, -13643, -31254, 5892, 32714, 2220, -32165, -10196, 29635, 17544, -25286, -23816, 19379, 28620, -12283, -31667, 4429, 32764, 3695, -31849, -11593, 28973, 18777, -24318, -24808, 18165, 29312, -10898, -32015, 2958, 32748, 5162, -31469, -12966, 28252, 19971, -23301, -25750, 16915, 29944, -9490, -32298, 1480, 32664, 6619, -31024, -14313, 27473, 21125, -22236, -26640, 15629, 30514, -8063, -32515}, +{0, 32297, 10897, -28621, -20554, 21685, 27870, -12283, -32015, 1480, 32514, 9489, -29313, -19380, 22773, 27063, -13643, -31667, 2958, 32664, 8062, -29945, -18166, 23815, 26201, -14975, -31254, 4429, 32748, 6619, -30515, -16916, 24807, 25285, -16277, -30777, 5892, 32764, 5162, -31024, -15630, 25749, 24317, -17545, -30238, 7342, 32714, 3695, -31469, -14313, 26639, 23300, -18778, -29636, 8778, 32597, 2220, -31849, -12966, 27473, 22235, -19972, -28974, 10195, 32414, 740, -32165, -11593, 28252, 21125, -21126, -28253, 11592, 32164, -741, -32415, -10196, 28973, 19971, -22236, -27474, 12965, 31848, -2221, -32598, -8779, 29635, 18777, -23301, -26640, 14312, 31468, -3696, -32715, -7343, 30237, 17544, -24318, -25750, 15629, 31023, -5163, -32765, -5893, 30776, 16276, -25286, -24808, 16915, 30514, -6620, -32749, -4430, 31253, 14974, -26202, -23816, 18165, 29944, -8063, -32665, -2959, 31666, 13642, -27064, -22774, 19379, 29312, -9490, -32515, -1481, 32014, 12282, -27871, -21686, 20553, 28620, -10898, -32298}, +{0, 32014, 13642, -26202, -24808, 15629, 31468, -2221, -32415, -11593, 27473, 23300, -17545, -30777, 4429, 32664, 9489, -28621, -21686, 19379, 29944, -6620, -32765, -7343, 29635, 19971, -21126, -28974, 8778, 32714, 5162, -30515, -18166, 22773, 27870, -10898, -32515, -2959, 31253, 16276, -24318, -26640, 12965, 32164, 740, -31849, -14313, 25749, 25285, -14975, -31667, 1480, 32297, 12282, -27064, -23816, 16915, 31023, -3696, -32598, -10196, 28252, 22235, -18778, -30238, 5892, 32748, 8062, -29313, -20554, 20553, 29312, -8063, -32749, -5893, 30237, 18777, -22236, -28253, 10195, 32597, 3695, -31024, -16916, 23815, 27063, -12283, -32298, -1481, 31666, 14974, -25286, -25750, 14312, 31848, -741, -32165, -12966, 26639, 24317, -16277, -31254, 2958, 32514, 10897, -27871, -22774, 18165, 30514, -5163, -32715, -8779, 28973, 21125, -19972, -29636, 7342, 32764, 6619, -29945, -19380, 21685, 28620, -9490, -32665, -4430, 30776, 17544, -23301, -27474, 11592, 32414, 2220, -31469, -15630, 24807, 26201, -13643, -32015}, +{0, 31666, 16276, -23301, -28253, 8778, 32764, 8062, -28621, -22774, 16915, 31468, -741, -31849, -15630, 23815, 27870, -9490, -32749, -7343, 28973, 22235, -17545, -31254, 1480, 32014, 14974, -24318, -27474, 10195, 32714, 6619, -29313, -21686, 18165, 31023, -2221, -32165, -14313, 24807, 27063, -10898, -32665, -5893, 29635, 21125, -18778, -30777, 2958, 32297, 13642, -25286, -26640, 11592, 32597, 5162, -29945, -20554, 19379, 30514, -3696, -32415, -12966, 25749, 26201, -12283, -32515, -4430, 30237, 19971, -19972, -30238, 4429, 32514, 12282, -26202, -25750, 12965, 32414, 3695, -30515, -19380, 20553, 29944, -5163, -32598, -11593, 26639, 25285, -13643, -32298, -2959, 30776, 18777, -21126, -29636, 5892, 32664, 10897, -27064, -24808, 14312, 32164, 2220, -31024, -18166, 21685, 29312, -6620, -32715, -10196, 27473, 24317, -14975, -32015, -1481, 31253, 17544, -22236, -28974, 7342, 32748, 9489, -27871, -23816, 15629, 31848, 740, -31469, -16916, 22773, 28620, -8063, -32765, -8779, 28252, 23300, -16277, -31667}, +{0, 31253, 18777, -19972, -30777, 1480, 31666, 17544, -21126, -30238, 2958, 32014, 16276, -22236, -29636, 4429, 32297, 14974, -23301, -28974, 5892, 32514, 13642, -24318, -28253, 7342, 32664, 12282, -25286, -27474, 8778, 32748, 10897, -26202, -26640, 10195, 32764, 9489, -27064, -25750, 11592, 32714, 8062, -27871, -24808, 12965, 32597, 6619, -28621, -23816, 14312, 32414, 5162, -29313, -22774, 15629, 32164, 3695, -29945, -21686, 16915, 31848, 2220, -30515, -20554, 18165, 31468, 740, -31024, -19380, 19379, 31023, -741, -31469, -18166, 20553, 30514, -2221, -31849, -16916, 21685, 29944, -3696, -32165, -15630, 22773, 29312, -5163, -32415, -14313, 23815, 28620, -6620, -32598, -12966, 24807, 27870, -8063, -32715, -11593, 25749, 27063, -9490, -32765, -10196, 26639, 26201, -10898, -32749, -8779, 27473, 25285, -12283, -32665, -7343, 28252, 24317, -13643, -32515, -5893, 28973, 23300, -14975, -32298, -4430, 29635, 22235, -16277, -32015, -2959, 30237, 21125, -17545, -31667, -1481, 30776, 19971, -18778, -31254}, +{0, 30776, 21125, -16277, -32298, -5893, 28252, 25285, -10898, -32765, -11593, 24807, 28620, -5163, -32165, -16916, 20553, 31023, 740, -30515, -21686, 15629, 32414, 6619, -27871, -25750, 10195, 32748, 12282, -24318, -28974, 4429, 32014, 17544, -19972, -31254, -1481, 30237, 22235, -14975, -32515, -7343, 27473, 26201, -9490, -32715, -12966, 23815, 29312, -3696, -31849, -18166, 19379, 31468, 2220, -29945, -22774, 14312, 32597, 8062, -27064, -26640, 8778, 32664, 13642, -23301, -29636, 2958, 31666, 18777, -18778, -31667, -2959, 29635, 23300, -13643, -32665, -8779, 26639, 27063, -8063, -32598, -14313, 22773, 29944, -2221, -31469, -19380, 18165, 31848, 3695, -29313, -23816, 12965, 32714, 9489, -26202, -27474, 7342, 32514, 14974, -22236, -30238, 1480, 31253, 19971, -17545, -32015, -4430, 28973, 24317, -12283, -32749, -10196, 25749, 27870, -6620, -32415, -15630, 21685, 30514, -741, -31024, -20554, 16915, 32164, 5162, -28621, -24808, 11592, 32764, 10897, -25286, -28253, 5892, 32297, 16276, -21126, -30777}, +{0, 30237, 23300, -12283, -32765, -12966, 22773, 30514, 740, -29945, -23816, 11592, 32748, 13642, -22236, -30777, -1481, 29635, 24317, -10898, -32715, -14313, 21685, 31023, 2220, -29313, -24808, 10195, 32664, 14974, -21126, -31254, -2959, 28973, 25285, -9490, -32598, -15630, 20553, 31468, 3695, -28621, -25750, 8778, 32514, 16276, -19972, -31667, -4430, 28252, 26201, -8063, -32415, -16916, 19379, 31848, 5162, -27871, -26640, 7342, 32297, 17544, -18778, -32015, -5893, 27473, 27063, -6620, -32165, -18166, 18165, 32164, 6619, -27064, -27474, 5892, 32014, 18777, -17545, -32298, -7343, 26639, 27870, -5163, -31849, -19380, 16915, 32414, 8062, -26202, -28253, 4429, 31666, 19971, -16277, -32515, -8779, 25749, 28620, -3696, -31469, -20554, 15629, 32597, 9489, -25286, -28974, 2958, 31253, 21125, -14975, -32665, -10196, 24807, 29312, -2221, -31024, -21686, 14312, 32714, 10897, -24318, -29636, 1480, 30776, 22235, -13643, -32749, -11593, 23815, 29944, -741, -30515, -22774, 12965, 32764, 12282, -23301, -30238}, +{0, 29635, 25285, -8063, -32165, -19380, 15629, 32714, 12282, -22236, -31254, -4430, 27473, 27870, -3696, -31024, -22774, 11592, 32664, 16276, -18778, -32298, -8779, 24807, 29944, 740, -29313, -25750, 7342, 32014, 19971, -14975, -32749, -12966, 21685, 31468, 5162, -27064, -28253, 2958, 30776, 23300, -10898, -32598, -16916, 18165, 32414, 9489, -24318, -30238, -1481, 28973, 26201, -6620, -31849, -20554, 14312, 32764, 13642, -21126, -31667, -5893, 26639, 28620, -2221, -30515, -23816, 10195, 32514, 17544, -17545, -32515, -10196, 23815, 30514, 2220, -28621, -26640, 5892, 31666, 21125, -13643, -32765, -14313, 20553, 31848, 6619, -26202, -28974, 1480, 30237, 24317, -9490, -32415, -18166, 16915, 32597, 10897, -23301, -30777, -2959, 28252, 27063, -5163, -31469, -21686, 12965, 32748, 14974, -19972, -32015, -7343, 25749, 29312, -741, -29945, -24808, 8778, 32297, 18777, -16277, -32665, -11593, 22773, 31023, 3695, -27871, -27474, 4429, 31253, 22235, -12283, -32715, -15630, 19379, 32164, 8062, -25286, -29636}, +{0, 28973, 27063, -3696, -30515, -24808, 7342, 31666, 22235, -10898, -32415, -19380, 14312, 32748, 16276, -17545, -32665, -12966, 20553, 32164, 9489, -23301, -31254, -5893, 25749, 29944, 2220, -27871, -28253, 1480, 29635, 26201, -5163, -31024, -23816, 8778, 32014, 21125, -12283, -32598, -18166, 15629, 32764, 14974, -18778, -32515, -11593, 21685, 31848, 8062, -24318, -30777, -4430, 26639, 29312, 740, -28621, -27474, 2958, 30237, 25285, -6620, -31469, -22774, 10195, 32297, 19971, -13643, -32715, -16916, 16915, 32714, 13642, -19972, -32298, -10196, 22773, 31468, 6619, -25286, -30238, -2959, 27473, 28620, -741, -29313, -26640, 4429, 30776, 24317, -8063, -31849, -21686, 11592, 32514, 18777, -14975, -32765, -15630, 18165, 32597, 12282, -21126, -32015, -8779, 23815, 31023, 5162, -26202, -29636, -1481, 28252, 27870, -2221, -29945, -25750, 5892, 31253, 23300, -9490, -32165, -20554, 12965, 32664, 17544, -16277, -32749, -14313, 19379, 32414, 10897, -22236, -31667, -7343, 24807, 30514, 3695, -27064, -28974}, +{0, 28252, 28620, 740, -27871, -28974, -1481, 27473, 29312, 2220, -27064, -29636, -2959, 26639, 29944, 3695, -26202, -30238, -4430, 25749, 30514, 5162, -25286, -30777, -5893, 24807, 31023, 6619, -24318, -31254, -7343, 23815, 31468, 8062, -23301, -31667, -8779, 22773, 31848, 9489, -22236, -32015, -10196, 21685, 32164, 10897, -21126, -32298, -11593, 20553, 32414, 12282, -19972, -32515, -12966, 19379, 32597, 13642, -18778, -32665, -14313, 18165, 32714, 14974, -17545, -32749, -15630, 16915, 32764, 16276, -16277, -32765, -16916, 15629, 32748, 17544, -14975, -32715, -18166, 14312, 32664, 18777, -13643, -32598, -19380, 12965, 32514, 19971, -12283, -32415, -20554, 11592, 32297, 21125, -10898, -32165, -21686, 10195, 32014, 22235, -9490, -31849, -22774, 8778, 31666, 23300, -8063, -31469, -23816, 7342, 31253, 24317, -6620, -31024, -24808, 5892, 30776, 25285, -5163, -30515, -25750, 4429, 30237, 26201, -3696, -29945, -26640, 2958, 29635, 27063, -2221, -29313, -27474, 1480, 28973, 27870, -741, -28621, -28253}, +{0, 27473, 29944, 5162, -24318, -31667, -10196, 20553, 32597, 14974, -16277, -32715, -19380, 11592, 32014, 23300, -6620, -30515, -26640, 1480, 28252, 29312, 3695, -25286, -31254, -8779, 21685, 32414, 13642, -17545, -32765, -18166, 12965, 32297, 22235, -8063, -31024, -25750, 2958, 28973, 28620, 2220, -26202, -30777, -7343, 22773, 32164, 12282, -18778, -32749, -16916, 14312, 32514, 21125, -9490, -31469, -24808, 4429, 29635, 27870, 740, -27064, -30238, -5893, 23815, 31848, 10897, -19972, -32665, -15630, 15629, 32664, 19971, -10898, -31849, -23816, 5892, 30237, 27063, -741, -27871, -29636, -4430, 24807, 31468, 9489, -21126, -32515, -14313, 16915, 32748, 18777, -12283, -32165, -22774, 7342, 30776, 26201, -2221, -28621, -28974, -2959, 25749, 31023, 8062, -22236, -32298, -12966, 18165, 32764, 17544, -13643, -32415, -21686, 8778, 31253, 25285, -3696, -29313, -28253, -1481, 26639, 30514, 6619, -23301, -32015, -11593, 19379, 32714, 16276, -14975, -32598, -20554, 10195, 31666, 24317, -5163, -29945, -27474}, +{0, 26639, 31023, 9489, -19972, -32749, -18166, 11592, 31666, 25285, -2221, -27871, -30238, -7343, 21685, 32597, 16276, -13643, -32165, -23816, 4429, 28973, 29312, 5162, -23301, -32298, -14313, 15629, 32514, 22235, -6620, -29945, -28253, -2959, 24807, 31848, 12282, -17545, -32715, -20554, 8778, 30776, 27063, 740, -26202, -31254, -10196, 19379, 32764, 18777, -10898, -31469, -25750, 1480, 27473, 30514, 8062, -21126, -32665, -16916, 12965, 32014, 24317, -3696, -28621, -29636, -5893, 22773, 32414, 14974, -14975, -32415, -22774, 5892, 29635, 28620, 3695, -24318, -32015, -12966, 16915, 32664, 21125, -8063, -30515, -27474, -1481, 25749, 31468, 10897, -18778, -32765, -19380, 10195, 31253, 26201, -741, -27064, -30777, -8779, 20553, 32714, 17544, -12283, -31849, -24808, 2958, 28252, 29944, 6619, -22236, -32515, -15630, 14312, 32297, 23300, -5163, -29313, -28974, -4430, 23815, 32164, 13642, -16277, -32598, -21686, 7342, 30237, 27870, 2220, -25286, -31667, -11593, 18165, 32748, 19971, -9490, -31024, -26640}, +{0, 25749, 31848, 13642, -14975, -32165, -24808, 1480, 26639, 31468, 12282, -16277, -32415, -23816, 2958, 27473, 31023, 10897, -17545, -32598, -22774, 4429, 28252, 30514, 9489, -18778, -32715, -21686, 5892, 28973, 29944, 8062, -19972, -32765, -20554, 7342, 29635, 29312, 6619, -21126, -32749, -19380, 8778, 30237, 28620, 5162, -22236, -32665, -18166, 10195, 30776, 27870, 3695, -23301, -32515, -16916, 11592, 31253, 27063, 2220, -24318, -32298, -15630, 12965, 31666, 26201, 740, -25286, -32015, -14313, 14312, 32014, 25285, -741, -26202, -31667, -12966, 15629, 32297, 24317, -2221, -27064, -31254, -11593, 16915, 32514, 23300, -3696, -27871, -30777, -10196, 18165, 32664, 22235, -5163, -28621, -30238, -8779, 19379, 32748, 21125, -6620, -29313, -29636, -7343, 20553, 32764, 19971, -8063, -29945, -28974, -5893, 21685, 32714, 18777, -9490, -30515, -28253, -4430, 22773, 32597, 17544, -10898, -31024, -27474, -2959, 23815, 32414, 16276, -12283, -31469, -26640, -1481, 24807, 32164, 14974, -13643, -31849, -25750}, +{0, 24807, 32414, 17544, -9490, -29945, -29636, -8779, 18165, 32514, 24317, -741, -25286, -32298, -16916, 10195, 30237, 29312, 8062, -18778, -32598, -23816, 1480, 25749, 32164, 16276, -10898, -30515, -28974, -7343, 19379, 32664, 23300, -2221, -26202, -32015, -15630, 11592, 30776, 28620, 6619, -19972, -32715, -22774, 2958, 26639, 31848, 14974, -12283, -31024, -28253, -5893, 20553, 32748, 22235, -3696, -27064, -31667, -14313, 12965, 31253, 27870, 5162, -21126, -32765, -21686, 4429, 27473, 31468, 13642, -13643, -31469, -27474, -4430, 21685, 32764, 21125, -5163, -27871, -31254, -12966, 14312, 31666, 27063, 3695, -22236, -32749, -20554, 5892, 28252, 31023, 12282, -14975, -31849, -26640, -2959, 22773, 32714, 19971, -6620, -28621, -30777, -11593, 15629, 32014, 26201, 2220, -23301, -32665, -19380, 7342, 28973, 30514, 10897, -16277, -32165, -25750, -1481, 23815, 32597, 18777, -8063, -29313, -30238, -10196, 16915, 32297, 25285, 740, -24318, -32515, -18166, 8778, 29635, 29944, 9489, -17545, -32415, -24808}, +{0, 23815, 32714, 21125, -3696, -26202, -32298, -18166, 7342, 28252, 31468, 14974, -10898, -29945, -30238, -11593, 14312, 31253, 28620, 8062, -17545, -32165, -26640, -4430, 20553, 32664, 24317, 740, -23301, -32749, -21686, 2958, 25749, 32414, 18777, -6620, -27871, -31667, -15630, 10195, 29635, 30514, 12282, -13643, -31024, -28974, -8779, 16915, 32014, 27063, 5162, -19972, -32598, -24808, -1481, 22773, 32764, 22235, -2221, -25286, -32515, -19380, 5892, 27473, 31848, 16276, -9490, -29313, -30777, -12966, 12965, 30776, 29312, 9489, -16277, -31849, -27474, -5893, 19379, 32514, 25285, 2220, -22236, -32765, -22774, 1480, 24807, 32597, 19971, -5163, -27064, -32015, -16916, 8778, 28973, 31023, 13642, -12283, -30515, -29636, -10196, 15629, 31666, 27870, 6619, -18778, -32415, -25750, -2959, 21685, 32748, 23300, -741, -24318, -32665, -20554, 4429, 26639, 32164, 17544, -8063, -28621, -31254, -14313, 11592, 30237, 29944, 10897, -14975, -31469, -28253, -7343, 18165, 32297, 26201, 3695, -21126, -32715, -23816}, +{0, 22773, 32748, 24317, 2220, -21126, -32598, -25750, -4430, 19379, 32297, 27063, 6619, -17545, -31849, -28253, -8779, 15629, 31253, 29312, 10897, -13643, -30515, -30238, -12966, 11592, 29635, 31023, 14974, -9490, -28621, -31667, -16916, 7342, 27473, 32164, 18777, -5163, -26202, -32515, -20554, 2958, 24807, 32714, 22235, -741, -23301, -32765, -23816, -1481, 21685, 32664, 25285, 3695, -19972, -32415, -26640, -5893, 18165, 32014, 27870, 8062, -16277, -31469, -28974, -10196, 14312, 30776, 29944, 12282, -12283, -29945, -30777, -14313, 10195, 28973, 31468, 16276, -8063, -27871, -32015, -18166, 5892, 26639, 32414, 19971, -3696, -25286, -32665, -21686, 1480, 23815, 32764, 23300, 740, -22236, -32715, -24808, -2959, 20553, 32514, 26201, 5162, -18778, -32165, -27474, -7343, 16915, 31666, 28620, 9489, -14975, -31024, -29636, -11593, 12965, 30237, 30514, 13642, -10898, -29313, -31254, -15630, 8778, 28252, 31848, 17544, -6620, -27064, -32298, -19380, 4429, 25749, 32597, 21125, -2221, -24318, -32749, -22774}, +{0, 21685, 32514, 27063, 8062, -14975, -30515, -30777, -15630, 7342, 26639, 32597, 22235, 740, -21126, -32415, -27474, -8779, 14312, 30237, 31023, 16276, -6620, -26202, -32665, -22774, -1481, 20553, 32297, 27870, 9489, -13643, -29945, -31254, -16916, 5892, 25749, 32714, 23300, 2220, -19972, -32165, -28253, -10196, 12965, 29635, 31468, 17544, -5163, -25286, -32749, -23816, -2959, 19379, 32014, 28620, 10897, -12283, -29313, -31667, -18166, 4429, 24807, 32764, 24317, 3695, -18778, -31849, -28974, -11593, 11592, 28973, 31848, 18777, -3696, -24318, -32765, -24808, -4430, 18165, 31666, 29312, 12282, -10898, -28621, -32015, -19380, 2958, 23815, 32748, 25285, 5162, -17545, -31469, -29636, -12966, 10195, 28252, 32164, 19971, -2221, -23301, -32715, -25750, -5893, 16915, 31253, 29944, 13642, -9490, -27871, -32298, -20554, 1480, 22773, 32664, 26201, 6619, -16277, -31024, -30238, -14313, 8778, 27473, 32414, 21125, -741, -22236, -32598, -26640, -7343, 15629, 30776, 30514, 14974, -8063, -27064, -32515, -21686}, +{0, 20553, 32014, 29312, 13642, -8063, -26202, -32749, -24808, -5893, 15629, 30237, 31468, 18777, -2221, -22236, -32415, -28253, -11593, 10195, 27473, 32597, 23300, 3695, -17545, -31024, -30777, -16916, 4429, 23815, 32664, 27063, 9489, -12283, -28621, -32298, -21686, -1481, 19379, 31666, 29944, 14974, -6620, -25286, -32765, -25750, -7343, 14312, 29635, 31848, 19971, -741, -21126, -32165, -28974, -12966, 8778, 26639, 32714, 24317, 5162, -16277, -30515, -31254, -18166, 2958, 22773, 32514, 27870, 10897, -10898, -27871, -32515, -22774, -2959, 18165, 31253, 30514, 16276, -5163, -24318, -32715, -26640, -8779, 12965, 28973, 32164, 21125, 740, -19972, -31849, -29636, -14313, 7342, 25749, 32764, 25285, 6619, -14975, -29945, -31667, -19380, 1480, 21685, 32297, 28620, 12282, -9490, -27064, -32665, -23816, -4430, 16915, 30776, 31023, 17544, -3696, -23301, -32598, -27474, -10196, 11592, 28252, 32414, 22235, 2220, -18778, -31469, -30238, -15630, 5892, 24807, 32748, 26201, 8062, -13643, -29313, -32015, -20554}, +{0, 19379, 31253, 31023, 18777, -741, -19972, -31469, -30777, -18166, 1480, 20553, 31666, 30514, 17544, -2221, -21126, -31849, -30238, -16916, 2958, 21685, 32014, 29944, 16276, -3696, -22236, -32165, -29636, -15630, 4429, 22773, 32297, 29312, 14974, -5163, -23301, -32415, -28974, -14313, 5892, 23815, 32514, 28620, 13642, -6620, -24318, -32598, -28253, -12966, 7342, 24807, 32664, 27870, 12282, -8063, -25286, -32715, -27474, -11593, 8778, 25749, 32748, 27063, 10897, -9490, -26202, -32765, -26640, -10196, 10195, 26639, 32764, 26201, 9489, -10898, -27064, -32749, -25750, -8779, 11592, 27473, 32714, 25285, 8062, -12283, -27871, -32665, -24808, -7343, 12965, 28252, 32597, 24317, 6619, -13643, -28621, -32515, -23816, -5893, 14312, 28973, 32414, 23300, 5162, -14975, -29313, -32298, -22774, -4430, 15629, 29635, 32164, 22235, 3695, -16277, -29945, -32015, -21686, -2959, 16915, 30237, 31848, 21125, 2220, -17545, -30515, -31667, -20554, -1481, 18165, 30776, 31468, 19971, 740, -18778, -31024, -31254, -19380}, +{0, 18165, 30237, 32164, 23300, 6619, -12283, -27064, -32765, -27474, -12966, 5892, 22773, 32014, 30514, 18777, 740, -17545, -29945, -32298, -23816, -7343, 11592, 26639, 32748, 27870, 13642, -5163, -22236, -31849, -30777, -19380, -1481, 16915, 29635, 32414, 24317, 8062, -10898, -26202, -32715, -28253, -14313, 4429, 21685, 31666, 31023, 19971, 2220, -16277, -29313, -32515, -24808, -8779, 10195, 25749, 32664, 28620, 14974, -3696, -21126, -31469, -31254, -20554, -2959, 15629, 28973, 32597, 25285, 9489, -9490, -25286, -32598, -28974, -15630, 2958, 20553, 31253, 31468, 21125, 3695, -14975, -28621, -32665, -25750, -10196, 8778, 24807, 32514, 29312, 16276, -2221, -19972, -31024, -31667, -21686, -4430, 14312, 28252, 32714, 26201, 10897, -8063, -24318, -32415, -29636, -16916, 1480, 19379, 30776, 31848, 22235, 5162, -13643, -27871, -32749, -26640, -11593, 7342, 23815, 32297, 29944, 17544, -741, -18778, -30515, -32015, -22774, -5893, 12965, 27473, 32764, 27063, 12282, -6620, -23301, -32165, -30238, -18166}, +{0, 16915, 28973, 32714, 27063, 13642, -3696, -19972, -30515, -32298, -24808, -10196, 7342, 22773, 31666, 31468, 22235, 6619, -10898, -25286, -32415, -30238, -19380, -2959, 14312, 27473, 32748, 28620, 16276, -741, -17545, -29313, -32665, -26640, -12966, 4429, 20553, 30776, 32164, 24317, 9489, -8063, -23301, -31849, -31254, -21686, -5893, 11592, 25749, 32514, 29944, 18777, 2220, -14975, -27871, -32765, -28253, -15630, 1480, 18165, 29635, 32597, 26201, 12282, -5163, -21126, -31024, -32015, -23816, -8779, 8778, 23815, 32014, 31023, 21125, 5162, -12283, -26202, -32598, -29636, -18166, -1481, 15629, 28252, 32764, 27870, 14974, -2221, -18778, -29945, -32515, -25750, -11593, 5892, 21685, 31253, 31848, 23300, 8062, -9490, -24318, -32165, -30777, -20554, -4430, 12965, 26639, 32664, 29312, 17544, 740, -16277, -28621, -32749, -27474, -14313, 2958, 19379, 30237, 32414, 25285, 10897, -6620, -22236, -31469, -31667, -22774, -7343, 10195, 24807, 32297, 30514, 19971, 3695, -13643, -27064, -32715, -28974, -16916}, +{0, 15629, 27473, 32664, 29944, 19971, 5162, -10898, -24318, -31849, -31667, -23816, -10196, 5892, 20553, 30237, 32597, 27063, 14974, -741, -16277, -27871, -32715, -29636, -19380, -4430, 11592, 24807, 32014, 31468, 23300, 9489, -6620, -21126, -30515, -32515, -26640, -14313, 1480, 16915, 28252, 32748, 29312, 18777, 3695, -12283, -25286, -32165, -31254, -22774, -8779, 7342, 21685, 30776, 32414, 26201, 13642, -2221, -17545, -28621, -32765, -28974, -18166, -2959, 12965, 25749, 32297, 31023, 22235, 8062, -8063, -22236, -31024, -32298, -25750, -12966, 2958, 18165, 28973, 32764, 28620, 17544, 2220, -13643, -26202, -32415, -30777, -21686, -7343, 8778, 22773, 31253, 32164, 25285, 12282, -3696, -18778, -29313, -32749, -28253, -16916, -1481, 14312, 26639, 32514, 30514, 21125, 6619, -9490, -23301, -31469, -32015, -24808, -11593, 4429, 19379, 29635, 32714, 27870, 16276, 740, -14975, -27064, -32598, -30238, -20554, -5893, 10195, 23815, 31666, 31848, 24317, 10897, -5163, -19972, -29945, -32665, -27474, -15630}, +{0, 14312, 25749, 32014, 31848, 25285, 13642, -741, -14975, -26202, -32165, -31667, -24808, -12966, 1480, 15629, 26639, 32297, 31468, 24317, 12282, -2221, -16277, -27064, -32415, -31254, -23816, -11593, 2958, 16915, 27473, 32514, 31023, 23300, 10897, -3696, -17545, -27871, -32598, -30777, -22774, -10196, 4429, 18165, 28252, 32664, 30514, 22235, 9489, -5163, -18778, -28621, -32715, -30238, -21686, -8779, 5892, 19379, 28973, 32748, 29944, 21125, 8062, -6620, -19972, -29313, -32765, -29636, -20554, -7343, 7342, 20553, 29635, 32764, 29312, 19971, 6619, -8063, -21126, -29945, -32749, -28974, -19380, -5893, 8778, 21685, 30237, 32714, 28620, 18777, 5162, -9490, -22236, -30515, -32665, -28253, -18166, -4430, 10195, 22773, 30776, 32597, 27870, 17544, 3695, -10898, -23301, -31024, -32515, -27474, -16916, -2959, 11592, 23815, 31253, 32414, 27063, 16276, 2220, -12283, -24318, -31469, -32298, -26640, -15630, -1481, 12965, 24807, 31666, 32164, 26201, 14974, 740, -13643, -25286, -31849, -32015, -25750, -14313}, +{0, 12965, 23815, 30776, 32714, 29312, 21125, 9489, -3696, -16277, -26202, -31849, -32298, -27474, -18166, -5893, 7342, 19379, 28252, 32514, 31468, 25285, 14974, 2220, -10898, -22236, -29945, -32765, -30238, -22774, -11593, 1480, 14312, 24807, 31253, 32597, 28620, 19971, 8062, -5163, -17545, -27064, -32165, -32015, -26640, -16916, -4430, 8778, 20553, 28973, 32664, 31023, 24317, 13642, 740, -12283, -23301, -30515, -32749, -29636, -21686, -10196, 2958, 15629, 25749, 31666, 32414, 27870, 18777, 6619, -6620, -18778, -27871, -32415, -31667, -25750, -15630, -2959, 10195, 21685, 29635, 32748, 30514, 23300, 12282, -741, -13643, -24318, -31024, -32665, -28974, -20554, -8779, 4429, 16915, 26639, 32014, 32164, 27063, 17544, 5162, -8063, -19972, -28621, -32598, -31254, -24808, -14313, -1481, 11592, 22773, 30237, 32764, 29944, 22235, 10897, -2221, -14975, -25286, -31469, -32515, -28253, -19380, -7343, 5892, 18165, 27473, 32297, 31848, 26201, 16276, 3695, -9490, -21126, -29313, -32715, -30777, -23816, -12966}, +{0, 11592, 21685, 28973, 32514, 31848, 27063, 18777, 8062, -3696, -14975, -24318, -30515, -32765, -30777, -24808, -15630, -4430, 7342, 18165, 26639, 31666, 32597, 29312, 22235, 12282, 740, -10898, -21126, -28621, -32415, -32015, -27474, -19380, -8779, 2958, 14312, 23815, 30237, 32748, 31023, 25285, 16276, 5162, -6620, -17545, -26202, -31469, -32665, -29636, -22774, -12966, -1481, 10195, 20553, 28252, 32297, 32164, 27870, 19971, 9489, -2221, -13643, -23301, -29945, -32715, -31254, -25750, -16916, -5893, 5892, 16915, 25749, 31253, 32714, 29944, 23300, 13642, 2220, -9490, -19972, -27871, -32165, -32298, -28253, -20554, -10196, 1480, 12965, 22773, 29635, 32664, 31468, 26201, 17544, 6619, -5163, -16277, -25286, -31024, -32749, -30238, -23816, -14313, -2959, 8778, 19379, 27473, 32014, 32414, 28620, 21125, 10897, -741, -12283, -22236, -29313, -32598, -31667, -26640, -18166, -7343, 4429, 15629, 24807, 30776, 32764, 30514, 24317, 14974, 3695, -8063, -18778, -27064, -31849, -32515, -28974, -21686, -11593}, +{0, 10195, 19379, 26639, 31253, 32764, 31023, 26201, 18777, 9489, -741, -10898, -19972, -27064, -31469, -32749, -30777, -25750, -18166, -8779, 1480, 11592, 20553, 27473, 31666, 32714, 30514, 25285, 17544, 8062, -2221, -12283, -21126, -27871, -31849, -32665, -30238, -24808, -16916, -7343, 2958, 12965, 21685, 28252, 32014, 32597, 29944, 24317, 16276, 6619, -3696, -13643, -22236, -28621, -32165, -32515, -29636, -23816, -15630, -5893, 4429, 14312, 22773, 28973, 32297, 32414, 29312, 23300, 14974, 5162, -5163, -14975, -23301, -29313, -32415, -32298, -28974, -22774, -14313, -4430, 5892, 15629, 23815, 29635, 32514, 32164, 28620, 22235, 13642, 3695, -6620, -16277, -24318, -29945, -32598, -32015, -28253, -21686, -12966, -2959, 7342, 16915, 24807, 30237, 32664, 31848, 27870, 21125, 12282, 2220, -8063, -17545, -25286, -30515, -32715, -31667, -27474, -20554, -11593, -1481, 8778, 18165, 25749, 30776, 32748, 31468, 27063, 19971, 10897, 740, -9490, -18778, -26202, -31024, -32765, -31254, -26640, -19380, -10196}, +{0, 8778, 16915, 23815, 28973, 32014, 32714, 31023, 27063, 21125, 13642, 5162, -3696, -12283, -19972, -26202, -30515, -32598, -32298, -29636, -24808, -18166, -10196, -1481, 7342, 15629, 22773, 28252, 31666, 32764, 31468, 27870, 22235, 14974, 6619, -2221, -10898, -18778, -25286, -29945, -32415, -32515, -30238, -25750, -19380, -11593, -2959, 5892, 14312, 21685, 27473, 31253, 32748, 31848, 28620, 23300, 16276, 8062, -741, -9490, -17545, -24318, -29313, -32165, -32665, -30777, -26640, -20554, -12966, -4430, 4429, 12965, 20553, 26639, 30776, 32664, 32164, 29312, 24317, 17544, 9489, 740, -8063, -16277, -23301, -28621, -31849, -32749, -31254, -27474, -21686, -14313, -5893, 2958, 11592, 19379, 25749, 30237, 32514, 32414, 29944, 25285, 18777, 10897, 2220, -6620, -14975, -22236, -27871, -31469, -32765, -31667, -28253, -22774, -15630, -7343, 1480, 10195, 18165, 24807, 29635, 32297, 32597, 30514, 26201, 19971, 12282, 3695, -5163, -13643, -21126, -27064, -31024, -32715, -32015, -28974, -23816, -16916, -8779}, +{0, 7342, 14312, 20553, 25749, 29635, 32014, 32764, 31848, 29312, 25285, 19971, 13642, 6619, -741, -8063, -14975, -21126, -26202, -29945, -32165, -32749, -31667, -28974, -24808, -19380, -12966, -5893, 1480, 8778, 15629, 21685, 26639, 30237, 32297, 32714, 31468, 28620, 24317, 18777, 12282, 5162, -2221, -9490, -16277, -22236, -27064, -30515, -32415, -32665, -31254, -28253, -23816, -18166, -11593, -4430, 2958, 10195, 16915, 22773, 27473, 30776, 32514, 32597, 31023, 27870, 23300, 17544, 10897, 3695, -3696, -10898, -17545, -23301, -27871, -31024, -32598, -32515, -30777, -27474, -22774, -16916, -10196, -2959, 4429, 11592, 18165, 23815, 28252, 31253, 32664, 32414, 30514, 27063, 22235, 16276, 9489, 2220, -5163, -12283, -18778, -24318, -28621, -31469, -32715, -32298, -30238, -26640, -21686, -15630, -8779, -1481, 5892, 12965, 19379, 24807, 28973, 31666, 32748, 32164, 29944, 26201, 21125, 14974, 8062, 740, -6620, -13643, -19972, -25286, -29313, -31849, -32765, -32015, -29636, -25750, -20554, -14313, -7343}, +{0, 5892, 11592, 16915, 21685, 25749, 28973, 31253, 32514, 32714, 31848, 29944, 27063, 23300, 18777, 13642, 8062, 2220, -3696, -9490, -14975, -19972, -24318, -27871, -30515, -32165, -32765, -32298, -30777, -28253, -24808, -20554, -15630, -10196, -4430, 1480, 7342, 12965, 18165, 22773, 26639, 29635, 31666, 32664, 32597, 31468, 29312, 26201, 22235, 17544, 12282, 6619, 740, -5163, -10898, -16277, -21126, -25286, -28621, -31024, -32415, -32749, -32015, -30238, -27474, -23816, -19380, -14313, -8779, -2959, 2958, 8778, 14312, 19379, 23815, 27473, 30237, 32014, 32748, 32414, 31023, 28620, 25285, 21125, 16276, 10897, 5162, -741, -6620, -12283, -17545, -22236, -26202, -29313, -31469, -32598, -32665, -31667, -29636, -26640, -22774, -18166, -12966, -7343, -1481, 4429, 10195, 15629, 20553, 24807, 28252, 30776, 32297, 32764, 32164, 30514, 27870, 24317, 19971, 14974, 9489, 3695, -2221, -8063, -13643, -18778, -23301, -27064, -29945, -31849, -32715, -32515, -31254, -28974, -25750, -21686, -16916, -11593, -5893}, +{0, 4429, 8778, 12965, 16915, 20553, 23815, 26639, 28973, 30776, 32014, 32664, 32714, 32164, 31023, 29312, 27063, 24317, 21125, 17544, 13642, 9489, 5162, 740, -3696, -8063, -12283, -16277, -19972, -23301, -26202, -28621, -30515, -31849, -32598, -32749, -32298, -31254, -29636, -27474, -24808, -21686, -18166, -14313, -10196, -5893, -1481, 2958, 7342, 11592, 15629, 19379, 22773, 25749, 28252, 30237, 31666, 32514, 32764, 32414, 31468, 29944, 27870, 25285, 22235, 18777, 14974, 10897, 6619, 2220, -2221, -6620, -10898, -14975, -18778, -22236, -25286, -27871, -29945, -31469, -32415, -32765, -32515, -31667, -30238, -28253, -25750, -22774, -19380, -15630, -11593, -7343, -2959, 1480, 5892, 10195, 14312, 18165, 21685, 24807, 27473, 29635, 31253, 32297, 32748, 32597, 31848, 30514, 28620, 26201, 23300, 19971, 16276, 12282, 8062, 3695, -741, -5163, -9490, -13643, -17545, -21126, -24318, -27064, -29313, -31024, -32165, -32715, -32665, -32015, -30777, -28974, -26640, -23816, -20554, -16916, -12966, -8779, -4430}, +{0, 2958, 5892, 8778, 11592, 14312, 16915, 19379, 21685, 23815, 25749, 27473, 28973, 30237, 31253, 32014, 32514, 32748, 32714, 32414, 31848, 31023, 29944, 28620, 27063, 25285, 23300, 21125, 18777, 16276, 13642, 10897, 8062, 5162, 2220, -741, -3696, -6620, -9490, -12283, -14975, -17545, -19972, -22236, -24318, -26202, -27871, -29313, -30515, -31469, -32165, -32598, -32765, -32665, -32298, -31667, -30777, -29636, -28253, -26640, -24808, -22774, -20554, -18166, -15630, -12966, -10196, -7343, -4430, -1481, 1480, 4429, 7342, 10195, 12965, 15629, 18165, 20553, 22773, 24807, 26639, 28252, 29635, 30776, 31666, 32297, 32664, 32764, 32597, 32164, 31468, 30514, 29312, 27870, 26201, 24317, 22235, 19971, 17544, 14974, 12282, 9489, 6619, 3695, 740, -2221, -5163, -8063, -10898, -13643, -16277, -18778, -21126, -23301, -25286, -27064, -28621, -29945, -31024, -31849, -32415, -32715, -32749, -32515, -32015, -31254, -30238, -28974, -27474, -25750, -23816, -21686, -19380, -16916, -14313, -11593, -8779, -5893, -2959}, +{0, 1480, 2958, 4429, 5892, 7342, 8778, 10195, 11592, 12965, 14312, 15629, 16915, 18165, 19379, 20553, 21685, 22773, 23815, 24807, 25749, 26639, 27473, 28252, 28973, 29635, 30237, 30776, 31253, 31666, 32014, 32297, 32514, 32664, 32748, 32764, 32714, 32597, 32414, 32164, 31848, 31468, 31023, 30514, 29944, 29312, 28620, 27870, 27063, 26201, 25285, 24317, 23300, 22235, 21125, 19971, 18777, 17544, 16276, 14974, 13642, 12282, 10897, 9489, 8062, 6619, 5162, 3695, 2220, 740, -741, -2221, -3696, -5163, -6620, -8063, -9490, -10898, -12283, -13643, -14975, -16277, -17545, -18778, -19972, -21126, -22236, -23301, -24318, -25286, -26202, -27064, -27871, -28621, -29313, -29945, -30515, -31024, -31469, -31849, -32165, -32415, -32598, -32715, -32765, -32749, -32665, -32515, -32298, -32015, -31667, -31254, -30777, -30238, -29636, -28974, -28253, -27474, -26640, -25750, -24808, -23816, -22774, -21686, -20554, -19380, -18166, -16916, -15630, -14313, -12966, -11593, -10196, -8779, -7343, -5893, -4430, -2959, -1481} +}; \ No newline at end of file diff --git a/openair1/PHY/NR_TRANSPORT/nr_prach_common.c b/openair1/PHY/NR_TRANSPORT/nr_prach_common.c index a95c519d43..8cc5951b19 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_prach_common.c +++ b/openair1/PHY/NR_TRANSPORT/nr_prach_common.c @@ -127,6 +127,8 @@ void compute_nr_prach_seq(uint8_t short_sequence, LOG_D( PHY, "compute_prach_seq: done init prach_tables\n" ); + int16_t *x_u_time = calloc(1, sizeof(int32_t)*N_ZC); + for (i=0; i>1); + x_u_time[k<<1] = (int16_t)nr_ru[nr_ru_index<<1]; + x_u_time[1+(k<<1)] = (int16_t)nr_ru[1+(nr_ru_index<<1)]; } + + int16_t *x_u_freq = (int16_t*)X_u[i]; + bzero(x_u_freq,sizeof(int32_t)*N_ZC); + for (int line=0; line>19); + x_u_freq[1+(line<<1)] = x_u_freq[1+(line<<1)] + (im>>19); + } + } + +#ifdef PRACH_DEBUG + for (k=0; k>16)); + } +#endif } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_UE_COMPUTE_PRACH, VCD_FUNCTION_OUT); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 1a330da02c..1d8f3a9caf 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -523,9 +523,9 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, } else { LOG_I(NR_MAC,"[RAPROC] RA-Msg3 received\n"); - LOG_I(NR_MAC,"[RAPROC] Received Msg3:\n"); + LOG_D(NR_MAC,"[RAPROC] Received Msg3:\n"); for (int k = 0; k < sdu_lenP; k++) { - LOG_I(NR_MAC,"(%i): 0x%x\n",k,sduP[k]); + LOG_D(NR_MAC,"(%i): 0x%x\n",k,sduP[k]); } // UE Contention Resolution Identity From 149785740dd056665f1c6f7d02acc2433bcf725a Mon Sep 17 00:00:00 2001 From: Remi Hardy Date: Thu, 18 Mar 2021 09:10:42 +0100 Subject: [PATCH 199/231] update of the CI NSA reference test --- ci-scripts/xml_files/fr1_nsa_base.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci-scripts/xml_files/fr1_nsa_base.xml b/ci-scripts/xml_files/fr1_nsa_base.xml index 01a5398225..96bdc79f0f 100644 --- a/ci-scripts/xml_files/fr1_nsa_base.xml +++ b/ci-scripts/xml_files/fr1_nsa_base.xml @@ -21,8 +21,8 @@ --> - TEST-FR1-TM1 - FR1 + TEST-NSA-FR1-TM1 + NSA FULL tasks 010000 From 43b867c55e9aaf006aa84760f1ed49e46efad411 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Thu, 18 Mar 2021 11:10:47 +0100 Subject: [PATCH 200/231] CI: adding child jobs trigger => Building U18 and RHEL8 images Signed-off-by: Raphael Defosseux --- ci-scripts/Jenkinsfile-GitLab-Container | 42 +++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/ci-scripts/Jenkinsfile-GitLab-Container b/ci-scripts/Jenkinsfile-GitLab-Container index ed13fcd1db..8ca126d0b7 100644 --- a/ci-scripts/Jenkinsfile-GitLab-Container +++ b/ci-scripts/Jenkinsfile-GitLab-Container @@ -110,6 +110,48 @@ pipeline { } } } + stage ("Image Building Processes") { + parallel { + stage ("Ubuntu18 Build") { + steps { + script { + triggerSlaveJob ('RAN-Ubuntu18-Image-Builder', 'Ubuntu18-Images-Build') + } + } + post { + always { + script { + finalizeSlaveJob('RAN-Ubuntu18-Image-Builder') + } + } + failure { + script { + currentBuild.result = 'FAILURE' + } + } + } + } + stage ("RHEL8 Build") { + steps { + script { + triggerSlaveJob ('RAN-RHEL8-Image-Builder', 'RHEL8-Images-Build') + } + } + post { + always { + script { + finalizeSlaveJob('RAN-RHEL8-Image-Builder') + } + } + failure { + script { + currentBuild.result = 'FAILURE' + } + } + } + } + } + } } post { always { From 00a70601848d7cdf79206064baa9d2f7d44f3d97 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Thu, 18 Mar 2021 11:18:21 +0100 Subject: [PATCH 201/231] CI: adding comments Signed-off-by: Raphael Defosseux --- ci-scripts/Jenkinsfile-GitLab-Container | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ci-scripts/Jenkinsfile-GitLab-Container b/ci-scripts/Jenkinsfile-GitLab-Container index 8ca126d0b7..fbf9ba8f4b 100644 --- a/ci-scripts/Jenkinsfile-GitLab-Container +++ b/ci-scripts/Jenkinsfile-GitLab-Container @@ -110,6 +110,8 @@ pipeline { } } } + // Build Stages are Mandatory + // Later we will add a Ubuntu20 build stage ("Image Building Processes") { parallel { stage ("Ubuntu18 Build") { From 6d028fb180d0849b27768aece014a33b7be3a668 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Thu, 18 Mar 2021 12:15:27 +0100 Subject: [PATCH 202/231] CI: podman3 cannot run rootless and some little fixes in pipeline Signed-off-by: Raphael Defosseux --- ci-scripts/Jenkinsfile-tmp-ran | 44 ++++++++++++++++++++++++++++++---- ci-scripts/cls_containerize.py | 2 +- 2 files changed, 41 insertions(+), 5 deletions(-) diff --git a/ci-scripts/Jenkinsfile-tmp-ran b/ci-scripts/Jenkinsfile-tmp-ran index ab1573de7f..92f5db952f 100644 --- a/ci-scripts/Jenkinsfile-tmp-ran +++ b/ci-scripts/Jenkinsfile-tmp-ran @@ -241,6 +241,10 @@ pipeline { stage ("Terminate") { parallel { stage('Terminate UE') { + // Bypassing this stage if there are no abd server defined + when { + expression { params.ADB_IPAddress != "none" } + } steps { echo '\u2705 \u001B[32mTerminate UE\u001B[0m' withCredentials([ @@ -275,6 +279,10 @@ pipeline { } } stage('Terminate SPGW') { + // Bypassing this stage if EPC server is not defined + when { + expression { params.EPC_IPAddress != "none" } + } steps { echo '\u2705 \u001B[32mTerminate SPGW\u001B[0m' withCredentials([ @@ -292,6 +300,10 @@ pipeline { } } stage('Terminate MME') { + // Bypassing this stage if EPC server is not defined + when { + expression { params.EPC_IPAddress != "none" } + } steps { echo '\u2705 \u001B[32mTerminate MME\u001B[0m' withCredentials([ @@ -309,6 +321,10 @@ pipeline { } } stage('Terminate HSS') { + // Bypassing this stage if EPC server is not defined + when { + expression { params.EPC_IPAddress != "none" } + } steps { echo '\u2705 \u001B[32mTerminate HSS\u001B[0m' withCredentials([ @@ -371,6 +387,10 @@ pipeline { } } stage('Log Collection (SPGW)') { + // Bypassing this stage if EPC server is not defined + when { + expression { params.EPC_IPAddress != "none" } + } steps { withCredentials([ [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.EPC_Credentials}", usernameVariable: 'EPC_Username', passwordVariable: 'EPC_Password'] @@ -389,6 +409,10 @@ pipeline { } } stage('Log Collection (MME)') { + // Bypassing this stage if EPC server is not defined + when { + expression { params.EPC_IPAddress != "none" } + } steps { withCredentials([ [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.EPC_Credentials}", usernameVariable: 'EPC_Username', passwordVariable: 'EPC_Password'] @@ -407,6 +431,10 @@ pipeline { } } stage('Log Collection (HSS)') { + // Bypassing this stage if EPC server is not defined + when { + expression { params.EPC_IPAddress != "none" } + } steps { withCredentials([ [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.EPC_Credentials}", usernameVariable: 'EPC_Username', passwordVariable: 'EPC_Password'] @@ -425,6 +453,10 @@ pipeline { } } stage('Log Collection (Ping)') { + // Bypassing this stage if EPC server is not defined + when { + expression { params.EPC_IPAddress != "none" } + } steps { withCredentials([ [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.EPC_Credentials}", usernameVariable: 'EPC_Username', passwordVariable: 'EPC_Password'] @@ -443,6 +475,10 @@ pipeline { } } stage('Log Collection (Iperf)') { + // Bypassing this stage if EPC server is not defined + when { + expression { params.EPC_IPAddress != "none" } + } steps { withCredentials([ [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.EPC_Credentials}", usernameVariable: 'EPC_Username', passwordVariable: 'EPC_Password'] @@ -482,7 +518,7 @@ pipeline { // Making sure that we really shutdown every thing before leaving failure { script { - if (!termStatusArray[termUE]) { + if ((!termStatusArray[termUE]) && (params.ADBIPAddress != "none")) { withCredentials([ [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.ADB_Credentials}", usernameVariable: 'ADB_Username', passwordVariable: 'ADB_Password'] ]) { @@ -496,21 +532,21 @@ pipeline { sh "python3 ci-scripts/main.py --mode=TerminateeNB --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password}" } } - if (!termStatusArray[termSPGW]) { + if ((!termStatusArray[termSPGW]) && (params.EPC_IPAddress != "none")) { withCredentials([ [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.EPC_Credentials}", usernameVariable: 'EPC_Username', passwordVariable: 'EPC_Password'] ]) { sh "python3 ci-scripts/main.py --mode=TerminateSPGW --EPCIPAddress=${params.EPC_IPAddress} --EPCUserName=${EPC_Username} --EPCPassword=${EPC_Password} --EPCType=${params.EPC_Type} --EPCSourceCodePath=${params.EPC_SourceCodePath}" } } - if (!termStatusArray[termMME]) { + if ((!termStatusArray[termMME]) && (params.EPC_IPAddress != "none")) { withCredentials([ [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.EPC_Credentials}", usernameVariable: 'EPC_Username', passwordVariable: 'EPC_Password'] ]) { sh "python3 ci-scripts/main.py --mode=TerminateMME --EPCIPAddress=${params.EPC_IPAddress} --EPCUserName=${EPC_Username} --EPCPassword=${EPC_Password} --EPCType=${params.EPC_Type} --EPCSourceCodePath=${params.EPC_SourceCodePath}" } } - if (!termStatusArray[termHSS]) { + if ((!termStatusArray[termHSS]) && (params.EPC_IPAddress != "none")) { withCredentials([ [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.EPC_Credentials}", usernameVariable: 'EPC_Username', passwordVariable: 'EPC_Password'] ]) { diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index 0c07dfe91f..a3bb6eeefc 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -124,7 +124,7 @@ class Containerize(): self.cli = 'docker' self.dockerfileprefix = '.ubuntu18' elif self.host == 'Red Hat': - self.cli = 'podman' + self.cli = 'sudo podman' self.dockerfileprefix = '.rhel8.2' imageNames = [] From 710fcba5b9688858b562303c0d11518da4991e7a Mon Sep 17 00:00:00 2001 From: hardy Date: Thu, 18 Mar 2021 11:53:57 +0100 Subject: [PATCH 203/231] fixing CI NSA Jenkins allow merge add new nsa reference test --- ci-scripts/Jenkinsfile-tmp-multi-enb-nsa | 6 +- ci-scripts/Jenkinsfile-trig-nsa | 7 +- ci-scripts/xml_files/fr1_nsa_base_ref.xml | 161 ++++++++++++++++++++++ 3 files changed, 170 insertions(+), 4 deletions(-) create mode 100644 ci-scripts/xml_files/fr1_nsa_base_ref.xml diff --git a/ci-scripts/Jenkinsfile-tmp-multi-enb-nsa b/ci-scripts/Jenkinsfile-tmp-multi-enb-nsa index 7f61639261..f312f05e45 100644 --- a/ci-scripts/Jenkinsfile-tmp-multi-enb-nsa +++ b/ci-scripts/Jenkinsfile-tmp-multi-enb-nsa @@ -42,7 +42,7 @@ def ciSmartPhoneResource2 = params.smartphonesResource2 def eNB_Repository def eNB_Branch def eNB_CommitID -def eNB_AllowMergeRequestProcess = false +def eNB_AllowMergeRequestProcess def eNB_TargetBranch pipeline { @@ -134,8 +134,8 @@ pipeline { eNB_CommitID = params.eNB_CommitID } echo "eNB_CommitID : ${eNB_CommitID}" - if (params.eNB_mergeRequest != null) { - eNB_AllowMergeRequestProcess = params.eNB_mergeRequest + if (params.eNB_AllowMergeRequestProcess!= null) { + eNB_AllowMergeRequestProcess = params.eNB_AllowMergeRequestProcess if (eNB_AllowMergeRequestProcess) { if (params.eNB_TargetBranch != null) { eNB_TargetBranch = params.eNB_TargetBranch diff --git a/ci-scripts/Jenkinsfile-trig-nsa b/ci-scripts/Jenkinsfile-trig-nsa index 2ecf6ebd1e..3bb5bfd359 100644 --- a/ci-scripts/Jenkinsfile-trig-nsa +++ b/ci-scripts/Jenkinsfile-trig-nsa @@ -25,6 +25,9 @@ // Location of the python executor node shall be in the same subnet as the others servers def pythonExecutor = params.pythonExecutor +def TARGET_BRANCH = "develop" +def ALLOW_MERGE = true + pipeline { agent { label pythonExecutor @@ -46,7 +49,9 @@ pipeline { build job: "RAN-CI-NSA-B210", wait : false, propagate : false, parameters: [ string(name: 'eNB_MR', value: String.valueOf(MR)), string(name: 'eNB_Branch', value: String.valueOf(SRC_BRANCH)), - string(name: 'eNB_CommitID', value: String.valueOf(COMMIT_ID)) + string(name: 'eNB_CommitID', value: String.valueOf(COMMIT_ID)), + string(name: 'eNB_TargetBranch', value: String.valueOf(TARGET_BRANCH)), + booleanParam(name: 'eNB_AllowMergeRequestProcess', value: Boolean.valueOf(ALLOW_MERGE)) ] } } diff --git a/ci-scripts/xml_files/fr1_nsa_base_ref.xml b/ci-scripts/xml_files/fr1_nsa_base_ref.xml new file mode 100644 index 0000000000..fd47db10b2 --- /dev/null +++ b/ci-scripts/xml_files/fr1_nsa_base_ref.xml @@ -0,0 +1,161 @@ + + + TEST-NSA-FR1-TM1 + NSA FULL + tasks + + 010000 + 030000 + 040000 + 010001 + 000001 + 050000 + 050001 + 000001 + 060000 + 060001 + 000001 + 070000 + 010002 + 000001 + 080001 + 080000 + 010003 + + + + + Initialize_UE + Initialize UE + + + + Terminate_UE + Terminate UE + + + + Attach_UE + Attach UE + + + + Detach_UE + Detach UE + + + + + Initialize_eNB + Initialize eNB + -O ci-scripts/conf_files/enb.band7.tm1.fr1.25PRB.usrpb210.conf + 0 + 0 + lte + + + + + Initialize_eNB + Initialize gNB + -O ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf -E + 1 + 1 + nr + + + + IdleSleep + Sleep + 20 + + + + Ping + Ping: 20pings in 20sec + -c 20 + 50 + + + + Ping + Ping: 100pings in 20sec + -c 100 -i 0.2 + 50 + + + + + Iperf + iperf (DL/3Mbps/UDP)(20 sec)(single-ue profile) + -u -b 3M -t 20 -i 1 + 50 + single-ue + + + + Iperf + iperf (UL/1Mbps/UDP)(20 sec)(single-ue profile) + -u -b 1M -t 20 -i 1 -R + 50 + single-ue + + + + + Iperf + iperf (DL/20Mbps/UDP)(20 sec)(single-ue profile) + -u -b 20M -t 20 -i 1 + 50 + single-ue + + + + Iperf + iperf (UL/3Mbps/UDP)(20 sec)(single-ue profile) + -u -b 3M -t 20 -i 1 -R + 50 + single-ue + + + + + + Terminate_eNB + Terminate eNB + 0 + 0 + lte + + + + Terminate_eNB + Terminate gNB + 1 + 1 + nr + + + + From bbb7489983df84f1501a6a46845668e34a11ba15 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Thu, 18 Mar 2021 13:51:40 +0100 Subject: [PATCH 204/231] CI: better reporting Signed-off-by: Raphael Defosseux --- ci-scripts/Jenkinsfile-tmp-ran | 2 +- ci-scripts/cls_containerize.py | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/ci-scripts/Jenkinsfile-tmp-ran b/ci-scripts/Jenkinsfile-tmp-ran index 92f5db952f..7d5307620f 100644 --- a/ci-scripts/Jenkinsfile-tmp-ran +++ b/ci-scripts/Jenkinsfile-tmp-ran @@ -518,7 +518,7 @@ pipeline { // Making sure that we really shutdown every thing before leaving failure { script { - if ((!termStatusArray[termUE]) && (params.ADBIPAddress != "none")) { + if ((!termStatusArray[termUE]) && (params.ADB_IPAddress != "none")) { withCredentials([ [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.ADB_Credentials}", usernameVariable: 'ADB_Username', passwordVariable: 'ADB_Password'] ]) { diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index a3bb6eeefc..cb5aacb4bc 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -189,8 +189,6 @@ class Containerize(): mySSH.command('sudo cp /etc/rhsm/ca/redhat-uep.pem tmp/ca/', '\$', 5) mySSH.command('sudo cp /etc/pki/entitlement/*.pem tmp/entitlement/', '\$', 5) - #mySSH.close() - #return 0 sharedimage = 'ran-build' # Let's remove any previous run artifacts if still there mySSH.command(self.cli + ' image prune --force', '\$', 5) @@ -214,7 +212,6 @@ class Containerize(): danglingShaOnes.append((image, result.group('imageShaOne'))) previousImage = image + ':' + imageTag - imageTag = 'ci-temp' # First verify if images were properly created. status = True mySSH.command(self.cli + ' image inspect --format=\'Size = {{.Size}} bytes\' ' + sharedimage + ':' + imageTag, '\$', 5) @@ -286,14 +283,16 @@ class Containerize(): mySSH.command('cd cmake_targets', '\$', 5) mySSH.command('mkdir -p build_log_' + self.testCase_id, '\$', 5) mySSH.command('mv log/* ' + 'build_log_' + self.testCase_id, '\$', 5) - #mySSH.close() - mySSH.command('cd /tmp/CI-eNB/cmake_targets', '\$', 5) + mySSH.command('cd ' + lSourcePath + '/cmake_targets', '\$', 5) + mySSH.command('rm -f build_log_' + self.testCase_id + '.zip || true', '\$', 5) if (os.path.isfile('./build_log_' + self.testCase_id + '.zip')): os.remove('./build_log_' + self.testCase_id + '.zip') + if (os.path.isdir('./build_log_' + self.testCase_id)): + shutil.rmtree('./build_log_' + self.testCase_id) mySSH.command('zip -r -qq build_log_' + self.testCase_id + '.zip build_log_' + self.testCase_id, '\$', 5) mySSH.copyin(lIpAddr, lUserName, lPassWord, lSourcePath + '/cmake_targets/build_log_' + self.testCase_id + '.zip', '.') - #mySSH.command('rm -f build_log_' + self.testCase_id + '.zip','\$', 5) + mySSH.command('rm -f build_log_' + self.testCase_id + '.zip','\$', 5) mySSH.close() ZipFile('build_log_' + self.testCase_id + '.zip').extractall('.') From 0973cb879d6561317d4d77b68504228820efee10 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Thu, 18 Mar 2021 14:36:14 +0100 Subject: [PATCH 205/231] [CI][DOCKER] fix RHEL8 build Signed-off-by: Raphael Defosseux --- ci-scripts/cls_containerize.py | 5 +++-- ci-scripts/xml_files/fr1_image_build.xml | 2 +- cmake_targets/tools/build_helper | 10 +++++----- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index cb5aacb4bc..850f9fa0e0 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -35,6 +35,7 @@ import sys # arg import re # reg import logging import os +import shutil import time from multiprocessing import Process, Lock, SimpleQueue from zipfile import ZipFile @@ -215,7 +216,7 @@ class Containerize(): # First verify if images were properly created. status = True mySSH.command(self.cli + ' image inspect --format=\'Size = {{.Size}} bytes\' ' + sharedimage + ':' + imageTag, '\$', 5) - if mySSH.getBefore().count('No such object') != 0: + if (mySSH.getBefore().count('No such object') != 0) or (mySSH.getBefore().count('no such image') != 0): logging.error('Could not build properly ran-build') status = False else: @@ -239,7 +240,7 @@ class Containerize(): logging.debug('ran-build size is unknown') for image,pattern in imageNames: mySSH.command(self.cli + ' image inspect --format=\'Size = {{.Size}} bytes\' ' + image + ':' + imageTag, '\$', 5) - if mySSH.getBefore().count('No such object') != 0: + if (mySSH.getBefore().count('No such object') != 0) or (mySSH.getBefore().count('no such image') != 0): logging.error('Could not build properly ' + image) status = False else: diff --git a/ci-scripts/xml_files/fr1_image_build.xml b/ci-scripts/xml_files/fr1_image_build.xml index 9dd386b646..19452c3644 100644 --- a/ci-scripts/xml_files/fr1_image_build.xml +++ b/ci-scripts/xml_files/fr1_image_build.xml @@ -31,7 +31,7 @@ Build_Image - Build eNB Image + Build all Images all 0 0 diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper index 977827b0c9..838ed1aec4 100755 --- a/cmake_targets/tools/build_helper +++ b/cmake_targets/tools/build_helper @@ -359,10 +359,10 @@ check_install_usrp_uhd_driver(){ elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then if [ $IS_CONTAINER -eq 0 ] then - $SUDO $INSTALLER -y install python boost libusb-devel libusbx-devel boost-devel python-mako python-docutils cmake + $SUDO $INSTALLER -y install python boost libusb-devel libusbx-devel boost-devel python-mako python-docutils $CMAKE $SUDO -H pip install requests else - $SUDO $INSTALLER -y install boost boost-devel cmake3 + $SUDO $INSTALLER -y install boost boost-devel $CMAKE $SUDO pip3 install mako requests fi if [[ "$OS_DISTRO" == "rhel" ]] || [[ "$OS_DISTRO" == "centos" ]]; then @@ -488,7 +488,7 @@ install_soapy_from_source(){ #git checkout tags/release_003_010_001_001 mkdir -p build cd build - cmake ../ + $CMAKE ../ echo "Compiling SoapyRemote" make -j`nproc` $SUDO make install @@ -507,7 +507,7 @@ install_soapy_iris_from_source(){ cd sklk-soapyiris mkdir -p build cd build - cmake ../ + $CMAKE ../ echo "Compiling SoapyIris" make -j`nproc` $SUDO make install @@ -684,7 +684,7 @@ check_install_oai_software() { automake \ bison \ build-essential \ - cmake \ + $CMAKE \ cmake-curses-gui \ ninja-build \ doxygen \ From 71538abf1cfce9dc6cc4b2a40a604c4f22b1cb24 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Thu, 18 Mar 2021 15:13:03 +0100 Subject: [PATCH 206/231] [CI][DOCKER] real fix on RHEL build Signed-off-by: Raphael Defosseux --- cmake_targets/tools/build_helper | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper index 838ed1aec4..0c3dbfd048 100755 --- a/cmake_targets/tools/build_helper +++ b/cmake_targets/tools/build_helper @@ -41,7 +41,7 @@ KERNEL_VERSION=$(uname -r | cut -d '.' -f1) KERNEL_MAJOR=$(uname -r | cut -d '.' -f2) #check if we run inside a container -IS_CONTAINER=`egrep -c "docker|podman|kubepods" /proc/self/cgroup || true` +IS_CONTAINER=`egrep -c "docker|podman|kubepods|libpod|buildah" /proc/self/cgroup || true` #sudo is not needed when we are root if [ "$UID" = 0 ] then From ee8cfe0e0e63aef851e14e9a98bb067c8d40ecbc Mon Sep 17 00:00:00 2001 From: hardy Date: Tue, 16 Mar 2021 09:55:42 +0100 Subject: [PATCH 207/231] fix dependency path for dpdk lib increasing timeout for command related to waitbuild debug removing parallel build of xNB updating test xml with benetel conf files --- ci-scripts/ran.py | 1 + .../xml_files/benetel_multi_node_build.xml | 16 +--------------- ci-scripts/xml_files/benetel_nsa_base.xml | 4 ++-- cmake_targets/CMakeLists.txt | 3 +++ 4 files changed, 7 insertions(+), 17 deletions(-) diff --git a/ci-scripts/ran.py b/ci-scripts/ran.py index 774d7f19c6..5a88a096a3 100644 --- a/ci-scripts/ran.py +++ b/ci-scripts/ran.py @@ -239,6 +239,7 @@ class RANManagement(): while (count > 0) and buildOAIprocess: mySSH.command('ps aux | grep --color=never build_ | grep -v grep', '\$', 6) result = re.search('build_oai', mySSH.getBefore()) + print(result) if result is None: buildOAIprocess = False else: diff --git a/ci-scripts/xml_files/benetel_multi_node_build.xml b/ci-scripts/xml_files/benetel_multi_node_build.xml index 6f9ebdd1d1..7d22675568 100644 --- a/ci-scripts/xml_files/benetel_multi_node_build.xml +++ b/ci-scripts/xml_files/benetel_multi_node_build.xml @@ -26,7 +26,6 @@ wrench 000001 000002 - 000003 000004 @@ -36,15 +35,8 @@ --eNB -t benetel4g -w None 0 0 - True - - WaitEndBuild_eNB - Wait for end of Build eNB - 0 - 0 - Build_eNB @@ -52,15 +44,9 @@ --gNB -t benetel5g -w None 1 1 - True - - WaitEndBuild_eNB - Wait for end of Build gNB - 1 - 1 - + diff --git a/ci-scripts/xml_files/benetel_nsa_base.xml b/ci-scripts/xml_files/benetel_nsa_base.xml index 01a5398225..0404c14a09 100644 --- a/ci-scripts/xml_files/benetel_nsa_base.xml +++ b/ci-scripts/xml_files/benetel_nsa_base.xml @@ -70,7 +70,7 @@ Initialize_eNB Initialize eNB - -O ci-scripts/conf_files/enb.band7.tm1.fr1.25PRB.usrpb210.conf + -O ci-scripts/conf_files/benetel-4g.conf 0 0 lte @@ -80,7 +80,7 @@ Initialize_eNB Initialize gNB - -O ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf -E + -O ci-scripts/conf_files/benetel-5g.conf -E 1 1 nr diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index e11c850b8e..28bd461c34 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -926,6 +926,9 @@ set_target_properties(tcp_bridge_oai PROPERTIES COMPILE_FLAGS "-fvisibility=hidd # Benetel 4G library ###################################################################### + +include_directories ("/usr/include/dpdk") + set(HWLIB_BENETEL_4G_SOURCE ${OPENAIR_TARGETS}/ARCH/ETHERNET/benetel/4g/benetel.c ${OPENAIR_TARGETS}/ARCH/ETHERNET/benetel/4g/shared_buffers.c From b5192b6b1265a38d9c14c22fb4d1b24653aef932 Mon Sep 17 00:00:00 2001 From: hardy Date: Tue, 16 Mar 2021 17:23:35 +0100 Subject: [PATCH 208/231] fixing gNB init --- ci-scripts/xml_files/benetel_nsa_base.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci-scripts/xml_files/benetel_nsa_base.xml b/ci-scripts/xml_files/benetel_nsa_base.xml index 0404c14a09..0aed28dffa 100644 --- a/ci-scripts/xml_files/benetel_nsa_base.xml +++ b/ci-scripts/xml_files/benetel_nsa_base.xml @@ -80,7 +80,7 @@ Initialize_eNB Initialize gNB - -O ci-scripts/conf_files/benetel-5g.conf -E + -O ci-scripts/conf_files/benetel-5g.conf 1 1 nr From 4a68d007aa7e409a7baabc1106b9f7e96ebdfdd5 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Thu, 18 Mar 2021 16:11:45 +0100 Subject: [PATCH 209/231] [DOCKER] force copy for workspace in each child dockerfiles Signed-off-by: Raphael Defosseux --- docker/Dockerfile.eNB.rhel8.2 | 3 ++- docker/Dockerfile.eNB.ubuntu18 | 3 ++- docker/Dockerfile.gNB.rhel8.2 | 3 ++- docker/Dockerfile.gNB.ubuntu18 | 3 ++- docker/Dockerfile.lteUE.rhel8.2 | 4 ++-- docker/Dockerfile.lteUE.ubuntu18 | 3 ++- docker/Dockerfile.nrUE.rhel8.2 | 3 ++- docker/Dockerfile.nrUE.ubuntu18 | 3 ++- 8 files changed, 16 insertions(+), 9 deletions(-) diff --git a/docker/Dockerfile.eNB.rhel8.2 b/docker/Dockerfile.eNB.rhel8.2 index 5fcd5a7b9f..05d9b62a6d 100644 --- a/docker/Dockerfile.eNB.rhel8.2 +++ b/docker/Dockerfile.eNB.rhel8.2 @@ -27,12 +27,13 @@ FROM localhost/ran-build:latest AS enb-build +RUN rm -Rf /oai-ran WORKDIR /oai-ran +COPY . . #run build_oai to build the target image RUN /bin/sh oaienv && \ cd cmake_targets && \ - rm -Rf log && \ mkdir -p log && \ ./build_oai --eNB --ninja -w USRP diff --git a/docker/Dockerfile.eNB.ubuntu18 b/docker/Dockerfile.eNB.ubuntu18 index cdfb37ebfc..1ecd166ead 100644 --- a/docker/Dockerfile.eNB.ubuntu18 +++ b/docker/Dockerfile.eNB.ubuntu18 @@ -27,12 +27,13 @@ FROM ran-build:latest AS enb-build +RUN rm -Rf /oai-ran WORKDIR /oai-ran +COPY . . #run build_oai to build the target image RUN /bin/sh oaienv && \ cd cmake_targets && \ - rm -Rf log && \ mkdir -p log && \ ./build_oai --eNB --ninja -w USRP diff --git a/docker/Dockerfile.gNB.rhel8.2 b/docker/Dockerfile.gNB.rhel8.2 index fb9ade927f..4621b4df9e 100644 --- a/docker/Dockerfile.gNB.rhel8.2 +++ b/docker/Dockerfile.gNB.rhel8.2 @@ -27,12 +27,13 @@ FROM localhost/ran-build:latest AS gnb-build +RUN rm -Rf /oai-ran WORKDIR /oai-ran +COPY . . #run build_oai to build the target image RUN /bin/sh oaienv && \ cd cmake_targets && \ - rm -Rf log && \ mkdir -p log && \ ./build_oai --gNB --ninja -w USRP diff --git a/docker/Dockerfile.gNB.ubuntu18 b/docker/Dockerfile.gNB.ubuntu18 index d43ad4709d..e492aa1a62 100644 --- a/docker/Dockerfile.gNB.ubuntu18 +++ b/docker/Dockerfile.gNB.ubuntu18 @@ -27,12 +27,13 @@ FROM ran-build:latest AS gnb-build +RUN rm -Rf /oai-ran WORKDIR /oai-ran +COPY . . #run build_oai to build the target image RUN /bin/sh oaienv && \ cd cmake_targets && \ - rm -Rf log && \ mkdir -p log && \ ./build_oai --gNB --ninja -w USRP diff --git a/docker/Dockerfile.lteUE.rhel8.2 b/docker/Dockerfile.lteUE.rhel8.2 index 0a853dcd6b..6b31646095 100644 --- a/docker/Dockerfile.lteUE.rhel8.2 +++ b/docker/Dockerfile.lteUE.rhel8.2 @@ -27,13 +27,13 @@ FROM localhost/ran-build:latest AS lte-ue-build - +RUN rm -Rf /oai-ran WORKDIR /oai-ran +COPY . . #run build_oai to build the target image RUN /bin/sh oaienv && \ cd cmake_targets && \ - rm -Rf log && \ mkdir -p log && \ ./build_oai --UE --ninja -w USRP diff --git a/docker/Dockerfile.lteUE.ubuntu18 b/docker/Dockerfile.lteUE.ubuntu18 index 8793cc54f7..9ef9bb01a7 100644 --- a/docker/Dockerfile.lteUE.ubuntu18 +++ b/docker/Dockerfile.lteUE.ubuntu18 @@ -27,12 +27,13 @@ FROM ran-build:latest AS lte-ue-build +RUN rm -Rf /oai-ran WORKDIR /oai-ran +COPY . . #run build_oai to build the target image RUN /bin/sh oaienv && \ cd cmake_targets && \ - rm -Rf log && \ mkdir -p log && \ ./build_oai --UE --ninja -w USRP diff --git a/docker/Dockerfile.nrUE.rhel8.2 b/docker/Dockerfile.nrUE.rhel8.2 index f9f3f8e4bf..119086fa6b 100644 --- a/docker/Dockerfile.nrUE.rhel8.2 +++ b/docker/Dockerfile.nrUE.rhel8.2 @@ -27,12 +27,13 @@ FROM localhost/ran-build:latest AS nr-ue-build +RUN rm -Rf /oai-ran WORKDIR /oai-ran +COPY . . #run build_oai to build the target image RUN /bin/sh oaienv && \ cd cmake_targets && \ - rm -Rf log && \ mkdir -p log && \ ./build_oai --nrUE --ninja -w USRP diff --git a/docker/Dockerfile.nrUE.ubuntu18 b/docker/Dockerfile.nrUE.ubuntu18 index 5450194f35..f1a27a3c01 100644 --- a/docker/Dockerfile.nrUE.ubuntu18 +++ b/docker/Dockerfile.nrUE.ubuntu18 @@ -27,12 +27,13 @@ FROM ran-build:latest AS nr-ue-build +RUN rm -Rf /oai-ran WORKDIR /oai-ran +COPY . . #run build_oai to build the target image RUN /bin/sh oaienv && \ cd cmake_targets && \ - rm -Rf log && \ mkdir -p log && \ ./build_oai --nrUE --ninja -w USRP From 642c639406421df70a9d8826b9ead4cef91ed18c Mon Sep 17 00:00:00 2001 From: Roberto Louro Magueta Date: Thu, 18 Mar 2021 17:14:31 +0100 Subject: [PATCH 210/231] Revert "Fix preamble sequence" This reverts commit 9efe4187e72f25fd2936be5b9e4daa5473383afb --- openair1/PHY/NR_TRANSPORT/nr_prach.c | 2 +- openair1/PHY/NR_TRANSPORT/nr_prach.h | 285 ------------------ openair1/PHY/NR_TRANSPORT/nr_prach_common.c | 27 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 4 +- 4 files changed, 5 insertions(+), 313 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/nr_prach.c b/openair1/PHY/NR_TRANSPORT/nr_prach.c index 0c1fde07a2..1d971a8831 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_prach.c +++ b/openair1/PHY/NR_TRANSPORT/nr_prach.c @@ -681,7 +681,7 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, preamble_shift -= NCS; if (preamble_shift < 0) - preamble_shift+=((N_ZC/NCS)*NCS); + preamble_shift+=N_ZC; } } else { // This is the high-speed case new_dft = 0; diff --git a/openair1/PHY/NR_TRANSPORT/nr_prach.h b/openair1/PHY/NR_TRANSPORT/nr_prach.h index d97689a5a6..d158e04c79 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_prach.h +++ b/openair1/PHY/NR_TRANSPORT/nr_prach.h @@ -93,288 +93,3 @@ uint16_t prach_root_sequence_map_abc[138] = { 51, 88 , 52, 87 , 53, 86 , 54, 85 , 55, 84 , 56, 83 , 57, 82 , 58, 81 , 59, 80 , 60, 79 , 61, 78 , 62, 77 , 63, 76 , 64, 75 , 65, 74 , 66, 73 , 67, 72 , 68, 71 , 69, 70 }; - -int16_t prach_fft139_re[139][139] = { -{32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767}, -{32767, 32733, 32633, 32466, 32232, 31933, 31569, 31140, 30647, 30092, 29475, 28799, 28063, 27270, 26421, 25519, 24564, 23559, 22506, 21406, 20264, 19079, 17856, 16596, 15303, 13978, 12624, 11245, 9843, 8421, 6981, 5527, 4062, 2589, 1110, -371, -1851, -3327, -4797, -6257, -7704, -9135, -10548, -11939, -13305, -14645, -15955, -17232, -18473, -19677, -20841, -21963, -23039, -24068, -25049, -25978, -26853, -27675, -28439, -29146, -29792, -30378, -30902, -31363, -31760, -32092, -32358, -32558, -32692, -32759, -32759, -32692, -32558, -32358, -32092, -31760, -31363, -30902, -30378, -29792, -29146, -28439, -27675, -26853, -25978, -25049, -24068, -23039, -21963, -20841, -19677, -18473, -17232, -15955, -14645, -13305, -11939, -10548, -9135, -7704, -6257, -4797, -3327, -1851, -371, 1110, 2589, 4062, 5527, 6981, 8421, 9843, 11245, 12624, 13978, 15303, 16596, 17856, 19079, 20264, 21406, 22506, 23559, 24564, 25519, 26421, 27270, 28063, 28799, 29475, 30092, 30647, 31140, 31569, 31933, 32232, 32466, 32633, 32733}, -{32767, 32633, 32232, 31569, 30647, 29475, 28063, 26421, 24564, 22506, 20264, 17856, 15303, 12624, 9843, 6981, 4062, 1110, -1851, -4797, -7704, -10548, -13305, -15955, -18473, -20841, -23039, -25049, -26853, -28439, -29792, -30902, -31760, -32358, -32692, -32759, -32558, -32092, -31363, -30378, -29146, -27675, -25978, -24068, -21963, -19677, -17232, -14645, -11939, -9135, -6257, -3327, -371, 2589, 5527, 8421, 11245, 13978, 16596, 19079, 21406, 23559, 25519, 27270, 28799, 30092, 31140, 31933, 32466, 32733, 32733, 32466, 31933, 31140, 30092, 28799, 27270, 25519, 23559, 21406, 19079, 16596, 13978, 11245, 8421, 5527, 2589, -371, -3327, -6257, -9135, -11939, -14645, -17232, -19677, -21963, -24068, -25978, -27675, -29146, -30378, -31363, -32092, -32558, -32759, -32692, -32358, -31760, -30902, -29792, -28439, -26853, -25049, -23039, -20841, -18473, -15955, -13305, -10548, -7704, -4797, -1851, 1110, 4062, 6981, 9843, 12624, 15303, 17856, 20264, 22506, 24564, 26421, 28063, 29475, 30647, 31569, 32232, 32633}, -{32767, 32466, 31569, 30092, 28063, 25519, 22506, 19079, 15303, 11245, 6981, 2589, -1851, -6257, -10548, -14645, -18473, -21963, -25049, -27675, -29792, -31363, -32358, -32759, -32558, -31760, -30378, -28439, -25978, -23039, -19677, -15955, -11939, -7704, -3327, 1110, 5527, 9843, 13978, 17856, 21406, 24564, 27270, 29475, 31140, 32232, 32733, 32633, 31933, 30647, 28799, 26421, 23559, 20264, 16596, 12624, 8421, 4062, -371, -4797, -9135, -13305, -17232, -20841, -24068, -26853, -29146, -30902, -32092, -32692, -32692, -32092, -30902, -29146, -26853, -24068, -20841, -17232, -13305, -9135, -4797, -371, 4062, 8421, 12624, 16596, 20264, 23559, 26421, 28799, 30647, 31933, 32633, 32733, 32232, 31140, 29475, 27270, 24564, 21406, 17856, 13978, 9843, 5527, 1110, -3327, -7704, -11939, -15955, -19677, -23039, -25978, -28439, -30378, -31760, -32558, -32759, -32358, -31363, -29792, -27675, -25049, -21963, -18473, -14645, -10548, -6257, -1851, 2589, 6981, 11245, 15303, 19079, 22506, 25519, 28063, 30092, 31569, 32466}, -{32767, 32232, 30647, 28063, 24564, 20264, 15303, 9843, 4062, -1851, -7704, -13305, -18473, -23039, -26853, -29792, -31760, -32692, -32558, -31363, -29146, -25978, -21963, -17232, -11939, -6257, -371, 5527, 11245, 16596, 21406, 25519, 28799, 31140, 32466, 32733, 31933, 30092, 27270, 23559, 19079, 13978, 8421, 2589, -3327, -9135, -14645, -19677, -24068, -27675, -30378, -32092, -32759, -32358, -30902, -28439, -25049, -20841, -15955, -10548, -4797, 1110, 6981, 12624, 17856, 22506, 26421, 29475, 31569, 32633, 32633, 31569, 29475, 26421, 22506, 17856, 12624, 6981, 1110, -4797, -10548, -15955, -20841, -25049, -28439, -30902, -32358, -32759, -32092, -30378, -27675, -24068, -19677, -14645, -9135, -3327, 2589, 8421, 13978, 19079, 23559, 27270, 30092, 31933, 32733, 32466, 31140, 28799, 25519, 21406, 16596, 11245, 5527, -371, -6257, -11939, -17232, -21963, -25978, -29146, -31363, -32558, -32692, -31760, -29792, -26853, -23039, -18473, -13305, -7704, -1851, 4062, 9843, 15303, 20264, 24564, 28063, 30647, 32232}, -{32767, 31933, 29475, 25519, 20264, 13978, 6981, -371, -7704, -14645, -20841, -25978, -29792, -32092, -32759, -31760, -29146, -25049, -19677, -13305, -6257, 1110, 8421, 15303, 21406, 26421, 30092, 32232, 32733, 31569, 28799, 24564, 19079, 12624, 5527, -1851, -9135, -15955, -21963, -26853, -30378, -32358, -32692, -31363, -28439, -24068, -18473, -11939, -4797, 2589, 9843, 16596, 22506, 27270, 30647, 32466, 32633, 31140, 28063, 23559, 17856, 11245, 4062, -3327, -10548, -17232, -23039, -27675, -30902, -32558, -32558, -30902, -27675, -23039, -17232, -10548, -3327, 4062, 11245, 17856, 23559, 28063, 31140, 32633, 32466, 30647, 27270, 22506, 16596, 9843, 2589, -4797, -11939, -18473, -24068, -28439, -31363, -32692, -32358, -30378, -26853, -21963, -15955, -9135, -1851, 5527, 12624, 19079, 24564, 28799, 31569, 32733, 32232, 30092, 26421, 21406, 15303, 8421, 1110, -6257, -13305, -19677, -25049, -29146, -31760, -32759, -32092, -29792, -25978, -20841, -14645, -7704, -371, 6981, 13978, 20264, 25519, 29475, 31933}, -{32767, 31569, 28063, 22506, 15303, 6981, -1851, -10548, -18473, -25049, -29792, -32358, -32558, -30378, -25978, -19677, -11939, -3327, 5527, 13978, 21406, 27270, 31140, 32733, 31933, 28799, 23559, 16596, 8421, -371, -9135, -17232, -24068, -29146, -32092, -32692, -30902, -26853, -20841, -13305, -4797, 4062, 12624, 20264, 26421, 30647, 32633, 32232, 29475, 24564, 17856, 9843, 1110, -7704, -15955, -23039, -28439, -31760, -32759, -31363, -27675, -21963, -14645, -6257, 2589, 11245, 19079, 25519, 30092, 32466, 32466, 30092, 25519, 19079, 11245, 2589, -6257, -14645, -21963, -27675, -31363, -32759, -31760, -28439, -23039, -15955, -7704, 1110, 9843, 17856, 24564, 29475, 32232, 32633, 30647, 26421, 20264, 12624, 4062, -4797, -13305, -20841, -26853, -30902, -32692, -32092, -29146, -24068, -17232, -9135, -371, 8421, 16596, 23559, 28799, 31933, 32733, 31140, 27270, 21406, 13978, 5527, -3327, -11939, -19677, -25978, -30378, -32558, -32358, -29792, -25049, -18473, -10548, -1851, 6981, 15303, 22506, 28063, 31569}, -{32767, 31140, 26421, 19079, 9843, -371, -10548, -19677, -26853, -31363, -32759, -30902, -25978, -18473, -9135, 1110, 11245, 20264, 27270, 31569, 32733, 30647, 25519, 17856, 8421, -1851, -11939, -20841, -27675, -31760, -32692, -30378, -25049, -17232, -7704, 2589, 12624, 21406, 28063, 31933, 32633, 30092, 24564, 16596, 6981, -3327, -13305, -21963, -28439, -32092, -32558, -29792, -24068, -15955, -6257, 4062, 13978, 22506, 28799, 32232, 32466, 29475, 23559, 15303, 5527, -4797, -14645, -23039, -29146, -32358, -32358, -29146, -23039, -14645, -4797, 5527, 15303, 23559, 29475, 32466, 32232, 28799, 22506, 13978, 4062, -6257, -15955, -24068, -29792, -32558, -32092, -28439, -21963, -13305, -3327, 6981, 16596, 24564, 30092, 32633, 31933, 28063, 21406, 12624, 2589, -7704, -17232, -25049, -30378, -32692, -31760, -27675, -20841, -11939, -1851, 8421, 17856, 25519, 30647, 32733, 31569, 27270, 20264, 11245, 1110, -9135, -18473, -25978, -30902, -32759, -31363, -26853, -19677, -10548, -371, 9843, 19079, 26421, 31140}, -{32767, 30647, 24564, 15303, 4062, -7704, -18473, -26853, -31760, -32558, -29146, -21963, -11939, -371, 11245, 21406, 28799, 32466, 31933, 27270, 19079, 8421, -3327, -14645, -24068, -30378, -32759, -30902, -25049, -15955, -4797, 6981, 17856, 26421, 31569, 32633, 29475, 22506, 12624, 1110, -10548, -20841, -28439, -32358, -32092, -27675, -19677, -9135, 2589, 13978, 23559, 30092, 32733, 31140, 25519, 16596, 5527, -6257, -17232, -25978, -31363, -32692, -29792, -23039, -13305, -1851, 9843, 20264, 28063, 32232, 32232, 28063, 20264, 9843, -1851, -13305, -23039, -29792, -32692, -31363, -25978, -17232, -6257, 5527, 16596, 25519, 31140, 32733, 30092, 23559, 13978, 2589, -9135, -19677, -27675, -32092, -32358, -28439, -20841, -10548, 1110, 12624, 22506, 29475, 32633, 31569, 26421, 17856, 6981, -4797, -15955, -25049, -30902, -32759, -30378, -24068, -14645, -3327, 8421, 19079, 27270, 31933, 32466, 28799, 21406, 11245, -371, -11939, -21963, -29146, -32558, -31760, -26853, -18473, -7704, 4062, 15303, 24564, 30647}, -{32767, 30092, 22506, 11245, -1851, -14645, -25049, -31363, -32558, -28439, -19677, -7704, 5527, 17856, 27270, 32232, 31933, 26421, 16596, 4062, -9135, -20841, -29146, -32692, -30902, -24068, -13305, -371, 12624, 23559, 30647, 32733, 29475, 21406, 9843, -3327, -15955, -25978, -31760, -32358, -27675, -18473, -6257, 6981, 19079, 28063, 32466, 31569, 25519, 15303, 2589, -10548, -21963, -29792, -32759, -30378, -23039, -11939, 1110, 13978, 24564, 31140, 32633, 28799, 20264, 8421, -4797, -17232, -26853, -32092, -32092, -26853, -17232, -4797, 8421, 20264, 28799, 32633, 31140, 24564, 13978, 1110, -11939, -23039, -30378, -32759, -29792, -21963, -10548, 2589, 15303, 25519, 31569, 32466, 28063, 19079, 6981, -6257, -18473, -27675, -32358, -31760, -25978, -15955, -3327, 9843, 21406, 29475, 32733, 30647, 23559, 12624, -371, -13305, -24068, -30902, -32692, -29146, -20841, -9135, 4062, 16596, 26421, 31933, 32232, 27270, 17856, 5527, -7704, -19677, -28439, -32558, -31363, -25049, -14645, -1851, 11245, 22506, 30092}, -{32767, 29475, 20264, 6981, -7704, -20841, -29792, -32759, -29146, -19677, -6257, 8421, 21406, 30092, 32733, 28799, 19079, 5527, -9135, -21963, -30378, -32692, -28439, -18473, -4797, 9843, 22506, 30647, 32633, 28063, 17856, 4062, -10548, -23039, -30902, -32558, -27675, -17232, -3327, 11245, 23559, 31140, 32466, 27270, 16596, 2589, -11939, -24068, -31363, -32358, -26853, -15955, -1851, 12624, 24564, 31569, 32232, 26421, 15303, 1110, -13305, -25049, -31760, -32092, -25978, -14645, -371, 13978, 25519, 31933, 31933, 25519, 13978, -371, -14645, -25978, -32092, -31760, -25049, -13305, 1110, 15303, 26421, 32232, 31569, 24564, 12624, -1851, -15955, -26853, -32358, -31363, -24068, -11939, 2589, 16596, 27270, 32466, 31140, 23559, 11245, -3327, -17232, -27675, -32558, -30902, -23039, -10548, 4062, 17856, 28063, 32633, 30647, 22506, 9843, -4797, -18473, -28439, -32692, -30378, -21963, -9135, 5527, 19079, 28799, 32733, 30092, 21406, 8421, -6257, -19677, -29146, -32759, -29792, -20841, -7704, 6981, 20264, 29475}, -{32767, 28799, 17856, 2589, -13305, -25978, -32358, -30902, -21963, -7704, 8421, 22506, 31140, 32232, 25519, 12624, -3327, -18473, -29146, -32759, -28439, -17232, -1851, 13978, 26421, 32466, 30647, 21406, 6981, -9135, -23039, -31363, -32092, -25049, -11939, 4062, 19079, 29475, 32733, 28063, 16596, 1110, -14645, -26853, -32558, -30378, -20841, -6257, 9843, 23559, 31569, 31933, 24564, 11245, -4797, -19677, -29792, -32692, -27675, -15955, -371, 15303, 27270, 32633, 30092, 20264, 5527, -10548, -24068, -31760, -31760, -24068, -10548, 5527, 20264, 30092, 32633, 27270, 15303, -371, -15955, -27675, -32692, -29792, -19677, -4797, 11245, 24564, 31933, 31569, 23559, 9843, -6257, -20841, -30378, -32558, -26853, -14645, 1110, 16596, 28063, 32733, 29475, 19079, 4062, -11939, -25049, -32092, -31363, -23039, -9135, 6981, 21406, 30647, 32466, 26421, 13978, -1851, -17232, -28439, -32759, -29146, -18473, -3327, 12624, 25519, 32232, 31140, 22506, 8421, -7704, -21963, -30902, -32358, -25978, -13305, 2589, 17856, 28799}, -{32767, 28063, 15303, -1851, -18473, -29792, -32558, -25978, -11939, 5527, 21406, 31140, 31933, 23559, 8421, -9135, -24068, -32092, -30902, -20841, -4797, 12624, 26421, 32633, 29475, 17856, 1110, -15955, -28439, -32759, -27675, -14645, 2589, 19079, 30092, 32466, 25519, 11245, -6257, -21963, -31363, -31760, -23039, -7704, 9843, 24564, 32232, 30647, 20264, 4062, -13305, -26853, -32692, -29146, -17232, -371, 16596, 28799, 32733, 27270, 13978, -3327, -19677, -30378, -32358, -25049, -10548, 6981, 22506, 31569, 31569, 22506, 6981, -10548, -25049, -32358, -30378, -19677, -3327, 13978, 27270, 32733, 28799, 16596, -371, -17232, -29146, -32692, -26853, -13305, 4062, 20264, 30647, 32232, 24564, 9843, -7704, -23039, -31760, -31363, -21963, -6257, 11245, 25519, 32466, 30092, 19079, 2589, -14645, -27675, -32759, -28439, -15955, 1110, 17856, 29475, 32633, 26421, 12624, -4797, -20841, -30902, -32092, -24068, -9135, 8421, 23559, 31933, 31140, 21406, 5527, -11939, -25978, -32558, -29792, -18473, -1851, 15303, 28063}, -{32767, 27270, 12624, -6257, -23039, -32092, -30378, -18473, -371, 17856, 30092, 32232, 23559, 6981, -11939, -26853, -32759, -27675, -13305, 5527, 22506, 31933, 30647, 19079, 1110, -17232, -29792, -32358, -24068, -7704, 11245, 26421, 32733, 28063, 13978, -4797, -21963, -31760, -30902, -19677, -1851, 16596, 29475, 32466, 24564, 8421, -10548, -25978, -32692, -28439, -14645, 4062, 21406, 31569, 31140, 20264, 2589, -15955, -29146, -32558, -25049, -9135, 9843, 25519, 32633, 28799, 15303, -3327, -20841, -31363, -31363, -20841, -3327, 15303, 28799, 32633, 25519, 9843, -9135, -25049, -32558, -29146, -15955, 2589, 20264, 31140, 31569, 21406, 4062, -14645, -28439, -32692, -25978, -10548, 8421, 24564, 32466, 29475, 16596, -1851, -19677, -30902, -31760, -21963, -4797, 13978, 28063, 32733, 26421, 11245, -7704, -24068, -32358, -29792, -17232, 1110, 19079, 30647, 31933, 22506, 5527, -13305, -27675, -32759, -26853, -11939, 6981, 23559, 32232, 30092, 17856, -371, -18473, -30378, -32092, -23039, -6257, 12624, 27270}, -{32767, 26421, 9843, -10548, -26853, -32759, -25978, -9135, 11245, 27270, 32733, 25519, 8421, -11939, -27675, -32692, -25049, -7704, 12624, 28063, 32633, 24564, 6981, -13305, -28439, -32558, -24068, -6257, 13978, 28799, 32466, 23559, 5527, -14645, -29146, -32358, -23039, -4797, 15303, 29475, 32232, 22506, 4062, -15955, -29792, -32092, -21963, -3327, 16596, 30092, 31933, 21406, 2589, -17232, -30378, -31760, -20841, -1851, 17856, 30647, 31569, 20264, 1110, -18473, -30902, -31363, -19677, -371, 19079, 31140, 31140, 19079, -371, -19677, -31363, -30902, -18473, 1110, 20264, 31569, 30647, 17856, -1851, -20841, -31760, -30378, -17232, 2589, 21406, 31933, 30092, 16596, -3327, -21963, -32092, -29792, -15955, 4062, 22506, 32232, 29475, 15303, -4797, -23039, -32358, -29146, -14645, 5527, 23559, 32466, 28799, 13978, -6257, -24068, -32558, -28439, -13305, 6981, 24564, 32633, 28063, 12624, -7704, -25049, -32692, -27675, -11939, 8421, 25519, 32733, 27270, 11245, -9135, -25978, -32759, -26853, -10548, 9843, 26421}, -{32767, 25519, 6981, -14645, -29792, -31760, -19677, 1110, 21406, 32232, 28799, 12624, -9135, -26853, -32692, -24068, -4797, 16596, 30647, 31140, 17856, -3327, -23039, -32558, -27675, -10548, 11245, 28063, 32466, 22506, 2589, -18473, -31363, -30378, -15955, 5527, 24564, 32733, 26421, 8421, -13305, -29146, -32092, -20841, -371, 20264, 31933, 29475, 13978, -7704, -25978, -32759, -25049, -6257, 15303, 30092, 31569, 19079, -1851, -21963, -32358, -28439, -11939, 9843, 27270, 32633, 23559, 4062, -17232, -30902, -30902, -17232, 4062, 23559, 32633, 27270, 9843, -11939, -28439, -32358, -21963, -1851, 19079, 31569, 30092, 15303, -6257, -25049, -32759, -25978, -7704, 13978, 29475, 31933, 20264, -371, -20841, -32092, -29146, -13305, 8421, 26421, 32733, 24564, 5527, -15955, -30378, -31363, -18473, 2589, 22506, 32466, 28063, 11245, -10548, -27675, -32558, -23039, -3327, 17856, 31140, 30647, 16596, -4797, -24068, -32692, -26853, -9135, 12624, 28799, 32232, 21406, 1110, -19677, -31760, -29792, -14645, 6981, 25519}, -{32767, 24564, 4062, -18473, -31760, -29146, -11939, 11245, 28799, 31933, 19079, -3327, -24068, -32759, -25049, -4797, 17856, 31569, 29475, 12624, -10548, -28439, -32092, -19677, 2589, 23559, 32733, 25519, 5527, -17232, -31363, -29792, -13305, 9843, 28063, 32232, 20264, -1851, -23039, -32692, -25978, -6257, 16596, 31140, 30092, 13978, -9135, -27675, -32358, -20841, 1110, 22506, 32633, 26421, 6981, -15955, -30902, -30378, -14645, 8421, 27270, 32466, 21406, -371, -21963, -32558, -26853, -7704, 15303, 30647, 30647, 15303, -7704, -26853, -32558, -21963, -371, 21406, 32466, 27270, 8421, -14645, -30378, -30902, -15955, 6981, 26421, 32633, 22506, 1110, -20841, -32358, -27675, -9135, 13978, 30092, 31140, 16596, -6257, -25978, -32692, -23039, -1851, 20264, 32232, 28063, 9843, -13305, -29792, -31363, -17232, 5527, 25519, 32733, 23559, 2589, -19677, -32092, -28439, -10548, 12624, 29475, 31569, 17856, -4797, -25049, -32759, -24068, -3327, 19079, 31933, 28799, 11245, -11939, -29146, -31760, -18473, 4062, 24564}, -{32767, 23559, 1110, -21963, -32692, -25049, -3327, 20264, 32466, 26421, 5527, -18473, -32092, -27675, -7704, 16596, 31569, 28799, 9843, -14645, -30902, -29792, -11939, 12624, 30092, 30647, 13978, -10548, -29146, -31363, -15955, 8421, 28063, 31933, 17856, -6257, -26853, -32358, -19677, 4062, 25519, 32633, 21406, -1851, -24068, -32759, -23039, -371, 22506, 32733, 24564, 2589, -20841, -32558, -25978, -4797, 19079, 32232, 27270, 6981, -17232, -31760, -28439, -9135, 15303, 31140, 29475, 11245, -13305, -30378, -30378, -13305, 11245, 29475, 31140, 15303, -9135, -28439, -31760, -17232, 6981, 27270, 32232, 19079, -4797, -25978, -32558, -20841, 2589, 24564, 32733, 22506, -371, -23039, -32759, -24068, -1851, 21406, 32633, 25519, 4062, -19677, -32358, -26853, -6257, 17856, 31933, 28063, 8421, -15955, -31363, -29146, -10548, 13978, 30647, 30092, 12624, -11939, -29792, -30902, -14645, 9843, 28799, 31569, 16596, -7704, -27675, -32092, -18473, 5527, 26421, 32466, 20264, -3327, -25049, -32692, -21963, 1110, 23559}, -{32767, 22506, -1851, -25049, -32558, -19677, 5527, 27270, 31933, 16596, -9135, -29146, -30902, -13305, 12624, 30647, 29475, 9843, -15955, -31760, -27675, -6257, 19079, 32466, 25519, 2589, -21963, -32759, -23039, 1110, 24564, 32633, 20264, -4797, -26853, -32092, -17232, 8421, 28799, 31140, 13978, -11939, -30378, -29792, -10548, 15303, 31569, 28063, 6981, -18473, -32358, -25978, -3327, 21406, 32733, 23559, -371, -24068, -32692, -20841, 4062, 26421, 32232, 17856, -7704, -28439, -31363, -14645, 11245, 30092, 30092, 11245, -14645, -31363, -28439, -7704, 17856, 32232, 26421, 4062, -20841, -32692, -24068, -371, 23559, 32733, 21406, -3327, -25978, -32358, -18473, 6981, 28063, 31569, 15303, -10548, -29792, -30378, -11939, 13978, 31140, 28799, 8421, -17232, -32092, -26853, -4797, 20264, 32633, 24564, 1110, -23039, -32759, -21963, 2589, 25519, 32466, 19079, -6257, -27675, -31760, -15955, 9843, 29475, 30647, 12624, -13305, -30902, -29146, -9135, 16596, 31933, 27270, 5527, -19677, -32558, -25049, -1851, 22506}, -{32767, 21406, -4797, -27675, -31363, -13305, 13978, 31569, 27270, 4062, -21963, -32759, -20841, 5527, 28063, 31140, 12624, -14645, -31760, -26853, -3327, 22506, 32733, 20264, -6257, -28439, -30902, -11939, 15303, 31933, 26421, 2589, -23039, -32692, -19677, 6981, 28799, 30647, 11245, -15955, -32092, -25978, -1851, 23559, 32633, 19079, -7704, -29146, -30378, -10548, 16596, 32232, 25519, 1110, -24068, -32558, -18473, 8421, 29475, 30092, 9843, -17232, -32358, -25049, -371, 24564, 32466, 17856, -9135, -29792, -29792, -9135, 17856, 32466, 24564, -371, -25049, -32358, -17232, 9843, 30092, 29475, 8421, -18473, -32558, -24068, 1110, 25519, 32232, 16596, -10548, -30378, -29146, -7704, 19079, 32633, 23559, -1851, -25978, -32092, -15955, 11245, 30647, 28799, 6981, -19677, -32692, -23039, 2589, 26421, 31933, 15303, -11939, -30902, -28439, -6257, 20264, 32733, 22506, -3327, -26853, -31760, -14645, 12624, 31140, 28063, 5527, -20841, -32759, -21963, 4062, 27270, 31569, 13978, -13305, -31363, -27675, -4797, 21406}, -{32767, 20264, -7704, -29792, -29146, -6257, 21406, 32733, 19079, -9135, -30378, -28439, -4797, 22506, 32633, 17856, -10548, -30902, -27675, -3327, 23559, 32466, 16596, -11939, -31363, -26853, -1851, 24564, 32232, 15303, -13305, -31760, -25978, -371, 25519, 31933, 13978, -14645, -32092, -25049, 1110, 26421, 31569, 12624, -15955, -32358, -24068, 2589, 27270, 31140, 11245, -17232, -32558, -23039, 4062, 28063, 30647, 9843, -18473, -32692, -21963, 5527, 28799, 30092, 8421, -19677, -32759, -20841, 6981, 29475, 29475, 6981, -20841, -32759, -19677, 8421, 30092, 28799, 5527, -21963, -32692, -18473, 9843, 30647, 28063, 4062, -23039, -32558, -17232, 11245, 31140, 27270, 2589, -24068, -32358, -15955, 12624, 31569, 26421, 1110, -25049, -32092, -14645, 13978, 31933, 25519, -371, -25978, -31760, -13305, 15303, 32232, 24564, -1851, -26853, -31363, -11939, 16596, 32466, 23559, -3327, -27675, -30902, -10548, 17856, 32633, 22506, -4797, -28439, -30378, -9135, 19079, 32733, 21406, -6257, -29146, -29792, -7704, 20264}, -{32767, 19079, -10548, -31363, -25978, 1110, 27270, 30647, 8421, -20841, -32692, -17232, 12624, 31933, 24564, -3327, -28439, -29792, -6257, 22506, 32466, 15303, -14645, -32358, -23039, 5527, 29475, 28799, 4062, -24068, -32092, -13305, 16596, 32633, 21406, -7704, -30378, -27675, -1851, 25519, 31569, 11245, -18473, -32759, -19677, 9843, 31140, 26421, -371, -26853, -30902, -9135, 20264, 32733, 17856, -11939, -31760, -25049, 2589, 28063, 30092, 6981, -21963, -32558, -15955, 13978, 32232, 23559, -4797, -29146, -29146, -4797, 23559, 32232, 13978, -15955, -32558, -21963, 6981, 30092, 28063, 2589, -25049, -31760, -11939, 17856, 32733, 20264, -9135, -30902, -26853, -371, 26421, 31140, 9843, -19677, -32759, -18473, 11245, 31569, 25519, -1851, -27675, -30378, -7704, 21406, 32633, 16596, -13305, -32092, -24068, 4062, 28799, 29475, 5527, -23039, -32358, -14645, 15303, 32466, 22506, -6257, -29792, -28439, -3327, 24564, 31933, 12624, -17232, -32692, -20841, 8421, 30647, 27270, 1110, -25978, -31363, -10548, 19079}, -{32767, 17856, -13305, -32358, -21963, 8421, 31140, 25519, -3327, -29146, -28439, -1851, 26421, 30647, 6981, -23039, -32092, -11939, 19079, 32733, 16596, -14645, -32558, -20841, 9843, 31569, 24564, -4797, -29792, -27675, -371, 27270, 30092, 5527, -24068, -31760, -10548, 20264, 32633, 15303, -15955, -32692, -19677, 11245, 31933, 23559, -6257, -30378, -26853, 1110, 28063, 29475, 4062, -25049, -31363, -9135, 21406, 32466, 13978, -17232, -32759, -18473, 12624, 32232, 22506, -7704, -30902, -25978, 2589, 28799, 28799, 2589, -25978, -30902, -7704, 22506, 32232, 12624, -18473, -32759, -17232, 13978, 32466, 21406, -9135, -31363, -25049, 4062, 29475, 28063, 1110, -26853, -30378, -6257, 23559, 31933, 11245, -19677, -32692, -15955, 15303, 32633, 20264, -10548, -31760, -24068, 5527, 30092, 27270, -371, -27675, -29792, -4797, 24564, 31569, 9843, -20841, -32558, -14645, 16596, 32733, 19079, -11939, -32092, -23039, 6981, 30647, 26421, -1851, -28439, -29146, -3327, 25519, 31140, 8421, -21963, -32358, -13305, 17856}, -{32767, 16596, -15955, -32759, -17232, 15303, 32733, 17856, -14645, -32692, -18473, 13978, 32633, 19079, -13305, -32558, -19677, 12624, 32466, 20264, -11939, -32358, -20841, 11245, 32232, 21406, -10548, -32092, -21963, 9843, 31933, 22506, -9135, -31760, -23039, 8421, 31569, 23559, -7704, -31363, -24068, 6981, 31140, 24564, -6257, -30902, -25049, 5527, 30647, 25519, -4797, -30378, -25978, 4062, 30092, 26421, -3327, -29792, -26853, 2589, 29475, 27270, -1851, -29146, -27675, 1110, 28799, 28063, -371, -28439, -28439, -371, 28063, 28799, 1110, -27675, -29146, -1851, 27270, 29475, 2589, -26853, -29792, -3327, 26421, 30092, 4062, -25978, -30378, -4797, 25519, 30647, 5527, -25049, -30902, -6257, 24564, 31140, 6981, -24068, -31363, -7704, 23559, 31569, 8421, -23039, -31760, -9135, 22506, 31933, 9843, -21963, -32092, -10548, 21406, 32232, 11245, -20841, -32358, -11939, 20264, 32466, 12624, -19677, -32558, -13305, 19079, 32633, 13978, -18473, -32692, -14645, 17856, 32733, 15303, -17232, -32759, -15955, 16596}, -{32767, 15303, -18473, -32558, -11939, 21406, 31933, 8421, -24068, -30902, -4797, 26421, 29475, 1110, -28439, -27675, 2589, 30092, 25519, -6257, -31363, -23039, 9843, 32232, 20264, -13305, -32692, -17232, 16596, 32733, 13978, -19677, -32358, -10548, 22506, 31569, 6981, -25049, -30378, -3327, 27270, 28799, -371, -29146, -26853, 4062, 30647, 24564, -7704, -31760, -21963, 11245, 32466, 19079, -14645, -32759, -15955, 17856, 32633, 12624, -20841, -32092, -9135, 23559, 31140, 5527, -25978, -29792, -1851, 28063, 28063, -1851, -29792, -25978, 5527, 31140, 23559, -9135, -32092, -20841, 12624, 32633, 17856, -15955, -32759, -14645, 19079, 32466, 11245, -21963, -31760, -7704, 24564, 30647, 4062, -26853, -29146, -371, 28799, 27270, -3327, -30378, -25049, 6981, 31569, 22506, -10548, -32358, -19677, 13978, 32733, 16596, -17232, -32692, -13305, 20264, 32232, 9843, -23039, -31363, -6257, 25519, 30092, 2589, -27675, -28439, 1110, 29475, 26421, -4797, -30902, -24068, 8421, 31933, 21406, -11939, -32558, -18473, 15303}, -{32767, 13978, -20841, -31760, -6257, 26421, 28799, -1851, -30378, -24068, 9843, 32466, 17856, -17232, -32558, -10548, 23559, 30647, 2589, -28439, -26853, 5527, 31569, 21406, -13305, -32759, -14645, 20264, 31933, 6981, -25978, -29146, 1110, 30092, 24564, -9135, -32358, -18473, 16596, 32633, 11245, -23039, -30902, -3327, 28063, 27270, -4797, -31363, -21963, 12624, 32733, 15303, -19677, -32092, -7704, 25519, 29475, -371, -29792, -25049, 8421, 32232, 19079, -15955, -32692, -11939, 22506, 31140, 4062, -27675, -27675, 4062, 31140, 22506, -11939, -32692, -15955, 19079, 32232, 8421, -25049, -29792, -371, 29475, 25519, -7704, -32092, -19677, 15303, 32733, 12624, -21963, -31363, -4797, 27270, 28063, -3327, -30902, -23039, 11245, 32633, 16596, -18473, -32358, -9135, 24564, 30092, 1110, -29146, -25978, 6981, 31933, 20264, -14645, -32759, -13305, 21406, 31569, 5527, -26853, -28439, 2589, 30647, 23559, -10548, -32558, -17232, 17856, 32466, 9843, -24068, -30378, -1851, 28799, 26421, -6257, -31760, -20841, 13978}, -{32767, 12624, -23039, -30378, -371, 30092, 23559, -11939, -32759, -13305, 22506, 30647, 1110, -29792, -24068, 11245, 32733, 13978, -21963, -30902, -1851, 29475, 24564, -10548, -32692, -14645, 21406, 31140, 2589, -29146, -25049, 9843, 32633, 15303, -20841, -31363, -3327, 28799, 25519, -9135, -32558, -15955, 20264, 31569, 4062, -28439, -25978, 8421, 32466, 16596, -19677, -31760, -4797, 28063, 26421, -7704, -32358, -17232, 19079, 31933, 5527, -27675, -26853, 6981, 32232, 17856, -18473, -32092, -6257, 27270, 27270, -6257, -32092, -18473, 17856, 32232, 6981, -26853, -27675, 5527, 31933, 19079, -17232, -32358, -7704, 26421, 28063, -4797, -31760, -19677, 16596, 32466, 8421, -25978, -28439, 4062, 31569, 20264, -15955, -32558, -9135, 25519, 28799, -3327, -31363, -20841, 15303, 32633, 9843, -25049, -29146, 2589, 31140, 21406, -14645, -32692, -10548, 24564, 29475, -1851, -30902, -21963, 13978, 32733, 11245, -24068, -29792, 1110, 30647, 22506, -13305, -32759, -11939, 23559, 30092, -371, -30378, -23039, 12624}, -{32767, 11245, -25049, -28439, 5527, 32232, 16596, -20841, -30902, -371, 30647, 21406, -15955, -32358, -6257, 28063, 25519, -10548, -32759, -11939, 24564, 28799, -4797, -32092, -17232, 20264, 31140, 1110, -30378, -21963, 15303, 32466, 6981, -27675, -25978, 9843, 32733, 12624, -24068, -29146, 4062, 31933, 17856, -19677, -31363, -1851, 30092, 22506, -14645, -32558, -7704, 27270, 26421, -9135, -32692, -13305, 23559, 29475, -3327, -31760, -18473, 19079, 31569, 2589, -29792, -23039, 13978, 32633, 8421, -26853, -26853, 8421, 32633, 13978, -23039, -29792, 2589, 31569, 19079, -18473, -31760, -3327, 29475, 23559, -13305, -32692, -9135, 26421, 27270, -7704, -32558, -14645, 22506, 30092, -1851, -31363, -19677, 17856, 31933, 4062, -29146, -24068, 12624, 32733, 9843, -25978, -27675, 6981, 32466, 15303, -21963, -30378, 1110, 31140, 20264, -17232, -32092, -4797, 28799, 24564, -11939, -32759, -10548, 25519, 28063, -6257, -32358, -15955, 21406, 30647, -371, -30902, -20841, 16596, 32232, 5527, -28439, -25049, 11245}, -{32767, 9843, -26853, -25978, 11245, 32733, 8421, -27675, -25049, 12624, 32633, 6981, -28439, -24068, 13978, 32466, 5527, -29146, -23039, 15303, 32232, 4062, -29792, -21963, 16596, 31933, 2589, -30378, -20841, 17856, 31569, 1110, -30902, -19677, 19079, 31140, -371, -31363, -18473, 20264, 30647, -1851, -31760, -17232, 21406, 30092, -3327, -32092, -15955, 22506, 29475, -4797, -32358, -14645, 23559, 28799, -6257, -32558, -13305, 24564, 28063, -7704, -32692, -11939, 25519, 27270, -9135, -32759, -10548, 26421, 26421, -10548, -32759, -9135, 27270, 25519, -11939, -32692, -7704, 28063, 24564, -13305, -32558, -6257, 28799, 23559, -14645, -32358, -4797, 29475, 22506, -15955, -32092, -3327, 30092, 21406, -17232, -31760, -1851, 30647, 20264, -18473, -31363, -371, 31140, 19079, -19677, -30902, 1110, 31569, 17856, -20841, -30378, 2589, 31933, 16596, -21963, -29792, 4062, 32232, 15303, -23039, -29146, 5527, 32466, 13978, -24068, -28439, 6981, 32633, 12624, -25049, -27675, 8421, 32733, 11245, -25978, -26853, 9843}, -{32767, 8421, -28439, -23039, 16596, 31569, -371, -31760, -15955, 23559, 28063, -9135, -32759, -7704, 28799, 22506, -17232, -31363, 1110, 31933, 15303, -24068, -27675, 9843, 32733, 6981, -29146, -21963, 17856, 31140, -1851, -32092, -14645, 24564, 27270, -10548, -32692, -6257, 29475, 21406, -18473, -30902, 2589, 32232, 13978, -25049, -26853, 11245, 32633, 5527, -29792, -20841, 19079, 30647, -3327, -32358, -13305, 25519, 26421, -11939, -32558, -4797, 30092, 20264, -19677, -30378, 4062, 32466, 12624, -25978, -25978, 12624, 32466, 4062, -30378, -19677, 20264, 30092, -4797, -32558, -11939, 26421, 25519, -13305, -32358, -3327, 30647, 19079, -20841, -29792, 5527, 32633, 11245, -26853, -25049, 13978, 32232, 2589, -30902, -18473, 21406, 29475, -6257, -32692, -10548, 27270, 24564, -14645, -32092, -1851, 31140, 17856, -21963, -29146, 6981, 32733, 9843, -27675, -24068, 15303, 31933, 1110, -31363, -17232, 22506, 28799, -7704, -32759, -9135, 28063, 23559, -15955, -31760, -371, 31569, 16596, -23039, -28439, 8421}, -{32767, 6981, -29792, -19677, 21406, 28799, -9135, -32692, -4797, 30647, 17856, -23039, -27675, 11245, 32466, 2589, -31363, -15955, 24564, 26421, -13305, -32092, -371, 31933, 13978, -25978, -25049, 15303, 31569, -1851, -32358, -11939, 27270, 23559, -17232, -30902, 4062, 32633, 9843, -28439, -21963, 19079, 30092, -6257, -32759, -7704, 29475, 20264, -20841, -29146, 8421, 32733, 5527, -30378, -18473, 22506, 28063, -10548, -32558, -3327, 31140, 16596, -24068, -26853, 12624, 32232, 1110, -31760, -14645, 25519, 25519, -14645, -31760, 1110, 32232, 12624, -26853, -24068, 16596, 31140, -3327, -32558, -10548, 28063, 22506, -18473, -30378, 5527, 32733, 8421, -29146, -20841, 20264, 29475, -7704, -32759, -6257, 30092, 19079, -21963, -28439, 9843, 32633, 4062, -30902, -17232, 23559, 27270, -11939, -32358, -1851, 31569, 15303, -25049, -25978, 13978, 31933, -371, -32092, -13305, 26421, 24564, -15955, -31363, 2589, 32466, 11245, -27675, -23039, 17856, 30647, -4797, -32692, -9135, 28799, 21406, -19677, -29792, 6981}, -{32767, 5527, -30902, -15955, 25519, 24564, -17232, -30378, 6981, 32733, 4062, -31363, -14645, 26421, 23559, -18473, -29792, 8421, 32633, 2589, -31760, -13305, 27270, 22506, -19677, -29146, 9843, 32466, 1110, -32092, -11939, 28063, 21406, -20841, -28439, 11245, 32232, -371, -32358, -10548, 28799, 20264, -21963, -27675, 12624, 31933, -1851, -32558, -9135, 29475, 19079, -23039, -26853, 13978, 31569, -3327, -32692, -7704, 30092, 17856, -24068, -25978, 15303, 31140, -4797, -32759, -6257, 30647, 16596, -25049, -25049, 16596, 30647, -6257, -32759, -4797, 31140, 15303, -25978, -24068, 17856, 30092, -7704, -32692, -3327, 31569, 13978, -26853, -23039, 19079, 29475, -9135, -32558, -1851, 31933, 12624, -27675, -21963, 20264, 28799, -10548, -32358, -371, 32232, 11245, -28439, -20841, 21406, 28063, -11939, -32092, 1110, 32466, 9843, -29146, -19677, 22506, 27270, -13305, -31760, 2589, 32633, 8421, -29792, -18473, 23559, 26421, -14645, -31363, 4062, 32733, 6981, -30378, -17232, 24564, 25519, -15955, -30902, 5527}, -{32767, 4062, -31760, -11939, 28799, 19079, -24068, -25049, 17856, 29475, -10548, -32092, 2589, 32733, 5527, -31363, -13305, 28063, 20264, -23039, -25978, 16596, 30092, -9135, -32358, 1110, 32633, 6981, -30902, -14645, 27270, 21406, -21963, -26853, 15303, 30647, -7704, -32558, -371, 32466, 8421, -30378, -15955, 26421, 22506, -20841, -27675, 13978, 31140, -6257, -32692, -1851, 32232, 9843, -29792, -17232, 25519, 23559, -19677, -28439, 12624, 31569, -4797, -32759, -3327, 31933, 11245, -29146, -18473, 24564, 24564, -18473, -29146, 11245, 31933, -3327, -32759, -4797, 31569, 12624, -28439, -19677, 23559, 25519, -17232, -29792, 9843, 32232, -1851, -32692, -6257, 31140, 13978, -27675, -20841, 22506, 26421, -15955, -30378, 8421, 32466, -371, -32558, -7704, 30647, 15303, -26853, -21963, 21406, 27270, -14645, -30902, 6981, 32633, 1110, -32358, -9135, 30092, 16596, -25978, -23039, 20264, 28063, -13305, -31363, 5527, 32733, 2589, -32092, -10548, 29475, 17856, -25049, -24068, 19079, 28799, -11939, -31760, 4062}, -{32767, 2589, -32358, -7704, 31140, 12624, -29146, -17232, 26421, 21406, -23039, -25049, 19079, 28063, -14645, -30378, 9843, 31933, -4797, -32692, -371, 32633, 5527, -31760, -10548, 30092, 15303, -27675, -19677, 24564, 23559, -20841, -26853, 16596, 29475, -11939, -31363, 6981, 32466, -1851, -32759, -3327, 32232, 8421, -30902, -13305, 28799, 17856, -25978, -21963, 22506, 25519, -18473, -28439, 13978, 30647, -9135, -32092, 4062, 32733, 1110, -32558, -6257, 31569, 11245, -29792, -15955, 27270, 20264, -24068, -24068, 20264, 27270, -15955, -29792, 11245, 31569, -6257, -32558, 1110, 32733, 4062, -32092, -9135, 30647, 13978, -28439, -18473, 25519, 22506, -21963, -25978, 17856, 28799, -13305, -30902, 8421, 32232, -3327, -32759, -1851, 32466, 6981, -31363, -11939, 29475, 16596, -26853, -20841, 23559, 24564, -19677, -27675, 15303, 30092, -10548, -31760, 5527, 32633, -371, -32692, -4797, 31933, 9843, -30378, -14645, 28063, 19079, -25049, -23039, 21406, 26421, -17232, -29146, 12624, 31140, -7704, -32358, 2589}, -{32767, 1110, -32692, -3327, 32466, 5527, -32092, -7704, 31569, 9843, -30902, -11939, 30092, 13978, -29146, -15955, 28063, 17856, -26853, -19677, 25519, 21406, -24068, -23039, 22506, 24564, -20841, -25978, 19079, 27270, -17232, -28439, 15303, 29475, -13305, -30378, 11245, 31140, -9135, -31760, 6981, 32232, -4797, -32558, 2589, 32733, -371, -32759, -1851, 32633, 4062, -32358, -6257, 31933, 8421, -31363, -10548, 30647, 12624, -29792, -14645, 28799, 16596, -27675, -18473, 26421, 20264, -25049, -21963, 23559, 23559, -21963, -25049, 20264, 26421, -18473, -27675, 16596, 28799, -14645, -29792, 12624, 30647, -10548, -31363, 8421, 31933, -6257, -32358, 4062, 32633, -1851, -32759, -371, 32733, 2589, -32558, -4797, 32232, 6981, -31760, -9135, 31140, 11245, -30378, -13305, 29475, 15303, -28439, -17232, 27270, 19079, -25978, -20841, 24564, 22506, -23039, -24068, 21406, 25519, -19677, -26853, 17856, 28063, -15955, -29146, 13978, 30092, -11939, -30902, 9843, 31569, -7704, -32092, 5527, 32466, -3327, -32692, 1110}, -{32767, -371, -32759, 1110, 32733, -1851, -32692, 2589, 32633, -3327, -32558, 4062, 32466, -4797, -32358, 5527, 32232, -6257, -32092, 6981, 31933, -7704, -31760, 8421, 31569, -9135, -31363, 9843, 31140, -10548, -30902, 11245, 30647, -11939, -30378, 12624, 30092, -13305, -29792, 13978, 29475, -14645, -29146, 15303, 28799, -15955, -28439, 16596, 28063, -17232, -27675, 17856, 27270, -18473, -26853, 19079, 26421, -19677, -25978, 20264, 25519, -20841, -25049, 21406, 24564, -21963, -24068, 22506, 23559, -23039, -23039, 23559, 22506, -24068, -21963, 24564, 21406, -25049, -20841, 25519, 20264, -25978, -19677, 26421, 19079, -26853, -18473, 27270, 17856, -27675, -17232, 28063, 16596, -28439, -15955, 28799, 15303, -29146, -14645, 29475, 13978, -29792, -13305, 30092, 12624, -30378, -11939, 30647, 11245, -30902, -10548, 31140, 9843, -31363, -9135, 31569, 8421, -31760, -7704, 31933, 6981, -32092, -6257, 32232, 5527, -32358, -4797, 32466, 4062, -32558, -3327, 32633, 2589, -32692, -1851, 32733, 1110, -32759, -371}, -{32767, -1851, -32558, 5527, 31933, -9135, -30902, 12624, 29475, -15955, -27675, 19079, 25519, -21963, -23039, 24564, 20264, -26853, -17232, 28799, 13978, -30378, -10548, 31569, 6981, -32358, -3327, 32733, -371, -32692, 4062, 32232, -7704, -31363, 11245, 30092, -14645, -28439, 17856, 26421, -20841, -24068, 23559, 21406, -25978, -18473, 28063, 15303, -29792, -11939, 31140, 8421, -32092, -4797, 32633, 1110, -32759, 2589, 32466, -6257, -31760, 9843, 30647, -13305, -29146, 16596, 27270, -19677, -25049, 22506, 22506, -25049, -19677, 27270, 16596, -29146, -13305, 30647, 9843, -31760, -6257, 32466, 2589, -32759, 1110, 32633, -4797, -32092, 8421, 31140, -11939, -29792, 15303, 28063, -18473, -25978, 21406, 23559, -24068, -20841, 26421, 17856, -28439, -14645, 30092, 11245, -31363, -7704, 32232, 4062, -32692, -371, 32733, -3327, -32358, 6981, 31569, -10548, -30378, 13978, 28799, -17232, -26853, 20264, 24564, -23039, -21963, 25519, 19079, -27675, -15955, 29475, 12624, -30902, -9135, 31933, 5527, -32558, -1851}, -{32767, -3327, -32092, 9843, 30092, -15955, -26853, 21406, 22506, -25978, -17232, 29475, 11245, -31760, -4797, 32733, -1851, -32358, 8421, 30647, -14645, -27675, 20264, 23559, -25049, -18473, 28799, 12624, -31363, -6257, 32633, -371, -32558, 6981, 31140, -13305, -28439, 19079, 24564, -24068, -19677, 28063, 13978, -30902, -7704, 32466, 1110, -32692, 5527, 31569, -11939, -29146, 17856, 25519, -23039, -20841, 27270, 15303, -30378, -9135, 32232, 2589, -32759, 4062, 31933, -10548, -29792, 16596, 26421, -21963, -21963, 26421, 16596, -29792, -10548, 31933, 4062, -32759, 2589, 32232, -9135, -30378, 15303, 27270, -20841, -23039, 25519, 17856, -29146, -11939, 31569, 5527, -32692, 1110, 32466, -7704, -30902, 13978, 28063, -19677, -24068, 24564, 19079, -28439, -13305, 31140, 6981, -32558, -371, 32633, -6257, -31363, 12624, 28799, -18473, -25049, 23559, 20264, -27675, -14645, 30647, 8421, -32358, -1851, 32733, -4797, -31760, 11245, 29475, -17232, -25978, 22506, 21406, -26853, -15955, 30092, 9843, -32092, -3327}, -{32767, -4797, -31363, 13978, 27270, -21963, -20841, 28063, 12624, -31760, -3327, 32733, -6257, -30902, 15303, 26421, -23039, -19677, 28799, 11245, -32092, -1851, 32633, -7704, -30378, 16596, 25519, -24068, -18473, 29475, 9843, -32358, -371, 32466, -9135, -29792, 17856, 24564, -25049, -17232, 30092, 8421, -32558, 1110, 32232, -10548, -29146, 19079, 23559, -25978, -15955, 30647, 6981, -32692, 2589, 31933, -11939, -28439, 20264, 22506, -26853, -14645, 31140, 5527, -32759, 4062, 31569, -13305, -27675, 21406, 21406, -27675, -13305, 31569, 4062, -32759, 5527, 31140, -14645, -26853, 22506, 20264, -28439, -11939, 31933, 2589, -32692, 6981, 30647, -15955, -25978, 23559, 19079, -29146, -10548, 32232, 1110, -32558, 8421, 30092, -17232, -25049, 24564, 17856, -29792, -9135, 32466, -371, -32358, 9843, 29475, -18473, -24068, 25519, 16596, -30378, -7704, 32633, -1851, -32092, 11245, 28799, -19677, -23039, 26421, 15303, -30902, -6257, 32733, -3327, -31760, 12624, 28063, -20841, -21963, 27270, 13978, -31363, -4797}, -{32767, -6257, -30378, 17856, 23559, -26853, -13305, 31933, 1110, -32358, 11245, 28063, -21963, -19677, 29475, 8421, -32692, 4062, 31140, -15955, -25049, 25519, 15303, -31363, -3327, 32633, -9135, -29146, 20264, 21406, -28439, -10548, 32466, -1851, -31760, 13978, 26421, -24068, -17232, 30647, 5527, -32759, 6981, 30092, -18473, -23039, 27270, 12624, -32092, -371, 32232, -11939, -27675, 22506, 19079, -29792, -7704, 32733, -4797, -30902, 16596, 24564, -25978, -14645, 31569, 2589, -32558, 9843, 28799, -20841, -20841, 28799, 9843, -32558, 2589, 31569, -14645, -25978, 24564, 16596, -30902, -4797, 32733, -7704, -29792, 19079, 22506, -27675, -11939, 32232, -371, -32092, 12624, 27270, -23039, -18473, 30092, 6981, -32759, 5527, 30647, -17232, -24068, 26421, 13978, -31760, -1851, 32466, -10548, -28439, 21406, 20264, -29146, -9135, 32633, -3327, -31363, 15303, 25519, -25049, -15955, 31140, 4062, -32692, 8421, 29475, -19677, -21963, 28063, 11245, -32358, 1110, 31933, -13305, -26853, 23559, 17856, -30378, -6257}, -{32767, -7704, -29146, 21406, 19079, -30378, -4797, 32633, -10548, -27675, 23559, 16596, -31363, -1851, 32232, -13305, -25978, 25519, 13978, -32092, 1110, 31569, -15955, -24068, 27270, 11245, -32558, 4062, 30647, -18473, -21963, 28799, 8421, -32759, 6981, 29475, -20841, -19677, 30092, 5527, -32692, 9843, 28063, -23039, -17232, 31140, 2589, -32358, 12624, 26421, -25049, -14645, 31933, -371, -31760, 15303, 24564, -26853, -11939, 32466, -3327, -30902, 17856, 22506, -28439, -9135, 32733, -6257, -29792, 20264, 20264, -29792, -6257, 32733, -9135, -28439, 22506, 17856, -30902, -3327, 32466, -11939, -26853, 24564, 15303, -31760, -371, 31933, -14645, -25049, 26421, 12624, -32358, 2589, 31140, -17232, -23039, 28063, 9843, -32692, 5527, 30092, -19677, -20841, 29475, 6981, -32759, 8421, 28799, -21963, -18473, 30647, 4062, -32558, 11245, 27270, -24068, -15955, 31569, 1110, -32092, 13978, 25519, -25978, -13305, 32232, -1851, -31363, 16596, 23559, -27675, -10548, 32633, -4797, -30378, 19079, 21406, -29146, -7704}, -{32767, -9135, -27675, 24564, 13978, -32358, 4062, 30092, -20841, -18473, 31140, 1110, -31760, 16596, 22506, -29146, -6257, 32633, -11939, -25978, 26421, 11245, -32692, 6981, 28799, -23039, -15955, 31933, -1851, -30902, 19079, 20264, -30378, -3327, 32232, -14645, -24068, 28063, 8421, -32759, 9843, 27270, -25049, -13305, 32466, -4797, -29792, 21406, 17856, -31363, -371, 31569, -17232, -21963, 29475, 5527, -32558, 12624, 25519, -26853, -10548, 32733, -7704, -28439, 23559, 15303, -32092, 2589, 30647, -19677, -19677, 30647, 2589, -32092, 15303, 23559, -28439, -7704, 32733, -10548, -26853, 25519, 12624, -32558, 5527, 29475, -21963, -17232, 31569, -371, -31363, 17856, 21406, -29792, -4797, 32466, -13305, -25049, 27270, 9843, -32759, 8421, 28063, -24068, -14645, 32232, -3327, -30378, 20264, 19079, -30902, -1851, 31933, -15955, -23039, 28799, 6981, -32692, 11245, 26421, -25978, -11939, 32633, -6257, -29146, 22506, 16596, -31760, 1110, 31140, -18473, -20841, 30092, 4062, -32358, 13978, 24564, -27675, -9135}, -{32767, -10548, -25978, 27270, 8421, -32692, 12624, 24564, -28439, -6257, 32466, -14645, -23039, 29475, 4062, -32092, 16596, 21406, -30378, -1851, 31569, -18473, -19677, 31140, -371, -30902, 20264, 17856, -31760, 2589, 30092, -21963, -15955, 32232, -4797, -29146, 23559, 13978, -32558, 6981, 28063, -25049, -11939, 32733, -9135, -26853, 26421, 9843, -32759, 11245, 25519, -27675, -7704, 32633, -13305, -24068, 28799, 5527, -32358, 15303, 22506, -29792, -3327, 31933, -17232, -20841, 30647, 1110, -31363, 19079, 19079, -31363, 1110, 30647, -20841, -17232, 31933, -3327, -29792, 22506, 15303, -32358, 5527, 28799, -24068, -13305, 32633, -7704, -27675, 25519, 11245, -32759, 9843, 26421, -26853, -9135, 32733, -11939, -25049, 28063, 6981, -32558, 13978, 23559, -29146, -4797, 32232, -15955, -21963, 30092, 2589, -31760, 17856, 20264, -30902, -371, 31140, -19677, -18473, 31569, -1851, -30378, 21406, 16596, -32092, 4062, 29475, -23039, -14645, 32466, -6257, -28439, 24564, 12624, -32692, 8421, 27270, -25978, -10548}, -{32767, -11939, -24068, 29475, 2589, -31363, 20264, 16596, -32358, 6981, 27270, -26853, -7704, 32466, -15955, -20841, 31140, -1851, -29792, 23559, 12624, -32759, 11245, 24564, -29146, -3327, 31569, -19677, -17232, 32232, -6257, -27675, 26421, 8421, -32558, 15303, 21406, -30902, 1110, 30092, -23039, -13305, 32733, -10548, -25049, 28799, 4062, -31760, 19079, 17856, -32092, 5527, 28063, -25978, -9135, 32633, -14645, -21963, 30647, -371, -30378, 22506, 13978, -32692, 9843, 25519, -28439, -4797, 31933, -18473, -18473, 31933, -4797, -28439, 25519, 9843, -32692, 13978, 22506, -30378, -371, 30647, -21963, -14645, 32633, -9135, -25978, 28063, 5527, -32092, 17856, 19079, -31760, 4062, 28799, -25049, -10548, 32733, -13305, -23039, 30092, 1110, -30902, 21406, 15303, -32558, 8421, 26421, -27675, -6257, 32232, -17232, -19677, 31569, -3327, -29146, 24564, 11245, -32759, 12624, 23559, -29792, -1851, 31140, -20841, -15955, 32466, -7704, -26853, 27270, 6981, -32358, 16596, 20264, -31363, 2589, 29475, -24068, -11939}, -{32767, -13305, -21963, 31140, -3327, -28439, 26421, 6981, -32092, 19079, 16596, -32558, 9843, 24564, -29792, -371, 30092, -24068, -10548, 32633, -15955, -19677, 31933, -6257, -26853, 28063, 4062, -31363, 21406, 13978, -32759, 12624, 22506, -30902, 2589, 28799, -25978, -7704, 32232, -18473, -17232, 32466, -9135, -25049, 29475, 1110, -30378, 23559, 11245, -32692, 15303, 20264, -31760, 5527, 27270, -27675, -4797, 31569, -20841, -14645, 32733, -11939, -23039, 30647, -1851, -29146, 25519, 8421, -32358, 17856, 17856, -32358, 8421, 25519, -29146, -1851, 30647, -23039, -11939, 32733, -14645, -20841, 31569, -4797, -27675, 27270, 5527, -31760, 20264, 15303, -32692, 11245, 23559, -30378, 1110, 29475, -25049, -9135, 32466, -17232, -18473, 32232, -7704, -25978, 28799, 2589, -30902, 22506, 12624, -32759, 13978, 21406, -31363, 4062, 28063, -26853, -6257, 31933, -19677, -15955, 32633, -10548, -24068, 30092, -371, -29792, 24564, 9843, -32558, 16596, 19079, -32092, 6981, 26421, -28439, -3327, 31140, -21963, -13305}, -{32767, -14645, -19677, 32232, -9135, -24068, 30647, -3327, -27675, 28063, 2589, -30378, 24564, 8421, -32092, 20264, 13978, -32759, 15303, 19079, -32358, 9843, 23559, -30902, 4062, 27270, -28439, -1851, 30092, -25049, -7704, 31933, -20841, -13305, 32733, -15955, -18473, 32466, -10548, -23039, 31140, -4797, -26853, 28799, 1110, -29792, 25519, 6981, -31760, 21406, 12624, -32692, 16596, 17856, -32558, 11245, 22506, -31363, 5527, 26421, -29146, -371, 29475, -25978, -6257, 31569, -21963, -11939, 32633, -17232, -17232, 32633, -11939, -21963, 31569, -6257, -25978, 29475, -371, -29146, 26421, 5527, -31363, 22506, 11245, -32558, 17856, 16596, -32692, 12624, 21406, -31760, 6981, 25519, -29792, 1110, 28799, -26853, -4797, 31140, -23039, -10548, 32466, -18473, -15955, 32733, -13305, -20841, 31933, -7704, -25049, 30092, -1851, -28439, 27270, 4062, -30902, 23559, 9843, -32358, 19079, 15303, -32759, 13978, 20264, -32092, 8421, 24564, -30378, 2589, 28063, -27675, -3327, 30647, -24068, -9135, 32232, -19677, -14645}, -{32767, -15955, -17232, 32733, -14645, -18473, 32633, -13305, -19677, 32466, -11939, -20841, 32232, -10548, -21963, 31933, -9135, -23039, 31569, -7704, -24068, 31140, -6257, -25049, 30647, -4797, -25978, 30092, -3327, -26853, 29475, -1851, -27675, 28799, -371, -28439, 28063, 1110, -29146, 27270, 2589, -29792, 26421, 4062, -30378, 25519, 5527, -30902, 24564, 6981, -31363, 23559, 8421, -31760, 22506, 9843, -32092, 21406, 11245, -32358, 20264, 12624, -32558, 19079, 13978, -32692, 17856, 15303, -32759, 16596, 16596, -32759, 15303, 17856, -32692, 13978, 19079, -32558, 12624, 20264, -32358, 11245, 21406, -32092, 9843, 22506, -31760, 8421, 23559, -31363, 6981, 24564, -30902, 5527, 25519, -30378, 4062, 26421, -29792, 2589, 27270, -29146, 1110, 28063, -28439, -371, 28799, -27675, -1851, 29475, -26853, -3327, 30092, -25978, -4797, 30647, -25049, -6257, 31140, -24068, -7704, 31569, -23039, -9135, 31933, -21963, -10548, 32232, -20841, -11939, 32466, -19677, -13305, 32633, -18473, -14645, 32733, -17232, -15955}, -{32767, -17232, -14645, 32633, -19677, -11939, 32232, -21963, -9135, 31569, -24068, -6257, 30647, -25978, -3327, 29475, -27675, -371, 28063, -29146, 2589, 26421, -30378, 5527, 24564, -31363, 8421, 22506, -32092, 11245, 20264, -32558, 13978, 17856, -32759, 16596, 15303, -32692, 19079, 12624, -32358, 21406, 9843, -31760, 23559, 6981, -30902, 25519, 4062, -29792, 27270, 1110, -28439, 28799, -1851, -26853, 30092, -4797, -25049, 31140, -7704, -23039, 31933, -10548, -20841, 32466, -13305, -18473, 32733, -15955, -15955, 32733, -18473, -13305, 32466, -20841, -10548, 31933, -23039, -7704, 31140, -25049, -4797, 30092, -26853, -1851, 28799, -28439, 1110, 27270, -29792, 4062, 25519, -30902, 6981, 23559, -31760, 9843, 21406, -32358, 12624, 19079, -32692, 15303, 16596, -32759, 17856, 13978, -32558, 20264, 11245, -32092, 22506, 8421, -31363, 24564, 5527, -30378, 26421, 2589, -29146, 28063, -371, -27675, 29475, -3327, -25978, 30647, -6257, -24068, 31569, -9135, -21963, 32232, -11939, -19677, 32633, -14645, -17232}, -{32767, -18473, -11939, 31933, -24068, -4797, 29475, -28439, 2589, 25519, -31363, 9843, 20264, -32692, 16596, 13978, -32358, 22506, 6981, -30378, 27270, -371, -26853, 30647, -7704, -21963, 32466, -14645, -15955, 32633, -20841, -9135, 31140, -25978, -1851, 28063, -29792, 5527, 23559, -32092, 12624, 17856, -32759, 19079, 11245, -31760, 24564, 4062, -29146, 28799, -3327, -25049, 31569, -10548, -19677, 32733, -17232, -13305, 32232, -23039, -6257, 30092, -27675, 1110, 26421, -30902, 8421, 21406, -32558, 15303, 15303, -32558, 21406, 8421, -30902, 26421, 1110, -27675, 30092, -6257, -23039, 32232, -13305, -17232, 32733, -19677, -10548, 31569, -25049, -3327, 28799, -29146, 4062, 24564, -31760, 11245, 19079, -32759, 17856, 12624, -32092, 23559, 5527, -29792, 28063, -1851, -25978, 31140, -9135, -20841, 32633, -15955, -14645, 32466, -21963, -7704, 30647, -26853, -371, 27270, -30378, 6981, 22506, -32358, 13978, 16596, -32692, 20264, 9843, -31363, 25519, 2589, -28439, 29475, -4797, -24068, 31933, -11939, -18473}, -{32767, -19677, -9135, 30647, -27675, 2589, 24564, -32092, 13978, 15303, -32358, 23559, 4062, -28439, 30092, -7704, -20841, 32733, -18473, -10548, 31140, -26853, 1110, 25519, -31760, 12624, 16596, -32558, 22506, 5527, -29146, 29475, -6257, -21963, 32633, -17232, -11939, 31569, -25978, -371, 26421, -31363, 11245, 17856, -32692, 21406, 6981, -29792, 28799, -4797, -23039, 32466, -15955, -13305, 31933, -25049, -1851, 27270, -30902, 9843, 19079, -32759, 20264, 8421, -30378, 28063, -3327, -24068, 32232, -14645, -14645, 32232, -24068, -3327, 28063, -30378, 8421, 20264, -32759, 19079, 9843, -30902, 27270, -1851, -25049, 31933, -13305, -15955, 32466, -23039, -4797, 28799, -29792, 6981, 21406, -32692, 17856, 11245, -31363, 26421, -371, -25978, 31569, -11939, -17232, 32633, -21963, -6257, 29475, -29146, 5527, 22506, -32558, 16596, 12624, -31760, 25519, 1110, -26853, 31140, -10548, -18473, 32733, -20841, -7704, 30092, -28439, 4062, 23559, -32358, 15303, 13978, -32092, 24564, 2589, -27675, 30647, -9135, -19677}, -{32767, -20841, -6257, 28799, -30378, 9843, 17856, -32558, 23559, 2589, -26853, 31569, -13305, -14645, 31933, -25978, 1110, 24564, -32358, 16596, 11245, -30902, 28063, -4797, -21963, 32733, -19677, -7704, 29475, -29792, 8421, 19079, -32692, 22506, 4062, -27675, 31140, -11939, -15955, 32232, -25049, -371, 25519, -32092, 15303, 12624, -31363, 27270, -3327, -23039, 32633, -18473, -9135, 30092, -29146, 6981, 20264, -32759, 21406, 5527, -28439, 30647, -10548, -17232, 32466, -24068, -1851, 26421, -31760, 13978, 13978, -31760, 26421, -1851, -24068, 32466, -17232, -10548, 30647, -28439, 5527, 21406, -32759, 20264, 6981, -29146, 30092, -9135, -18473, 32633, -23039, -3327, 27270, -31363, 12624, 15303, -32092, 25519, -371, -25049, 32232, -15955, -11939, 31140, -27675, 4062, 22506, -32692, 19079, 8421, -29792, 29475, -7704, -19677, 32733, -21963, -4797, 28063, -30902, 11245, 16596, -32358, 24564, 1110, -25978, 31933, -14645, -13305, 31569, -26853, 2589, 23559, -32558, 17856, 9843, -30378, 28799, -6257, -20841}, -{32767, -21963, -3327, 26421, -32092, 16596, 9843, -29792, 30092, -10548, -15955, 31933, -26853, 4062, 21406, -32759, 22506, 2589, -25978, 32232, -17232, -9135, 29475, -30378, 11245, 15303, -31760, 27270, -4797, -20841, 32733, -23039, -1851, 25519, -32358, 17856, 8421, -29146, 30647, -11939, -14645, 31569, -27675, 5527, 20264, -32692, 23559, 1110, -25049, 32466, -18473, -7704, 28799, -30902, 12624, 13978, -31363, 28063, -6257, -19677, 32633, -24068, -371, 24564, -32558, 19079, 6981, -28439, 31140, -13305, -13305, 31140, -28439, 6981, 19079, -32558, 24564, -371, -24068, 32633, -19677, -6257, 28063, -31363, 13978, 12624, -30902, 28799, -7704, -18473, 32466, -25049, 1110, 23559, -32692, 20264, 5527, -27675, 31569, -14645, -11939, 30647, -29146, 8421, 17856, -32358, 25519, -1851, -23039, 32733, -20841, -4797, 27270, -31760, 15303, 11245, -30378, 29475, -9135, -17232, 32232, -25978, 2589, 22506, -32759, 21406, 4062, -26853, 31933, -15955, -10548, 30092, -29792, 9843, 16596, -32092, 26421, -3327, -21963}, -{32767, -23039, -371, 23559, -32759, 22506, 1110, -24068, 32733, -21963, -1851, 24564, -32692, 21406, 2589, -25049, 32633, -20841, -3327, 25519, -32558, 20264, 4062, -25978, 32466, -19677, -4797, 26421, -32358, 19079, 5527, -26853, 32232, -18473, -6257, 27270, -32092, 17856, 6981, -27675, 31933, -17232, -7704, 28063, -31760, 16596, 8421, -28439, 31569, -15955, -9135, 28799, -31363, 15303, 9843, -29146, 31140, -14645, -10548, 29475, -30902, 13978, 11245, -29792, 30647, -13305, -11939, 30092, -30378, 12624, 12624, -30378, 30092, -11939, -13305, 30647, -29792, 11245, 13978, -30902, 29475, -10548, -14645, 31140, -29146, 9843, 15303, -31363, 28799, -9135, -15955, 31569, -28439, 8421, 16596, -31760, 28063, -7704, -17232, 31933, -27675, 6981, 17856, -32092, 27270, -6257, -18473, 32232, -26853, 5527, 19079, -32358, 26421, -4797, -19677, 32466, -25978, 4062, 20264, -32558, 25519, -3327, -20841, 32633, -25049, 2589, 21406, -32692, 24564, -1851, -21963, 32733, -24068, 1110, 22506, -32759, 23559, -371, -23039}, -{32767, -24068, 2589, 20264, -32358, 27270, -7704, -15955, 31140, -29792, 12624, 11245, -29146, 31569, -17232, -6257, 26421, -32558, 21406, 1110, -23039, 32733, -25049, 4062, 19079, -32092, 28063, -9135, -14645, 30647, -30378, 13978, 9843, -28439, 31933, -18473, -4797, 25519, -32692, 22506, -371, -21963, 32633, -25978, 5527, 17856, -31760, 28799, -10548, -13305, 30092, -30902, 15303, 8421, -27675, 32232, -19677, -3327, 24564, -32759, 23559, -1851, -20841, 32466, -26853, 6981, 16596, -31363, 29475, -11939, -11939, 29475, -31363, 16596, 6981, -26853, 32466, -20841, -1851, 23559, -32759, 24564, -3327, -19677, 32232, -27675, 8421, 15303, -30902, 30092, -13305, -10548, 28799, -31760, 17856, 5527, -25978, 32633, -21963, -371, 22506, -32692, 25519, -4797, -18473, 31933, -28439, 9843, 13978, -30378, 30647, -14645, -9135, 28063, -32092, 19079, 4062, -25049, 32733, -23039, 1110, 21406, -32558, 26421, -6257, -17232, 31569, -29146, 11245, 12624, -29792, 31140, -15955, -7704, 27270, -32358, 20264, 2589, -24068}, -{32767, -25049, 5527, 16596, -30902, 30647, -15955, -6257, 25519, -32759, 24564, -4797, -17232, 31140, -30378, 15303, 6981, -25978, 32733, -24068, 4062, 17856, -31363, 30092, -14645, -7704, 26421, -32692, 23559, -3327, -18473, 31569, -29792, 13978, 8421, -26853, 32633, -23039, 2589, 19079, -31760, 29475, -13305, -9135, 27270, -32558, 22506, -1851, -19677, 31933, -29146, 12624, 9843, -27675, 32466, -21963, 1110, 20264, -32092, 28799, -11939, -10548, 28063, -32358, 21406, -371, -20841, 32232, -28439, 11245, 11245, -28439, 32232, -20841, -371, 21406, -32358, 28063, -10548, -11939, 28799, -32092, 20264, 1110, -21963, 32466, -27675, 9843, 12624, -29146, 31933, -19677, -1851, 22506, -32558, 27270, -9135, -13305, 29475, -31760, 19079, 2589, -23039, 32633, -26853, 8421, 13978, -29792, 31569, -18473, -3327, 23559, -32692, 26421, -7704, -14645, 30092, -31363, 17856, 4062, -24068, 32733, -25978, 6981, 15303, -30378, 31140, -17232, -4797, 24564, -32759, 25519, -6257, -15955, 30647, -30902, 16596, 5527, -25049}, -{32767, -25978, 8421, 12624, -28439, 32466, -23039, 4062, 16596, -30378, 31569, -19677, -371, 20264, -31760, 30092, -15955, -4797, 23559, -32558, 28063, -11939, -9135, 26421, -32759, 25519, -7704, -13305, 28799, -32358, 22506, -3327, -17232, 30647, -31363, 19079, 1110, -20841, 31933, -29792, 15303, 5527, -24068, 32633, -27675, 11245, 9843, -26853, 32733, -25049, 6981, 13978, -29146, 32232, -21963, 2589, 17856, -30902, 31140, -18473, -1851, 21406, -32092, 29475, -14645, -6257, 24564, -32692, 27270, -10548, -10548, 27270, -32692, 24564, -6257, -14645, 29475, -32092, 21406, -1851, -18473, 31140, -30902, 17856, 2589, -21963, 32232, -29146, 13978, 6981, -25049, 32733, -26853, 9843, 11245, -27675, 32633, -24068, 5527, 15303, -29792, 31933, -20841, 1110, 19079, -31363, 30647, -17232, -3327, 22506, -32358, 28799, -13305, -7704, 25519, -32759, 26421, -9135, -11939, 28063, -32558, 23559, -4797, -15955, 30092, -31760, 20264, -371, -19677, 31569, -30378, 16596, 4062, -23039, 32466, -28439, 12624, 8421, -25978}, -{32767, -26853, 11245, 8421, -25049, 32633, -28439, 13978, 5527, -23039, 32232, -29792, 16596, 2589, -20841, 31569, -30902, 19079, -371, -18473, 30647, -31760, 21406, -3327, -15955, 29475, -32358, 23559, -6257, -13305, 28063, -32692, 25519, -9135, -10548, 26421, -32759, 27270, -11939, -7704, 24564, -32558, 28799, -14645, -4797, 22506, -32092, 30092, -17232, -1851, 20264, -31363, 31140, -19677, 1110, 17856, -30378, 31933, -21963, 4062, 15303, -29146, 32466, -24068, 6981, 12624, -27675, 32733, -25978, 9843, 9843, -25978, 32733, -27675, 12624, 6981, -24068, 32466, -29146, 15303, 4062, -21963, 31933, -30378, 17856, 1110, -19677, 31140, -31363, 20264, -1851, -17232, 30092, -32092, 22506, -4797, -14645, 28799, -32558, 24564, -7704, -11939, 27270, -32759, 26421, -10548, -9135, 25519, -32692, 28063, -13305, -6257, 23559, -32358, 29475, -15955, -3327, 21406, -31760, 30647, -18473, -371, 19079, -30902, 31569, -20841, 2589, 16596, -29792, 32232, -23039, 5527, 13978, -28439, 32633, -25049, 8421, 11245, -26853}, -{32767, -27675, 13978, 4062, -20841, 31140, -31760, 22506, -6257, -11939, 26421, -32692, 28799, -15955, -1851, 19079, -30378, 32232, -24068, 8421, 9843, -25049, 32466, -29792, 17856, -371, -17232, 29475, -32558, 25519, -10548, -7704, 23559, -32092, 30647, -19677, 2589, 15303, -28439, 32733, -26853, 12624, 5527, -21963, 31569, -31363, 21406, -4797, -13305, 27270, -32759, 28063, -14645, -3327, 20264, -30902, 31933, -23039, 6981, 11245, -25978, 32633, -29146, 16596, 1110, -18473, 30092, -32358, 24564, -9135, -9135, 24564, -32358, 30092, -18473, 1110, 16596, -29146, 32633, -25978, 11245, 6981, -23039, 31933, -30902, 20264, -3327, -14645, 28063, -32759, 27270, -13305, -4797, 21406, -31363, 31569, -21963, 5527, 12624, -26853, 32733, -28439, 15303, 2589, -19677, 30647, -32092, 23559, -7704, -10548, 25519, -32558, 29475, -17232, -371, 17856, -29792, 32466, -25049, 9843, 8421, -24068, 32232, -30378, 19079, -1851, -15955, 28799, -32692, 26421, -11939, -6257, 22506, -31760, 31140, -20841, 4062, 13978, -27675}, -{32767, -28439, 16596, -371, -15955, 28063, -32759, 28799, -17232, 1110, 15303, -27675, 32733, -29146, 17856, -1851, -14645, 27270, -32692, 29475, -18473, 2589, 13978, -26853, 32633, -29792, 19079, -3327, -13305, 26421, -32558, 30092, -19677, 4062, 12624, -25978, 32466, -30378, 20264, -4797, -11939, 25519, -32358, 30647, -20841, 5527, 11245, -25049, 32232, -30902, 21406, -6257, -10548, 24564, -32092, 31140, -21963, 6981, 9843, -24068, 31933, -31363, 22506, -7704, -9135, 23559, -31760, 31569, -23039, 8421, 8421, -23039, 31569, -31760, 23559, -9135, -7704, 22506, -31363, 31933, -24068, 9843, 6981, -21963, 31140, -32092, 24564, -10548, -6257, 21406, -30902, 32232, -25049, 11245, 5527, -20841, 30647, -32358, 25519, -11939, -4797, 20264, -30378, 32466, -25978, 12624, 4062, -19677, 30092, -32558, 26421, -13305, -3327, 19079, -29792, 32633, -26853, 13978, 2589, -18473, 29475, -32692, 27270, -14645, -1851, 17856, -29146, 32733, -27675, 15303, 1110, -17232, 28799, -32759, 28063, -15955, -371, 16596, -28439}, -{32767, -29146, 19079, -4797, -10548, 23559, -31363, 32232, -25978, 13978, 1110, -15955, 27270, -32558, 30647, -21963, 8421, 6981, -20841, 30092, -32692, 28063, -17232, 2589, 12624, -25049, 31933, -31760, 24564, -11939, -3327, 17856, -28439, 32733, -29792, 20264, -6257, -9135, 22506, -30902, 32466, -26853, 15303, -371, -14645, 26421, -32358, 31140, -23039, 9843, 5527, -19677, 29475, -32759, 28799, -18473, 4062, 11245, -24068, 31569, -32092, 25519, -13305, -1851, 16596, -27675, 32633, -30378, 21406, -7704, -7704, 21406, -30378, 32633, -27675, 16596, -1851, -13305, 25519, -32092, 31569, -24068, 11245, 4062, -18473, 28799, -32759, 29475, -19677, 5527, 9843, -23039, 31140, -32358, 26421, -14645, -371, 15303, -26853, 32466, -30902, 22506, -9135, -6257, 20264, -29792, 32733, -28439, 17856, -3327, -11939, 24564, -31760, 31933, -25049, 12624, 2589, -17232, 28063, -32692, 30092, -20841, 6981, 8421, -21963, 30647, -32558, 27270, -15955, 1110, 13978, -25978, 32232, -31363, 23559, -10548, -4797, 19079, -29146}, -{32767, -29792, 21406, -9135, -4797, 17856, -27675, 32466, -31363, 24564, -13305, -371, 13978, -25049, 31569, -32358, 27270, -17232, 4062, 9843, -21963, 30092, -32759, 29475, -20841, 8421, 5527, -18473, 28063, -32558, 31140, -24068, 12624, 1110, -14645, 25519, -31760, 32232, -26853, 16596, -3327, -10548, 22506, -30378, 32733, -29146, 20264, -7704, -6257, 19079, -28439, 32633, -30902, 23559, -11939, -1851, 15303, -25978, 31933, -32092, 26421, -15955, 2589, 11245, -23039, 30647, -32692, 28799, -19677, 6981, 6981, -19677, 28799, -32692, 30647, -23039, 11245, 2589, -15955, 26421, -32092, 31933, -25978, 15303, -1851, -11939, 23559, -30902, 32633, -28439, 19079, -6257, -7704, 20264, -29146, 32733, -30378, 22506, -10548, -3327, 16596, -26853, 32232, -31760, 25519, -14645, 1110, 12624, -24068, 31140, -32558, 28063, -18473, 5527, 8421, -20841, 29475, -32759, 30092, -21963, 9843, 4062, -17232, 27270, -32358, 31569, -25049, 13978, -371, -13305, 24564, -31363, 32466, -27675, 17856, -4797, -9135, 21406, -29792}, -{32767, -30378, 23559, -13305, 1110, 11245, -21963, 29475, -32692, 31140, -25049, 15303, -3327, -9135, 20264, -28439, 32466, -31760, 26421, -17232, 5527, 6981, -18473, 27270, -32092, 32232, -27675, 19079, -7704, -4797, 16596, -25978, 31569, -32558, 28799, -20841, 9843, 2589, -14645, 24564, -30902, 32733, -29792, 22506, -11939, -371, 12624, -23039, 30092, -32759, 30647, -24068, 13978, -1851, -10548, 21406, -29146, 32633, -31363, 25519, -15955, 4062, 8421, -19677, 28063, -32358, 31933, -26853, 17856, -6257, -6257, 17856, -26853, 31933, -32358, 28063, -19677, 8421, 4062, -15955, 25519, -31363, 32633, -29146, 21406, -10548, -1851, 13978, -24068, 30647, -32759, 30092, -23039, 12624, -371, -11939, 22506, -29792, 32733, -30902, 24564, -14645, 2589, 9843, -20841, 28799, -32558, 31569, -25978, 16596, -4797, -7704, 19079, -27675, 32232, -32092, 27270, -18473, 6981, 5527, -17232, 26421, -31760, 32466, -28439, 20264, -9135, -3327, 15303, -25049, 31140, -32692, 29475, -21963, 11245, 1110, -13305, 23559, -30378}, -{32767, -30902, 25519, -17232, 6981, 4062, -14645, 23559, -29792, 32633, -31760, 27270, -19677, 9843, 1110, -11939, 21406, -28439, 32232, -32358, 28799, -21963, 12624, -1851, -9135, 19079, -26853, 31569, -32692, 30092, -24068, 15303, -4797, -6257, 16596, -25049, 30647, -32759, 31140, -25978, 17856, -7704, -3327, 13978, -23039, 29475, -32558, 31933, -27675, 20264, -10548, -371, 11245, -20841, 28063, -32092, 32466, -29146, 22506, -13305, 2589, 8421, -18473, 26421, -31363, 32733, -30378, 24564, -15955, 5527, 5527, -15955, 24564, -30378, 32733, -31363, 26421, -18473, 8421, 2589, -13305, 22506, -29146, 32466, -32092, 28063, -20841, 11245, -371, -10548, 20264, -27675, 31933, -32558, 29475, -23039, 13978, -3327, -7704, 17856, -25978, 31140, -32759, 30647, -25049, 16596, -6257, -4797, 15303, -24068, 30092, -32692, 31569, -26853, 19079, -9135, -1851, 12624, -21963, 28799, -32358, 32232, -28439, 21406, -11939, 1110, 9843, -19677, 27270, -31760, 32633, -29792, 23559, -14645, 4062, 6981, -17232, 25519, -30902}, -{32767, -31363, 27270, -20841, 12624, -3327, -6257, 15303, -23039, 28799, -32092, 32633, -30378, 25519, -18473, 9843, -371, -9135, 17856, -25049, 30092, -32558, 32232, -29146, 23559, -15955, 6981, 2589, -11939, 20264, -26853, 31140, -32759, 31569, -27675, 21406, -13305, 4062, 5527, -14645, 22506, -28439, 31933, -32692, 30647, -25978, 19079, -10548, 1110, 8421, -17232, 24564, -29792, 32466, -32358, 29475, -24068, 16596, -7704, -1851, 11245, -19677, 26421, -30902, 32733, -31760, 28063, -21963, 13978, -4797, -4797, 13978, -21963, 28063, -31760, 32733, -30902, 26421, -19677, 11245, -1851, -7704, 16596, -24068, 29475, -32358, 32466, -29792, 24564, -17232, 8421, 1110, -10548, 19079, -25978, 30647, -32692, 31933, -28439, 22506, -14645, 5527, 4062, -13305, 21406, -27675, 31569, -32759, 31140, -26853, 20264, -11939, 2589, 6981, -15955, 23559, -29146, 32232, -32558, 30092, -25049, 17856, -9135, -371, 9843, -18473, 25519, -30378, 32633, -32092, 28799, -23039, 15303, -6257, -3327, 12624, -20841, 27270, -31363}, -{32767, -31760, 28799, -24068, 17856, -10548, 2589, 5527, -13305, 20264, -25978, 30092, -32358, 32633, -30902, 27270, -21963, 15303, -7704, -371, 8421, -15955, 22506, -27675, 31140, -32692, 32232, -29792, 25519, -19677, 12624, -4797, -3327, 11245, -18473, 24564, -29146, 31933, -32759, 31569, -28439, 23559, -17232, 9843, -1851, -6257, 13978, -20841, 26421, -30378, 32466, -32558, 30647, -26853, 21406, -14645, 6981, 1110, -9135, 16596, -23039, 28063, -31363, 32733, -32092, 29475, -25049, 19079, -11939, 4062, 4062, -11939, 19079, -25049, 29475, -32092, 32733, -31363, 28063, -23039, 16596, -9135, 1110, 6981, -14645, 21406, -26853, 30647, -32558, 32466, -30378, 26421, -20841, 13978, -6257, -1851, 9843, -17232, 23559, -28439, 31569, -32759, 31933, -29146, 24564, -18473, 11245, -3327, -4797, 12624, -19677, 25519, -29792, 32232, -32692, 31140, -27675, 22506, -15955, 8421, -371, -7704, 15303, -21963, 27270, -30902, 32633, -32358, 30092, -25978, 20264, -13305, 5527, 2589, -10548, 17856, -24068, 28799, -31760}, -{32767, -32092, 30092, -26853, 22506, -17232, 11245, -4797, -1851, 8421, -14645, 20264, -25049, 28799, -31363, 32633, -32558, 31140, -28439, 24564, -19677, 13978, -7704, 1110, 5527, -11939, 17856, -23039, 27270, -30378, 32232, -32759, 31933, -29792, 26421, -21963, 16596, -10548, 4062, 2589, -9135, 15303, -20841, 25519, -29146, 31569, -32692, 32466, -30902, 28063, -24068, 19079, -13305, 6981, -371, -6257, 12624, -18473, 23559, -27675, 30647, -32358, 32733, -31760, 29475, -25978, 21406, -15955, 9843, -3327, -3327, 9843, -15955, 21406, -25978, 29475, -31760, 32733, -32358, 30647, -27675, 23559, -18473, 12624, -6257, -371, 6981, -13305, 19079, -24068, 28063, -30902, 32466, -32692, 31569, -29146, 25519, -20841, 15303, -9135, 2589, 4062, -10548, 16596, -21963, 26421, -29792, 31933, -32759, 32232, -30378, 27270, -23039, 17856, -11939, 5527, 1110, -7704, 13978, -19677, 24564, -28439, 31140, -32558, 32633, -31363, 28799, -25049, 20264, -14645, 8421, -1851, -4797, 11245, -17232, 22506, -26853, 30092, -32092}, -{32767, -32358, 31140, -29146, 26421, -23039, 19079, -14645, 9843, -4797, -371, 5527, -10548, 15303, -19677, 23559, -26853, 29475, -31363, 32466, -32759, 32232, -30902, 28799, -25978, 22506, -18473, 13978, -9135, 4062, 1110, -6257, 11245, -15955, 20264, -24068, 27270, -29792, 31569, -32558, 32733, -32092, 30647, -28439, 25519, -21963, 17856, -13305, 8421, -3327, -1851, 6981, -11939, 16596, -20841, 24564, -27675, 30092, -31760, 32633, -32692, 31933, -30378, 28063, -25049, 21406, -17232, 12624, -7704, 2589, 2589, -7704, 12624, -17232, 21406, -25049, 28063, -30378, 31933, -32692, 32633, -31760, 30092, -27675, 24564, -20841, 16596, -11939, 6981, -1851, -3327, 8421, -13305, 17856, -21963, 25519, -28439, 30647, -32092, 32733, -32558, 31569, -29792, 27270, -24068, 20264, -15955, 11245, -6257, 1110, 4062, -9135, 13978, -18473, 22506, -25978, 28799, -30902, 32232, -32759, 32466, -31363, 29475, -26853, 23559, -19677, 15303, -10548, 5527, -371, -4797, 9843, -14645, 19079, -23039, 26421, -29146, 31140, -32358}, -{32767, -32558, 31933, -30902, 29475, -27675, 25519, -23039, 20264, -17232, 13978, -10548, 6981, -3327, -371, 4062, -7704, 11245, -14645, 17856, -20841, 23559, -25978, 28063, -29792, 31140, -32092, 32633, -32759, 32466, -31760, 30647, -29146, 27270, -25049, 22506, -19677, 16596, -13305, 9843, -6257, 2589, 1110, -4797, 8421, -11939, 15303, -18473, 21406, -24068, 26421, -28439, 30092, -31363, 32232, -32692, 32733, -32358, 31569, -30378, 28799, -26853, 24564, -21963, 19079, -15955, 12624, -9135, 5527, -1851, -1851, 5527, -9135, 12624, -15955, 19079, -21963, 24564, -26853, 28799, -30378, 31569, -32358, 32733, -32692, 32232, -31363, 30092, -28439, 26421, -24068, 21406, -18473, 15303, -11939, 8421, -4797, 1110, 2589, -6257, 9843, -13305, 16596, -19677, 22506, -25049, 27270, -29146, 30647, -31760, 32466, -32759, 32633, -32092, 31140, -29792, 28063, -25978, 23559, -20841, 17856, -14645, 11245, -7704, 4062, -371, -3327, 6981, -10548, 13978, -17232, 20264, -23039, 25519, -27675, 29475, -30902, 31933, -32558}, -{32767, -32692, 32466, -32092, 31569, -30902, 30092, -29146, 28063, -26853, 25519, -24068, 22506, -20841, 19079, -17232, 15303, -13305, 11245, -9135, 6981, -4797, 2589, -371, -1851, 4062, -6257, 8421, -10548, 12624, -14645, 16596, -18473, 20264, -21963, 23559, -25049, 26421, -27675, 28799, -29792, 30647, -31363, 31933, -32358, 32633, -32759, 32733, -32558, 32232, -31760, 31140, -30378, 29475, -28439, 27270, -25978, 24564, -23039, 21406, -19677, 17856, -15955, 13978, -11939, 9843, -7704, 5527, -3327, 1110, 1110, -3327, 5527, -7704, 9843, -11939, 13978, -15955, 17856, -19677, 21406, -23039, 24564, -25978, 27270, -28439, 29475, -30378, 31140, -31760, 32232, -32558, 32733, -32759, 32633, -32358, 31933, -31363, 30647, -29792, 28799, -27675, 26421, -25049, 23559, -21963, 20264, -18473, 16596, -14645, 12624, -10548, 8421, -6257, 4062, -1851, -371, 2589, -4797, 6981, -9135, 11245, -13305, 15303, -17232, 19079, -20841, 22506, -24068, 25519, -26853, 28063, -29146, 30092, -30902, 31569, -32092, 32466, -32692}, -{32767, -32759, 32733, -32692, 32633, -32558, 32466, -32358, 32232, -32092, 31933, -31760, 31569, -31363, 31140, -30902, 30647, -30378, 30092, -29792, 29475, -29146, 28799, -28439, 28063, -27675, 27270, -26853, 26421, -25978, 25519, -25049, 24564, -24068, 23559, -23039, 22506, -21963, 21406, -20841, 20264, -19677, 19079, -18473, 17856, -17232, 16596, -15955, 15303, -14645, 13978, -13305, 12624, -11939, 11245, -10548, 9843, -9135, 8421, -7704, 6981, -6257, 5527, -4797, 4062, -3327, 2589, -1851, 1110, -371, -371, 1110, -1851, 2589, -3327, 4062, -4797, 5527, -6257, 6981, -7704, 8421, -9135, 9843, -10548, 11245, -11939, 12624, -13305, 13978, -14645, 15303, -15955, 16596, -17232, 17856, -18473, 19079, -19677, 20264, -20841, 21406, -21963, 22506, -23039, 23559, -24068, 24564, -25049, 25519, -25978, 26421, -26853, 27270, -27675, 28063, -28439, 28799, -29146, 29475, -29792, 30092, -30378, 30647, -30902, 31140, -31363, 31569, -31760, 31933, -32092, 32232, -32358, 32466, -32558, 32633, -32692, 32733, -32759}, -{32767, -32759, 32733, -32692, 32633, -32558, 32466, -32358, 32232, -32092, 31933, -31760, 31569, -31363, 31140, -30902, 30647, -30378, 30092, -29792, 29475, -29146, 28799, -28439, 28063, -27675, 27270, -26853, 26421, -25978, 25519, -25049, 24564, -24068, 23559, -23039, 22506, -21963, 21406, -20841, 20264, -19677, 19079, -18473, 17856, -17232, 16596, -15955, 15303, -14645, 13978, -13305, 12624, -11939, 11245, -10548, 9843, -9135, 8421, -7704, 6981, -6257, 5527, -4797, 4062, -3327, 2589, -1851, 1110, -371, -371, 1110, -1851, 2589, -3327, 4062, -4797, 5527, -6257, 6981, -7704, 8421, -9135, 9843, -10548, 11245, -11939, 12624, -13305, 13978, -14645, 15303, -15955, 16596, -17232, 17856, -18473, 19079, -19677, 20264, -20841, 21406, -21963, 22506, -23039, 23559, -24068, 24564, -25049, 25519, -25978, 26421, -26853, 27270, -27675, 28063, -28439, 28799, -29146, 29475, -29792, 30092, -30378, 30647, -30902, 31140, -31363, 31569, -31760, 31933, -32092, 32232, -32358, 32466, -32558, 32633, -32692, 32733, -32759}, -{32767, -32692, 32466, -32092, 31569, -30902, 30092, -29146, 28063, -26853, 25519, -24068, 22506, -20841, 19079, -17232, 15303, -13305, 11245, -9135, 6981, -4797, 2589, -371, -1851, 4062, -6257, 8421, -10548, 12624, -14645, 16596, -18473, 20264, -21963, 23559, -25049, 26421, -27675, 28799, -29792, 30647, -31363, 31933, -32358, 32633, -32759, 32733, -32558, 32232, -31760, 31140, -30378, 29475, -28439, 27270, -25978, 24564, -23039, 21406, -19677, 17856, -15955, 13978, -11939, 9843, -7704, 5527, -3327, 1110, 1110, -3327, 5527, -7704, 9843, -11939, 13978, -15955, 17856, -19677, 21406, -23039, 24564, -25978, 27270, -28439, 29475, -30378, 31140, -31760, 32232, -32558, 32733, -32759, 32633, -32358, 31933, -31363, 30647, -29792, 28799, -27675, 26421, -25049, 23559, -21963, 20264, -18473, 16596, -14645, 12624, -10548, 8421, -6257, 4062, -1851, -371, 2589, -4797, 6981, -9135, 11245, -13305, 15303, -17232, 19079, -20841, 22506, -24068, 25519, -26853, 28063, -29146, 30092, -30902, 31569, -32092, 32466, -32692}, -{32767, -32558, 31933, -30902, 29475, -27675, 25519, -23039, 20264, -17232, 13978, -10548, 6981, -3327, -371, 4062, -7704, 11245, -14645, 17856, -20841, 23559, -25978, 28063, -29792, 31140, -32092, 32633, -32759, 32466, -31760, 30647, -29146, 27270, -25049, 22506, -19677, 16596, -13305, 9843, -6257, 2589, 1110, -4797, 8421, -11939, 15303, -18473, 21406, -24068, 26421, -28439, 30092, -31363, 32232, -32692, 32733, -32358, 31569, -30378, 28799, -26853, 24564, -21963, 19079, -15955, 12624, -9135, 5527, -1851, -1851, 5527, -9135, 12624, -15955, 19079, -21963, 24564, -26853, 28799, -30378, 31569, -32358, 32733, -32692, 32232, -31363, 30092, -28439, 26421, -24068, 21406, -18473, 15303, -11939, 8421, -4797, 1110, 2589, -6257, 9843, -13305, 16596, -19677, 22506, -25049, 27270, -29146, 30647, -31760, 32466, -32759, 32633, -32092, 31140, -29792, 28063, -25978, 23559, -20841, 17856, -14645, 11245, -7704, 4062, -371, -3327, 6981, -10548, 13978, -17232, 20264, -23039, 25519, -27675, 29475, -30902, 31933, -32558}, -{32767, -32358, 31140, -29146, 26421, -23039, 19079, -14645, 9843, -4797, -371, 5527, -10548, 15303, -19677, 23559, -26853, 29475, -31363, 32466, -32759, 32232, -30902, 28799, -25978, 22506, -18473, 13978, -9135, 4062, 1110, -6257, 11245, -15955, 20264, -24068, 27270, -29792, 31569, -32558, 32733, -32092, 30647, -28439, 25519, -21963, 17856, -13305, 8421, -3327, -1851, 6981, -11939, 16596, -20841, 24564, -27675, 30092, -31760, 32633, -32692, 31933, -30378, 28063, -25049, 21406, -17232, 12624, -7704, 2589, 2589, -7704, 12624, -17232, 21406, -25049, 28063, -30378, 31933, -32692, 32633, -31760, 30092, -27675, 24564, -20841, 16596, -11939, 6981, -1851, -3327, 8421, -13305, 17856, -21963, 25519, -28439, 30647, -32092, 32733, -32558, 31569, -29792, 27270, -24068, 20264, -15955, 11245, -6257, 1110, 4062, -9135, 13978, -18473, 22506, -25978, 28799, -30902, 32232, -32759, 32466, -31363, 29475, -26853, 23559, -19677, 15303, -10548, 5527, -371, -4797, 9843, -14645, 19079, -23039, 26421, -29146, 31140, -32358}, -{32767, -32092, 30092, -26853, 22506, -17232, 11245, -4797, -1851, 8421, -14645, 20264, -25049, 28799, -31363, 32633, -32558, 31140, -28439, 24564, -19677, 13978, -7704, 1110, 5527, -11939, 17856, -23039, 27270, -30378, 32232, -32759, 31933, -29792, 26421, -21963, 16596, -10548, 4062, 2589, -9135, 15303, -20841, 25519, -29146, 31569, -32692, 32466, -30902, 28063, -24068, 19079, -13305, 6981, -371, -6257, 12624, -18473, 23559, -27675, 30647, -32358, 32733, -31760, 29475, -25978, 21406, -15955, 9843, -3327, -3327, 9843, -15955, 21406, -25978, 29475, -31760, 32733, -32358, 30647, -27675, 23559, -18473, 12624, -6257, -371, 6981, -13305, 19079, -24068, 28063, -30902, 32466, -32692, 31569, -29146, 25519, -20841, 15303, -9135, 2589, 4062, -10548, 16596, -21963, 26421, -29792, 31933, -32759, 32232, -30378, 27270, -23039, 17856, -11939, 5527, 1110, -7704, 13978, -19677, 24564, -28439, 31140, -32558, 32633, -31363, 28799, -25049, 20264, -14645, 8421, -1851, -4797, 11245, -17232, 22506, -26853, 30092, -32092}, -{32767, -31760, 28799, -24068, 17856, -10548, 2589, 5527, -13305, 20264, -25978, 30092, -32358, 32633, -30902, 27270, -21963, 15303, -7704, -371, 8421, -15955, 22506, -27675, 31140, -32692, 32232, -29792, 25519, -19677, 12624, -4797, -3327, 11245, -18473, 24564, -29146, 31933, -32759, 31569, -28439, 23559, -17232, 9843, -1851, -6257, 13978, -20841, 26421, -30378, 32466, -32558, 30647, -26853, 21406, -14645, 6981, 1110, -9135, 16596, -23039, 28063, -31363, 32733, -32092, 29475, -25049, 19079, -11939, 4062, 4062, -11939, 19079, -25049, 29475, -32092, 32733, -31363, 28063, -23039, 16596, -9135, 1110, 6981, -14645, 21406, -26853, 30647, -32558, 32466, -30378, 26421, -20841, 13978, -6257, -1851, 9843, -17232, 23559, -28439, 31569, -32759, 31933, -29146, 24564, -18473, 11245, -3327, -4797, 12624, -19677, 25519, -29792, 32232, -32692, 31140, -27675, 22506, -15955, 8421, -371, -7704, 15303, -21963, 27270, -30902, 32633, -32358, 30092, -25978, 20264, -13305, 5527, 2589, -10548, 17856, -24068, 28799, -31760}, -{32767, -31363, 27270, -20841, 12624, -3327, -6257, 15303, -23039, 28799, -32092, 32633, -30378, 25519, -18473, 9843, -371, -9135, 17856, -25049, 30092, -32558, 32232, -29146, 23559, -15955, 6981, 2589, -11939, 20264, -26853, 31140, -32759, 31569, -27675, 21406, -13305, 4062, 5527, -14645, 22506, -28439, 31933, -32692, 30647, -25978, 19079, -10548, 1110, 8421, -17232, 24564, -29792, 32466, -32358, 29475, -24068, 16596, -7704, -1851, 11245, -19677, 26421, -30902, 32733, -31760, 28063, -21963, 13978, -4797, -4797, 13978, -21963, 28063, -31760, 32733, -30902, 26421, -19677, 11245, -1851, -7704, 16596, -24068, 29475, -32358, 32466, -29792, 24564, -17232, 8421, 1110, -10548, 19079, -25978, 30647, -32692, 31933, -28439, 22506, -14645, 5527, 4062, -13305, 21406, -27675, 31569, -32759, 31140, -26853, 20264, -11939, 2589, 6981, -15955, 23559, -29146, 32232, -32558, 30092, -25049, 17856, -9135, -371, 9843, -18473, 25519, -30378, 32633, -32092, 28799, -23039, 15303, -6257, -3327, 12624, -20841, 27270, -31363}, -{32767, -30902, 25519, -17232, 6981, 4062, -14645, 23559, -29792, 32633, -31760, 27270, -19677, 9843, 1110, -11939, 21406, -28439, 32232, -32358, 28799, -21963, 12624, -1851, -9135, 19079, -26853, 31569, -32692, 30092, -24068, 15303, -4797, -6257, 16596, -25049, 30647, -32759, 31140, -25978, 17856, -7704, -3327, 13978, -23039, 29475, -32558, 31933, -27675, 20264, -10548, -371, 11245, -20841, 28063, -32092, 32466, -29146, 22506, -13305, 2589, 8421, -18473, 26421, -31363, 32733, -30378, 24564, -15955, 5527, 5527, -15955, 24564, -30378, 32733, -31363, 26421, -18473, 8421, 2589, -13305, 22506, -29146, 32466, -32092, 28063, -20841, 11245, -371, -10548, 20264, -27675, 31933, -32558, 29475, -23039, 13978, -3327, -7704, 17856, -25978, 31140, -32759, 30647, -25049, 16596, -6257, -4797, 15303, -24068, 30092, -32692, 31569, -26853, 19079, -9135, -1851, 12624, -21963, 28799, -32358, 32232, -28439, 21406, -11939, 1110, 9843, -19677, 27270, -31760, 32633, -29792, 23559, -14645, 4062, 6981, -17232, 25519, -30902}, -{32767, -30378, 23559, -13305, 1110, 11245, -21963, 29475, -32692, 31140, -25049, 15303, -3327, -9135, 20264, -28439, 32466, -31760, 26421, -17232, 5527, 6981, -18473, 27270, -32092, 32232, -27675, 19079, -7704, -4797, 16596, -25978, 31569, -32558, 28799, -20841, 9843, 2589, -14645, 24564, -30902, 32733, -29792, 22506, -11939, -371, 12624, -23039, 30092, -32759, 30647, -24068, 13978, -1851, -10548, 21406, -29146, 32633, -31363, 25519, -15955, 4062, 8421, -19677, 28063, -32358, 31933, -26853, 17856, -6257, -6257, 17856, -26853, 31933, -32358, 28063, -19677, 8421, 4062, -15955, 25519, -31363, 32633, -29146, 21406, -10548, -1851, 13978, -24068, 30647, -32759, 30092, -23039, 12624, -371, -11939, 22506, -29792, 32733, -30902, 24564, -14645, 2589, 9843, -20841, 28799, -32558, 31569, -25978, 16596, -4797, -7704, 19079, -27675, 32232, -32092, 27270, -18473, 6981, 5527, -17232, 26421, -31760, 32466, -28439, 20264, -9135, -3327, 15303, -25049, 31140, -32692, 29475, -21963, 11245, 1110, -13305, 23559, -30378}, -{32767, -29792, 21406, -9135, -4797, 17856, -27675, 32466, -31363, 24564, -13305, -371, 13978, -25049, 31569, -32358, 27270, -17232, 4062, 9843, -21963, 30092, -32759, 29475, -20841, 8421, 5527, -18473, 28063, -32558, 31140, -24068, 12624, 1110, -14645, 25519, -31760, 32232, -26853, 16596, -3327, -10548, 22506, -30378, 32733, -29146, 20264, -7704, -6257, 19079, -28439, 32633, -30902, 23559, -11939, -1851, 15303, -25978, 31933, -32092, 26421, -15955, 2589, 11245, -23039, 30647, -32692, 28799, -19677, 6981, 6981, -19677, 28799, -32692, 30647, -23039, 11245, 2589, -15955, 26421, -32092, 31933, -25978, 15303, -1851, -11939, 23559, -30902, 32633, -28439, 19079, -6257, -7704, 20264, -29146, 32733, -30378, 22506, -10548, -3327, 16596, -26853, 32232, -31760, 25519, -14645, 1110, 12624, -24068, 31140, -32558, 28063, -18473, 5527, 8421, -20841, 29475, -32759, 30092, -21963, 9843, 4062, -17232, 27270, -32358, 31569, -25049, 13978, -371, -13305, 24564, -31363, 32466, -27675, 17856, -4797, -9135, 21406, -29792}, -{32767, -29146, 19079, -4797, -10548, 23559, -31363, 32232, -25978, 13978, 1110, -15955, 27270, -32558, 30647, -21963, 8421, 6981, -20841, 30092, -32692, 28063, -17232, 2589, 12624, -25049, 31933, -31760, 24564, -11939, -3327, 17856, -28439, 32733, -29792, 20264, -6257, -9135, 22506, -30902, 32466, -26853, 15303, -371, -14645, 26421, -32358, 31140, -23039, 9843, 5527, -19677, 29475, -32759, 28799, -18473, 4062, 11245, -24068, 31569, -32092, 25519, -13305, -1851, 16596, -27675, 32633, -30378, 21406, -7704, -7704, 21406, -30378, 32633, -27675, 16596, -1851, -13305, 25519, -32092, 31569, -24068, 11245, 4062, -18473, 28799, -32759, 29475, -19677, 5527, 9843, -23039, 31140, -32358, 26421, -14645, -371, 15303, -26853, 32466, -30902, 22506, -9135, -6257, 20264, -29792, 32733, -28439, 17856, -3327, -11939, 24564, -31760, 31933, -25049, 12624, 2589, -17232, 28063, -32692, 30092, -20841, 6981, 8421, -21963, 30647, -32558, 27270, -15955, 1110, 13978, -25978, 32232, -31363, 23559, -10548, -4797, 19079, -29146}, -{32767, -28439, 16596, -371, -15955, 28063, -32759, 28799, -17232, 1110, 15303, -27675, 32733, -29146, 17856, -1851, -14645, 27270, -32692, 29475, -18473, 2589, 13978, -26853, 32633, -29792, 19079, -3327, -13305, 26421, -32558, 30092, -19677, 4062, 12624, -25978, 32466, -30378, 20264, -4797, -11939, 25519, -32358, 30647, -20841, 5527, 11245, -25049, 32232, -30902, 21406, -6257, -10548, 24564, -32092, 31140, -21963, 6981, 9843, -24068, 31933, -31363, 22506, -7704, -9135, 23559, -31760, 31569, -23039, 8421, 8421, -23039, 31569, -31760, 23559, -9135, -7704, 22506, -31363, 31933, -24068, 9843, 6981, -21963, 31140, -32092, 24564, -10548, -6257, 21406, -30902, 32232, -25049, 11245, 5527, -20841, 30647, -32358, 25519, -11939, -4797, 20264, -30378, 32466, -25978, 12624, 4062, -19677, 30092, -32558, 26421, -13305, -3327, 19079, -29792, 32633, -26853, 13978, 2589, -18473, 29475, -32692, 27270, -14645, -1851, 17856, -29146, 32733, -27675, 15303, 1110, -17232, 28799, -32759, 28063, -15955, -371, 16596, -28439}, -{32767, -27675, 13978, 4062, -20841, 31140, -31760, 22506, -6257, -11939, 26421, -32692, 28799, -15955, -1851, 19079, -30378, 32232, -24068, 8421, 9843, -25049, 32466, -29792, 17856, -371, -17232, 29475, -32558, 25519, -10548, -7704, 23559, -32092, 30647, -19677, 2589, 15303, -28439, 32733, -26853, 12624, 5527, -21963, 31569, -31363, 21406, -4797, -13305, 27270, -32759, 28063, -14645, -3327, 20264, -30902, 31933, -23039, 6981, 11245, -25978, 32633, -29146, 16596, 1110, -18473, 30092, -32358, 24564, -9135, -9135, 24564, -32358, 30092, -18473, 1110, 16596, -29146, 32633, -25978, 11245, 6981, -23039, 31933, -30902, 20264, -3327, -14645, 28063, -32759, 27270, -13305, -4797, 21406, -31363, 31569, -21963, 5527, 12624, -26853, 32733, -28439, 15303, 2589, -19677, 30647, -32092, 23559, -7704, -10548, 25519, -32558, 29475, -17232, -371, 17856, -29792, 32466, -25049, 9843, 8421, -24068, 32232, -30378, 19079, -1851, -15955, 28799, -32692, 26421, -11939, -6257, 22506, -31760, 31140, -20841, 4062, 13978, -27675}, -{32767, -26853, 11245, 8421, -25049, 32633, -28439, 13978, 5527, -23039, 32232, -29792, 16596, 2589, -20841, 31569, -30902, 19079, -371, -18473, 30647, -31760, 21406, -3327, -15955, 29475, -32358, 23559, -6257, -13305, 28063, -32692, 25519, -9135, -10548, 26421, -32759, 27270, -11939, -7704, 24564, -32558, 28799, -14645, -4797, 22506, -32092, 30092, -17232, -1851, 20264, -31363, 31140, -19677, 1110, 17856, -30378, 31933, -21963, 4062, 15303, -29146, 32466, -24068, 6981, 12624, -27675, 32733, -25978, 9843, 9843, -25978, 32733, -27675, 12624, 6981, -24068, 32466, -29146, 15303, 4062, -21963, 31933, -30378, 17856, 1110, -19677, 31140, -31363, 20264, -1851, -17232, 30092, -32092, 22506, -4797, -14645, 28799, -32558, 24564, -7704, -11939, 27270, -32759, 26421, -10548, -9135, 25519, -32692, 28063, -13305, -6257, 23559, -32358, 29475, -15955, -3327, 21406, -31760, 30647, -18473, -371, 19079, -30902, 31569, -20841, 2589, 16596, -29792, 32232, -23039, 5527, 13978, -28439, 32633, -25049, 8421, 11245, -26853}, -{32767, -25978, 8421, 12624, -28439, 32466, -23039, 4062, 16596, -30378, 31569, -19677, -371, 20264, -31760, 30092, -15955, -4797, 23559, -32558, 28063, -11939, -9135, 26421, -32759, 25519, -7704, -13305, 28799, -32358, 22506, -3327, -17232, 30647, -31363, 19079, 1110, -20841, 31933, -29792, 15303, 5527, -24068, 32633, -27675, 11245, 9843, -26853, 32733, -25049, 6981, 13978, -29146, 32232, -21963, 2589, 17856, -30902, 31140, -18473, -1851, 21406, -32092, 29475, -14645, -6257, 24564, -32692, 27270, -10548, -10548, 27270, -32692, 24564, -6257, -14645, 29475, -32092, 21406, -1851, -18473, 31140, -30902, 17856, 2589, -21963, 32232, -29146, 13978, 6981, -25049, 32733, -26853, 9843, 11245, -27675, 32633, -24068, 5527, 15303, -29792, 31933, -20841, 1110, 19079, -31363, 30647, -17232, -3327, 22506, -32358, 28799, -13305, -7704, 25519, -32759, 26421, -9135, -11939, 28063, -32558, 23559, -4797, -15955, 30092, -31760, 20264, -371, -19677, 31569, -30378, 16596, 4062, -23039, 32466, -28439, 12624, 8421, -25978}, -{32767, -25049, 5527, 16596, -30902, 30647, -15955, -6257, 25519, -32759, 24564, -4797, -17232, 31140, -30378, 15303, 6981, -25978, 32733, -24068, 4062, 17856, -31363, 30092, -14645, -7704, 26421, -32692, 23559, -3327, -18473, 31569, -29792, 13978, 8421, -26853, 32633, -23039, 2589, 19079, -31760, 29475, -13305, -9135, 27270, -32558, 22506, -1851, -19677, 31933, -29146, 12624, 9843, -27675, 32466, -21963, 1110, 20264, -32092, 28799, -11939, -10548, 28063, -32358, 21406, -371, -20841, 32232, -28439, 11245, 11245, -28439, 32232, -20841, -371, 21406, -32358, 28063, -10548, -11939, 28799, -32092, 20264, 1110, -21963, 32466, -27675, 9843, 12624, -29146, 31933, -19677, -1851, 22506, -32558, 27270, -9135, -13305, 29475, -31760, 19079, 2589, -23039, 32633, -26853, 8421, 13978, -29792, 31569, -18473, -3327, 23559, -32692, 26421, -7704, -14645, 30092, -31363, 17856, 4062, -24068, 32733, -25978, 6981, 15303, -30378, 31140, -17232, -4797, 24564, -32759, 25519, -6257, -15955, 30647, -30902, 16596, 5527, -25049}, -{32767, -24068, 2589, 20264, -32358, 27270, -7704, -15955, 31140, -29792, 12624, 11245, -29146, 31569, -17232, -6257, 26421, -32558, 21406, 1110, -23039, 32733, -25049, 4062, 19079, -32092, 28063, -9135, -14645, 30647, -30378, 13978, 9843, -28439, 31933, -18473, -4797, 25519, -32692, 22506, -371, -21963, 32633, -25978, 5527, 17856, -31760, 28799, -10548, -13305, 30092, -30902, 15303, 8421, -27675, 32232, -19677, -3327, 24564, -32759, 23559, -1851, -20841, 32466, -26853, 6981, 16596, -31363, 29475, -11939, -11939, 29475, -31363, 16596, 6981, -26853, 32466, -20841, -1851, 23559, -32759, 24564, -3327, -19677, 32232, -27675, 8421, 15303, -30902, 30092, -13305, -10548, 28799, -31760, 17856, 5527, -25978, 32633, -21963, -371, 22506, -32692, 25519, -4797, -18473, 31933, -28439, 9843, 13978, -30378, 30647, -14645, -9135, 28063, -32092, 19079, 4062, -25049, 32733, -23039, 1110, 21406, -32558, 26421, -6257, -17232, 31569, -29146, 11245, 12624, -29792, 31140, -15955, -7704, 27270, -32358, 20264, 2589, -24068}, -{32767, -23039, -371, 23559, -32759, 22506, 1110, -24068, 32733, -21963, -1851, 24564, -32692, 21406, 2589, -25049, 32633, -20841, -3327, 25519, -32558, 20264, 4062, -25978, 32466, -19677, -4797, 26421, -32358, 19079, 5527, -26853, 32232, -18473, -6257, 27270, -32092, 17856, 6981, -27675, 31933, -17232, -7704, 28063, -31760, 16596, 8421, -28439, 31569, -15955, -9135, 28799, -31363, 15303, 9843, -29146, 31140, -14645, -10548, 29475, -30902, 13978, 11245, -29792, 30647, -13305, -11939, 30092, -30378, 12624, 12624, -30378, 30092, -11939, -13305, 30647, -29792, 11245, 13978, -30902, 29475, -10548, -14645, 31140, -29146, 9843, 15303, -31363, 28799, -9135, -15955, 31569, -28439, 8421, 16596, -31760, 28063, -7704, -17232, 31933, -27675, 6981, 17856, -32092, 27270, -6257, -18473, 32232, -26853, 5527, 19079, -32358, 26421, -4797, -19677, 32466, -25978, 4062, 20264, -32558, 25519, -3327, -20841, 32633, -25049, 2589, 21406, -32692, 24564, -1851, -21963, 32733, -24068, 1110, 22506, -32759, 23559, -371, -23039}, -{32767, -21963, -3327, 26421, -32092, 16596, 9843, -29792, 30092, -10548, -15955, 31933, -26853, 4062, 21406, -32759, 22506, 2589, -25978, 32232, -17232, -9135, 29475, -30378, 11245, 15303, -31760, 27270, -4797, -20841, 32733, -23039, -1851, 25519, -32358, 17856, 8421, -29146, 30647, -11939, -14645, 31569, -27675, 5527, 20264, -32692, 23559, 1110, -25049, 32466, -18473, -7704, 28799, -30902, 12624, 13978, -31363, 28063, -6257, -19677, 32633, -24068, -371, 24564, -32558, 19079, 6981, -28439, 31140, -13305, -13305, 31140, -28439, 6981, 19079, -32558, 24564, -371, -24068, 32633, -19677, -6257, 28063, -31363, 13978, 12624, -30902, 28799, -7704, -18473, 32466, -25049, 1110, 23559, -32692, 20264, 5527, -27675, 31569, -14645, -11939, 30647, -29146, 8421, 17856, -32358, 25519, -1851, -23039, 32733, -20841, -4797, 27270, -31760, 15303, 11245, -30378, 29475, -9135, -17232, 32232, -25978, 2589, 22506, -32759, 21406, 4062, -26853, 31933, -15955, -10548, 30092, -29792, 9843, 16596, -32092, 26421, -3327, -21963}, -{32767, -20841, -6257, 28799, -30378, 9843, 17856, -32558, 23559, 2589, -26853, 31569, -13305, -14645, 31933, -25978, 1110, 24564, -32358, 16596, 11245, -30902, 28063, -4797, -21963, 32733, -19677, -7704, 29475, -29792, 8421, 19079, -32692, 22506, 4062, -27675, 31140, -11939, -15955, 32232, -25049, -371, 25519, -32092, 15303, 12624, -31363, 27270, -3327, -23039, 32633, -18473, -9135, 30092, -29146, 6981, 20264, -32759, 21406, 5527, -28439, 30647, -10548, -17232, 32466, -24068, -1851, 26421, -31760, 13978, 13978, -31760, 26421, -1851, -24068, 32466, -17232, -10548, 30647, -28439, 5527, 21406, -32759, 20264, 6981, -29146, 30092, -9135, -18473, 32633, -23039, -3327, 27270, -31363, 12624, 15303, -32092, 25519, -371, -25049, 32232, -15955, -11939, 31140, -27675, 4062, 22506, -32692, 19079, 8421, -29792, 29475, -7704, -19677, 32733, -21963, -4797, 28063, -30902, 11245, 16596, -32358, 24564, 1110, -25978, 31933, -14645, -13305, 31569, -26853, 2589, 23559, -32558, 17856, 9843, -30378, 28799, -6257, -20841}, -{32767, -19677, -9135, 30647, -27675, 2589, 24564, -32092, 13978, 15303, -32358, 23559, 4062, -28439, 30092, -7704, -20841, 32733, -18473, -10548, 31140, -26853, 1110, 25519, -31760, 12624, 16596, -32558, 22506, 5527, -29146, 29475, -6257, -21963, 32633, -17232, -11939, 31569, -25978, -371, 26421, -31363, 11245, 17856, -32692, 21406, 6981, -29792, 28799, -4797, -23039, 32466, -15955, -13305, 31933, -25049, -1851, 27270, -30902, 9843, 19079, -32759, 20264, 8421, -30378, 28063, -3327, -24068, 32232, -14645, -14645, 32232, -24068, -3327, 28063, -30378, 8421, 20264, -32759, 19079, 9843, -30902, 27270, -1851, -25049, 31933, -13305, -15955, 32466, -23039, -4797, 28799, -29792, 6981, 21406, -32692, 17856, 11245, -31363, 26421, -371, -25978, 31569, -11939, -17232, 32633, -21963, -6257, 29475, -29146, 5527, 22506, -32558, 16596, 12624, -31760, 25519, 1110, -26853, 31140, -10548, -18473, 32733, -20841, -7704, 30092, -28439, 4062, 23559, -32358, 15303, 13978, -32092, 24564, 2589, -27675, 30647, -9135, -19677}, -{32767, -18473, -11939, 31933, -24068, -4797, 29475, -28439, 2589, 25519, -31363, 9843, 20264, -32692, 16596, 13978, -32358, 22506, 6981, -30378, 27270, -371, -26853, 30647, -7704, -21963, 32466, -14645, -15955, 32633, -20841, -9135, 31140, -25978, -1851, 28063, -29792, 5527, 23559, -32092, 12624, 17856, -32759, 19079, 11245, -31760, 24564, 4062, -29146, 28799, -3327, -25049, 31569, -10548, -19677, 32733, -17232, -13305, 32232, -23039, -6257, 30092, -27675, 1110, 26421, -30902, 8421, 21406, -32558, 15303, 15303, -32558, 21406, 8421, -30902, 26421, 1110, -27675, 30092, -6257, -23039, 32232, -13305, -17232, 32733, -19677, -10548, 31569, -25049, -3327, 28799, -29146, 4062, 24564, -31760, 11245, 19079, -32759, 17856, 12624, -32092, 23559, 5527, -29792, 28063, -1851, -25978, 31140, -9135, -20841, 32633, -15955, -14645, 32466, -21963, -7704, 30647, -26853, -371, 27270, -30378, 6981, 22506, -32358, 13978, 16596, -32692, 20264, 9843, -31363, 25519, 2589, -28439, 29475, -4797, -24068, 31933, -11939, -18473}, -{32767, -17232, -14645, 32633, -19677, -11939, 32232, -21963, -9135, 31569, -24068, -6257, 30647, -25978, -3327, 29475, -27675, -371, 28063, -29146, 2589, 26421, -30378, 5527, 24564, -31363, 8421, 22506, -32092, 11245, 20264, -32558, 13978, 17856, -32759, 16596, 15303, -32692, 19079, 12624, -32358, 21406, 9843, -31760, 23559, 6981, -30902, 25519, 4062, -29792, 27270, 1110, -28439, 28799, -1851, -26853, 30092, -4797, -25049, 31140, -7704, -23039, 31933, -10548, -20841, 32466, -13305, -18473, 32733, -15955, -15955, 32733, -18473, -13305, 32466, -20841, -10548, 31933, -23039, -7704, 31140, -25049, -4797, 30092, -26853, -1851, 28799, -28439, 1110, 27270, -29792, 4062, 25519, -30902, 6981, 23559, -31760, 9843, 21406, -32358, 12624, 19079, -32692, 15303, 16596, -32759, 17856, 13978, -32558, 20264, 11245, -32092, 22506, 8421, -31363, 24564, 5527, -30378, 26421, 2589, -29146, 28063, -371, -27675, 29475, -3327, -25978, 30647, -6257, -24068, 31569, -9135, -21963, 32232, -11939, -19677, 32633, -14645, -17232}, -{32767, -15955, -17232, 32733, -14645, -18473, 32633, -13305, -19677, 32466, -11939, -20841, 32232, -10548, -21963, 31933, -9135, -23039, 31569, -7704, -24068, 31140, -6257, -25049, 30647, -4797, -25978, 30092, -3327, -26853, 29475, -1851, -27675, 28799, -371, -28439, 28063, 1110, -29146, 27270, 2589, -29792, 26421, 4062, -30378, 25519, 5527, -30902, 24564, 6981, -31363, 23559, 8421, -31760, 22506, 9843, -32092, 21406, 11245, -32358, 20264, 12624, -32558, 19079, 13978, -32692, 17856, 15303, -32759, 16596, 16596, -32759, 15303, 17856, -32692, 13978, 19079, -32558, 12624, 20264, -32358, 11245, 21406, -32092, 9843, 22506, -31760, 8421, 23559, -31363, 6981, 24564, -30902, 5527, 25519, -30378, 4062, 26421, -29792, 2589, 27270, -29146, 1110, 28063, -28439, -371, 28799, -27675, -1851, 29475, -26853, -3327, 30092, -25978, -4797, 30647, -25049, -6257, 31140, -24068, -7704, 31569, -23039, -9135, 31933, -21963, -10548, 32232, -20841, -11939, 32466, -19677, -13305, 32633, -18473, -14645, 32733, -17232, -15955}, -{32767, -14645, -19677, 32232, -9135, -24068, 30647, -3327, -27675, 28063, 2589, -30378, 24564, 8421, -32092, 20264, 13978, -32759, 15303, 19079, -32358, 9843, 23559, -30902, 4062, 27270, -28439, -1851, 30092, -25049, -7704, 31933, -20841, -13305, 32733, -15955, -18473, 32466, -10548, -23039, 31140, -4797, -26853, 28799, 1110, -29792, 25519, 6981, -31760, 21406, 12624, -32692, 16596, 17856, -32558, 11245, 22506, -31363, 5527, 26421, -29146, -371, 29475, -25978, -6257, 31569, -21963, -11939, 32633, -17232, -17232, 32633, -11939, -21963, 31569, -6257, -25978, 29475, -371, -29146, 26421, 5527, -31363, 22506, 11245, -32558, 17856, 16596, -32692, 12624, 21406, -31760, 6981, 25519, -29792, 1110, 28799, -26853, -4797, 31140, -23039, -10548, 32466, -18473, -15955, 32733, -13305, -20841, 31933, -7704, -25049, 30092, -1851, -28439, 27270, 4062, -30902, 23559, 9843, -32358, 19079, 15303, -32759, 13978, 20264, -32092, 8421, 24564, -30378, 2589, 28063, -27675, -3327, 30647, -24068, -9135, 32232, -19677, -14645}, -{32767, -13305, -21963, 31140, -3327, -28439, 26421, 6981, -32092, 19079, 16596, -32558, 9843, 24564, -29792, -371, 30092, -24068, -10548, 32633, -15955, -19677, 31933, -6257, -26853, 28063, 4062, -31363, 21406, 13978, -32759, 12624, 22506, -30902, 2589, 28799, -25978, -7704, 32232, -18473, -17232, 32466, -9135, -25049, 29475, 1110, -30378, 23559, 11245, -32692, 15303, 20264, -31760, 5527, 27270, -27675, -4797, 31569, -20841, -14645, 32733, -11939, -23039, 30647, -1851, -29146, 25519, 8421, -32358, 17856, 17856, -32358, 8421, 25519, -29146, -1851, 30647, -23039, -11939, 32733, -14645, -20841, 31569, -4797, -27675, 27270, 5527, -31760, 20264, 15303, -32692, 11245, 23559, -30378, 1110, 29475, -25049, -9135, 32466, -17232, -18473, 32232, -7704, -25978, 28799, 2589, -30902, 22506, 12624, -32759, 13978, 21406, -31363, 4062, 28063, -26853, -6257, 31933, -19677, -15955, 32633, -10548, -24068, 30092, -371, -29792, 24564, 9843, -32558, 16596, 19079, -32092, 6981, 26421, -28439, -3327, 31140, -21963, -13305}, -{32767, -11939, -24068, 29475, 2589, -31363, 20264, 16596, -32358, 6981, 27270, -26853, -7704, 32466, -15955, -20841, 31140, -1851, -29792, 23559, 12624, -32759, 11245, 24564, -29146, -3327, 31569, -19677, -17232, 32232, -6257, -27675, 26421, 8421, -32558, 15303, 21406, -30902, 1110, 30092, -23039, -13305, 32733, -10548, -25049, 28799, 4062, -31760, 19079, 17856, -32092, 5527, 28063, -25978, -9135, 32633, -14645, -21963, 30647, -371, -30378, 22506, 13978, -32692, 9843, 25519, -28439, -4797, 31933, -18473, -18473, 31933, -4797, -28439, 25519, 9843, -32692, 13978, 22506, -30378, -371, 30647, -21963, -14645, 32633, -9135, -25978, 28063, 5527, -32092, 17856, 19079, -31760, 4062, 28799, -25049, -10548, 32733, -13305, -23039, 30092, 1110, -30902, 21406, 15303, -32558, 8421, 26421, -27675, -6257, 32232, -17232, -19677, 31569, -3327, -29146, 24564, 11245, -32759, 12624, 23559, -29792, -1851, 31140, -20841, -15955, 32466, -7704, -26853, 27270, 6981, -32358, 16596, 20264, -31363, 2589, 29475, -24068, -11939}, -{32767, -10548, -25978, 27270, 8421, -32692, 12624, 24564, -28439, -6257, 32466, -14645, -23039, 29475, 4062, -32092, 16596, 21406, -30378, -1851, 31569, -18473, -19677, 31140, -371, -30902, 20264, 17856, -31760, 2589, 30092, -21963, -15955, 32232, -4797, -29146, 23559, 13978, -32558, 6981, 28063, -25049, -11939, 32733, -9135, -26853, 26421, 9843, -32759, 11245, 25519, -27675, -7704, 32633, -13305, -24068, 28799, 5527, -32358, 15303, 22506, -29792, -3327, 31933, -17232, -20841, 30647, 1110, -31363, 19079, 19079, -31363, 1110, 30647, -20841, -17232, 31933, -3327, -29792, 22506, 15303, -32358, 5527, 28799, -24068, -13305, 32633, -7704, -27675, 25519, 11245, -32759, 9843, 26421, -26853, -9135, 32733, -11939, -25049, 28063, 6981, -32558, 13978, 23559, -29146, -4797, 32232, -15955, -21963, 30092, 2589, -31760, 17856, 20264, -30902, -371, 31140, -19677, -18473, 31569, -1851, -30378, 21406, 16596, -32092, 4062, 29475, -23039, -14645, 32466, -6257, -28439, 24564, 12624, -32692, 8421, 27270, -25978, -10548}, -{32767, -9135, -27675, 24564, 13978, -32358, 4062, 30092, -20841, -18473, 31140, 1110, -31760, 16596, 22506, -29146, -6257, 32633, -11939, -25978, 26421, 11245, -32692, 6981, 28799, -23039, -15955, 31933, -1851, -30902, 19079, 20264, -30378, -3327, 32232, -14645, -24068, 28063, 8421, -32759, 9843, 27270, -25049, -13305, 32466, -4797, -29792, 21406, 17856, -31363, -371, 31569, -17232, -21963, 29475, 5527, -32558, 12624, 25519, -26853, -10548, 32733, -7704, -28439, 23559, 15303, -32092, 2589, 30647, -19677, -19677, 30647, 2589, -32092, 15303, 23559, -28439, -7704, 32733, -10548, -26853, 25519, 12624, -32558, 5527, 29475, -21963, -17232, 31569, -371, -31363, 17856, 21406, -29792, -4797, 32466, -13305, -25049, 27270, 9843, -32759, 8421, 28063, -24068, -14645, 32232, -3327, -30378, 20264, 19079, -30902, -1851, 31933, -15955, -23039, 28799, 6981, -32692, 11245, 26421, -25978, -11939, 32633, -6257, -29146, 22506, 16596, -31760, 1110, 31140, -18473, -20841, 30092, 4062, -32358, 13978, 24564, -27675, -9135}, -{32767, -7704, -29146, 21406, 19079, -30378, -4797, 32633, -10548, -27675, 23559, 16596, -31363, -1851, 32232, -13305, -25978, 25519, 13978, -32092, 1110, 31569, -15955, -24068, 27270, 11245, -32558, 4062, 30647, -18473, -21963, 28799, 8421, -32759, 6981, 29475, -20841, -19677, 30092, 5527, -32692, 9843, 28063, -23039, -17232, 31140, 2589, -32358, 12624, 26421, -25049, -14645, 31933, -371, -31760, 15303, 24564, -26853, -11939, 32466, -3327, -30902, 17856, 22506, -28439, -9135, 32733, -6257, -29792, 20264, 20264, -29792, -6257, 32733, -9135, -28439, 22506, 17856, -30902, -3327, 32466, -11939, -26853, 24564, 15303, -31760, -371, 31933, -14645, -25049, 26421, 12624, -32358, 2589, 31140, -17232, -23039, 28063, 9843, -32692, 5527, 30092, -19677, -20841, 29475, 6981, -32759, 8421, 28799, -21963, -18473, 30647, 4062, -32558, 11245, 27270, -24068, -15955, 31569, 1110, -32092, 13978, 25519, -25978, -13305, 32232, -1851, -31363, 16596, 23559, -27675, -10548, 32633, -4797, -30378, 19079, 21406, -29146, -7704}, -{32767, -6257, -30378, 17856, 23559, -26853, -13305, 31933, 1110, -32358, 11245, 28063, -21963, -19677, 29475, 8421, -32692, 4062, 31140, -15955, -25049, 25519, 15303, -31363, -3327, 32633, -9135, -29146, 20264, 21406, -28439, -10548, 32466, -1851, -31760, 13978, 26421, -24068, -17232, 30647, 5527, -32759, 6981, 30092, -18473, -23039, 27270, 12624, -32092, -371, 32232, -11939, -27675, 22506, 19079, -29792, -7704, 32733, -4797, -30902, 16596, 24564, -25978, -14645, 31569, 2589, -32558, 9843, 28799, -20841, -20841, 28799, 9843, -32558, 2589, 31569, -14645, -25978, 24564, 16596, -30902, -4797, 32733, -7704, -29792, 19079, 22506, -27675, -11939, 32232, -371, -32092, 12624, 27270, -23039, -18473, 30092, 6981, -32759, 5527, 30647, -17232, -24068, 26421, 13978, -31760, -1851, 32466, -10548, -28439, 21406, 20264, -29146, -9135, 32633, -3327, -31363, 15303, 25519, -25049, -15955, 31140, 4062, -32692, 8421, 29475, -19677, -21963, 28063, 11245, -32358, 1110, 31933, -13305, -26853, 23559, 17856, -30378, -6257}, -{32767, -4797, -31363, 13978, 27270, -21963, -20841, 28063, 12624, -31760, -3327, 32733, -6257, -30902, 15303, 26421, -23039, -19677, 28799, 11245, -32092, -1851, 32633, -7704, -30378, 16596, 25519, -24068, -18473, 29475, 9843, -32358, -371, 32466, -9135, -29792, 17856, 24564, -25049, -17232, 30092, 8421, -32558, 1110, 32232, -10548, -29146, 19079, 23559, -25978, -15955, 30647, 6981, -32692, 2589, 31933, -11939, -28439, 20264, 22506, -26853, -14645, 31140, 5527, -32759, 4062, 31569, -13305, -27675, 21406, 21406, -27675, -13305, 31569, 4062, -32759, 5527, 31140, -14645, -26853, 22506, 20264, -28439, -11939, 31933, 2589, -32692, 6981, 30647, -15955, -25978, 23559, 19079, -29146, -10548, 32232, 1110, -32558, 8421, 30092, -17232, -25049, 24564, 17856, -29792, -9135, 32466, -371, -32358, 9843, 29475, -18473, -24068, 25519, 16596, -30378, -7704, 32633, -1851, -32092, 11245, 28799, -19677, -23039, 26421, 15303, -30902, -6257, 32733, -3327, -31760, 12624, 28063, -20841, -21963, 27270, 13978, -31363, -4797}, -{32767, -3327, -32092, 9843, 30092, -15955, -26853, 21406, 22506, -25978, -17232, 29475, 11245, -31760, -4797, 32733, -1851, -32358, 8421, 30647, -14645, -27675, 20264, 23559, -25049, -18473, 28799, 12624, -31363, -6257, 32633, -371, -32558, 6981, 31140, -13305, -28439, 19079, 24564, -24068, -19677, 28063, 13978, -30902, -7704, 32466, 1110, -32692, 5527, 31569, -11939, -29146, 17856, 25519, -23039, -20841, 27270, 15303, -30378, -9135, 32232, 2589, -32759, 4062, 31933, -10548, -29792, 16596, 26421, -21963, -21963, 26421, 16596, -29792, -10548, 31933, 4062, -32759, 2589, 32232, -9135, -30378, 15303, 27270, -20841, -23039, 25519, 17856, -29146, -11939, 31569, 5527, -32692, 1110, 32466, -7704, -30902, 13978, 28063, -19677, -24068, 24564, 19079, -28439, -13305, 31140, 6981, -32558, -371, 32633, -6257, -31363, 12624, 28799, -18473, -25049, 23559, 20264, -27675, -14645, 30647, 8421, -32358, -1851, 32733, -4797, -31760, 11245, 29475, -17232, -25978, 22506, 21406, -26853, -15955, 30092, 9843, -32092, -3327}, -{32767, -1851, -32558, 5527, 31933, -9135, -30902, 12624, 29475, -15955, -27675, 19079, 25519, -21963, -23039, 24564, 20264, -26853, -17232, 28799, 13978, -30378, -10548, 31569, 6981, -32358, -3327, 32733, -371, -32692, 4062, 32232, -7704, -31363, 11245, 30092, -14645, -28439, 17856, 26421, -20841, -24068, 23559, 21406, -25978, -18473, 28063, 15303, -29792, -11939, 31140, 8421, -32092, -4797, 32633, 1110, -32759, 2589, 32466, -6257, -31760, 9843, 30647, -13305, -29146, 16596, 27270, -19677, -25049, 22506, 22506, -25049, -19677, 27270, 16596, -29146, -13305, 30647, 9843, -31760, -6257, 32466, 2589, -32759, 1110, 32633, -4797, -32092, 8421, 31140, -11939, -29792, 15303, 28063, -18473, -25978, 21406, 23559, -24068, -20841, 26421, 17856, -28439, -14645, 30092, 11245, -31363, -7704, 32232, 4062, -32692, -371, 32733, -3327, -32358, 6981, 31569, -10548, -30378, 13978, 28799, -17232, -26853, 20264, 24564, -23039, -21963, 25519, 19079, -27675, -15955, 29475, 12624, -30902, -9135, 31933, 5527, -32558, -1851}, -{32767, -371, -32759, 1110, 32733, -1851, -32692, 2589, 32633, -3327, -32558, 4062, 32466, -4797, -32358, 5527, 32232, -6257, -32092, 6981, 31933, -7704, -31760, 8421, 31569, -9135, -31363, 9843, 31140, -10548, -30902, 11245, 30647, -11939, -30378, 12624, 30092, -13305, -29792, 13978, 29475, -14645, -29146, 15303, 28799, -15955, -28439, 16596, 28063, -17232, -27675, 17856, 27270, -18473, -26853, 19079, 26421, -19677, -25978, 20264, 25519, -20841, -25049, 21406, 24564, -21963, -24068, 22506, 23559, -23039, -23039, 23559, 22506, -24068, -21963, 24564, 21406, -25049, -20841, 25519, 20264, -25978, -19677, 26421, 19079, -26853, -18473, 27270, 17856, -27675, -17232, 28063, 16596, -28439, -15955, 28799, 15303, -29146, -14645, 29475, 13978, -29792, -13305, 30092, 12624, -30378, -11939, 30647, 11245, -30902, -10548, 31140, 9843, -31363, -9135, 31569, 8421, -31760, -7704, 31933, 6981, -32092, -6257, 32232, 5527, -32358, -4797, 32466, 4062, -32558, -3327, 32633, 2589, -32692, -1851, 32733, 1110, -32759, -371}, -{32767, 1110, -32692, -3327, 32466, 5527, -32092, -7704, 31569, 9843, -30902, -11939, 30092, 13978, -29146, -15955, 28063, 17856, -26853, -19677, 25519, 21406, -24068, -23039, 22506, 24564, -20841, -25978, 19079, 27270, -17232, -28439, 15303, 29475, -13305, -30378, 11245, 31140, -9135, -31760, 6981, 32232, -4797, -32558, 2589, 32733, -371, -32759, -1851, 32633, 4062, -32358, -6257, 31933, 8421, -31363, -10548, 30647, 12624, -29792, -14645, 28799, 16596, -27675, -18473, 26421, 20264, -25049, -21963, 23559, 23559, -21963, -25049, 20264, 26421, -18473, -27675, 16596, 28799, -14645, -29792, 12624, 30647, -10548, -31363, 8421, 31933, -6257, -32358, 4062, 32633, -1851, -32759, -371, 32733, 2589, -32558, -4797, 32232, 6981, -31760, -9135, 31140, 11245, -30378, -13305, 29475, 15303, -28439, -17232, 27270, 19079, -25978, -20841, 24564, 22506, -23039, -24068, 21406, 25519, -19677, -26853, 17856, 28063, -15955, -29146, 13978, 30092, -11939, -30902, 9843, 31569, -7704, -32092, 5527, 32466, -3327, -32692, 1110}, -{32767, 2589, -32358, -7704, 31140, 12624, -29146, -17232, 26421, 21406, -23039, -25049, 19079, 28063, -14645, -30378, 9843, 31933, -4797, -32692, -371, 32633, 5527, -31760, -10548, 30092, 15303, -27675, -19677, 24564, 23559, -20841, -26853, 16596, 29475, -11939, -31363, 6981, 32466, -1851, -32759, -3327, 32232, 8421, -30902, -13305, 28799, 17856, -25978, -21963, 22506, 25519, -18473, -28439, 13978, 30647, -9135, -32092, 4062, 32733, 1110, -32558, -6257, 31569, 11245, -29792, -15955, 27270, 20264, -24068, -24068, 20264, 27270, -15955, -29792, 11245, 31569, -6257, -32558, 1110, 32733, 4062, -32092, -9135, 30647, 13978, -28439, -18473, 25519, 22506, -21963, -25978, 17856, 28799, -13305, -30902, 8421, 32232, -3327, -32759, -1851, 32466, 6981, -31363, -11939, 29475, 16596, -26853, -20841, 23559, 24564, -19677, -27675, 15303, 30092, -10548, -31760, 5527, 32633, -371, -32692, -4797, 31933, 9843, -30378, -14645, 28063, 19079, -25049, -23039, 21406, 26421, -17232, -29146, 12624, 31140, -7704, -32358, 2589}, -{32767, 4062, -31760, -11939, 28799, 19079, -24068, -25049, 17856, 29475, -10548, -32092, 2589, 32733, 5527, -31363, -13305, 28063, 20264, -23039, -25978, 16596, 30092, -9135, -32358, 1110, 32633, 6981, -30902, -14645, 27270, 21406, -21963, -26853, 15303, 30647, -7704, -32558, -371, 32466, 8421, -30378, -15955, 26421, 22506, -20841, -27675, 13978, 31140, -6257, -32692, -1851, 32232, 9843, -29792, -17232, 25519, 23559, -19677, -28439, 12624, 31569, -4797, -32759, -3327, 31933, 11245, -29146, -18473, 24564, 24564, -18473, -29146, 11245, 31933, -3327, -32759, -4797, 31569, 12624, -28439, -19677, 23559, 25519, -17232, -29792, 9843, 32232, -1851, -32692, -6257, 31140, 13978, -27675, -20841, 22506, 26421, -15955, -30378, 8421, 32466, -371, -32558, -7704, 30647, 15303, -26853, -21963, 21406, 27270, -14645, -30902, 6981, 32633, 1110, -32358, -9135, 30092, 16596, -25978, -23039, 20264, 28063, -13305, -31363, 5527, 32733, 2589, -32092, -10548, 29475, 17856, -25049, -24068, 19079, 28799, -11939, -31760, 4062}, -{32767, 5527, -30902, -15955, 25519, 24564, -17232, -30378, 6981, 32733, 4062, -31363, -14645, 26421, 23559, -18473, -29792, 8421, 32633, 2589, -31760, -13305, 27270, 22506, -19677, -29146, 9843, 32466, 1110, -32092, -11939, 28063, 21406, -20841, -28439, 11245, 32232, -371, -32358, -10548, 28799, 20264, -21963, -27675, 12624, 31933, -1851, -32558, -9135, 29475, 19079, -23039, -26853, 13978, 31569, -3327, -32692, -7704, 30092, 17856, -24068, -25978, 15303, 31140, -4797, -32759, -6257, 30647, 16596, -25049, -25049, 16596, 30647, -6257, -32759, -4797, 31140, 15303, -25978, -24068, 17856, 30092, -7704, -32692, -3327, 31569, 13978, -26853, -23039, 19079, 29475, -9135, -32558, -1851, 31933, 12624, -27675, -21963, 20264, 28799, -10548, -32358, -371, 32232, 11245, -28439, -20841, 21406, 28063, -11939, -32092, 1110, 32466, 9843, -29146, -19677, 22506, 27270, -13305, -31760, 2589, 32633, 8421, -29792, -18473, 23559, 26421, -14645, -31363, 4062, 32733, 6981, -30378, -17232, 24564, 25519, -15955, -30902, 5527}, -{32767, 6981, -29792, -19677, 21406, 28799, -9135, -32692, -4797, 30647, 17856, -23039, -27675, 11245, 32466, 2589, -31363, -15955, 24564, 26421, -13305, -32092, -371, 31933, 13978, -25978, -25049, 15303, 31569, -1851, -32358, -11939, 27270, 23559, -17232, -30902, 4062, 32633, 9843, -28439, -21963, 19079, 30092, -6257, -32759, -7704, 29475, 20264, -20841, -29146, 8421, 32733, 5527, -30378, -18473, 22506, 28063, -10548, -32558, -3327, 31140, 16596, -24068, -26853, 12624, 32232, 1110, -31760, -14645, 25519, 25519, -14645, -31760, 1110, 32232, 12624, -26853, -24068, 16596, 31140, -3327, -32558, -10548, 28063, 22506, -18473, -30378, 5527, 32733, 8421, -29146, -20841, 20264, 29475, -7704, -32759, -6257, 30092, 19079, -21963, -28439, 9843, 32633, 4062, -30902, -17232, 23559, 27270, -11939, -32358, -1851, 31569, 15303, -25049, -25978, 13978, 31933, -371, -32092, -13305, 26421, 24564, -15955, -31363, 2589, 32466, 11245, -27675, -23039, 17856, 30647, -4797, -32692, -9135, 28799, 21406, -19677, -29792, 6981}, -{32767, 8421, -28439, -23039, 16596, 31569, -371, -31760, -15955, 23559, 28063, -9135, -32759, -7704, 28799, 22506, -17232, -31363, 1110, 31933, 15303, -24068, -27675, 9843, 32733, 6981, -29146, -21963, 17856, 31140, -1851, -32092, -14645, 24564, 27270, -10548, -32692, -6257, 29475, 21406, -18473, -30902, 2589, 32232, 13978, -25049, -26853, 11245, 32633, 5527, -29792, -20841, 19079, 30647, -3327, -32358, -13305, 25519, 26421, -11939, -32558, -4797, 30092, 20264, -19677, -30378, 4062, 32466, 12624, -25978, -25978, 12624, 32466, 4062, -30378, -19677, 20264, 30092, -4797, -32558, -11939, 26421, 25519, -13305, -32358, -3327, 30647, 19079, -20841, -29792, 5527, 32633, 11245, -26853, -25049, 13978, 32232, 2589, -30902, -18473, 21406, 29475, -6257, -32692, -10548, 27270, 24564, -14645, -32092, -1851, 31140, 17856, -21963, -29146, 6981, 32733, 9843, -27675, -24068, 15303, 31933, 1110, -31363, -17232, 22506, 28799, -7704, -32759, -9135, 28063, 23559, -15955, -31760, -371, 31569, 16596, -23039, -28439, 8421}, -{32767, 9843, -26853, -25978, 11245, 32733, 8421, -27675, -25049, 12624, 32633, 6981, -28439, -24068, 13978, 32466, 5527, -29146, -23039, 15303, 32232, 4062, -29792, -21963, 16596, 31933, 2589, -30378, -20841, 17856, 31569, 1110, -30902, -19677, 19079, 31140, -371, -31363, -18473, 20264, 30647, -1851, -31760, -17232, 21406, 30092, -3327, -32092, -15955, 22506, 29475, -4797, -32358, -14645, 23559, 28799, -6257, -32558, -13305, 24564, 28063, -7704, -32692, -11939, 25519, 27270, -9135, -32759, -10548, 26421, 26421, -10548, -32759, -9135, 27270, 25519, -11939, -32692, -7704, 28063, 24564, -13305, -32558, -6257, 28799, 23559, -14645, -32358, -4797, 29475, 22506, -15955, -32092, -3327, 30092, 21406, -17232, -31760, -1851, 30647, 20264, -18473, -31363, -371, 31140, 19079, -19677, -30902, 1110, 31569, 17856, -20841, -30378, 2589, 31933, 16596, -21963, -29792, 4062, 32232, 15303, -23039, -29146, 5527, 32466, 13978, -24068, -28439, 6981, 32633, 12624, -25049, -27675, 8421, 32733, 11245, -25978, -26853, 9843}, -{32767, 11245, -25049, -28439, 5527, 32232, 16596, -20841, -30902, -371, 30647, 21406, -15955, -32358, -6257, 28063, 25519, -10548, -32759, -11939, 24564, 28799, -4797, -32092, -17232, 20264, 31140, 1110, -30378, -21963, 15303, 32466, 6981, -27675, -25978, 9843, 32733, 12624, -24068, -29146, 4062, 31933, 17856, -19677, -31363, -1851, 30092, 22506, -14645, -32558, -7704, 27270, 26421, -9135, -32692, -13305, 23559, 29475, -3327, -31760, -18473, 19079, 31569, 2589, -29792, -23039, 13978, 32633, 8421, -26853, -26853, 8421, 32633, 13978, -23039, -29792, 2589, 31569, 19079, -18473, -31760, -3327, 29475, 23559, -13305, -32692, -9135, 26421, 27270, -7704, -32558, -14645, 22506, 30092, -1851, -31363, -19677, 17856, 31933, 4062, -29146, -24068, 12624, 32733, 9843, -25978, -27675, 6981, 32466, 15303, -21963, -30378, 1110, 31140, 20264, -17232, -32092, -4797, 28799, 24564, -11939, -32759, -10548, 25519, 28063, -6257, -32358, -15955, 21406, 30647, -371, -30902, -20841, 16596, 32232, 5527, -28439, -25049, 11245}, -{32767, 12624, -23039, -30378, -371, 30092, 23559, -11939, -32759, -13305, 22506, 30647, 1110, -29792, -24068, 11245, 32733, 13978, -21963, -30902, -1851, 29475, 24564, -10548, -32692, -14645, 21406, 31140, 2589, -29146, -25049, 9843, 32633, 15303, -20841, -31363, -3327, 28799, 25519, -9135, -32558, -15955, 20264, 31569, 4062, -28439, -25978, 8421, 32466, 16596, -19677, -31760, -4797, 28063, 26421, -7704, -32358, -17232, 19079, 31933, 5527, -27675, -26853, 6981, 32232, 17856, -18473, -32092, -6257, 27270, 27270, -6257, -32092, -18473, 17856, 32232, 6981, -26853, -27675, 5527, 31933, 19079, -17232, -32358, -7704, 26421, 28063, -4797, -31760, -19677, 16596, 32466, 8421, -25978, -28439, 4062, 31569, 20264, -15955, -32558, -9135, 25519, 28799, -3327, -31363, -20841, 15303, 32633, 9843, -25049, -29146, 2589, 31140, 21406, -14645, -32692, -10548, 24564, 29475, -1851, -30902, -21963, 13978, 32733, 11245, -24068, -29792, 1110, 30647, 22506, -13305, -32759, -11939, 23559, 30092, -371, -30378, -23039, 12624}, -{32767, 13978, -20841, -31760, -6257, 26421, 28799, -1851, -30378, -24068, 9843, 32466, 17856, -17232, -32558, -10548, 23559, 30647, 2589, -28439, -26853, 5527, 31569, 21406, -13305, -32759, -14645, 20264, 31933, 6981, -25978, -29146, 1110, 30092, 24564, -9135, -32358, -18473, 16596, 32633, 11245, -23039, -30902, -3327, 28063, 27270, -4797, -31363, -21963, 12624, 32733, 15303, -19677, -32092, -7704, 25519, 29475, -371, -29792, -25049, 8421, 32232, 19079, -15955, -32692, -11939, 22506, 31140, 4062, -27675, -27675, 4062, 31140, 22506, -11939, -32692, -15955, 19079, 32232, 8421, -25049, -29792, -371, 29475, 25519, -7704, -32092, -19677, 15303, 32733, 12624, -21963, -31363, -4797, 27270, 28063, -3327, -30902, -23039, 11245, 32633, 16596, -18473, -32358, -9135, 24564, 30092, 1110, -29146, -25978, 6981, 31933, 20264, -14645, -32759, -13305, 21406, 31569, 5527, -26853, -28439, 2589, 30647, 23559, -10548, -32558, -17232, 17856, 32466, 9843, -24068, -30378, -1851, 28799, 26421, -6257, -31760, -20841, 13978}, -{32767, 15303, -18473, -32558, -11939, 21406, 31933, 8421, -24068, -30902, -4797, 26421, 29475, 1110, -28439, -27675, 2589, 30092, 25519, -6257, -31363, -23039, 9843, 32232, 20264, -13305, -32692, -17232, 16596, 32733, 13978, -19677, -32358, -10548, 22506, 31569, 6981, -25049, -30378, -3327, 27270, 28799, -371, -29146, -26853, 4062, 30647, 24564, -7704, -31760, -21963, 11245, 32466, 19079, -14645, -32759, -15955, 17856, 32633, 12624, -20841, -32092, -9135, 23559, 31140, 5527, -25978, -29792, -1851, 28063, 28063, -1851, -29792, -25978, 5527, 31140, 23559, -9135, -32092, -20841, 12624, 32633, 17856, -15955, -32759, -14645, 19079, 32466, 11245, -21963, -31760, -7704, 24564, 30647, 4062, -26853, -29146, -371, 28799, 27270, -3327, -30378, -25049, 6981, 31569, 22506, -10548, -32358, -19677, 13978, 32733, 16596, -17232, -32692, -13305, 20264, 32232, 9843, -23039, -31363, -6257, 25519, 30092, 2589, -27675, -28439, 1110, 29475, 26421, -4797, -30902, -24068, 8421, 31933, 21406, -11939, -32558, -18473, 15303}, -{32767, 16596, -15955, -32759, -17232, 15303, 32733, 17856, -14645, -32692, -18473, 13978, 32633, 19079, -13305, -32558, -19677, 12624, 32466, 20264, -11939, -32358, -20841, 11245, 32232, 21406, -10548, -32092, -21963, 9843, 31933, 22506, -9135, -31760, -23039, 8421, 31569, 23559, -7704, -31363, -24068, 6981, 31140, 24564, -6257, -30902, -25049, 5527, 30647, 25519, -4797, -30378, -25978, 4062, 30092, 26421, -3327, -29792, -26853, 2589, 29475, 27270, -1851, -29146, -27675, 1110, 28799, 28063, -371, -28439, -28439, -371, 28063, 28799, 1110, -27675, -29146, -1851, 27270, 29475, 2589, -26853, -29792, -3327, 26421, 30092, 4062, -25978, -30378, -4797, 25519, 30647, 5527, -25049, -30902, -6257, 24564, 31140, 6981, -24068, -31363, -7704, 23559, 31569, 8421, -23039, -31760, -9135, 22506, 31933, 9843, -21963, -32092, -10548, 21406, 32232, 11245, -20841, -32358, -11939, 20264, 32466, 12624, -19677, -32558, -13305, 19079, 32633, 13978, -18473, -32692, -14645, 17856, 32733, 15303, -17232, -32759, -15955, 16596}, -{32767, 17856, -13305, -32358, -21963, 8421, 31140, 25519, -3327, -29146, -28439, -1851, 26421, 30647, 6981, -23039, -32092, -11939, 19079, 32733, 16596, -14645, -32558, -20841, 9843, 31569, 24564, -4797, -29792, -27675, -371, 27270, 30092, 5527, -24068, -31760, -10548, 20264, 32633, 15303, -15955, -32692, -19677, 11245, 31933, 23559, -6257, -30378, -26853, 1110, 28063, 29475, 4062, -25049, -31363, -9135, 21406, 32466, 13978, -17232, -32759, -18473, 12624, 32232, 22506, -7704, -30902, -25978, 2589, 28799, 28799, 2589, -25978, -30902, -7704, 22506, 32232, 12624, -18473, -32759, -17232, 13978, 32466, 21406, -9135, -31363, -25049, 4062, 29475, 28063, 1110, -26853, -30378, -6257, 23559, 31933, 11245, -19677, -32692, -15955, 15303, 32633, 20264, -10548, -31760, -24068, 5527, 30092, 27270, -371, -27675, -29792, -4797, 24564, 31569, 9843, -20841, -32558, -14645, 16596, 32733, 19079, -11939, -32092, -23039, 6981, 30647, 26421, -1851, -28439, -29146, -3327, 25519, 31140, 8421, -21963, -32358, -13305, 17856}, -{32767, 19079, -10548, -31363, -25978, 1110, 27270, 30647, 8421, -20841, -32692, -17232, 12624, 31933, 24564, -3327, -28439, -29792, -6257, 22506, 32466, 15303, -14645, -32358, -23039, 5527, 29475, 28799, 4062, -24068, -32092, -13305, 16596, 32633, 21406, -7704, -30378, -27675, -1851, 25519, 31569, 11245, -18473, -32759, -19677, 9843, 31140, 26421, -371, -26853, -30902, -9135, 20264, 32733, 17856, -11939, -31760, -25049, 2589, 28063, 30092, 6981, -21963, -32558, -15955, 13978, 32232, 23559, -4797, -29146, -29146, -4797, 23559, 32232, 13978, -15955, -32558, -21963, 6981, 30092, 28063, 2589, -25049, -31760, -11939, 17856, 32733, 20264, -9135, -30902, -26853, -371, 26421, 31140, 9843, -19677, -32759, -18473, 11245, 31569, 25519, -1851, -27675, -30378, -7704, 21406, 32633, 16596, -13305, -32092, -24068, 4062, 28799, 29475, 5527, -23039, -32358, -14645, 15303, 32466, 22506, -6257, -29792, -28439, -3327, 24564, 31933, 12624, -17232, -32692, -20841, 8421, 30647, 27270, 1110, -25978, -31363, -10548, 19079}, -{32767, 20264, -7704, -29792, -29146, -6257, 21406, 32733, 19079, -9135, -30378, -28439, -4797, 22506, 32633, 17856, -10548, -30902, -27675, -3327, 23559, 32466, 16596, -11939, -31363, -26853, -1851, 24564, 32232, 15303, -13305, -31760, -25978, -371, 25519, 31933, 13978, -14645, -32092, -25049, 1110, 26421, 31569, 12624, -15955, -32358, -24068, 2589, 27270, 31140, 11245, -17232, -32558, -23039, 4062, 28063, 30647, 9843, -18473, -32692, -21963, 5527, 28799, 30092, 8421, -19677, -32759, -20841, 6981, 29475, 29475, 6981, -20841, -32759, -19677, 8421, 30092, 28799, 5527, -21963, -32692, -18473, 9843, 30647, 28063, 4062, -23039, -32558, -17232, 11245, 31140, 27270, 2589, -24068, -32358, -15955, 12624, 31569, 26421, 1110, -25049, -32092, -14645, 13978, 31933, 25519, -371, -25978, -31760, -13305, 15303, 32232, 24564, -1851, -26853, -31363, -11939, 16596, 32466, 23559, -3327, -27675, -30902, -10548, 17856, 32633, 22506, -4797, -28439, -30378, -9135, 19079, 32733, 21406, -6257, -29146, -29792, -7704, 20264}, -{32767, 21406, -4797, -27675, -31363, -13305, 13978, 31569, 27270, 4062, -21963, -32759, -20841, 5527, 28063, 31140, 12624, -14645, -31760, -26853, -3327, 22506, 32733, 20264, -6257, -28439, -30902, -11939, 15303, 31933, 26421, 2589, -23039, -32692, -19677, 6981, 28799, 30647, 11245, -15955, -32092, -25978, -1851, 23559, 32633, 19079, -7704, -29146, -30378, -10548, 16596, 32232, 25519, 1110, -24068, -32558, -18473, 8421, 29475, 30092, 9843, -17232, -32358, -25049, -371, 24564, 32466, 17856, -9135, -29792, -29792, -9135, 17856, 32466, 24564, -371, -25049, -32358, -17232, 9843, 30092, 29475, 8421, -18473, -32558, -24068, 1110, 25519, 32232, 16596, -10548, -30378, -29146, -7704, 19079, 32633, 23559, -1851, -25978, -32092, -15955, 11245, 30647, 28799, 6981, -19677, -32692, -23039, 2589, 26421, 31933, 15303, -11939, -30902, -28439, -6257, 20264, 32733, 22506, -3327, -26853, -31760, -14645, 12624, 31140, 28063, 5527, -20841, -32759, -21963, 4062, 27270, 31569, 13978, -13305, -31363, -27675, -4797, 21406}, -{32767, 22506, -1851, -25049, -32558, -19677, 5527, 27270, 31933, 16596, -9135, -29146, -30902, -13305, 12624, 30647, 29475, 9843, -15955, -31760, -27675, -6257, 19079, 32466, 25519, 2589, -21963, -32759, -23039, 1110, 24564, 32633, 20264, -4797, -26853, -32092, -17232, 8421, 28799, 31140, 13978, -11939, -30378, -29792, -10548, 15303, 31569, 28063, 6981, -18473, -32358, -25978, -3327, 21406, 32733, 23559, -371, -24068, -32692, -20841, 4062, 26421, 32232, 17856, -7704, -28439, -31363, -14645, 11245, 30092, 30092, 11245, -14645, -31363, -28439, -7704, 17856, 32232, 26421, 4062, -20841, -32692, -24068, -371, 23559, 32733, 21406, -3327, -25978, -32358, -18473, 6981, 28063, 31569, 15303, -10548, -29792, -30378, -11939, 13978, 31140, 28799, 8421, -17232, -32092, -26853, -4797, 20264, 32633, 24564, 1110, -23039, -32759, -21963, 2589, 25519, 32466, 19079, -6257, -27675, -31760, -15955, 9843, 29475, 30647, 12624, -13305, -30902, -29146, -9135, 16596, 31933, 27270, 5527, -19677, -32558, -25049, -1851, 22506}, -{32767, 23559, 1110, -21963, -32692, -25049, -3327, 20264, 32466, 26421, 5527, -18473, -32092, -27675, -7704, 16596, 31569, 28799, 9843, -14645, -30902, -29792, -11939, 12624, 30092, 30647, 13978, -10548, -29146, -31363, -15955, 8421, 28063, 31933, 17856, -6257, -26853, -32358, -19677, 4062, 25519, 32633, 21406, -1851, -24068, -32759, -23039, -371, 22506, 32733, 24564, 2589, -20841, -32558, -25978, -4797, 19079, 32232, 27270, 6981, -17232, -31760, -28439, -9135, 15303, 31140, 29475, 11245, -13305, -30378, -30378, -13305, 11245, 29475, 31140, 15303, -9135, -28439, -31760, -17232, 6981, 27270, 32232, 19079, -4797, -25978, -32558, -20841, 2589, 24564, 32733, 22506, -371, -23039, -32759, -24068, -1851, 21406, 32633, 25519, 4062, -19677, -32358, -26853, -6257, 17856, 31933, 28063, 8421, -15955, -31363, -29146, -10548, 13978, 30647, 30092, 12624, -11939, -29792, -30902, -14645, 9843, 28799, 31569, 16596, -7704, -27675, -32092, -18473, 5527, 26421, 32466, 20264, -3327, -25049, -32692, -21963, 1110, 23559}, -{32767, 24564, 4062, -18473, -31760, -29146, -11939, 11245, 28799, 31933, 19079, -3327, -24068, -32759, -25049, -4797, 17856, 31569, 29475, 12624, -10548, -28439, -32092, -19677, 2589, 23559, 32733, 25519, 5527, -17232, -31363, -29792, -13305, 9843, 28063, 32232, 20264, -1851, -23039, -32692, -25978, -6257, 16596, 31140, 30092, 13978, -9135, -27675, -32358, -20841, 1110, 22506, 32633, 26421, 6981, -15955, -30902, -30378, -14645, 8421, 27270, 32466, 21406, -371, -21963, -32558, -26853, -7704, 15303, 30647, 30647, 15303, -7704, -26853, -32558, -21963, -371, 21406, 32466, 27270, 8421, -14645, -30378, -30902, -15955, 6981, 26421, 32633, 22506, 1110, -20841, -32358, -27675, -9135, 13978, 30092, 31140, 16596, -6257, -25978, -32692, -23039, -1851, 20264, 32232, 28063, 9843, -13305, -29792, -31363, -17232, 5527, 25519, 32733, 23559, 2589, -19677, -32092, -28439, -10548, 12624, 29475, 31569, 17856, -4797, -25049, -32759, -24068, -3327, 19079, 31933, 28799, 11245, -11939, -29146, -31760, -18473, 4062, 24564}, -{32767, 25519, 6981, -14645, -29792, -31760, -19677, 1110, 21406, 32232, 28799, 12624, -9135, -26853, -32692, -24068, -4797, 16596, 30647, 31140, 17856, -3327, -23039, -32558, -27675, -10548, 11245, 28063, 32466, 22506, 2589, -18473, -31363, -30378, -15955, 5527, 24564, 32733, 26421, 8421, -13305, -29146, -32092, -20841, -371, 20264, 31933, 29475, 13978, -7704, -25978, -32759, -25049, -6257, 15303, 30092, 31569, 19079, -1851, -21963, -32358, -28439, -11939, 9843, 27270, 32633, 23559, 4062, -17232, -30902, -30902, -17232, 4062, 23559, 32633, 27270, 9843, -11939, -28439, -32358, -21963, -1851, 19079, 31569, 30092, 15303, -6257, -25049, -32759, -25978, -7704, 13978, 29475, 31933, 20264, -371, -20841, -32092, -29146, -13305, 8421, 26421, 32733, 24564, 5527, -15955, -30378, -31363, -18473, 2589, 22506, 32466, 28063, 11245, -10548, -27675, -32558, -23039, -3327, 17856, 31140, 30647, 16596, -4797, -24068, -32692, -26853, -9135, 12624, 28799, 32232, 21406, 1110, -19677, -31760, -29792, -14645, 6981, 25519}, -{32767, 26421, 9843, -10548, -26853, -32759, -25978, -9135, 11245, 27270, 32733, 25519, 8421, -11939, -27675, -32692, -25049, -7704, 12624, 28063, 32633, 24564, 6981, -13305, -28439, -32558, -24068, -6257, 13978, 28799, 32466, 23559, 5527, -14645, -29146, -32358, -23039, -4797, 15303, 29475, 32232, 22506, 4062, -15955, -29792, -32092, -21963, -3327, 16596, 30092, 31933, 21406, 2589, -17232, -30378, -31760, -20841, -1851, 17856, 30647, 31569, 20264, 1110, -18473, -30902, -31363, -19677, -371, 19079, 31140, 31140, 19079, -371, -19677, -31363, -30902, -18473, 1110, 20264, 31569, 30647, 17856, -1851, -20841, -31760, -30378, -17232, 2589, 21406, 31933, 30092, 16596, -3327, -21963, -32092, -29792, -15955, 4062, 22506, 32232, 29475, 15303, -4797, -23039, -32358, -29146, -14645, 5527, 23559, 32466, 28799, 13978, -6257, -24068, -32558, -28439, -13305, 6981, 24564, 32633, 28063, 12624, -7704, -25049, -32692, -27675, -11939, 8421, 25519, 32733, 27270, 11245, -9135, -25978, -32759, -26853, -10548, 9843, 26421}, -{32767, 27270, 12624, -6257, -23039, -32092, -30378, -18473, -371, 17856, 30092, 32232, 23559, 6981, -11939, -26853, -32759, -27675, -13305, 5527, 22506, 31933, 30647, 19079, 1110, -17232, -29792, -32358, -24068, -7704, 11245, 26421, 32733, 28063, 13978, -4797, -21963, -31760, -30902, -19677, -1851, 16596, 29475, 32466, 24564, 8421, -10548, -25978, -32692, -28439, -14645, 4062, 21406, 31569, 31140, 20264, 2589, -15955, -29146, -32558, -25049, -9135, 9843, 25519, 32633, 28799, 15303, -3327, -20841, -31363, -31363, -20841, -3327, 15303, 28799, 32633, 25519, 9843, -9135, -25049, -32558, -29146, -15955, 2589, 20264, 31140, 31569, 21406, 4062, -14645, -28439, -32692, -25978, -10548, 8421, 24564, 32466, 29475, 16596, -1851, -19677, -30902, -31760, -21963, -4797, 13978, 28063, 32733, 26421, 11245, -7704, -24068, -32358, -29792, -17232, 1110, 19079, 30647, 31933, 22506, 5527, -13305, -27675, -32759, -26853, -11939, 6981, 23559, 32232, 30092, 17856, -371, -18473, -30378, -32092, -23039, -6257, 12624, 27270}, -{32767, 28063, 15303, -1851, -18473, -29792, -32558, -25978, -11939, 5527, 21406, 31140, 31933, 23559, 8421, -9135, -24068, -32092, -30902, -20841, -4797, 12624, 26421, 32633, 29475, 17856, 1110, -15955, -28439, -32759, -27675, -14645, 2589, 19079, 30092, 32466, 25519, 11245, -6257, -21963, -31363, -31760, -23039, -7704, 9843, 24564, 32232, 30647, 20264, 4062, -13305, -26853, -32692, -29146, -17232, -371, 16596, 28799, 32733, 27270, 13978, -3327, -19677, -30378, -32358, -25049, -10548, 6981, 22506, 31569, 31569, 22506, 6981, -10548, -25049, -32358, -30378, -19677, -3327, 13978, 27270, 32733, 28799, 16596, -371, -17232, -29146, -32692, -26853, -13305, 4062, 20264, 30647, 32232, 24564, 9843, -7704, -23039, -31760, -31363, -21963, -6257, 11245, 25519, 32466, 30092, 19079, 2589, -14645, -27675, -32759, -28439, -15955, 1110, 17856, 29475, 32633, 26421, 12624, -4797, -20841, -30902, -32092, -24068, -9135, 8421, 23559, 31933, 31140, 21406, 5527, -11939, -25978, -32558, -29792, -18473, -1851, 15303, 28063}, -{32767, 28799, 17856, 2589, -13305, -25978, -32358, -30902, -21963, -7704, 8421, 22506, 31140, 32232, 25519, 12624, -3327, -18473, -29146, -32759, -28439, -17232, -1851, 13978, 26421, 32466, 30647, 21406, 6981, -9135, -23039, -31363, -32092, -25049, -11939, 4062, 19079, 29475, 32733, 28063, 16596, 1110, -14645, -26853, -32558, -30378, -20841, -6257, 9843, 23559, 31569, 31933, 24564, 11245, -4797, -19677, -29792, -32692, -27675, -15955, -371, 15303, 27270, 32633, 30092, 20264, 5527, -10548, -24068, -31760, -31760, -24068, -10548, 5527, 20264, 30092, 32633, 27270, 15303, -371, -15955, -27675, -32692, -29792, -19677, -4797, 11245, 24564, 31933, 31569, 23559, 9843, -6257, -20841, -30378, -32558, -26853, -14645, 1110, 16596, 28063, 32733, 29475, 19079, 4062, -11939, -25049, -32092, -31363, -23039, -9135, 6981, 21406, 30647, 32466, 26421, 13978, -1851, -17232, -28439, -32759, -29146, -18473, -3327, 12624, 25519, 32232, 31140, 22506, 8421, -7704, -21963, -30902, -32358, -25978, -13305, 2589, 17856, 28799}, -{32767, 29475, 20264, 6981, -7704, -20841, -29792, -32759, -29146, -19677, -6257, 8421, 21406, 30092, 32733, 28799, 19079, 5527, -9135, -21963, -30378, -32692, -28439, -18473, -4797, 9843, 22506, 30647, 32633, 28063, 17856, 4062, -10548, -23039, -30902, -32558, -27675, -17232, -3327, 11245, 23559, 31140, 32466, 27270, 16596, 2589, -11939, -24068, -31363, -32358, -26853, -15955, -1851, 12624, 24564, 31569, 32232, 26421, 15303, 1110, -13305, -25049, -31760, -32092, -25978, -14645, -371, 13978, 25519, 31933, 31933, 25519, 13978, -371, -14645, -25978, -32092, -31760, -25049, -13305, 1110, 15303, 26421, 32232, 31569, 24564, 12624, -1851, -15955, -26853, -32358, -31363, -24068, -11939, 2589, 16596, 27270, 32466, 31140, 23559, 11245, -3327, -17232, -27675, -32558, -30902, -23039, -10548, 4062, 17856, 28063, 32633, 30647, 22506, 9843, -4797, -18473, -28439, -32692, -30378, -21963, -9135, 5527, 19079, 28799, 32733, 30092, 21406, 8421, -6257, -19677, -29146, -32759, -29792, -20841, -7704, 6981, 20264, 29475}, -{32767, 30092, 22506, 11245, -1851, -14645, -25049, -31363, -32558, -28439, -19677, -7704, 5527, 17856, 27270, 32232, 31933, 26421, 16596, 4062, -9135, -20841, -29146, -32692, -30902, -24068, -13305, -371, 12624, 23559, 30647, 32733, 29475, 21406, 9843, -3327, -15955, -25978, -31760, -32358, -27675, -18473, -6257, 6981, 19079, 28063, 32466, 31569, 25519, 15303, 2589, -10548, -21963, -29792, -32759, -30378, -23039, -11939, 1110, 13978, 24564, 31140, 32633, 28799, 20264, 8421, -4797, -17232, -26853, -32092, -32092, -26853, -17232, -4797, 8421, 20264, 28799, 32633, 31140, 24564, 13978, 1110, -11939, -23039, -30378, -32759, -29792, -21963, -10548, 2589, 15303, 25519, 31569, 32466, 28063, 19079, 6981, -6257, -18473, -27675, -32358, -31760, -25978, -15955, -3327, 9843, 21406, 29475, 32733, 30647, 23559, 12624, -371, -13305, -24068, -30902, -32692, -29146, -20841, -9135, 4062, 16596, 26421, 31933, 32232, 27270, 17856, 5527, -7704, -19677, -28439, -32558, -31363, -25049, -14645, -1851, 11245, 22506, 30092}, -{32767, 30647, 24564, 15303, 4062, -7704, -18473, -26853, -31760, -32558, -29146, -21963, -11939, -371, 11245, 21406, 28799, 32466, 31933, 27270, 19079, 8421, -3327, -14645, -24068, -30378, -32759, -30902, -25049, -15955, -4797, 6981, 17856, 26421, 31569, 32633, 29475, 22506, 12624, 1110, -10548, -20841, -28439, -32358, -32092, -27675, -19677, -9135, 2589, 13978, 23559, 30092, 32733, 31140, 25519, 16596, 5527, -6257, -17232, -25978, -31363, -32692, -29792, -23039, -13305, -1851, 9843, 20264, 28063, 32232, 32232, 28063, 20264, 9843, -1851, -13305, -23039, -29792, -32692, -31363, -25978, -17232, -6257, 5527, 16596, 25519, 31140, 32733, 30092, 23559, 13978, 2589, -9135, -19677, -27675, -32092, -32358, -28439, -20841, -10548, 1110, 12624, 22506, 29475, 32633, 31569, 26421, 17856, 6981, -4797, -15955, -25049, -30902, -32759, -30378, -24068, -14645, -3327, 8421, 19079, 27270, 31933, 32466, 28799, 21406, 11245, -371, -11939, -21963, -29146, -32558, -31760, -26853, -18473, -7704, 4062, 15303, 24564, 30647}, -{32767, 31140, 26421, 19079, 9843, -371, -10548, -19677, -26853, -31363, -32759, -30902, -25978, -18473, -9135, 1110, 11245, 20264, 27270, 31569, 32733, 30647, 25519, 17856, 8421, -1851, -11939, -20841, -27675, -31760, -32692, -30378, -25049, -17232, -7704, 2589, 12624, 21406, 28063, 31933, 32633, 30092, 24564, 16596, 6981, -3327, -13305, -21963, -28439, -32092, -32558, -29792, -24068, -15955, -6257, 4062, 13978, 22506, 28799, 32232, 32466, 29475, 23559, 15303, 5527, -4797, -14645, -23039, -29146, -32358, -32358, -29146, -23039, -14645, -4797, 5527, 15303, 23559, 29475, 32466, 32232, 28799, 22506, 13978, 4062, -6257, -15955, -24068, -29792, -32558, -32092, -28439, -21963, -13305, -3327, 6981, 16596, 24564, 30092, 32633, 31933, 28063, 21406, 12624, 2589, -7704, -17232, -25049, -30378, -32692, -31760, -27675, -20841, -11939, -1851, 8421, 17856, 25519, 30647, 32733, 31569, 27270, 20264, 11245, 1110, -9135, -18473, -25978, -30902, -32759, -31363, -26853, -19677, -10548, -371, 9843, 19079, 26421, 31140}, -{32767, 31569, 28063, 22506, 15303, 6981, -1851, -10548, -18473, -25049, -29792, -32358, -32558, -30378, -25978, -19677, -11939, -3327, 5527, 13978, 21406, 27270, 31140, 32733, 31933, 28799, 23559, 16596, 8421, -371, -9135, -17232, -24068, -29146, -32092, -32692, -30902, -26853, -20841, -13305, -4797, 4062, 12624, 20264, 26421, 30647, 32633, 32232, 29475, 24564, 17856, 9843, 1110, -7704, -15955, -23039, -28439, -31760, -32759, -31363, -27675, -21963, -14645, -6257, 2589, 11245, 19079, 25519, 30092, 32466, 32466, 30092, 25519, 19079, 11245, 2589, -6257, -14645, -21963, -27675, -31363, -32759, -31760, -28439, -23039, -15955, -7704, 1110, 9843, 17856, 24564, 29475, 32232, 32633, 30647, 26421, 20264, 12624, 4062, -4797, -13305, -20841, -26853, -30902, -32692, -32092, -29146, -24068, -17232, -9135, -371, 8421, 16596, 23559, 28799, 31933, 32733, 31140, 27270, 21406, 13978, 5527, -3327, -11939, -19677, -25978, -30378, -32558, -32358, -29792, -25049, -18473, -10548, -1851, 6981, 15303, 22506, 28063, 31569}, -{32767, 31933, 29475, 25519, 20264, 13978, 6981, -371, -7704, -14645, -20841, -25978, -29792, -32092, -32759, -31760, -29146, -25049, -19677, -13305, -6257, 1110, 8421, 15303, 21406, 26421, 30092, 32232, 32733, 31569, 28799, 24564, 19079, 12624, 5527, -1851, -9135, -15955, -21963, -26853, -30378, -32358, -32692, -31363, -28439, -24068, -18473, -11939, -4797, 2589, 9843, 16596, 22506, 27270, 30647, 32466, 32633, 31140, 28063, 23559, 17856, 11245, 4062, -3327, -10548, -17232, -23039, -27675, -30902, -32558, -32558, -30902, -27675, -23039, -17232, -10548, -3327, 4062, 11245, 17856, 23559, 28063, 31140, 32633, 32466, 30647, 27270, 22506, 16596, 9843, 2589, -4797, -11939, -18473, -24068, -28439, -31363, -32692, -32358, -30378, -26853, -21963, -15955, -9135, -1851, 5527, 12624, 19079, 24564, 28799, 31569, 32733, 32232, 30092, 26421, 21406, 15303, 8421, 1110, -6257, -13305, -19677, -25049, -29146, -31760, -32759, -32092, -29792, -25978, -20841, -14645, -7704, -371, 6981, 13978, 20264, 25519, 29475, 31933}, -{32767, 32232, 30647, 28063, 24564, 20264, 15303, 9843, 4062, -1851, -7704, -13305, -18473, -23039, -26853, -29792, -31760, -32692, -32558, -31363, -29146, -25978, -21963, -17232, -11939, -6257, -371, 5527, 11245, 16596, 21406, 25519, 28799, 31140, 32466, 32733, 31933, 30092, 27270, 23559, 19079, 13978, 8421, 2589, -3327, -9135, -14645, -19677, -24068, -27675, -30378, -32092, -32759, -32358, -30902, -28439, -25049, -20841, -15955, -10548, -4797, 1110, 6981, 12624, 17856, 22506, 26421, 29475, 31569, 32633, 32633, 31569, 29475, 26421, 22506, 17856, 12624, 6981, 1110, -4797, -10548, -15955, -20841, -25049, -28439, -30902, -32358, -32759, -32092, -30378, -27675, -24068, -19677, -14645, -9135, -3327, 2589, 8421, 13978, 19079, 23559, 27270, 30092, 31933, 32733, 32466, 31140, 28799, 25519, 21406, 16596, 11245, 5527, -371, -6257, -11939, -17232, -21963, -25978, -29146, -31363, -32558, -32692, -31760, -29792, -26853, -23039, -18473, -13305, -7704, -1851, 4062, 9843, 15303, 20264, 24564, 28063, 30647, 32232}, -{32767, 32466, 31569, 30092, 28063, 25519, 22506, 19079, 15303, 11245, 6981, 2589, -1851, -6257, -10548, -14645, -18473, -21963, -25049, -27675, -29792, -31363, -32358, -32759, -32558, -31760, -30378, -28439, -25978, -23039, -19677, -15955, -11939, -7704, -3327, 1110, 5527, 9843, 13978, 17856, 21406, 24564, 27270, 29475, 31140, 32232, 32733, 32633, 31933, 30647, 28799, 26421, 23559, 20264, 16596, 12624, 8421, 4062, -371, -4797, -9135, -13305, -17232, -20841, -24068, -26853, -29146, -30902, -32092, -32692, -32692, -32092, -30902, -29146, -26853, -24068, -20841, -17232, -13305, -9135, -4797, -371, 4062, 8421, 12624, 16596, 20264, 23559, 26421, 28799, 30647, 31933, 32633, 32733, 32232, 31140, 29475, 27270, 24564, 21406, 17856, 13978, 9843, 5527, 1110, -3327, -7704, -11939, -15955, -19677, -23039, -25978, -28439, -30378, -31760, -32558, -32759, -32358, -31363, -29792, -27675, -25049, -21963, -18473, -14645, -10548, -6257, -1851, 2589, 6981, 11245, 15303, 19079, 22506, 25519, 28063, 30092, 31569, 32466}, -{32767, 32633, 32232, 31569, 30647, 29475, 28063, 26421, 24564, 22506, 20264, 17856, 15303, 12624, 9843, 6981, 4062, 1110, -1851, -4797, -7704, -10548, -13305, -15955, -18473, -20841, -23039, -25049, -26853, -28439, -29792, -30902, -31760, -32358, -32692, -32759, -32558, -32092, -31363, -30378, -29146, -27675, -25978, -24068, -21963, -19677, -17232, -14645, -11939, -9135, -6257, -3327, -371, 2589, 5527, 8421, 11245, 13978, 16596, 19079, 21406, 23559, 25519, 27270, 28799, 30092, 31140, 31933, 32466, 32733, 32733, 32466, 31933, 31140, 30092, 28799, 27270, 25519, 23559, 21406, 19079, 16596, 13978, 11245, 8421, 5527, 2589, -371, -3327, -6257, -9135, -11939, -14645, -17232, -19677, -21963, -24068, -25978, -27675, -29146, -30378, -31363, -32092, -32558, -32759, -32692, -32358, -31760, -30902, -29792, -28439, -26853, -25049, -23039, -20841, -18473, -15955, -13305, -10548, -7704, -4797, -1851, 1110, 4062, 6981, 9843, 12624, 15303, 17856, 20264, 22506, 24564, 26421, 28063, 29475, 30647, 31569, 32232, 32633}, -{32767, 32733, 32633, 32466, 32232, 31933, 31569, 31140, 30647, 30092, 29475, 28799, 28063, 27270, 26421, 25519, 24564, 23559, 22506, 21406, 20264, 19079, 17856, 16596, 15303, 13978, 12624, 11245, 9843, 8421, 6981, 5527, 4062, 2589, 1110, -371, -1851, -3327, -4797, -6257, -7704, -9135, -10548, -11939, -13305, -14645, -15955, -17232, -18473, -19677, -20841, -21963, -23039, -24068, -25049, -25978, -26853, -27675, -28439, -29146, -29792, -30378, -30902, -31363, -31760, -32092, -32358, -32558, -32692, -32759, -32759, -32692, -32558, -32358, -32092, -31760, -31363, -30902, -30378, -29792, -29146, -28439, -27675, -26853, -25978, -25049, -24068, -23039, -21963, -20841, -19677, -18473, -17232, -15955, -14645, -13305, -11939, -10548, -9135, -7704, -6257, -4797, -3327, -1851, -371, 1110, 2589, 4062, 5527, 6981, 8421, 9843, 11245, 12624, 13978, 15303, 16596, 17856, 19079, 20264, 21406, 22506, 23559, 24564, 25519, 26421, 27270, 28063, 28799, 29475, 30092, 30647, 31140, 31569, 31933, 32232, 32466, 32633, 32733} -}; - - -int16_t prach_fft139_im[139][139] = { -{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, -{0, -1481, -2959, -4430, -5893, -7343, -8779, -10196, -11593, -12966, -14313, -15630, -16916, -18166, -19380, -20554, -21686, -22774, -23816, -24808, -25750, -26640, -27474, -28253, -28974, -29636, -30238, -30777, -31254, -31667, -32015, -32298, -32515, -32665, -32749, -32765, -32715, -32598, -32415, -32165, -31849, -31469, -31024, -30515, -29945, -29313, -28621, -27871, -27064, -26202, -25286, -24318, -23301, -22236, -21126, -19972, -18778, -17545, -16277, -14975, -13643, -12283, -10898, -9490, -8063, -6620, -5163, -3696, -2221, -741, 740, 2220, 3695, 5162, 6619, 8062, 9489, 10897, 12282, 13642, 14974, 16276, 17544, 18777, 19971, 21125, 22235, 23300, 24317, 25285, 26201, 27063, 27870, 28620, 29312, 29944, 30514, 31023, 31468, 31848, 32164, 32414, 32597, 32714, 32764, 32748, 32664, 32514, 32297, 32014, 31666, 31253, 30776, 30237, 29635, 28973, 28252, 27473, 26639, 25749, 24807, 23815, 22773, 21685, 20553, 19379, 18165, 16915, 15629, 14312, 12965, 11592, 10195, 8778, 7342, 5892, 4429, 2958, 1480}, -{0, -2959, -5893, -8779, -11593, -14313, -16916, -19380, -21686, -23816, -25750, -27474, -28974, -30238, -31254, -32015, -32515, -32749, -32715, -32415, -31849, -31024, -29945, -28621, -27064, -25286, -23301, -21126, -18778, -16277, -13643, -10898, -8063, -5163, -2221, 740, 3695, 6619, 9489, 12282, 14974, 17544, 19971, 22235, 24317, 26201, 27870, 29312, 30514, 31468, 32164, 32597, 32764, 32664, 32297, 31666, 30776, 29635, 28252, 26639, 24807, 22773, 20553, 18165, 15629, 12965, 10195, 7342, 4429, 1480, -1481, -4430, -7343, -10196, -12966, -15630, -18166, -20554, -22774, -24808, -26640, -28253, -29636, -30777, -31667, -32298, -32665, -32765, -32598, -32165, -31469, -30515, -29313, -27871, -26202, -24318, -22236, -19972, -17545, -14975, -12283, -9490, -6620, -3696, -741, 2220, 5162, 8062, 10897, 13642, 16276, 18777, 21125, 23300, 25285, 27063, 28620, 29944, 31023, 31848, 32414, 32714, 32748, 32514, 32014, 31253, 30237, 28973, 27473, 25749, 23815, 21685, 19379, 16915, 14312, 11592, 8778, 5892, 2958}, -{0, -4430, -8779, -12966, -16916, -20554, -23816, -26640, -28974, -30777, -32015, -32665, -32715, -32165, -31024, -29313, -27064, -24318, -21126, -17545, -13643, -9490, -5163, -741, 3695, 8062, 12282, 16276, 19971, 23300, 26201, 28620, 30514, 31848, 32597, 32748, 32297, 31253, 29635, 27473, 24807, 21685, 18165, 14312, 10195, 5892, 1480, -2959, -7343, -11593, -15630, -19380, -22774, -25750, -28253, -30238, -31667, -32515, -32765, -32415, -31469, -29945, -27871, -25286, -22236, -18778, -14975, -10898, -6620, -2221, 2220, 6619, 10897, 14974, 18777, 22235, 25285, 27870, 29944, 31468, 32414, 32764, 32514, 31666, 30237, 28252, 25749, 22773, 19379, 15629, 11592, 7342, 2958, -1481, -5893, -10196, -14313, -18166, -21686, -24808, -27474, -29636, -31254, -32298, -32749, -32598, -31849, -30515, -28621, -26202, -23301, -19972, -16277, -12283, -8063, -3696, 740, 5162, 9489, 13642, 17544, 21125, 24317, 27063, 29312, 31023, 32164, 32714, 32664, 32014, 30776, 28973, 26639, 23815, 20553, 16915, 12965, 8778, 4429}, -{0, -5893, -11593, -16916, -21686, -25750, -28974, -31254, -32515, -32715, -31849, -29945, -27064, -23301, -18778, -13643, -8063, -2221, 3695, 9489, 14974, 19971, 24317, 27870, 30514, 32164, 32764, 32297, 30776, 28252, 24807, 20553, 15629, 10195, 4429, -1481, -7343, -12966, -18166, -22774, -26640, -29636, -31667, -32665, -32598, -31469, -29313, -26202, -22236, -17545, -12283, -6620, -741, 5162, 10897, 16276, 21125, 25285, 28620, 31023, 32414, 32748, 32014, 30237, 27473, 23815, 19379, 14312, 8778, 2958, -2959, -8779, -14313, -19380, -23816, -27474, -30238, -32015, -32749, -32415, -31024, -28621, -25286, -21126, -16277, -10898, -5163, 740, 6619, 12282, 17544, 22235, 26201, 29312, 31468, 32597, 32664, 31666, 29635, 26639, 22773, 18165, 12965, 7342, 1480, -4430, -10196, -15630, -20554, -24808, -28253, -30777, -32298, -32765, -32165, -30515, -27871, -24318, -19972, -14975, -9490, -3696, 2220, 8062, 13642, 18777, 23300, 27063, 29944, 31848, 32714, 32514, 31253, 28973, 25749, 21685, 16915, 11592, 5892}, -{0, -7343, -14313, -20554, -25750, -29636, -32015, -32765, -31849, -29313, -25286, -19972, -13643, -6620, 740, 8062, 14974, 21125, 26201, 29944, 32164, 32748, 31666, 28973, 24807, 19379, 12965, 5892, -1481, -8779, -15630, -21686, -26640, -30238, -32298, -32715, -31469, -28621, -24318, -18778, -12283, -5163, 2220, 9489, 16276, 22235, 27063, 30514, 32414, 32664, 31253, 28252, 23815, 18165, 11592, 4429, -2959, -10196, -16916, -22774, -27474, -30777, -32515, -32598, -31024, -27871, -23301, -17545, -10898, -3696, 3695, 10897, 17544, 23300, 27870, 31023, 32597, 32514, 30776, 27473, 22773, 16915, 10195, 2958, -4430, -11593, -18166, -23816, -28253, -31254, -32665, -32415, -30515, -27064, -22236, -16277, -9490, -2221, 5162, 12282, 18777, 24317, 28620, 31468, 32714, 32297, 30237, 26639, 21685, 15629, 8778, 1480, -5893, -12966, -19380, -24808, -28974, -31667, -32749, -32165, -29945, -26202, -21126, -14975, -8063, -741, 6619, 13642, 19971, 25285, 29312, 31848, 32764, 32014, 29635, 25749, 20553, 14312, 7342}, -{0, -8779, -16916, -23816, -28974, -32015, -32715, -31024, -27064, -21126, -13643, -5163, 3695, 12282, 19971, 26201, 30514, 32597, 32297, 29635, 24807, 18165, 10195, 1480, -7343, -15630, -22774, -28253, -31667, -32765, -31469, -27871, -22236, -14975, -6620, 2220, 10897, 18777, 25285, 29944, 32414, 32514, 30237, 25749, 19379, 11592, 2958, -5893, -14313, -21686, -27474, -31254, -32749, -31849, -28621, -23301, -16277, -8063, 740, 9489, 17544, 24317, 29312, 32164, 32664, 30776, 26639, 20553, 12965, 4429, -4430, -12966, -20554, -26640, -30777, -32665, -32165, -29313, -24318, -17545, -9490, -741, 8062, 16276, 23300, 28620, 31848, 32748, 31253, 27473, 21685, 14312, 5892, -2959, -11593, -19380, -25750, -30238, -32515, -32415, -29945, -25286, -18778, -10898, -2221, 6619, 14974, 22235, 27870, 31468, 32764, 31666, 28252, 22773, 15629, 7342, -1481, -10196, -18166, -24808, -29636, -32298, -32598, -30515, -26202, -19972, -12283, -3696, 5162, 13642, 21125, 27063, 31023, 32714, 32014, 28973, 23815, 16915, 8778}, -{0, -10196, -19380, -26640, -31254, -32765, -31024, -26202, -18778, -9490, 740, 10897, 19971, 27063, 31468, 32748, 30776, 25749, 18165, 8778, -1481, -11593, -20554, -27474, -31667, -32715, -30515, -25286, -17545, -8063, 2220, 12282, 21125, 27870, 31848, 32664, 30237, 24807, 16915, 7342, -2959, -12966, -21686, -28253, -32015, -32598, -29945, -24318, -16277, -6620, 3695, 13642, 22235, 28620, 32164, 32514, 29635, 23815, 15629, 5892, -4430, -14313, -22774, -28974, -32298, -32415, -29313, -23301, -14975, -5163, 5162, 14974, 23300, 29312, 32414, 32297, 28973, 22773, 14312, 4429, -5893, -15630, -23816, -29636, -32515, -32165, -28621, -22236, -13643, -3696, 6619, 16276, 24317, 29944, 32597, 32014, 28252, 21685, 12965, 2958, -7343, -16916, -24808, -30238, -32665, -31849, -27871, -21126, -12283, -2221, 8062, 17544, 25285, 30514, 32714, 31666, 27473, 20553, 11592, 1480, -8779, -18166, -25750, -30777, -32749, -31469, -27064, -19972, -10898, -741, 9489, 18777, 26201, 31023, 32764, 31253, 26639, 19379, 10195}, -{0, -11593, -21686, -28974, -32515, -31849, -27064, -18778, -8063, 3695, 14974, 24317, 30514, 32764, 30776, 24807, 15629, 4429, -7343, -18166, -26640, -31667, -32598, -29313, -22236, -12283, -741, 10897, 21125, 28620, 32414, 32014, 27473, 19379, 8778, -2959, -14313, -23816, -30238, -32749, -31024, -25286, -16277, -5163, 6619, 17544, 26201, 31468, 32664, 29635, 22773, 12965, 1480, -10196, -20554, -28253, -32298, -32165, -27871, -19972, -9490, 2220, 13642, 23300, 29944, 32714, 31253, 25749, 16915, 5892, -5893, -16916, -25750, -31254, -32715, -29945, -23301, -13643, -2221, 9489, 19971, 27870, 32164, 32297, 28252, 20553, 10195, -1481, -12966, -22774, -29636, -32665, -31469, -26202, -17545, -6620, 5162, 16276, 25285, 31023, 32748, 30237, 23815, 14312, 2958, -8779, -19380, -27474, -32015, -32415, -28621, -21126, -10898, 740, 12282, 22235, 29312, 32597, 31666, 26639, 18165, 7342, -4430, -15630, -24808, -30777, -32765, -30515, -24318, -14975, -3696, 8062, 18777, 27063, 31848, 32514, 28973, 21685, 11592}, -{0, -12966, -23816, -30777, -32715, -29313, -21126, -9490, 3695, 16276, 26201, 31848, 32297, 27473, 18165, 5892, -7343, -19380, -28253, -32515, -31469, -25286, -14975, -2221, 10897, 22235, 29944, 32764, 30237, 22773, 11592, -1481, -14313, -24808, -31254, -32598, -28621, -19972, -8063, 5162, 17544, 27063, 32164, 32014, 26639, 16915, 4429, -8779, -20554, -28974, -32665, -31024, -24318, -13643, -741, 12282, 23300, 30514, 32748, 29635, 21685, 10195, -2959, -15630, -25750, -31667, -32415, -27871, -18778, -6620, 6619, 18777, 27870, 32414, 31666, 25749, 15629, 2958, -10196, -21686, -29636, -32749, -30515, -23301, -12283, 740, 13642, 24317, 31023, 32664, 28973, 20553, 8778, -4430, -16916, -26640, -32015, -32165, -27064, -17545, -5163, 8062, 19971, 28620, 32597, 31253, 24807, 14312, 1480, -11593, -22774, -30238, -32765, -29945, -22236, -10898, 2220, 14974, 25285, 31468, 32514, 28252, 19379, 7342, -5893, -18166, -27474, -32298, -31849, -26202, -16277, -3696, 9489, 21125, 29312, 32714, 30776, 23815, 12965}, -{0, -14313, -25750, -32015, -31849, -25286, -13643, 740, 14974, 26201, 32164, 31666, 24807, 12965, -1481, -15630, -26640, -32298, -31469, -24318, -12283, 2220, 16276, 27063, 32414, 31253, 23815, 11592, -2959, -16916, -27474, -32515, -31024, -23301, -10898, 3695, 17544, 27870, 32597, 30776, 22773, 10195, -4430, -18166, -28253, -32665, -30515, -22236, -9490, 5162, 18777, 28620, 32714, 30237, 21685, 8778, -5893, -19380, -28974, -32749, -29945, -21126, -8063, 6619, 19971, 29312, 32764, 29635, 20553, 7342, -7343, -20554, -29636, -32765, -29313, -19972, -6620, 8062, 21125, 29944, 32748, 28973, 19379, 5892, -8779, -21686, -30238, -32715, -28621, -18778, -5163, 9489, 22235, 30514, 32664, 28252, 18165, 4429, -10196, -22774, -30777, -32598, -27871, -17545, -3696, 10897, 23300, 31023, 32514, 27473, 16915, 2958, -11593, -23816, -31254, -32415, -27064, -16277, -2221, 12282, 24317, 31468, 32297, 26639, 15629, 1480, -12966, -24808, -31667, -32165, -26202, -14975, -741, 13642, 25285, 31848, 32014, 25749, 14312}, -{0, -15630, -27474, -32665, -29945, -19972, -5163, 10897, 24317, 31848, 31666, 23815, 10195, -5893, -20554, -30238, -32598, -27064, -14975, 740, 16276, 27870, 32714, 29635, 19379, 4429, -11593, -24808, -32015, -31469, -23301, -9490, 6619, 21125, 30514, 32514, 26639, 14312, -1481, -16916, -28253, -32749, -29313, -18778, -3696, 12282, 25285, 32164, 31253, 22773, 8778, -7343, -21686, -30777, -32415, -26202, -13643, 2220, 17544, 28620, 32764, 28973, 18165, 2958, -12966, -25750, -32298, -31024, -22236, -8063, 8062, 22235, 31023, 32297, 25749, 12965, -2959, -18166, -28974, -32765, -28621, -17545, -2221, 13642, 26201, 32414, 30776, 21685, 7342, -8779, -22774, -31254, -32165, -25286, -12283, 3695, 18777, 29312, 32748, 28252, 16915, 1480, -14313, -26640, -32515, -30515, -21126, -6620, 9489, 23300, 31468, 32014, 24807, 11592, -4430, -19380, -29636, -32715, -27871, -16277, -741, 14974, 27063, 32597, 30237, 20553, 5892, -10196, -23816, -31667, -31849, -24318, -10898, 5162, 19971, 29944, 32664, 27473, 15629}, -{0, -16916, -28974, -32715, -27064, -13643, 3695, 19971, 30514, 32297, 24807, 10195, -7343, -22774, -31667, -31469, -22236, -6620, 10897, 25285, 32414, 30237, 19379, 2958, -14313, -27474, -32749, -28621, -16277, 740, 17544, 29312, 32664, 26639, 12965, -4430, -20554, -30777, -32165, -24318, -9490, 8062, 23300, 31848, 31253, 21685, 5892, -11593, -25750, -32515, -29945, -18778, -2221, 14974, 27870, 32764, 28252, 15629, -1481, -18166, -29636, -32598, -26202, -12283, 5162, 21125, 31023, 32014, 23815, 8778, -8779, -23816, -32015, -31024, -21126, -5163, 12282, 26201, 32597, 29635, 18165, 1480, -15630, -28253, -32765, -27871, -14975, 2220, 18777, 29944, 32514, 25749, 11592, -5893, -21686, -31254, -31849, -23301, -8063, 9489, 24317, 32164, 30776, 20553, 4429, -12966, -26640, -32665, -29313, -17545, -741, 16276, 28620, 32748, 27473, 14312, -2959, -19380, -30238, -32415, -25286, -10898, 6619, 22235, 31468, 31666, 22773, 7342, -10196, -24808, -32298, -30515, -19972, -3696, 13642, 27063, 32714, 28973, 16915}, -{0, -18166, -30238, -32165, -23301, -6620, 12282, 27063, 32764, 27473, 12965, -5893, -22774, -32015, -30515, -18778, -741, 17544, 29944, 32297, 23815, 7342, -11593, -26640, -32749, -27871, -13643, 5162, 22235, 31848, 30776, 19379, 1480, -16916, -29636, -32415, -24318, -8063, 10897, 26201, 32714, 28252, 14312, -4430, -21686, -31667, -31024, -19972, -2221, 16276, 29312, 32514, 24807, 8778, -10196, -25750, -32665, -28621, -14975, 3695, 21125, 31468, 31253, 20553, 2958, -15630, -28974, -32598, -25286, -9490, 9489, 25285, 32597, 28973, 15629, -2959, -20554, -31254, -31469, -21126, -3696, 14974, 28620, 32664, 25749, 10195, -8779, -24808, -32515, -29313, -16277, 2220, 19971, 31023, 31666, 21685, 4429, -14313, -28253, -32715, -26202, -10898, 8062, 24317, 32414, 29635, 16915, -1481, -19380, -30777, -31849, -22236, -5163, 13642, 27870, 32748, 26639, 11592, -7343, -23816, -32298, -29945, -17545, 740, 18777, 30514, 32014, 22773, 5892, -12966, -27474, -32765, -27064, -12283, 6619, 23300, 32164, 30237, 18165}, -{0, -19380, -31254, -31024, -18778, 740, 19971, 31468, 30776, 18165, -1481, -20554, -31667, -30515, -17545, 2220, 21125, 31848, 30237, 16915, -2959, -21686, -32015, -29945, -16277, 3695, 22235, 32164, 29635, 15629, -4430, -22774, -32298, -29313, -14975, 5162, 23300, 32414, 28973, 14312, -5893, -23816, -32515, -28621, -13643, 6619, 24317, 32597, 28252, 12965, -7343, -24808, -32665, -27871, -12283, 8062, 25285, 32714, 27473, 11592, -8779, -25750, -32749, -27064, -10898, 9489, 26201, 32764, 26639, 10195, -10196, -26640, -32765, -26202, -9490, 10897, 27063, 32748, 25749, 8778, -11593, -27474, -32715, -25286, -8063, 12282, 27870, 32664, 24807, 7342, -12966, -28253, -32598, -24318, -6620, 13642, 28620, 32514, 23815, 5892, -14313, -28974, -32415, -23301, -5163, 14974, 29312, 32297, 22773, 4429, -15630, -29636, -32165, -22236, -3696, 16276, 29944, 32014, 21685, 2958, -16916, -30238, -31849, -21126, -2221, 17544, 30514, 31666, 20553, 1480, -18166, -30777, -31469, -19972, -741, 18777, 31023, 31253, 19379}, -{0, -20554, -32015, -29313, -13643, 8062, 26201, 32748, 24807, 5892, -15630, -30238, -31469, -18778, 2220, 22235, 32414, 28252, 11592, -10196, -27474, -32598, -23301, -3696, 17544, 31023, 30776, 16915, -4430, -23816, -32665, -27064, -9490, 12282, 28620, 32297, 21685, 1480, -19380, -31667, -29945, -14975, 6619, 25285, 32764, 25749, 7342, -14313, -29636, -31849, -19972, 740, 21125, 32164, 28973, 12965, -8779, -26640, -32715, -24318, -5163, 16276, 30514, 31253, 18165, -2959, -22774, -32515, -27871, -10898, 10897, 27870, 32514, 22773, 2958, -18166, -31254, -30515, -16277, 5162, 24317, 32714, 26639, 8778, -12966, -28974, -32165, -21126, -741, 19971, 31848, 29635, 14312, -7343, -25750, -32765, -25286, -6620, 14974, 29944, 31666, 19379, -1481, -21686, -32298, -28621, -12283, 9489, 27063, 32664, 23815, 4429, -16916, -30777, -31024, -17545, 3695, 23300, 32597, 27473, 10195, -11593, -28253, -32415, -22236, -2221, 18777, 31468, 30237, 15629, -5893, -24808, -32749, -26202, -8063, 13642, 29312, 32014, 20553}, -{0, -21686, -32515, -27064, -8063, 14974, 30514, 30776, 15629, -7343, -26640, -32598, -22236, -741, 21125, 32414, 27473, 8778, -14313, -30238, -31024, -16277, 6619, 26201, 32664, 22773, 1480, -20554, -32298, -27871, -9490, 13642, 29944, 31253, 16915, -5893, -25750, -32715, -23301, -2221, 19971, 32164, 28252, 10195, -12966, -29636, -31469, -17545, 5162, 25285, 32748, 23815, 2958, -19380, -32015, -28621, -10898, 12282, 29312, 31666, 18165, -4430, -24808, -32765, -24318, -3696, 18777, 31848, 28973, 11592, -11593, -28974, -31849, -18778, 3695, 24317, 32764, 24807, 4429, -18166, -31667, -29313, -12283, 10897, 28620, 32014, 19379, -2959, -23816, -32749, -25286, -5163, 17544, 31468, 29635, 12965, -10196, -28253, -32165, -19972, 2220, 23300, 32714, 25749, 5892, -16916, -31254, -29945, -13643, 9489, 27870, 32297, 20553, -1481, -22774, -32665, -26202, -6620, 16276, 31023, 30237, 14312, -8779, -27474, -32415, -21126, 740, 22235, 32597, 26639, 7342, -15630, -30777, -30515, -14975, 8062, 27063, 32514, 21685}, -{0, -22774, -32749, -24318, -2221, 21125, 32597, 25749, 4429, -19380, -32298, -27064, -6620, 17544, 31848, 28252, 8778, -15630, -31254, -29313, -10898, 13642, 30514, 30237, 12965, -11593, -29636, -31024, -14975, 9489, 28620, 31666, 16915, -7343, -27474, -32165, -18778, 5162, 26201, 32514, 20553, -2959, -24808, -32715, -22236, 740, 23300, 32764, 23815, 1480, -21686, -32665, -25286, -3696, 19971, 32414, 26639, 5892, -18166, -32015, -27871, -8063, 16276, 31468, 28973, 10195, -14313, -30777, -29945, -12283, 12282, 29944, 30776, 14312, -10196, -28974, -31469, -16277, 8062, 27870, 32014, 18165, -5893, -26640, -32415, -19972, 3695, 25285, 32664, 21685, -1481, -23816, -32765, -23301, -741, 22235, 32714, 24807, 2958, -20554, -32515, -26202, -5163, 18777, 32164, 27473, 7342, -16916, -31667, -28621, -9490, 14974, 31023, 29635, 11592, -12966, -30238, -30515, -13643, 10897, 29312, 31253, 15629, -8779, -28253, -31849, -17545, 6619, 27063, 32297, 19379, -4430, -25750, -32598, -21126, 2220, 24317, 32748, 22773}, -{0, -23816, -32715, -21126, 3695, 26201, 32297, 18165, -7343, -28253, -31469, -14975, 10897, 29944, 30237, 11592, -14313, -31254, -28621, -8063, 17544, 32164, 26639, 4429, -20554, -32665, -24318, -741, 23300, 32748, 21685, -2959, -25750, -32415, -18778, 6619, 27870, 31666, 15629, -10196, -29636, -30515, -12283, 13642, 31023, 28973, 8778, -16916, -32015, -27064, -5163, 19971, 32597, 24807, 1480, -22774, -32765, -22236, 2220, 25285, 32514, 19379, -5893, -27474, -31849, -16277, 9489, 29312, 30776, 12965, -12966, -30777, -29313, -9490, 16276, 31848, 27473, 5892, -19380, -32515, -25286, -2221, 22235, 32764, 22773, -1481, -24808, -32598, -19972, 5162, 27063, 32014, 16915, -8779, -28974, -31024, -13643, 12282, 30514, 29635, 10195, -15630, -31667, -27871, -6620, 18777, 32414, 25749, 2958, -21686, -32749, -23301, 740, 24317, 32664, 20553, -4430, -26640, -32165, -17545, 8062, 28620, 31253, 14312, -11593, -30238, -29945, -10898, 14974, 31468, 28252, 7342, -18166, -32298, -26202, -3696, 21125, 32714, 23815}, -{0, -24808, -32415, -17545, 9489, 29944, 29635, 8778, -18166, -32515, -24318, 740, 25285, 32297, 16915, -10196, -30238, -29313, -8063, 18777, 32597, 23815, -1481, -25750, -32165, -16277, 10897, 30514, 28973, 7342, -19380, -32665, -23301, 2220, 26201, 32014, 15629, -11593, -30777, -28621, -6620, 19971, 32714, 22773, -2959, -26640, -31849, -14975, 12282, 31023, 28252, 5892, -20554, -32749, -22236, 3695, 27063, 31666, 14312, -12966, -31254, -27871, -5163, 21125, 32764, 21685, -4430, -27474, -31469, -13643, 13642, 31468, 27473, 4429, -21686, -32765, -21126, 5162, 27870, 31253, 12965, -14313, -31667, -27064, -3696, 22235, 32748, 20553, -5893, -28253, -31024, -12283, 14974, 31848, 26639, 2958, -22774, -32715, -19972, 6619, 28620, 30776, 11592, -15630, -32015, -26202, -2221, 23300, 32664, 19379, -7343, -28974, -30515, -10898, 16276, 32164, 25749, 1480, -23816, -32598, -18778, 8062, 29312, 30237, 10195, -16916, -32298, -25286, -741, 24317, 32514, 18165, -8779, -29636, -29945, -9490, 17544, 32414, 24807}, -{0, -25750, -31849, -13643, 14974, 32164, 24807, -1481, -26640, -31469, -12283, 16276, 32414, 23815, -2959, -27474, -31024, -10898, 17544, 32597, 22773, -4430, -28253, -30515, -9490, 18777, 32714, 21685, -5893, -28974, -29945, -8063, 19971, 32764, 20553, -7343, -29636, -29313, -6620, 21125, 32748, 19379, -8779, -30238, -28621, -5163, 22235, 32664, 18165, -10196, -30777, -27871, -3696, 23300, 32514, 16915, -11593, -31254, -27064, -2221, 24317, 32297, 15629, -12966, -31667, -26202, -741, 25285, 32014, 14312, -14313, -32015, -25286, 740, 26201, 31666, 12965, -15630, -32298, -24318, 2220, 27063, 31253, 11592, -16916, -32515, -23301, 3695, 27870, 30776, 10195, -18166, -32665, -22236, 5162, 28620, 30237, 8778, -19380, -32749, -21126, 6619, 29312, 29635, 7342, -20554, -32765, -19972, 8062, 29944, 28973, 5892, -21686, -32715, -18778, 9489, 30514, 28252, 4429, -22774, -32598, -17545, 10897, 31023, 27473, 2958, -23816, -32415, -16277, 12282, 31468, 26639, 1480, -24808, -32165, -14975, 13642, 31848, 25749}, -{0, -26640, -31024, -9490, 19971, 32748, 18165, -11593, -31667, -25286, 2220, 27870, 30237, 7342, -21686, -32598, -16277, 13642, 32164, 23815, -4430, -28974, -29313, -5163, 23300, 32297, 14312, -15630, -32515, -22236, 6619, 29944, 28252, 2958, -24808, -31849, -12283, 17544, 32714, 20553, -8779, -30777, -27064, -741, 26201, 31253, 10195, -19380, -32765, -18778, 10897, 31468, 25749, -1481, -27474, -30515, -8063, 21125, 32664, 16915, -12966, -32015, -24318, 3695, 28620, 29635, 5892, -22774, -32415, -14975, 14974, 32414, 22773, -5893, -29636, -28621, -3696, 24317, 32014, 12965, -16916, -32665, -21126, 8062, 30514, 27473, 1480, -25750, -31469, -10898, 18777, 32764, 19379, -10196, -31254, -26202, 740, 27063, 30776, 8778, -20554, -32715, -17545, 12282, 31848, 24807, -2959, -28253, -29945, -6620, 22235, 32514, 15629, -14313, -32298, -23301, 5162, 29312, 28973, 4429, -23816, -32165, -13643, 16276, 32597, 21685, -7343, -30238, -27871, -2221, 25285, 31666, 11592, -18166, -32749, -19972, 9489, 31023, 26639}, -{0, -27474, -29945, -5163, 24317, 31666, 10195, -20554, -32598, -14975, 16276, 32714, 19379, -11593, -32015, -23301, 6619, 30514, 26639, -1481, -28253, -29313, -3696, 25285, 31253, 8778, -21686, -32415, -13643, 17544, 32764, 18165, -12966, -32298, -22236, 8062, 31023, 25749, -2959, -28974, -28621, -2221, 26201, 30776, 7342, -22774, -32165, -12283, 18777, 32748, 16915, -14313, -32515, -21126, 9489, 31468, 24807, -4430, -29636, -27871, -741, 27063, 30237, 5892, -23816, -31849, -10898, 19971, 32664, 15629, -15630, -32665, -19972, 10897, 31848, 23815, -5893, -30238, -27064, 740, 27870, 29635, 4429, -24808, -31469, -9490, 21125, 32514, 14312, -16916, -32749, -18778, 12282, 32164, 22773, -7343, -30777, -26202, 2220, 28620, 28973, 2958, -25750, -31024, -8063, 22235, 32297, 12965, -18166, -32765, -17545, 13642, 32414, 21685, -8779, -31254, -25286, 3695, 29312, 28252, 1480, -26640, -30515, -6620, 23300, 32014, 11592, -19380, -32715, -16277, 14974, 32597, 20553, -10196, -31667, -24318, 5162, 29944, 27473}, -{0, -28253, -28621, -741, 27870, 28973, 1480, -27474, -29313, -2221, 27063, 29635, 2958, -26640, -29945, -3696, 26201, 30237, 4429, -25750, -30515, -5163, 25285, 30776, 5892, -24808, -31024, -6620, 24317, 31253, 7342, -23816, -31469, -8063, 23300, 31666, 8778, -22774, -31849, -9490, 22235, 32014, 10195, -21686, -32165, -10898, 21125, 32297, 11592, -20554, -32415, -12283, 19971, 32514, 12965, -19380, -32598, -13643, 18777, 32664, 14312, -18166, -32715, -14975, 17544, 32748, 15629, -16916, -32765, -16277, 16276, 32764, 16915, -15630, -32749, -17545, 14974, 32714, 18165, -14313, -32665, -18778, 13642, 32597, 19379, -12966, -32515, -19972, 12282, 32414, 20553, -11593, -32298, -21126, 10897, 32164, 21685, -10196, -32015, -22236, 9489, 31848, 22773, -8779, -31667, -23301, 8062, 31468, 23815, -7343, -31254, -24318, 6619, 31023, 24807, -5893, -30777, -25286, 5162, 30514, 25749, -4430, -30238, -26202, 3695, 29944, 26639, -2959, -29636, -27064, 2220, 29312, 27473, -1481, -28974, -27871, 740, 28620, 28252}, -{0, -28974, -27064, 3695, 30514, 24807, -7343, -31667, -22236, 10897, 32414, 19379, -14313, -32749, -16277, 17544, 32664, 12965, -20554, -32165, -9490, 23300, 31253, 5892, -25750, -29945, -2221, 27870, 28252, -1481, -29636, -26202, 5162, 31023, 23815, -8779, -32015, -21126, 12282, 32597, 18165, -15630, -32765, -14975, 18777, 32514, 11592, -21686, -31849, -8063, 24317, 30776, 4429, -26640, -29313, -741, 28620, 27473, -2959, -30238, -25286, 6619, 31468, 22773, -10196, -32298, -19972, 13642, 32714, 16915, -16916, -32715, -13643, 19971, 32297, 10195, -22774, -31469, -6620, 25285, 30237, 2958, -27474, -28621, 740, 29312, 26639, -4430, -30777, -24318, 8062, 31848, 21685, -11593, -32515, -18778, 14974, 32764, 15629, -18166, -32598, -12283, 21125, 32014, 8778, -23816, -31024, -5163, 26201, 29635, 1480, -28253, -27871, 2220, 29944, 25749, -5893, -31254, -23301, 9489, 32164, 20553, -12966, -32665, -17545, 16276, 32748, 14312, -19380, -32415, -10898, 22235, 31666, 7342, -24808, -30515, -3696, 27063, 28973}, -{0, -29636, -25286, 8062, 32164, 19379, -15630, -32715, -12283, 22235, 31253, 4429, -27474, -27871, 3695, 31023, 22773, -11593, -32665, -16277, 18777, 32297, 8778, -24808, -29945, -741, 29312, 25749, -7343, -32015, -19972, 14974, 32748, 12965, -21686, -31469, -5163, 27063, 28252, -2959, -30777, -23301, 10897, 32597, 16915, -18166, -32415, -9490, 24317, 30237, 1480, -28974, -26202, 6619, 31848, 20553, -14313, -32765, -13643, 21125, 31666, 5892, -26640, -28621, 2220, 30514, 23815, -10196, -32515, -17545, 17544, 32514, 10195, -23816, -30515, -2221, 28620, 26639, -5893, -31667, -21126, 13642, 32764, 14312, -20554, -31849, -6620, 26201, 28973, -1481, -30238, -24318, 9489, 32414, 18165, -16916, -32598, -10898, 23300, 30776, 2958, -28253, -27064, 5162, 31468, 21685, -12966, -32749, -14975, 19971, 32014, 7342, -25750, -29313, 740, 29944, 24807, -8779, -32298, -18778, 16276, 32664, 11592, -22774, -31024, -3696, 27870, 27473, -4430, -31254, -22236, 12282, 32714, 15629, -19380, -32165, -8063, 25285, 29635}, -{0, -30238, -23301, 12282, 32764, 12965, -22774, -30515, -741, 29944, 23815, -11593, -32749, -13643, 22235, 30776, 1480, -29636, -24318, 10897, 32714, 14312, -21686, -31024, -2221, 29312, 24807, -10196, -32665, -14975, 21125, 31253, 2958, -28974, -25286, 9489, 32597, 15629, -20554, -31469, -3696, 28620, 25749, -8779, -32515, -16277, 19971, 31666, 4429, -28253, -26202, 8062, 32414, 16915, -19380, -31849, -5163, 27870, 26639, -7343, -32298, -17545, 18777, 32014, 5892, -27474, -27064, 6619, 32164, 18165, -18166, -32165, -6620, 27063, 27473, -5893, -32015, -18778, 17544, 32297, 7342, -26640, -27871, 5162, 31848, 19379, -16916, -32415, -8063, 26201, 28252, -4430, -31667, -19972, 16276, 32514, 8778, -25750, -28621, 3695, 31468, 20553, -15630, -32598, -9490, 25285, 28973, -2959, -31254, -21126, 14974, 32664, 10195, -24808, -29313, 2220, 31023, 21685, -14313, -32715, -10898, 24317, 29635, -1481, -30777, -22236, 13642, 32748, 11592, -23816, -29945, 740, 30514, 22773, -12966, -32765, -12283, 23300, 30237}, -{0, -30777, -21126, 16276, 32297, 5892, -28253, -25286, 10897, 32764, 11592, -24808, -28621, 5162, 32164, 16915, -20554, -31024, -741, 30514, 21685, -15630, -32415, -6620, 27870, 25749, -10196, -32749, -12283, 24317, 28973, -4430, -32015, -17545, 19971, 31253, 1480, -30238, -22236, 14974, 32514, 7342, -27474, -26202, 9489, 32714, 12965, -23816, -29313, 3695, 31848, 18165, -19380, -31469, -2221, 29944, 22773, -14313, -32598, -8063, 27063, 26639, -8779, -32665, -13643, 23300, 29635, -2959, -31667, -18778, 18777, 31666, 2958, -29636, -23301, 13642, 32664, 8778, -26640, -27064, 8062, 32597, 14312, -22774, -29945, 2220, 31468, 19379, -18166, -31849, -3696, 29312, 23815, -12966, -32715, -9490, 26201, 27473, -7343, -32515, -14975, 22235, 30237, -1481, -31254, -19972, 17544, 32014, 4429, -28974, -24318, 12282, 32748, 10195, -25750, -27871, 6619, 32414, 15629, -21686, -30515, 740, 31023, 20553, -16916, -32165, -5163, 28620, 24807, -11593, -32765, -10898, 25285, 28252, -5893, -32298, -16277, 21125, 30776}, -{0, -31254, -18778, 19971, 30776, -1481, -31667, -17545, 21125, 30237, -2959, -32015, -16277, 22235, 29635, -4430, -32298, -14975, 23300, 28973, -5893, -32515, -13643, 24317, 28252, -7343, -32665, -12283, 25285, 27473, -8779, -32749, -10898, 26201, 26639, -10196, -32765, -9490, 27063, 25749, -11593, -32715, -8063, 27870, 24807, -12966, -32598, -6620, 28620, 23815, -14313, -32415, -5163, 29312, 22773, -15630, -32165, -3696, 29944, 21685, -16916, -31849, -2221, 30514, 20553, -18166, -31469, -741, 31023, 19379, -19380, -31024, 740, 31468, 18165, -20554, -30515, 2220, 31848, 16915, -21686, -29945, 3695, 32164, 15629, -22774, -29313, 5162, 32414, 14312, -23816, -28621, 6619, 32597, 12965, -24808, -27871, 8062, 32714, 11592, -25750, -27064, 9489, 32764, 10195, -26640, -26202, 10897, 32748, 8778, -27474, -25286, 12282, 32664, 7342, -28253, -24318, 13642, 32514, 5892, -28974, -23301, 14974, 32297, 4429, -29636, -22236, 16276, 32014, 2958, -30238, -21126, 17544, 31666, 1480, -30777, -19972, 18777, 31253}, -{0, -31667, -16277, 23300, 28252, -8779, -32765, -8063, 28620, 22773, -16916, -31469, 740, 31848, 15629, -23816, -27871, 9489, 32748, 7342, -28974, -22236, 17544, 31253, -1481, -32015, -14975, 24317, 27473, -10196, -32715, -6620, 29312, 21685, -18166, -31024, 2220, 32164, 14312, -24808, -27064, 10897, 32664, 5892, -29636, -21126, 18777, 30776, -2959, -32298, -13643, 25285, 26639, -11593, -32598, -5163, 29944, 20553, -19380, -30515, 3695, 32414, 12965, -25750, -26202, 12282, 32514, 4429, -30238, -19972, 19971, 30237, -4430, -32515, -12283, 26201, 25749, -12966, -32415, -3696, 30514, 19379, -20554, -29945, 5162, 32597, 11592, -26640, -25286, 13642, 32297, 2958, -30777, -18778, 21125, 29635, -5893, -32665, -10898, 27063, 24807, -14313, -32165, -2221, 31023, 18165, -21686, -29313, 6619, 32714, 10195, -27474, -24318, 14974, 32014, 1480, -31254, -17545, 22235, 28973, -7343, -32749, -9490, 27870, 23815, -15630, -31849, -741, 31468, 16915, -22774, -28621, 8062, 32764, 8778, -28253, -23301, 16276, 31666}, -{0, -32015, -13643, 26201, 24807, -15630, -31469, 2220, 32414, 11592, -27474, -23301, 17544, 30776, -4430, -32665, -9490, 28620, 21685, -19380, -29945, 6619, 32764, 7342, -29636, -19972, 21125, 28973, -8779, -32715, -5163, 30514, 18165, -22774, -27871, 10897, 32514, 2958, -31254, -16277, 24317, 26639, -12966, -32165, -741, 31848, 14312, -25750, -25286, 14974, 31666, -1481, -32298, -12283, 27063, 23815, -16916, -31024, 3695, 32597, 10195, -28253, -22236, 18777, 30237, -5893, -32749, -8063, 29312, 20553, -20554, -29313, 8062, 32748, 5892, -30238, -18778, 22235, 28252, -10196, -32598, -3696, 31023, 16915, -23816, -27064, 12282, 32297, 1480, -31667, -14975, 25285, 25749, -14313, -31849, 740, 32164, 12965, -26640, -24318, 16276, 31253, -2959, -32515, -10898, 27870, 22773, -18166, -30515, 5162, 32714, 8778, -28974, -21126, 19971, 29635, -7343, -32765, -6620, 29944, 19379, -21686, -28621, 9489, 32664, 4429, -30777, -17545, 23300, 27473, -11593, -32415, -2221, 31468, 15629, -24808, -26202, 13642, 32014}, -{0, -32298, -10898, 28620, 20553, -21686, -27871, 12282, 32014, -1481, -32515, -9490, 29312, 19379, -22774, -27064, 13642, 31666, -2959, -32665, -8063, 29944, 18165, -23816, -26202, 14974, 31253, -4430, -32749, -6620, 30514, 16915, -24808, -25286, 16276, 30776, -5893, -32765, -5163, 31023, 15629, -25750, -24318, 17544, 30237, -7343, -32715, -3696, 31468, 14312, -26640, -23301, 18777, 29635, -8779, -32598, -2221, 31848, 12965, -27474, -22236, 19971, 28973, -10196, -32415, -741, 32164, 11592, -28253, -21126, 21125, 28252, -11593, -32165, 740, 32414, 10195, -28974, -19972, 22235, 27473, -12966, -31849, 2220, 32597, 8778, -29636, -18778, 23300, 26639, -14313, -31469, 3695, 32714, 7342, -30238, -17545, 24317, 25749, -15630, -31024, 5162, 32764, 5892, -30777, -16277, 25285, 24807, -16916, -30515, 6619, 32748, 4429, -31254, -14975, 26201, 23815, -18166, -29945, 8062, 32664, 2958, -31667, -13643, 27063, 22773, -19380, -29313, 9489, 32514, 1480, -32015, -12283, 27870, 21685, -20554, -28621, 10897, 32297}, -{0, -32515, -8063, 30514, 15629, -26640, -22236, 21125, 27473, -14313, -31024, 6619, 32664, 1480, -32298, -9490, 29944, 16915, -25750, -23301, 19971, 28252, -12966, -31469, 5162, 32748, 2958, -32015, -10898, 29312, 18165, -24808, -24318, 18777, 28973, -11593, -31849, 3695, 32764, 4429, -31667, -12283, 28620, 19379, -23816, -25286, 17544, 29635, -10196, -32165, 2220, 32714, 5892, -31254, -13643, 27870, 20553, -22774, -26202, 16276, 30237, -8779, -32415, 740, 32597, 7342, -30777, -14975, 27063, 21685, -21686, -27064, 14974, 30776, -7343, -32598, -741, 32414, 8778, -30238, -16277, 26201, 22773, -20554, -27871, 13642, 31253, -5893, -32715, -2221, 32164, 10195, -29636, -17545, 25285, 23815, -19380, -28621, 12282, 31666, -4430, -32765, -3696, 31848, 11592, -28974, -18778, 24317, 24807, -18166, -29313, 10897, 32014, -2959, -32749, -5163, 31468, 12965, -28253, -19972, 23300, 25749, -16916, -29945, 9489, 32297, -1481, -32665, -6620, 31023, 14312, -27474, -21126, 22235, 26639, -15630, -30515, 8062, 32514}, -{0, -32665, -5163, 31848, 10195, -30238, -14975, 27870, 19379, -24808, -23301, 21125, 26639, -16916, -29313, 12282, 31253, -7343, -32415, 2220, 32764, 2958, -32298, -8063, 31023, 12965, -28974, -17545, 26201, 21685, -22774, -25286, 18777, 28252, -14313, -30515, 9489, 32014, -4430, -32715, -741, 32597, 5892, -31667, -10898, 29944, 15629, -27474, -19972, 24317, 23815, -20554, -27064, 16276, 29635, -11593, -31469, 6619, 32514, -1481, -32749, -3696, 32164, 8778, -30777, -13643, 28620, 18165, -25750, -22236, 22235, 25749, -18166, -28621, 13642, 30776, -8779, -32165, 3695, 32748, 1480, -32515, -6620, 31468, 11592, -29636, -16277, 27063, 20553, -23816, -24318, 19971, 27473, -15630, -29945, 10897, 31666, -5893, -32598, 740, 32714, 4429, -32015, -9490, 30514, 14312, -28253, -18778, 25285, 22773, -21686, -26202, 17544, 28973, -12966, -31024, 8062, 32297, -2959, -32765, -2221, 32414, 7342, -31254, -12283, 29312, 16915, -26640, -21126, 23300, 24807, -19380, -27871, 14974, 30237, -10196, -31849, 5162, 32664}, -{0, -32749, -2221, 32597, 4429, -32298, -6620, 31848, 8778, -31254, -10898, 30514, 12965, -29636, -14975, 28620, 16915, -27474, -18778, 26201, 20553, -24808, -22236, 23300, 23815, -21686, -25286, 19971, 26639, -18166, -27871, 16276, 28973, -14313, -29945, 12282, 30776, -10196, -31469, 8062, 32014, -5893, -32415, 3695, 32664, -1481, -32765, -741, 32714, 2958, -32515, -5163, 32164, 7342, -31667, -9490, 31023, 11592, -30238, -13643, 29312, 15629, -28253, -17545, 27063, 19379, -25750, -21126, 24317, 22773, -22774, -24318, 21125, 25749, -19380, -27064, 17544, 28252, -15630, -29313, 13642, 30237, -11593, -31024, 9489, 31666, -7343, -32165, 5162, 32514, -2959, -32715, 740, 32764, 1480, -32665, -3696, 32414, 5892, -32015, -8063, 31468, 10195, -30777, -12283, 29944, 14312, -28974, -16277, 27870, 18165, -26640, -19972, 25285, 21685, -23816, -23301, 22235, 24807, -20554, -26202, 18777, 27473, -16916, -28621, 14974, 29635, -12966, -30515, 10897, 31253, -8779, -31849, 6619, 32297, -4430, -32598, 2220, 32748}, -{0, -32765, 740, 32748, -1481, -32715, 2220, 32664, -2959, -32598, 3695, 32514, -4430, -32415, 5162, 32297, -5893, -32165, 6619, 32014, -7343, -31849, 8062, 31666, -8779, -31469, 9489, 31253, -10196, -31024, 10897, 30776, -11593, -30515, 12282, 30237, -12966, -29945, 13642, 29635, -14313, -29313, 14974, 28973, -15630, -28621, 16276, 28252, -16916, -27871, 17544, 27473, -18166, -27064, 18777, 26639, -19380, -26202, 19971, 25749, -20554, -25286, 21125, 24807, -21686, -24318, 22235, 23815, -22774, -23301, 23300, 22773, -23816, -22236, 24317, 21685, -24808, -21126, 25285, 20553, -25750, -19972, 26201, 19379, -26640, -18778, 27063, 18165, -27474, -17545, 27870, 16915, -28253, -16277, 28620, 15629, -28974, -14975, 29312, 14312, -29636, -13643, 29944, 12965, -30238, -12283, 30514, 11592, -30777, -10898, 31023, 10195, -31254, -9490, 31468, 8778, -31667, -8063, 31848, 7342, -32015, -6620, 32164, 5892, -32298, -5163, 32414, 4429, -32515, -3696, 32597, 2958, -32665, -2221, 32714, 1480, -32749, -741, 32764}, -{0, -32715, 3695, 32297, -7343, -31469, 10897, 30237, -14313, -28621, 17544, 26639, -20554, -24318, 23300, 21685, -25750, -18778, 27870, 15629, -29636, -12283, 31023, 8778, -32015, -5163, 32597, 1480, -32765, 2220, 32514, -5893, -31849, 9489, 30776, -12966, -29313, 16276, 27473, -19380, -25286, 22235, 22773, -24808, -19972, 27063, 16915, -28974, -13643, 30514, 10195, -31667, -6620, 32414, 2958, -32749, 740, 32664, -4430, -32165, 8062, 31253, -11593, -29945, 14974, 28252, -18166, -26202, 21125, 23815, -23816, -21126, 26201, 18165, -28253, -14975, 29944, 11592, -31254, -8063, 32164, 4429, -32665, -741, 32748, -2959, -32415, 6619, 31666, -10196, -30515, 13642, 28973, -16916, -27064, 19971, 24807, -22774, -22236, 25285, 19379, -27474, -16277, 29312, 12965, -30777, -9490, 31848, 5892, -32515, -2221, 32764, -1481, -32598, 5162, 32014, -8779, -31024, 12282, 29635, -15630, -27871, 18777, 25749, -21686, -23301, 24317, 20553, -26640, -17545, 28620, 14312, -30238, -10898, 31468, 7342, -32298, -3696, 32714}, -{0, -32598, 6619, 31253, -12966, -28621, 18777, 24807, -23816, -19972, 27870, 14312, -30777, -8063, 32414, 1480, -32715, 5162, 31666, -11593, -29313, 17544, 25749, -22774, -21126, 27063, 15629, -30238, -9490, 32164, 2958, -32765, 3695, 32014, -10196, -29945, 16276, 26639, -21686, -22236, 26201, 16915, -29636, -10898, 31848, 4429, -32749, 2220, 32297, -8779, -30515, 14974, 27473, -20554, -23301, 25285, 18165, -28974, -12283, 31468, 5892, -32665, 740, 32514, -7343, -31024, 13642, 28252, -19380, -24318, 24317, 19379, -28253, -13643, 31023, 7342, -32515, -741, 32664, -5893, -31469, 12282, 28973, -18166, -25286, 23300, 20553, -27474, -14975, 30514, 8778, -32298, -2221, 32748, -4430, -31849, 10897, 29635, -16916, -26202, 22235, 21685, -26640, -16277, 29944, 10195, -32015, -3696, 32764, -2959, -32165, 9489, 30237, -15630, -27064, 21125, 22773, -25750, -17545, 29312, 11592, -31667, -5163, 32714, -1481, -32415, 8062, 30776, -14313, -27871, 19971, 23815, -24808, -18778, 28620, 12965, -31254, -6620, 32597}, -{0, -32415, 9489, 29635, -18166, -24318, 25285, 16915, -30238, -8063, 32597, -1481, -32165, 10897, 28973, -19380, -23301, 26201, 15629, -30777, -6620, 32714, -2959, -31849, 12282, 28252, -20554, -22236, 27063, 14312, -31254, -5163, 32764, -4430, -31469, 13642, 27473, -21686, -21126, 27870, 12965, -31667, -3696, 32748, -5893, -31024, 14974, 26639, -22774, -19972, 28620, 11592, -32015, -2221, 32664, -7343, -30515, 16276, 25749, -23816, -18778, 29312, 10195, -32298, -741, 32514, -8779, -29945, 17544, 24807, -24808, -17545, 29944, 8778, -32515, 740, 32297, -10196, -29313, 18777, 23815, -25750, -16277, 30514, 7342, -32665, 2220, 32014, -11593, -28621, 19971, 22773, -26640, -14975, 31023, 5892, -32749, 3695, 31666, -12966, -27871, 21125, 21685, -27474, -13643, 31468, 4429, -32765, 5162, 31253, -14313, -27064, 22235, 20553, -28253, -12283, 31848, 2958, -32715, 6619, 30776, -15630, -26202, 23300, 19379, -28974, -10898, 32164, 1480, -32598, 8062, 30237, -16916, -25286, 24317, 18165, -29636, -9490, 32414}, -{0, -32165, 12282, 27473, -22774, -18778, 29944, 7342, -32749, 5162, 30776, -16916, -24318, 26201, 14312, -31667, -2221, 32514, -10196, -28621, 21125, 20553, -28974, -9490, 32597, -2959, -31469, 14974, 25749, -24808, -16277, 31023, 4429, -32715, 8062, 29635, -19380, -22236, 27870, 11592, -32298, 740, 32014, -12966, -27064, 23300, 18165, -30238, -6620, 32764, -5893, -30515, 17544, 23815, -26640, -13643, 31848, 1480, -32415, 10897, 28252, -21686, -19972, 29312, 8778, -32665, 3695, 31253, -15630, -25286, 25285, 15629, -31254, -3696, 32664, -8779, -29313, 19971, 21685, -28253, -10898, 32414, -1481, -31849, 13642, 26639, -23816, -17545, 30514, 5892, -32765, 6619, 30237, -18166, -23301, 27063, 12965, -32015, -741, 32297, -11593, -27871, 22235, 19379, -29636, -8063, 32714, -4430, -31024, 16276, 24807, -25750, -14975, 31468, 2958, -32598, 9489, 28973, -20554, -21126, 28620, 10195, -32515, 2220, 31666, -14313, -26202, 24317, 16915, -30777, -5163, 32748, -7343, -29945, 18777, 22773, -27474, -12283, 32164}, -{0, -31849, 14974, 24807, -26640, -12283, 32414, -2959, -31024, 17544, 22773, -28253, -9490, 32714, -5893, -29945, 19971, 20553, -29636, -6620, 32748, -8779, -28621, 22235, 18165, -30777, -3696, 32514, -11593, -27064, 24317, 15629, -31667, -741, 32014, -14313, -25286, 26201, 12965, -32298, 2220, 31253, -16916, -23301, 27870, 10195, -32665, 5162, 30237, -19380, -21126, 29312, 7342, -32765, 8062, 28973, -21686, -18778, 30514, 4429, -32598, 10897, 27473, -23816, -16277, 31468, 1480, -32165, 13642, 25749, -25750, -13643, 32164, -1481, -31469, 16276, 23815, -27474, -10898, 32597, -4430, -30515, 18777, 21685, -28974, -8063, 32764, -7343, -29313, 21125, 19379, -30238, -5163, 32664, -10196, -27871, 23300, 16915, -31254, -2221, 32297, -12966, -26202, 25285, 14312, -32015, 740, 31666, -15630, -24318, 27063, 11592, -32515, 3695, 30776, -18166, -22236, 28620, 8778, -32749, 6619, 29635, -20554, -19972, 29944, 5892, -32715, 9489, 28252, -22774, -17545, 31023, 2958, -32415, 12282, 26639, -24808, -14975, 31848}, -{0, -31469, 17544, 21685, -29636, -5163, 32514, -12966, -25286, 27063, 10195, -32749, 8062, 28252, -23816, -14975, 32164, -2959, -30515, 19971, 19379, -30777, -2221, 32014, -15630, -23301, 28620, 7342, -32715, 10897, 26639, -25750, -12283, 32597, -5893, -29313, 22235, 16915, -31667, 740, 31253, -18166, -21126, 29944, 4429, -32415, 13642, 24807, -27474, -9490, 32764, -8779, -27871, 24317, 14312, -32298, 3695, 30237, -20554, -18778, 31023, 1480, -31849, 16276, 22773, -28974, -6620, 32664, -11593, -26202, 26201, 11592, -32665, 6619, 28973, -22774, -16277, 31848, -1481, -31024, 18777, 20553, -30238, -3696, 32297, -14313, -24318, 27870, 8778, -32765, 9489, 27473, -24808, -13643, 32414, -4430, -29945, 21125, 18165, -31254, -741, 31666, -16916, -22236, 29312, 5892, -32598, 12282, 25749, -26640, -10898, 32714, -7343, -28621, 23300, 15629, -32015, 2220, 30776, -19380, -19972, 30514, 2958, -32165, 14974, 23815, -28253, -8063, 32748, -10196, -27064, 25285, 12965, -32515, 5162, 29635, -21686, -17545, 31468}, -{0, -31024, 19971, 18165, -31667, 2220, 30237, -21686, -16277, 32164, -4430, -29313, 23300, 14312, -32515, 6619, 28252, -24808, -12283, 32714, -8779, -27064, 26201, 10195, -32765, 10897, 25749, -27474, -8063, 32664, -12966, -24318, 28620, 5892, -32415, 14974, 22773, -29636, -3696, 32014, -16916, -21126, 30514, 1480, -31469, 18777, 19379, -31254, 740, 30776, -20554, -17545, 31848, -2959, -29945, 22235, 15629, -32298, 5162, 28973, -23816, -13643, 32597, -7343, -27871, 25285, 11592, -32749, 9489, 26639, -26640, -9490, 32748, -11593, -25286, 27870, 7342, -32598, 13642, 23815, -28974, -5163, 32297, -15630, -22236, 29944, 2958, -31849, 17544, 20553, -30777, -741, 31253, -19380, -18778, 31468, -1481, -30515, 21125, 16915, -32015, 3695, 29635, -22774, -14975, 32414, -5893, -28621, 24317, 12965, -32665, 8062, 27473, -25750, -10898, 32764, -10196, -26202, 27063, 8778, -32715, 12282, 24807, -28253, -6620, 32514, -14313, -23301, 29312, 4429, -32165, 16276, 21685, -30238, -2221, 31666, -18166, -19972, 31023}, -{0, -30515, 22235, 14312, -32665, 9489, 25749, -28253, -5163, 32014, -18166, -18778, 31848, -4430, -28621, 25285, 10195, -32715, 13642, 22773, -30238, -741, 30776, -21686, -14975, 32597, -8779, -26202, 27870, 5892, -32165, 17544, 19379, -31667, 3695, 28973, -24808, -10898, 32748, -12966, -23301, 29944, 1480, -31024, 21125, 15629, -32515, 8062, 26639, -27474, -6620, 32297, -16916, -19972, 31468, -2959, -29313, 24317, 11592, -32765, 12282, 23815, -29636, -2221, 31253, -20554, -16277, 32414, -7343, -27064, 27063, 7342, -32415, 16276, 20553, -31254, 2220, 29635, -23816, -12283, 32764, -11593, -24318, 29312, 2958, -31469, 19971, 16915, -32298, 6619, 27473, -26640, -8063, 32514, -15630, -21126, 31023, -1481, -29945, 23300, 12965, -32749, 10897, 24807, -28974, -3696, 31666, -19380, -17545, 32164, -5893, -27871, 26201, 8778, -32598, 14974, 21685, -30777, 740, 30237, -22774, -13643, 32714, -10196, -25286, 28620, 4429, -31849, 18777, 18165, -32015, 5162, 28252, -25750, -9490, 32664, -14313, -22236, 30514}, -{0, -29945, 24317, 10195, -32598, 16276, 19379, -32015, 6619, 26639, -28253, -3696, 31253, -21686, -13643, 32764, -12966, -22236, 31023, -2959, -28621, 26201, 7342, -32165, 18777, 16915, -32515, 9489, 24807, -29636, -741, 30237, -23816, -10898, 32664, -15630, -19972, 31848, -5893, -27064, 27870, 4429, -31469, 21125, 14312, -32749, 12282, 22773, -30777, 2220, 28973, -25750, -8063, 32297, -18166, -17545, 32414, -8779, -25286, 29312, 1480, -30515, 23300, 11592, -32715, 14974, 20553, -31667, 5162, 27473, -27474, -5163, 31666, -20554, -14975, 32714, -11593, -23301, 30514, -1481, -29313, 25285, 8778, -32415, 17544, 18165, -32298, 8062, 25749, -28974, -2221, 30776, -22774, -12283, 32748, -14313, -21126, 31468, -4430, -27871, 27063, 5892, -31849, 19971, 15629, -32665, 10897, 23815, -30238, 740, 29635, -24808, -9490, 32514, -16916, -18778, 32164, -7343, -26202, 28620, 2958, -31024, 22235, 12965, -32765, 13642, 21685, -31254, 3695, 28252, -26640, -6620, 32014, -19380, -16277, 32597, -10196, -24318, 29944}, -{0, -29313, 26201, 5892, -31469, 22235, 11592, -32598, 17544, 16915, -32665, 12282, 21685, -31667, 6619, 25749, -29636, 740, 28973, -26640, -5163, 31253, -22774, -10898, 32514, -18166, -16277, 32714, -12966, -21126, 31848, -7343, -25286, 29944, -1481, -28621, 27063, 4429, -31024, 23300, 10195, -32415, 18777, 15629, -32749, 13642, 20553, -32015, 8062, 24807, -30238, 2220, 28252, -27474, -3696, 30776, -23816, -9490, 32297, -19380, -14975, 32764, -14313, -19972, 32164, -8779, -24318, 30514, -2959, -27871, 27870, 2958, -30515, 24317, 8778, -32165, 19971, 14312, -32765, 14974, 19379, -32298, 9489, 23815, -30777, 3695, 27473, -28253, -2221, 30237, -24808, -8063, 32014, -20554, -13643, 32748, -15630, -18778, 32414, -10196, -23301, 31023, -4430, -27064, 28620, 1480, -29945, 25285, 7342, -31849, 21125, 12965, -32715, 16276, 18165, -32515, 10897, 22773, -31254, 5162, 26639, -28974, -741, 29635, -25750, -6620, 31666, -21686, -12283, 32664, -16916, -17545, 32597, -11593, -22236, 31468, -5893, -26202, 29312}, -{0, -28621, 27870, 1480, -29313, 27063, 2958, -29945, 26201, 4429, -30515, 25285, 5892, -31024, 24317, 7342, -31469, 23300, 8778, -31849, 22235, 10195, -32165, 21125, 11592, -32415, 19971, 12965, -32598, 18777, 14312, -32715, 17544, 15629, -32765, 16276, 16915, -32749, 14974, 18165, -32665, 13642, 19379, -32515, 12282, 20553, -32298, 10897, 21685, -32015, 9489, 22773, -31667, 8062, 23815, -31254, 6619, 24807, -30777, 5162, 25749, -30238, 3695, 26639, -29636, 2220, 27473, -28974, 740, 28252, -28253, -741, 28973, -27474, -2221, 29635, -26640, -3696, 30237, -25750, -5163, 30776, -24808, -6620, 31253, -23816, -8063, 31666, -22774, -9490, 32014, -21686, -10898, 32297, -20554, -12283, 32514, -19380, -13643, 32664, -18166, -14975, 32748, -16916, -16277, 32764, -15630, -17545, 32714, -14313, -18778, 32597, -12966, -19972, 32414, -11593, -21126, 32164, -10196, -22236, 31848, -8779, -23301, 31468, -7343, -24318, 31023, -5893, -25286, 30514, -4430, -26202, 29944, -2959, -27064, 29312, -1481, -27871, 28620}, -{0, -27871, 29312, -2959, -26202, 30514, -5893, -24318, 31468, -8779, -22236, 32164, -11593, -19972, 32597, -14313, -17545, 32764, -16916, -14975, 32664, -19380, -12283, 32297, -21686, -9490, 31666, -23816, -6620, 30776, -25750, -3696, 29635, -27474, -741, 28252, -28974, 2220, 26639, -30238, 5162, 24807, -31254, 8062, 22773, -32015, 10897, 20553, -32515, 13642, 18165, -32749, 16276, 15629, -32715, 18777, 12965, -32415, 21125, 10195, -31849, 23300, 7342, -31024, 25285, 4429, -29945, 27063, 1480, -28621, 28620, -1481, -27064, 29944, -4430, -25286, 31023, -7343, -23301, 31848, -10196, -21126, 32414, -12966, -18778, 32714, -15630, -16277, 32748, -18166, -13643, 32514, -20554, -10898, 32014, -22774, -8063, 31253, -24808, -5163, 30237, -26640, -2221, 28973, -28253, 740, 27473, -29636, 3695, 25749, -30777, 6619, 23815, -31667, 9489, 21685, -32298, 12282, 19379, -32665, 14974, 16915, -32765, 17544, 14312, -32598, 19971, 11592, -32165, 22235, 8778, -31469, 24317, 5892, -30515, 26201, 2958, -29313, 27870}, -{0, -27064, 30514, -7343, -22236, 32414, -14313, -16277, 32664, -20554, -9490, 31253, -25750, -2221, 28252, -29636, 5162, 23815, -32015, 12282, 18165, -32765, 18777, 11592, -31849, 24317, 4429, -29313, 28620, -2959, -25286, 31468, -10196, -19972, 32714, -16916, -13643, 32297, -22774, -6620, 30237, -27474, 740, 26639, -30777, 8062, 21685, -32515, 14974, 15629, -32598, 21125, 8778, -31024, 26201, 1480, -27871, 29944, -5893, -23301, 32164, -12966, -17545, 32748, -19380, -10898, 31666, -24808, -3696, 28973, -28974, 3695, 24807, -31667, 10897, 19379, -32749, 17544, 12965, -32165, 23300, 5892, -29945, 27870, -1481, -26202, 31023, -8779, -21126, 32597, -15630, -14975, 32514, -21686, -8063, 30776, -26640, -741, 27473, -30238, 6619, 22773, -32298, 13642, 16915, -32715, 19971, 10195, -31469, 25285, 2958, -28621, 29312, -4430, -24318, 31848, -11593, -18778, 32764, -18166, -12283, 32014, -23816, -5163, 29635, -28253, 2220, 25749, -31254, 9489, 20553, -32665, 16276, 14312, -32415, 22235, 7342, -30515, 27063}, -{0, -26202, 31468, -11593, -17545, 32664, -21686, -6620, 29635, -28974, 5162, 22773, -32515, 16276, 12965, -31849, 25285, 1480, -27064, 31023, -10196, -18778, 32748, -20554, -8063, 30237, -28253, 3695, 23815, -32298, 14974, 14312, -32165, 24317, 2958, -27871, 30514, -8779, -19972, 32764, -19380, -9490, 30776, -27474, 2220, 24807, -32015, 13642, 15629, -32415, 23300, 4429, -28621, 29944, -7343, -21126, 32714, -18166, -10898, 31253, -26640, 740, 25749, -31667, 12282, 16915, -32598, 22235, 5892, -29313, 29312, -5893, -22236, 32597, -16916, -12283, 31666, -25750, -741, 26639, -31254, 10897, 18165, -32715, 21125, 7342, -29945, 28620, -4430, -23301, 32414, -15630, -13643, 32014, -24808, -2221, 27473, -30777, 9489, 19379, -32765, 19971, 8778, -30515, 27870, -2959, -24318, 32164, -14313, -14975, 32297, -23816, -3696, 28252, -30238, 8062, 20553, -32749, 18777, 10195, -31024, 27063, -1481, -25286, 31848, -12966, -16277, 32514, -22774, -5163, 28973, -29636, 6619, 21685, -32665, 17544, 11592, -31469, 26201}, -{0, -25286, 32164, -15630, -12283, 31253, -27474, 3695, 22773, -32665, 18777, 8778, -29945, 29312, -7343, -19972, 32748, -21686, -5163, 28252, -30777, 10897, 16915, -32415, 24317, 1480, -26202, 31848, -14313, -13643, 31666, -26640, 2220, 23815, -32515, 17544, 10195, -30515, 28620, -5893, -21126, 32764, -20554, -6620, 28973, -30238, 9489, 18165, -32598, 23300, 2958, -27064, 31468, -12966, -14975, 32014, -25750, 740, 24807, -32298, 16276, 11592, -31024, 27870, -4430, -22236, 32714, -19380, -8063, 29635, -29636, 8062, 19379, -32715, 22235, 4429, -27871, 31023, -11593, -16277, 32297, -24808, -741, 25749, -32015, 14974, 12965, -31469, 27063, -2959, -23301, 32597, -18166, -9490, 30237, -28974, 6619, 20553, -32765, 21125, 5892, -28621, 30514, -10196, -17545, 32514, -23816, -2221, 26639, -31667, 13642, 14312, -31849, 26201, -1481, -24318, 32414, -16916, -10898, 30776, -28253, 5162, 21685, -32749, 19971, 7342, -29313, 29944, -8779, -18778, 32664, -22774, -3696, 27473, -31254, 12282, 15629, -32165, 25285}, -{0, -24318, 32597, -19380, -6620, 28252, -31254, 13642, 12965, -31024, 28620, -7343, -18778, 32514, -24808, 740, 23815, -32665, 19971, 5892, -27871, 31468, -14313, -12283, 30776, -28974, 8062, 18165, -32415, 25285, -1481, -23301, 32714, -20554, -5163, 27473, -31667, 14974, 11592, -30515, 29312, -8779, -17545, 32297, -25750, 2220, 22773, -32749, 21125, 4429, -27064, 31848, -15630, -10898, 30237, -29636, 9489, 16915, -32165, 26201, -2959, -22236, 32764, -21686, -3696, 26639, -32015, 16276, 10195, -29945, 29944, -10196, -16277, 32014, -26640, 3695, 21685, -32765, 22235, 2958, -26202, 32164, -16916, -9490, 29635, -30238, 10897, 15629, -31849, 27063, -4430, -21126, 32748, -22774, -2221, 25749, -32298, 17544, 8778, -29313, 30514, -11593, -14975, 31666, -27474, 5162, 20553, -32715, 23300, 1480, -25286, 32414, -18166, -8063, 28973, -30777, 12282, 14312, -31469, 27870, -5893, -19972, 32664, -23816, -741, 24807, -32515, 18777, 7342, -28621, 31023, -12966, -13643, 31253, -28253, 6619, 19379, -32598, 24317}, -{0, -23301, 32764, -22774, -741, 23815, -32749, 22235, 1480, -24318, 32714, -21686, -2221, 24807, -32665, 21125, 2958, -25286, 32597, -20554, -3696, 25749, -32515, 19971, 4429, -26202, 32414, -19380, -5163, 26639, -32298, 18777, 5892, -27064, 32164, -18166, -6620, 27473, -32015, 17544, 7342, -27871, 31848, -16916, -8063, 28252, -31667, 16276, 8778, -28621, 31468, -15630, -9490, 28973, -31254, 14974, 10195, -29313, 31023, -14313, -10898, 29635, -30777, 13642, 11592, -29945, 30514, -12966, -12283, 30237, -30238, 12282, 12965, -30515, 29944, -11593, -13643, 30776, -29636, 10897, 14312, -31024, 29312, -10196, -14975, 31253, -28974, 9489, 15629, -31469, 28620, -8779, -16277, 31666, -28253, 8062, 16915, -31849, 27870, -7343, -17545, 32014, -27474, 6619, 18165, -32165, 27063, -5893, -18778, 32297, -26640, 5162, 19379, -32415, 26201, -4430, -19972, 32514, -25750, 3695, 20553, -32598, 25285, -2959, -21126, 32664, -24808, 2220, 21685, -32715, 24317, -1481, -22236, 32748, -23816, 740, 22773, -32765, 23300}, -{0, -22236, 32664, -25750, 5162, 18165, -31849, 28620, -10196, -13643, 30237, -30777, 14974, 8778, -27871, 32164, -19380, -3696, 24807, -32749, 23300, -1481, -21126, 32514, -26640, 6619, 16915, -31469, 29312, -11593, -12283, 29635, -31254, 16276, 7342, -27064, 32414, -20554, -2221, 23815, -32765, 24317, -2959, -19972, 32297, -27474, 8062, 15629, -31024, 29944, -12966, -10898, 28973, -31667, 17544, 5892, -26202, 32597, -21686, -741, 22773, -32715, 25285, -4430, -18778, 32014, -28253, 9489, 14312, -30515, 30514, -14313, -9490, 28252, -32015, 18777, 4429, -25286, 32714, -22774, 740, 21685, -32598, 26201, -5893, -17545, 31666, -28974, 10897, 12965, -29945, 31023, -15630, -8063, 27473, -32298, 19971, 2958, -24318, 32764, -23816, 2220, 20553, -32415, 27063, -7343, -16277, 31253, -29636, 12282, 11592, -29313, 31468, -16916, -6620, 26639, -32515, 21125, 1480, -23301, 32748, -24808, 3695, 19379, -32165, 27870, -8779, -14975, 30776, -30238, 13642, 10195, -28621, 31848, -18166, -5163, 25749, -32665, 22235}, -{0, -21126, 32297, -28253, 10897, 11592, -28621, 32164, -20554, -741, 21685, -32415, 27870, -10196, -12283, 28973, -32015, 19971, 1480, -22236, 32514, -27474, 9489, 12965, -29313, 31848, -19380, -2221, 22773, -32598, 27063, -8779, -13643, 29635, -31667, 18777, 2958, -23301, 32664, -26640, 8062, 14312, -29945, 31468, -18166, -3696, 23815, -32715, 26201, -7343, -14975, 30237, -31254, 17544, 4429, -24318, 32748, -25750, 6619, 15629, -30515, 31023, -16916, -5163, 24807, -32765, 25285, -5893, -16277, 30776, -30777, 16276, 5892, -25286, 32764, -24808, 5162, 16915, -31024, 30514, -15630, -6620, 25749, -32749, 24317, -4430, -17545, 31253, -30238, 14974, 7342, -26202, 32714, -23816, 3695, 18165, -31469, 29944, -14313, -8063, 26639, -32665, 23300, -2959, -18778, 31666, -29636, 13642, 8778, -27064, 32597, -22774, 2220, 19379, -31849, 29312, -12966, -9490, 27473, -32515, 22235, -1481, -19972, 32014, -28974, 12282, 10195, -27871, 32414, -21686, 740, 20553, -32165, 28620, -11593, -10898, 28252, -32298, 21125}, -{0, -19972, 31666, -30238, 16276, 4429, -23301, 32514, -28253, 12282, 8778, -26202, 32764, -25750, 8062, 12965, -28621, 32414, -22774, 3695, 16915, -30515, 31468, -19380, -741, 20553, -31849, 29944, -15630, -5163, 23815, -32598, 27870, -11593, -9490, 26639, -32749, 25285, -7343, -13643, 28973, -32298, 22235, -2959, -17545, 30776, -31254, 18777, 1480, -21126, 32014, -29636, 14974, 5892, -24318, 32664, -27474, 10897, 10195, -27064, 32714, -24808, 6619, 14312, -29313, 32164, -21686, 2220, 18165, -31024, 31023, -18166, -2221, 21685, -32165, 29312, -14313, -6620, 24807, -32715, 27063, -10196, -10898, 27473, -32665, 24317, -5893, -14975, 29635, -32015, 21125, -1481, -18778, 31253, -30777, 17544, 2958, -22236, 32297, -28974, 13642, 7342, -25286, 32748, -26640, 9489, 11592, -27871, 32597, -23816, 5162, 15629, -29945, 31848, -20554, 740, 19379, -31469, 30514, -16916, -3696, 22773, -32415, 28620, -12966, -8063, 25749, -32765, 26201, -8779, -12283, 28252, -32515, 23300, -4430, -16277, 30237, -31667, 19971}, -{0, -18778, 30776, -31667, 21125, -2959, -16277, 29635, -32298, 23300, -5893, -13643, 28252, -32665, 25285, -8779, -10898, 26639, -32765, 27063, -11593, -8063, 24807, -32598, 28620, -14313, -5163, 22773, -32165, 29944, -16916, -2221, 20553, -31469, 31023, -19380, 740, 18165, -30515, 31848, -21686, 3695, 15629, -29313, 32414, -23816, 6619, 12965, -27871, 32714, -25750, 9489, 10195, -26202, 32748, -27474, 12282, 7342, -24318, 32514, -28974, 14974, 4429, -22236, 32014, -30238, 17544, 1480, -19972, 31253, -31254, 19971, -1481, -17545, 30237, -32015, 22235, -4430, -14975, 28973, -32515, 24317, -7343, -12283, 27473, -32749, 26201, -10196, -9490, 25749, -32715, 27870, -12966, -6620, 23815, -32415, 29312, -15630, -3696, 21685, -31849, 30514, -18166, -741, 19379, -31024, 31468, -20554, 2220, 16915, -29945, 32164, -22774, 5162, 14312, -28621, 32597, -24808, 8062, 11592, -27064, 32764, -26640, 10897, 8778, -25286, 32664, -28253, 13642, 5892, -23301, 32297, -29636, 16276, 2958, -21126, 31666, -30777, 18777}, -{0, -17545, 29635, -32515, 25285, -10196, -8063, 23815, -32165, 30514, -19380, 2220, 15629, -28621, 32714, -26640, 12282, 5892, -22236, 31666, -31254, 21125, -4430, -13643, 27473, -32765, 27870, -14313, -3696, 20553, -31024, 31848, -22774, 6619, 11592, -26202, 32664, -28974, 16276, 1480, -18778, 30237, -32298, 24317, -8779, -9490, 24807, -32415, 29944, -18166, 740, 16915, -29313, 32597, -25750, 10897, 7342, -23301, 32014, -30777, 19971, -2959, -14975, 28252, -32749, 27063, -12966, -5163, 21685, -31469, 31468, -21686, 5162, 12965, -27064, 32748, -28253, 14974, 2958, -19972, 30776, -32015, 23300, -7343, -10898, 25749, -32598, 29312, -16916, -741, 18165, -29945, 32414, -24808, 9489, 8778, -24318, 32297, -30238, 18777, -1481, -16277, 28973, -32665, 26201, -11593, -6620, 22773, -31849, 31023, -20554, 3695, 14312, -27871, 32764, -27474, 13642, 4429, -21126, 31253, -31667, 22235, -5893, -12283, 26639, -32715, 28620, -15630, -2221, 19379, -30515, 32164, -23816, 8062, 10195, -25286, 32514, -29636, 17544}, -{0, -16277, 28252, -32765, 28620, -16916, 740, 15629, -27871, 32748, -28974, 17544, -1481, -14975, 27473, -32715, 29312, -18166, 2220, 14312, -27064, 32664, -29636, 18777, -2959, -13643, 26639, -32598, 29944, -19380, 3695, 12965, -26202, 32514, -30238, 19971, -4430, -12283, 25749, -32415, 30514, -20554, 5162, 11592, -25286, 32297, -30777, 21125, -5893, -10898, 24807, -32165, 31023, -21686, 6619, 10195, -24318, 32014, -31254, 22235, -7343, -9490, 23815, -31849, 31468, -22774, 8062, 8778, -23301, 31666, -31667, 23300, -8779, -8063, 22773, -31469, 31848, -23816, 9489, 7342, -22236, 31253, -32015, 24317, -10196, -6620, 21685, -31024, 32164, -24808, 10897, 5892, -21126, 30776, -32298, 25285, -11593, -5163, 20553, -30515, 32414, -25750, 12282, 4429, -19972, 30237, -32515, 26201, -12966, -3696, 19379, -29945, 32597, -26640, 13642, 2958, -18778, 29635, -32665, 27063, -14313, -2221, 18165, -29313, 32714, -27474, 14974, 1480, -17545, 28973, -32749, 27870, -15630, -741, 16915, -28621, 32764, -28253, 16276}, -{0, -14975, 26639, -32415, 31023, -22774, 9489, 5892, -19972, 29635, -32749, 28620, -18166, 3695, 11592, -24318, 31666, -32015, 25285, -12966, -2221, 16915, -27871, 32664, -30238, 21125, -7343, -8063, 21685, -30515, 32597, -27474, 16276, -1481, -13643, 25749, -32165, 31468, -23816, 10897, 4429, -18778, 28973, -32765, 29312, -19380, 5162, 10195, -23301, 31253, -32298, 26201, -14313, -741, 15629, -27064, 32514, -30777, 22235, -8779, -6620, 20553, -29945, 32714, -28253, 17544, -2959, -12283, 24807, -31849, 31848, -24808, 12282, 2958, -17545, 28252, -32715, 29944, -20554, 6619, 8778, -22236, 30776, -32515, 27063, -15630, 740, 14312, -26202, 32297, -31254, 23300, -10196, -5163, 19379, -29313, 32764, -28974, 18777, -4430, -10898, 23815, -31469, 32164, -25750, 13642, 1480, -16277, 27473, -32598, 30514, -21686, 8062, 7342, -21126, 30237, -32665, 27870, -16916, 2220, 12965, -25286, 32014, -31667, 24317, -11593, -3696, 18165, -28621, 32748, -29636, 19971, -5893, -9490, 22773, -31024, 32414, -26640, 14974}, -{0, -13643, 24807, -31469, 32414, -27474, 17544, -4430, -9490, 21685, -29945, 32764, -29636, 21125, -8779, -5163, 18165, -27871, 32514, -31254, 24317, -12966, -741, 14312, -25286, 31666, -32298, 27063, -16916, 3695, 10195, -22236, 30237, -32749, 29312, -20554, 8062, 5892, -18778, 28252, -32598, 31023, -23816, 12282, 1480, -14975, 25749, -31849, 32164, -26640, 16276, -2959, -10898, 22773, -30515, 32714, -28974, 19971, -7343, -6620, 19379, -28621, 32664, -30777, 23300, -11593, -2221, 15629, -26202, 32014, -32015, 26201, -15630, 2220, 11592, -23301, 30776, -32665, 28620, -19380, 6619, 7342, -19972, 28973, -32715, 30514, -22774, 10897, 2958, -16277, 26639, -32165, 31848, -25750, 14974, -1481, -12283, 23815, -31024, 32597, -28253, 18777, -5893, -8063, 20553, -29313, 32748, -30238, 22235, -10196, -3696, 16915, -27064, 32297, -31667, 25285, -14313, 740, 12965, -24318, 31253, -32515, 27870, -18166, 5162, 8778, -21126, 29635, -32765, 29944, -21686, 9489, 4429, -17545, 27473, -32415, 31468, -24808, 13642}, -{0, -12283, 22773, -29945, 32748, -30777, 24317, -14313, 2220, 10195, -21126, 28973, -32598, 31468, -25750, 16276, -4430, -8063, 19379, -27871, 32297, -32015, 27063, -18166, 6619, 5892, -17545, 26639, -31849, 32414, -28253, 19971, -8779, -3696, 15629, -25286, 31253, -32665, 29312, -21686, 10897, 1480, -13643, 23815, -30515, 32764, -30238, 23300, -12966, 740, 11592, -22236, 29635, -32715, 31023, -24808, 14974, -2959, -9490, 20553, -28621, 32514, -31667, 26201, -16916, 5162, 7342, -18778, 27473, -32165, 32164, -27474, 18777, -7343, -5163, 16915, -26202, 31666, -32515, 28620, -20554, 9489, 2958, -14975, 24807, -31024, 32714, -29636, 22235, -11593, -741, 12965, -23301, 30237, -32765, 30514, -23816, 13642, -1481, -10898, 21685, -29313, 32664, -31254, 25285, -15630, 3695, 8778, -19972, 28252, -32415, 31848, -26640, 17544, -5893, -6620, 18165, -27064, 32014, -32298, 27870, -19380, 8062, 4429, -16277, 25749, -31469, 32597, -28974, 21125, -10196, -2221, 14312, -24318, 30776, -32749, 29944, -22774, 12282}, -{0, -10898, 20553, -27871, 32014, -32515, 29312, -22774, 13642, -2959, -8063, 18165, -26202, 31253, -32749, 30514, -24808, 16276, -5893, -5163, 15629, -24318, 30237, -32715, 31468, -26640, 18777, -8779, -2221, 12965, -22236, 28973, -32415, 32164, -28253, 21125, -11593, 740, 10195, -19972, 27473, -31849, 32597, -29636, 23300, -14313, 3695, 7342, -17545, 25749, -31024, 32764, -30777, 25285, -16916, 6619, 4429, -14975, 23815, -29945, 32664, -31667, 27063, -19380, 9489, 1480, -12283, 21685, -28621, 32297, -32298, 28620, -21686, 12282, -1481, -9490, 19379, -27064, 31666, -32665, 29944, -23816, 14974, -4430, -6620, 16915, -25286, 30776, -32765, 31023, -25750, 17544, -7343, -3696, 14312, -23301, 29635, -32598, 31848, -27474, 19971, -10196, -741, 11592, -21126, 28252, -32165, 32414, -28974, 22235, -12966, 2220, 8778, -18778, 26639, -31469, 32714, -30238, 24317, -15630, 5162, 5892, -16277, 24807, -30515, 32748, -31254, 26201, -18166, 8062, 2958, -13643, 22773, -29313, 32514, -32015, 27870, -20554, 10897}, -{0, -9490, 18165, -25286, 30237, -32598, 32164, -28974, 23300, -15630, 6619, 2958, -12283, 20553, -27064, 31253, -32765, 31468, -27474, 21125, -12966, 3695, 5892, -14975, 22773, -28621, 32014, -32665, 30514, -25750, 18777, -10196, 740, 8778, -17545, 24807, -29945, 32514, -32298, 29312, -23816, 16276, -7343, -2221, 11592, -19972, 26639, -31024, 32748, -31667, 27870, -21686, 13642, -4430, -5163, 14312, -22236, 28252, -31849, 32714, -30777, 26201, -19380, 10897, -1481, -8063, 16915, -24318, 29635, -32415, 32414, -29636, 24317, -16916, 8062, 1480, -10898, 19379, -26202, 30776, -32715, 31848, -28253, 22235, -14313, 5162, 4429, -13643, 21685, -27871, 31666, -32749, 31023, -26640, 19971, -11593, 2220, 7342, -16277, 23815, -29313, 32297, -32515, 29944, -24808, 17544, -8779, -741, 10195, -18778, 25749, -30515, 32664, -32015, 28620, -22774, 14974, -5893, -3696, 12965, -21126, 27473, -31469, 32764, -31254, 27063, -20554, 12282, -2959, -6620, 15629, -23301, 28973, -32165, 32597, -30238, 25285, -18166, 9489}, -{0, -8063, 15629, -22236, 27473, -31024, 32664, -32298, 29944, -25750, 19971, -12966, 5162, 2958, -10898, 18165, -24318, 28973, -31849, 32764, -31667, 28620, -23816, 17544, -10196, 2220, 5892, -13643, 20553, -26202, 30237, -32415, 32597, -30777, 27063, -21686, 14974, -7343, -741, 8778, -16277, 22773, -27871, 31253, -32715, 32164, -29636, 25285, -19380, 12282, -4430, -3696, 11592, -18778, 24807, -29313, 32014, -32749, 31468, -28253, 23300, -16916, 9489, -1481, -6620, 14312, -21126, 26639, -30515, 32514, -32515, 30514, -26640, 21125, -14313, 6619, 1480, -9490, 16915, -23301, 28252, -31469, 32748, -32015, 29312, -24808, 18777, -11593, 3695, 4429, -12283, 19379, -25286, 29635, -32165, 32714, -31254, 27870, -22774, 16276, -8779, 740, 7342, -14975, 21685, -27064, 30776, -32598, 32414, -30238, 26201, -20554, 13642, -5893, -2221, 10195, -17545, 23815, -28621, 31666, -32765, 31848, -28974, 24317, -18166, 10897, -2959, -5163, 12965, -19972, 25749, -29945, 32297, -32665, 31023, -27474, 22235, -15630, 8062}, -{0, -6620, 12965, -18778, 23815, -27871, 30776, -32415, 32714, -31667, 29312, -25750, 21125, -15630, 9489, -2959, -3696, 10195, -16277, 21685, -26202, 29635, -31849, 32748, -32298, 30514, -27474, 23300, -18166, 12282, -5893, -741, 7342, -13643, 19379, -24318, 28252, -31024, 32514, -32665, 31468, -28974, 25285, -20554, 14974, -8779, 2220, 4429, -10898, 16915, -22236, 26639, -29945, 32014, -32765, 32164, -30238, 27063, -22774, 17544, -11593, 5162, 1480, -8063, 14312, -19972, 24807, -28621, 31253, -32598, 32597, -31254, 28620, -24808, 19971, -14313, 8062, -1481, -5163, 11592, -17545, 22773, -27064, 30237, -32165, 32764, -32015, 29944, -26640, 22235, -16916, 10897, -4430, -2221, 8778, -14975, 20553, -25286, 28973, -31469, 32664, -32515, 31023, -28253, 24317, -19380, 13642, -7343, 740, 5892, -12283, 18165, -23301, 27473, -30515, 32297, -32749, 31848, -29636, 26201, -21686, 16276, -10196, 3695, 2958, -9490, 15629, -21126, 25749, -29313, 31666, -32715, 32414, -30777, 27870, -23816, 18777, -12966, 6619}, -{0, -5163, 10195, -14975, 19379, -23301, 26639, -29313, 31253, -32415, 32764, -32298, 31023, -28974, 26201, -22774, 18777, -14313, 9489, -4430, -741, 5892, -10898, 15629, -19972, 23815, -27064, 29635, -31469, 32514, -32749, 32164, -30777, 28620, -25750, 22235, -18166, 13642, -8779, 3695, 1480, -6620, 11592, -16277, 20553, -24318, 27473, -29945, 31666, -32598, 32714, -32015, 30514, -28253, 25285, -21686, 17544, -12966, 8062, -2959, -2221, 7342, -12283, 16915, -21126, 24807, -27871, 30237, -31849, 32664, -32665, 31848, -30238, 27870, -24808, 21125, -16916, 12282, -7343, 2220, 2958, -8063, 12965, -17545, 21685, -25286, 28252, -30515, 32014, -32715, 32597, -31667, 29944, -27474, 24317, -20554, 16276, -11593, 6619, -1481, -3696, 8778, -13643, 18165, -22236, 25749, -28621, 30776, -32165, 32748, -32515, 31468, -29636, 27063, -23816, 19971, -15630, 10897, -5893, 740, 4429, -9490, 14312, -18778, 22773, -26202, 28973, -31024, 32297, -32765, 32414, -31254, 29312, -26640, 23300, -19380, 14974, -10196, 5162}, -{0, -3696, 7342, -10898, 14312, -17545, 20553, -23301, 25749, -27871, 29635, -31024, 32014, -32598, 32764, -32515, 31848, -30777, 29312, -27474, 25285, -22774, 19971, -16916, 13642, -10196, 6619, -2959, -741, 4429, -8063, 11592, -14975, 18165, -21126, 23815, -26202, 28252, -29945, 31253, -32165, 32664, -32749, 32414, -31667, 30514, -28974, 27063, -24808, 22235, -19380, 16276, -12966, 9489, -5893, 2220, 1480, -5163, 8778, -12283, 15629, -18778, 21685, -24318, 26639, -28621, 30237, -31469, 32297, -32715, 32714, -32298, 31468, -30238, 28620, -26640, 24317, -21686, 18777, -15630, 12282, -8779, 5162, -1481, -2221, 5892, -9490, 12965, -16277, 19379, -22236, 24807, -27064, 28973, -30515, 31666, -32415, 32748, -32665, 32164, -31254, 29944, -28253, 26201, -23816, 21125, -18166, 14974, -11593, 8062, -4430, 740, 2958, -6620, 10195, -13643, 16915, -19972, 22773, -25286, 27473, -29313, 30776, -31849, 32514, -32765, 32597, -32015, 31023, -29636, 27870, -25750, 23300, -20554, 17544, -14313, 10897, -7343, 3695}, -{0, -2221, 4429, -6620, 8778, -10898, 12965, -14975, 16915, -18778, 20553, -22236, 23815, -25286, 26639, -27871, 28973, -29945, 30776, -31469, 32014, -32415, 32664, -32765, 32714, -32515, 32164, -31667, 31023, -30238, 29312, -28253, 27063, -25750, 24317, -22774, 21125, -19380, 17544, -15630, 13642, -11593, 9489, -7343, 5162, -2959, 740, 1480, -3696, 5892, -8063, 10195, -12283, 14312, -16277, 18165, -19972, 21685, -23301, 24807, -26202, 27473, -28621, 29635, -30515, 31253, -31849, 32297, -32598, 32748, -32749, 32597, -32298, 31848, -31254, 30514, -29636, 28620, -27474, 26201, -24808, 23300, -21686, 19971, -18166, 16276, -14313, 12282, -10196, 8062, -5893, 3695, -1481, -741, 2958, -5163, 7342, -9490, 11592, -13643, 15629, -17545, 19379, -21126, 22773, -24318, 25749, -27064, 28252, -29313, 30237, -31024, 31666, -32165, 32514, -32715, 32764, -32665, 32414, -32015, 31468, -30777, 29944, -28974, 27870, -26640, 25285, -23816, 22235, -20554, 18777, -16916, 14974, -12966, 10897, -8779, 6619, -4430, 2220}, -{0, -741, 1480, -2221, 2958, -3696, 4429, -5163, 5892, -6620, 7342, -8063, 8778, -9490, 10195, -10898, 11592, -12283, 12965, -13643, 14312, -14975, 15629, -16277, 16915, -17545, 18165, -18778, 19379, -19972, 20553, -21126, 21685, -22236, 22773, -23301, 23815, -24318, 24807, -25286, 25749, -26202, 26639, -27064, 27473, -27871, 28252, -28621, 28973, -29313, 29635, -29945, 30237, -30515, 30776, -31024, 31253, -31469, 31666, -31849, 32014, -32165, 32297, -32415, 32514, -32598, 32664, -32715, 32748, -32765, 32764, -32749, 32714, -32665, 32597, -32515, 32414, -32298, 32164, -32015, 31848, -31667, 31468, -31254, 31023, -30777, 30514, -30238, 29944, -29636, 29312, -28974, 28620, -28253, 27870, -27474, 27063, -26640, 26201, -25750, 25285, -24808, 24317, -23816, 23300, -22774, 22235, -21686, 21125, -20554, 19971, -19380, 18777, -18166, 17544, -16916, 16276, -15630, 14974, -14313, 13642, -12966, 12282, -11593, 10897, -10196, 9489, -8779, 8062, -7343, 6619, -5893, 5162, -4430, 3695, -2959, 2220, -1481, 740}, -{0, 740, -1481, 2220, -2959, 3695, -4430, 5162, -5893, 6619, -7343, 8062, -8779, 9489, -10196, 10897, -11593, 12282, -12966, 13642, -14313, 14974, -15630, 16276, -16916, 17544, -18166, 18777, -19380, 19971, -20554, 21125, -21686, 22235, -22774, 23300, -23816, 24317, -24808, 25285, -25750, 26201, -26640, 27063, -27474, 27870, -28253, 28620, -28974, 29312, -29636, 29944, -30238, 30514, -30777, 31023, -31254, 31468, -31667, 31848, -32015, 32164, -32298, 32414, -32515, 32597, -32665, 32714, -32749, 32764, -32765, 32748, -32715, 32664, -32598, 32514, -32415, 32297, -32165, 32014, -31849, 31666, -31469, 31253, -31024, 30776, -30515, 30237, -29945, 29635, -29313, 28973, -28621, 28252, -27871, 27473, -27064, 26639, -26202, 25749, -25286, 24807, -24318, 23815, -23301, 22773, -22236, 21685, -21126, 20553, -19972, 19379, -18778, 18165, -17545, 16915, -16277, 15629, -14975, 14312, -13643, 12965, -12283, 11592, -10898, 10195, -9490, 8778, -8063, 7342, -6620, 5892, -5163, 4429, -3696, 2958, -2221, 1480, -741}, -{0, 2220, -4430, 6619, -8779, 10897, -12966, 14974, -16916, 18777, -20554, 22235, -23816, 25285, -26640, 27870, -28974, 29944, -30777, 31468, -32015, 32414, -32665, 32764, -32715, 32514, -32165, 31666, -31024, 30237, -29313, 28252, -27064, 25749, -24318, 22773, -21126, 19379, -17545, 15629, -13643, 11592, -9490, 7342, -5163, 2958, -741, -1481, 3695, -5893, 8062, -10196, 12282, -14313, 16276, -18166, 19971, -21686, 23300, -24808, 26201, -27474, 28620, -29636, 30514, -31254, 31848, -32298, 32597, -32749, 32748, -32598, 32297, -31849, 31253, -30515, 29635, -28621, 27473, -26202, 24807, -23301, 21685, -19972, 18165, -16277, 14312, -12283, 10195, -8063, 5892, -3696, 1480, 740, -2959, 5162, -7343, 9489, -11593, 13642, -15630, 17544, -19380, 21125, -22774, 24317, -25750, 27063, -28253, 29312, -30238, 31023, -31667, 32164, -32515, 32714, -32765, 32664, -32415, 32014, -31469, 30776, -29945, 28973, -27871, 26639, -25286, 23815, -22236, 20553, -18778, 16915, -14975, 12965, -10898, 8778, -6620, 4429, -2221}, -{0, 3695, -7343, 10897, -14313, 17544, -20554, 23300, -25750, 27870, -29636, 31023, -32015, 32597, -32765, 32514, -31849, 30776, -29313, 27473, -25286, 22773, -19972, 16915, -13643, 10195, -6620, 2958, 740, -4430, 8062, -11593, 14974, -18166, 21125, -23816, 26201, -28253, 29944, -31254, 32164, -32665, 32748, -32415, 31666, -30515, 28973, -27064, 24807, -22236, 19379, -16277, 12965, -9490, 5892, -2221, -1481, 5162, -8779, 12282, -15630, 18777, -21686, 24317, -26640, 28620, -30238, 31468, -32298, 32714, -32715, 32297, -31469, 30237, -28621, 26639, -24318, 21685, -18778, 15629, -12283, 8778, -5163, 1480, 2220, -5893, 9489, -12966, 16276, -19380, 22235, -24808, 27063, -28974, 30514, -31667, 32414, -32749, 32664, -32165, 31253, -29945, 28252, -26202, 23815, -21126, 18165, -14975, 11592, -8063, 4429, -741, -2959, 6619, -10196, 13642, -16916, 19971, -22774, 25285, -27474, 29312, -30777, 31848, -32515, 32764, -32598, 32014, -31024, 29635, -27871, 25749, -23301, 20553, -17545, 14312, -10898, 7342, -3696}, -{0, 5162, -10196, 14974, -19380, 23300, -26640, 29312, -31254, 32414, -32765, 32297, -31024, 28973, -26202, 22773, -18778, 14312, -9490, 4429, 740, -5893, 10897, -15630, 19971, -23816, 27063, -29636, 31468, -32515, 32748, -32165, 30776, -28621, 25749, -22236, 18165, -13643, 8778, -3696, -1481, 6619, -11593, 16276, -20554, 24317, -27474, 29944, -31667, 32597, -32715, 32014, -30515, 28252, -25286, 21685, -17545, 12965, -8063, 2958, 2220, -7343, 12282, -16916, 21125, -24808, 27870, -30238, 31848, -32665, 32664, -31849, 30237, -27871, 24807, -21126, 16915, -12283, 7342, -2221, -2959, 8062, -12966, 17544, -21686, 25285, -28253, 30514, -32015, 32714, -32598, 31666, -29945, 27473, -24318, 20553, -16277, 11592, -6620, 1480, 3695, -8779, 13642, -18166, 22235, -25750, 28620, -30777, 32164, -32749, 32514, -31469, 29635, -27064, 23815, -19972, 15629, -10898, 5892, -741, -4430, 9489, -14313, 18777, -22774, 26201, -28974, 31023, -32298, 32764, -32415, 31253, -29313, 26639, -23301, 19379, -14975, 10195, -5163}, -{0, 6619, -12966, 18777, -23816, 27870, -30777, 32414, -32715, 31666, -29313, 25749, -21126, 15629, -9490, 2958, 3695, -10196, 16276, -21686, 26201, -29636, 31848, -32749, 32297, -30515, 27473, -23301, 18165, -12283, 5892, 740, -7343, 13642, -19380, 24317, -28253, 31023, -32515, 32664, -31469, 28973, -25286, 20553, -14975, 8778, -2221, -4430, 10897, -16916, 22235, -26640, 29944, -32015, 32764, -32165, 30237, -27064, 22773, -17545, 11592, -5163, -1481, 8062, -14313, 19971, -24808, 28620, -31254, 32597, -32598, 31253, -28621, 24807, -19972, 14312, -8063, 1480, 5162, -11593, 17544, -22774, 27063, -30238, 32164, -32765, 32014, -29945, 26639, -22236, 16915, -10898, 4429, 2220, -8779, 14974, -20554, 25285, -28974, 31468, -32665, 32514, -31024, 28252, -24318, 19379, -13643, 7342, -741, -5893, 12282, -18166, 23300, -27474, 30514, -32298, 32748, -31849, 29635, -26202, 21685, -16277, 10195, -3696, -2959, 9489, -15630, 21125, -25750, 29312, -31667, 32714, -32415, 30776, -27871, 23815, -18778, 12965, -6620}, -{0, 8062, -15630, 22235, -27474, 31023, -32665, 32297, -29945, 25749, -19972, 12965, -5163, -2959, 10897, -18166, 24317, -28974, 31848, -32765, 31666, -28621, 23815, -17545, 10195, -2221, -5893, 13642, -20554, 26201, -30238, 32414, -32598, 30776, -27064, 21685, -14975, 7342, 740, -8779, 16276, -22774, 27870, -31254, 32714, -32165, 29635, -25286, 19379, -12283, 4429, 3695, -11593, 18777, -24808, 29312, -32015, 32748, -31469, 28252, -23301, 16915, -9490, 1480, 6619, -14313, 21125, -26640, 30514, -32515, 32514, -30515, 26639, -21126, 14312, -6620, -1481, 9489, -16916, 23300, -28253, 31468, -32749, 32014, -29313, 24807, -18778, 11592, -3696, -4430, 12282, -19380, 25285, -29636, 32164, -32715, 31253, -27871, 22773, -16277, 8778, -741, -7343, 14974, -21686, 27063, -30777, 32597, -32415, 30237, -26202, 20553, -13643, 5892, 2220, -10196, 17544, -23816, 28620, -31667, 32764, -31849, 28973, -24318, 18165, -10898, 2958, 5162, -12966, 19971, -25750, 29944, -32298, 32664, -31024, 27473, -22236, 15629, -8063}, -{0, 9489, -18166, 25285, -30238, 32597, -32165, 28973, -23301, 15629, -6620, -2959, 12282, -20554, 27063, -31254, 32764, -31469, 27473, -21126, 12965, -3696, -5893, 14974, -22774, 28620, -32015, 32664, -30515, 25749, -18778, 10195, -741, -8779, 17544, -24808, 29944, -32515, 32297, -29313, 23815, -16277, 7342, 2220, -11593, 19971, -26640, 31023, -32749, 31666, -27871, 21685, -13643, 4429, 5162, -14313, 22235, -28253, 31848, -32715, 30776, -26202, 19379, -10898, 1480, 8062, -16916, 24317, -29636, 32414, -32415, 29635, -24318, 16915, -8063, -1481, 10897, -19380, 26201, -30777, 32714, -31849, 28252, -22236, 14312, -5163, -4430, 13642, -21686, 27870, -31667, 32748, -31024, 26639, -19972, 11592, -2221, -7343, 16276, -23816, 29312, -32298, 32514, -29945, 24807, -17545, 8778, 740, -10196, 18777, -25750, 30514, -32665, 32014, -28621, 22773, -14975, 5892, 3695, -12966, 21125, -27474, 31468, -32765, 31253, -27064, 20553, -12283, 2958, 6619, -15630, 23300, -28974, 32164, -32598, 30237, -25286, 18165, -9490}, -{0, 10897, -20554, 27870, -32015, 32514, -29313, 22773, -13643, 2958, 8062, -18166, 26201, -31254, 32748, -30515, 24807, -16277, 5892, 5162, -15630, 24317, -30238, 32714, -31469, 26639, -18778, 8778, 2220, -12966, 22235, -28974, 32414, -32165, 28252, -21126, 11592, -741, -10196, 19971, -27474, 31848, -32598, 29635, -23301, 14312, -3696, -7343, 17544, -25750, 31023, -32765, 30776, -25286, 16915, -6620, -4430, 14974, -23816, 29944, -32665, 31666, -27064, 19379, -9490, -1481, 12282, -21686, 28620, -32298, 32297, -28621, 21685, -12283, 1480, 9489, -19380, 27063, -31667, 32664, -29945, 23815, -14975, 4429, 6619, -16916, 25285, -30777, 32764, -31024, 25749, -17545, 7342, 3695, -14313, 23300, -29636, 32597, -31849, 27473, -19972, 10195, 740, -11593, 21125, -28253, 32164, -32415, 28973, -22236, 12965, -2221, -8779, 18777, -26640, 31468, -32715, 30237, -24318, 15629, -5163, -5893, 16276, -24808, 30514, -32749, 31253, -26202, 18165, -8063, -2959, 13642, -22774, 29312, -32515, 32014, -27871, 20553, -10898}, -{0, 12282, -22774, 29944, -32749, 30776, -24318, 14312, -2221, -10196, 21125, -28974, 32597, -31469, 25749, -16277, 4429, 8062, -19380, 27870, -32298, 32014, -27064, 18165, -6620, -5893, 17544, -26640, 31848, -32415, 28252, -19972, 8778, 3695, -15630, 25285, -31254, 32664, -29313, 21685, -10898, -1481, 13642, -23816, 30514, -32765, 30237, -23301, 12965, -741, -11593, 22235, -29636, 32714, -31024, 24807, -14975, 2958, 9489, -20554, 28620, -32515, 31666, -26202, 16915, -5163, -7343, 18777, -27474, 32164, -32165, 27473, -18778, 7342, 5162, -16916, 26201, -31667, 32514, -28621, 20553, -9490, -2959, 14974, -24808, 31023, -32715, 29635, -22236, 11592, 740, -12966, 23300, -30238, 32764, -30515, 23815, -13643, 1480, 10897, -21686, 29312, -32665, 31253, -25286, 15629, -3696, -8779, 19971, -28253, 32414, -31849, 26639, -17545, 5892, 6619, -18166, 27063, -32015, 32297, -27871, 19379, -8063, -4430, 16276, -25750, 31468, -32598, 28973, -21126, 10195, 2220, -14313, 24317, -30777, 32748, -29945, 22773, -12283}, -{0, 13642, -24808, 31468, -32415, 27473, -17545, 4429, 9489, -21686, 29944, -32765, 29635, -21126, 8778, 5162, -18166, 27870, -32515, 31253, -24318, 12965, 740, -14313, 25285, -31667, 32297, -27064, 16915, -3696, -10196, 22235, -30238, 32748, -29313, 20553, -8063, -5893, 18777, -28253, 32597, -31024, 23815, -12283, -1481, 14974, -25750, 31848, -32165, 26639, -16277, 2958, 10897, -22774, 30514, -32715, 28973, -19972, 7342, 6619, -19380, 28620, -32665, 30776, -23301, 11592, 2220, -15630, 26201, -32015, 32014, -26202, 15629, -2221, -11593, 23300, -30777, 32664, -28621, 19379, -6620, -7343, 19971, -28974, 32714, -30515, 22773, -10898, -2959, 16276, -26640, 32164, -31849, 25749, -14975, 1480, 12282, -23816, 31023, -32598, 28252, -18778, 5892, 8062, -20554, 29312, -32749, 30237, -22236, 10195, 3695, -16916, 27063, -32298, 31666, -25286, 14312, -741, -12966, 24317, -31254, 32514, -27871, 18165, -5163, -8779, 21125, -29636, 32764, -29945, 21685, -9490, -4430, 17544, -27474, 32414, -31469, 24807, -13643}, -{0, 14974, -26640, 32414, -31024, 22773, -9490, -5893, 19971, -29636, 32748, -28621, 18165, -3696, -11593, 24317, -31667, 32014, -25286, 12965, 2220, -16916, 27870, -32665, 30237, -21126, 7342, 8062, -21686, 30514, -32598, 27473, -16277, 1480, 13642, -25750, 32164, -31469, 23815, -10898, -4430, 18777, -28974, 32764, -29313, 19379, -5163, -10196, 23300, -31254, 32297, -26202, 14312, 740, -15630, 27063, -32515, 30776, -22236, 8778, 6619, -20554, 29944, -32715, 28252, -17545, 2958, 12282, -24808, 31848, -31849, 24807, -12283, -2959, 17544, -28253, 32714, -29945, 20553, -6620, -8779, 22235, -30777, 32514, -27064, 15629, -741, -14313, 26201, -32298, 31253, -23301, 10195, 5162, -19380, 29312, -32765, 28973, -18778, 4429, 10897, -23816, 31468, -32165, 25749, -13643, -1481, 16276, -27474, 32597, -30515, 21685, -8063, -7343, 21125, -30238, 32664, -27871, 16915, -2221, -12966, 25285, -32015, 31666, -24318, 11592, 3695, -18166, 28620, -32749, 29635, -19972, 5892, 9489, -22774, 31023, -32415, 26639, -14975}, -{0, 16276, -28253, 32764, -28621, 16915, -741, -15630, 27870, -32749, 28973, -17545, 1480, 14974, -27474, 32714, -29313, 18165, -2221, -14313, 27063, -32665, 29635, -18778, 2958, 13642, -26640, 32597, -29945, 19379, -3696, -12966, 26201, -32515, 30237, -19972, 4429, 12282, -25750, 32414, -30515, 20553, -5163, -11593, 25285, -32298, 30776, -21126, 5892, 10897, -24808, 32164, -31024, 21685, -6620, -10196, 24317, -32015, 31253, -22236, 7342, 9489, -23816, 31848, -31469, 22773, -8063, -8779, 23300, -31667, 31666, -23301, 8778, 8062, -22774, 31468, -31849, 23815, -9490, -7343, 22235, -31254, 32014, -24318, 10195, 6619, -21686, 31023, -32165, 24807, -10898, -5893, 21125, -30777, 32297, -25286, 11592, 5162, -20554, 30514, -32415, 25749, -12283, -4430, 19971, -30238, 32514, -26202, 12965, 3695, -19380, 29944, -32598, 26639, -13643, -2959, 18777, -29636, 32664, -27064, 14312, 2220, -18166, 29312, -32715, 27473, -14975, -1481, 17544, -28974, 32748, -27871, 15629, 740, -16916, 28620, -32765, 28252, -16277}, -{0, 17544, -29636, 32514, -25286, 10195, 8062, -23816, 32164, -30515, 19379, -2221, -15630, 28620, -32715, 26639, -12283, -5893, 22235, -31667, 31253, -21126, 4429, 13642, -27474, 32764, -27871, 14312, 3695, -20554, 31023, -31849, 22773, -6620, -11593, 26201, -32665, 28973, -16277, -1481, 18777, -30238, 32297, -24318, 8778, 9489, -24808, 32414, -29945, 18165, -741, -16916, 29312, -32598, 25749, -10898, -7343, 23300, -32015, 30776, -19972, 2958, 14974, -28253, 32748, -27064, 12965, 5162, -21686, 31468, -31469, 21685, -5163, -12966, 27063, -32749, 28252, -14975, -2959, 19971, -30777, 32014, -23301, 7342, 10897, -25750, 32597, -29313, 16915, 740, -18166, 29944, -32415, 24807, -9490, -8779, 24317, -32298, 30237, -18778, 1480, 16276, -28974, 32664, -26202, 11592, 6619, -22774, 31848, -31024, 20553, -3696, -14313, 27870, -32765, 27473, -13643, -4430, 21125, -31254, 31666, -22236, 5892, 12282, -26640, 32714, -28621, 15629, 2220, -19380, 30514, -32165, 23815, -8063, -10196, 25285, -32515, 29635, -17545}, -{0, 18777, -30777, 31666, -21126, 2958, 16276, -29636, 32297, -23301, 5892, 13642, -28253, 32664, -25286, 8778, 10897, -26640, 32764, -27064, 11592, 8062, -24808, 32597, -28621, 14312, 5162, -22774, 32164, -29945, 16915, 2220, -20554, 31468, -31024, 19379, -741, -18166, 30514, -31849, 21685, -3696, -15630, 29312, -32415, 23815, -6620, -12966, 27870, -32715, 25749, -9490, -10196, 26201, -32749, 27473, -12283, -7343, 24317, -32515, 28973, -14975, -4430, 22235, -32015, 30237, -17545, -1481, 19971, -31254, 31253, -19972, 1480, 17544, -30238, 32014, -22236, 4429, 14974, -28974, 32514, -24318, 7342, 12282, -27474, 32748, -26202, 10195, 9489, -25750, 32714, -27871, 12965, 6619, -23816, 32414, -29313, 15629, 3695, -21686, 31848, -30515, 18165, 740, -19380, 31023, -31469, 20553, -2221, -16916, 29944, -32165, 22773, -5163, -14313, 28620, -32598, 24807, -8063, -11593, 27063, -32765, 26639, -10898, -8779, 25285, -32665, 28252, -13643, -5893, 23300, -32298, 29635, -16277, -2959, 21125, -31667, 30776, -18778}, -{0, 19971, -31667, 30237, -16277, -4430, 23300, -32515, 28252, -12283, -8779, 26201, -32765, 25749, -8063, -12966, 28620, -32415, 22773, -3696, -16916, 30514, -31469, 19379, 740, -20554, 31848, -29945, 15629, 5162, -23816, 32597, -27871, 11592, 9489, -26640, 32748, -25286, 7342, 13642, -28974, 32297, -22236, 2958, 17544, -30777, 31253, -18778, -1481, 21125, -32015, 29635, -14975, -5893, 24317, -32665, 27473, -10898, -10196, 27063, -32715, 24807, -6620, -14313, 29312, -32165, 21685, -2221, -18166, 31023, -31024, 18165, 2220, -21686, 32164, -29313, 14312, 6619, -24808, 32714, -27064, 10195, 10897, -27474, 32664, -24318, 5892, 14974, -29636, 32014, -21126, 1480, 18777, -31254, 30776, -17545, -2959, 22235, -32298, 28973, -13643, -7343, 25285, -32749, 26639, -9490, -11593, 27870, -32598, 23815, -5163, -15630, 29944, -31849, 20553, -741, -19380, 31468, -30515, 16915, 3695, -22774, 32414, -28621, 12965, 8062, -25750, 32764, -26202, 8778, 12282, -28253, 32514, -23301, 4429, 16276, -30238, 31666, -19972}, -{0, 21125, -32298, 28252, -10898, -11593, 28620, -32165, 20553, 740, -21686, 32414, -27871, 10195, 12282, -28974, 32014, -19972, -1481, 22235, -32515, 27473, -9490, -12966, 29312, -31849, 19379, 2220, -22774, 32597, -27064, 8778, 13642, -29636, 31666, -18778, -2959, 23300, -32665, 26639, -8063, -14313, 29944, -31469, 18165, 3695, -23816, 32714, -26202, 7342, 14974, -30238, 31253, -17545, -4430, 24317, -32749, 25749, -6620, -15630, 30514, -31024, 16915, 5162, -24808, 32764, -25286, 5892, 16276, -30777, 30776, -16277, -5893, 25285, -32765, 24807, -5163, -16916, 31023, -30515, 15629, 6619, -25750, 32748, -24318, 4429, 17544, -31254, 30237, -14975, -7343, 26201, -32715, 23815, -3696, -18166, 31468, -29945, 14312, 8062, -26640, 32664, -23301, 2958, 18777, -31667, 29635, -13643, -8779, 27063, -32598, 22773, -2221, -19380, 31848, -29313, 12965, 9489, -27474, 32514, -22236, 1480, 19971, -32015, 28973, -12283, -10196, 27870, -32415, 21685, -741, -20554, 32164, -28621, 11592, 10897, -28253, 32297, -21126}, -{0, 22235, -32665, 25749, -5163, -18166, 31848, -28621, 10195, 13642, -30238, 30776, -14975, -8779, 27870, -32165, 19379, 3695, -24808, 32748, -23301, 1480, 21125, -32515, 26639, -6620, -16916, 31468, -29313, 11592, 12282, -29636, 31253, -16277, -7343, 27063, -32415, 20553, 2220, -23816, 32764, -24318, 2958, 19971, -32298, 27473, -8063, -15630, 31023, -29945, 12965, 10897, -28974, 31666, -17545, -5893, 26201, -32598, 21685, 740, -22774, 32714, -25286, 4429, 18777, -32015, 28252, -9490, -14313, 30514, -30515, 14312, 9489, -28253, 32014, -18778, -4430, 25285, -32715, 22773, -741, -21686, 32597, -26202, 5892, 17544, -31667, 28973, -10898, -12966, 29944, -31024, 15629, 8062, -27474, 32297, -19972, -2959, 24317, -32765, 23815, -2221, -20554, 32414, -27064, 7342, 16276, -31254, 29635, -12283, -11593, 29312, -31469, 16915, 6619, -26640, 32514, -21126, -1481, 23300, -32749, 24807, -3696, -19380, 32164, -27871, 8778, 14974, -30777, 30237, -13643, -10196, 28620, -31849, 18165, 5162, -25750, 32664, -22236}, -{0, 23300, -32765, 22773, 740, -23816, 32748, -22236, -1481, 24317, -32715, 21685, 2220, -24808, 32664, -21126, -2959, 25285, -32598, 20553, 3695, -25750, 32514, -19972, -4430, 26201, -32415, 19379, 5162, -26640, 32297, -18778, -5893, 27063, -32165, 18165, 6619, -27474, 32014, -17545, -7343, 27870, -31849, 16915, 8062, -28253, 31666, -16277, -8779, 28620, -31469, 15629, 9489, -28974, 31253, -14975, -10196, 29312, -31024, 14312, 10897, -29636, 30776, -13643, -11593, 29944, -30515, 12965, 12282, -30238, 30237, -12283, -12966, 30514, -29945, 11592, 13642, -30777, 29635, -10898, -14313, 31023, -29313, 10195, 14974, -31254, 28973, -9490, -15630, 31468, -28621, 8778, 16276, -31667, 28252, -8063, -16916, 31848, -27871, 7342, 17544, -32015, 27473, -6620, -18166, 32164, -27064, 5892, 18777, -32298, 26639, -5163, -19380, 32414, -26202, 4429, 19971, -32515, 25749, -3696, -20554, 32597, -25286, 2958, 21125, -32665, 24807, -2221, -21686, 32714, -24318, 1480, 22235, -32749, 23815, -741, -22774, 32764, -23301}, -{0, 24317, -32598, 19379, 6619, -28253, 31253, -13643, -12966, 31023, -28621, 7342, 18777, -32515, 24807, -741, -23816, 32664, -19972, -5893, 27870, -31469, 14312, 12282, -30777, 28973, -8063, -18166, 32414, -25286, 1480, 23300, -32715, 20553, 5162, -27474, 31666, -14975, -11593, 30514, -29313, 8778, 17544, -32298, 25749, -2221, -22774, 32748, -21126, -4430, 27063, -31849, 15629, 10897, -30238, 29635, -9490, -16916, 32164, -26202, 2958, 22235, -32765, 21685, 3695, -26640, 32014, -16277, -10196, 29944, -29945, 10195, 16276, -32015, 26639, -3696, -21686, 32764, -22236, -2959, 26201, -32165, 16915, 9489, -29636, 30237, -10898, -15630, 31848, -27064, 4429, 21125, -32749, 22773, 2220, -25750, 32297, -17545, -8779, 29312, -30515, 11592, 14974, -31667, 27473, -5163, -20554, 32714, -23301, -1481, 25285, -32415, 18165, 8062, -28974, 30776, -12283, -14313, 31468, -27871, 5892, 19971, -32665, 23815, 740, -24808, 32514, -18778, -7343, 28620, -31024, 12965, 13642, -31254, 28252, -6620, -19380, 32597, -24318}, -{0, 25285, -32165, 15629, 12282, -31254, 27473, -3696, -22774, 32664, -18778, -8779, 29944, -29313, 7342, 19971, -32749, 21685, 5162, -28253, 30776, -10898, -16916, 32414, -24318, -1481, 26201, -31849, 14312, 13642, -31667, 26639, -2221, -23816, 32514, -17545, -10196, 30514, -28621, 5892, 21125, -32765, 20553, 6619, -28974, 30237, -9490, -18166, 32597, -23301, -2959, 27063, -31469, 12965, 14974, -32015, 25749, -741, -24808, 32297, -16277, -11593, 31023, -27871, 4429, 22235, -32715, 19379, 8062, -29636, 29635, -8063, -19380, 32714, -22236, -4430, 27870, -31024, 11592, 16276, -32298, 24807, 740, -25750, 32014, -14975, -12966, 31468, -27064, 2958, 23300, -32598, 18165, 9489, -30238, 28973, -6620, -20554, 32764, -21126, -5893, 28620, -30515, 10195, 17544, -32515, 23815, 2220, -26640, 31666, -13643, -14313, 31848, -26202, 1480, 24317, -32415, 16915, 10897, -30777, 28252, -5163, -21686, 32748, -19972, -7343, 29312, -29945, 8778, 18777, -32665, 22773, 3695, -27474, 31253, -12283, -15630, 32164, -25286}, -{0, 26201, -31469, 11592, 17544, -32665, 21685, 6619, -29636, 28973, -5163, -22774, 32514, -16277, -12966, 31848, -25286, -1481, 27063, -31024, 10195, 18777, -32749, 20553, 8062, -30238, 28252, -3696, -23816, 32297, -14975, -14313, 32164, -24318, -2959, 27870, -30515, 8778, 19971, -32765, 19379, 9489, -30777, 27473, -2221, -24808, 32014, -13643, -15630, 32414, -23301, -4430, 28620, -29945, 7342, 21125, -32715, 18165, 10897, -31254, 26639, -741, -25750, 31666, -12283, -16916, 32597, -22236, -5893, 29312, -29313, 5892, 22235, -32598, 16915, 12282, -31667, 25749, 740, -26640, 31253, -10898, -18166, 32714, -21126, -7343, 29944, -28621, 4429, 23300, -32415, 15629, 13642, -32015, 24807, 2220, -27474, 30776, -9490, -19380, 32764, -19972, -8779, 30514, -27871, 2958, 24317, -32165, 14312, 14974, -32298, 23815, 3695, -28253, 30237, -8063, -20554, 32748, -18778, -10196, 31023, -27064, 1480, 25285, -31849, 12965, 16276, -32515, 22773, 5162, -28974, 29635, -6620, -21686, 32664, -17545, -11593, 31468, -26202}, -{0, 27063, -30515, 7342, 22235, -32415, 14312, 16276, -32665, 20553, 9489, -31254, 25749, 2220, -28253, 29635, -5163, -23816, 32014, -12283, -18166, 32764, -18778, -11593, 31848, -24318, -4430, 29312, -28621, 2958, 25285, -31469, 10195, 19971, -32715, 16915, 13642, -32298, 22773, 6619, -30238, 27473, -741, -26640, 30776, -8063, -21686, 32514, -14975, -15630, 32597, -21126, -8779, 31023, -26202, -1481, 27870, -29945, 5892, 23300, -32165, 12965, 17544, -32749, 19379, 10897, -31667, 24807, 3695, -28974, 28973, -3696, -24808, 31666, -10898, -19380, 32748, -17545, -12966, 32164, -23301, -5893, 29944, -27871, 1480, 26201, -31024, 8778, 21125, -32598, 15629, 14974, -32515, 21685, 8062, -30777, 26639, 740, -27474, 30237, -6620, -22774, 32297, -13643, -16916, 32714, -19972, -10196, 31468, -25286, -2959, 28620, -29313, 4429, 24317, -31849, 11592, 18777, -32765, 18165, 12282, -32015, 23815, 5162, -29636, 28252, -2221, -25750, 31253, -9490, -20554, 32664, -16277, -14313, 32414, -22236, -7343, 30514, -27064}, -{0, 27870, -29313, 2958, 26201, -30515, 5892, 24317, -31469, 8778, 22235, -32165, 11592, 19971, -32598, 14312, 17544, -32765, 16915, 14974, -32665, 19379, 12282, -32298, 21685, 9489, -31667, 23815, 6619, -30777, 25749, 3695, -29636, 27473, 740, -28253, 28973, -2221, -26640, 30237, -5163, -24808, 31253, -8063, -22774, 32014, -10898, -20554, 32514, -13643, -18166, 32748, -16277, -15630, 32714, -18778, -12966, 32414, -21126, -10196, 31848, -23301, -7343, 31023, -25286, -4430, 29944, -27064, -1481, 28620, -28621, 1480, 27063, -29945, 4429, 25285, -31024, 7342, 23300, -31849, 10195, 21125, -32415, 12965, 18777, -32715, 15629, 16276, -32749, 18165, 13642, -32515, 20553, 10897, -32015, 22773, 8062, -31254, 24807, 5162, -30238, 26639, 2220, -28974, 28252, -741, -27474, 29635, -3696, -25750, 30776, -6620, -23816, 31666, -9490, -21686, 32297, -12283, -19380, 32664, -14975, -16916, 32764, -17545, -14313, 32597, -19972, -11593, 32164, -22236, -8779, 31468, -24318, -5893, 30514, -26202, -2959, 29312, -27871}, -{0, 28620, -27871, -1481, 29312, -27064, -2959, 29944, -26202, -4430, 30514, -25286, -5893, 31023, -24318, -7343, 31468, -23301, -8779, 31848, -22236, -10196, 32164, -21126, -11593, 32414, -19972, -12966, 32597, -18778, -14313, 32714, -17545, -15630, 32764, -16277, -16916, 32748, -14975, -18166, 32664, -13643, -19380, 32514, -12283, -20554, 32297, -10898, -21686, 32014, -9490, -22774, 31666, -8063, -23816, 31253, -6620, -24808, 30776, -5163, -25750, 30237, -3696, -26640, 29635, -2221, -27474, 28973, -741, -28253, 28252, 740, -28974, 27473, 2220, -29636, 26639, 3695, -30238, 25749, 5162, -30777, 24807, 6619, -31254, 23815, 8062, -31667, 22773, 9489, -32015, 21685, 10897, -32298, 20553, 12282, -32515, 19379, 13642, -32665, 18165, 14974, -32749, 16915, 16276, -32765, 15629, 17544, -32715, 14312, 18777, -32598, 12965, 19971, -32415, 11592, 21125, -32165, 10195, 22235, -31849, 8778, 23300, -31469, 7342, 24317, -31024, 5892, 25285, -30515, 4429, 26201, -29945, 2958, 27063, -29313, 1480, 27870, -28621}, -{0, 29312, -26202, -5893, 31468, -22236, -11593, 32597, -17545, -16916, 32664, -12283, -21686, 31666, -6620, -25750, 29635, -741, -28974, 26639, 5162, -31254, 22773, 10897, -32515, 18165, 16276, -32715, 12965, 21125, -31849, 7342, 25285, -29945, 1480, 28620, -27064, -4430, 31023, -23301, -10196, 32414, -18778, -15630, 32748, -13643, -20554, 32014, -8063, -24808, 30237, -2221, -28253, 27473, 3695, -30777, 23815, 9489, -32298, 19379, 14974, -32765, 14312, 19971, -32165, 8778, 24317, -30515, 2958, 27870, -27871, -2959, 30514, -24318, -8779, 32164, -19972, -14313, 32764, -14975, -19380, 32297, -9490, -23816, 30776, -3696, -27474, 28252, 2220, -30238, 24807, 8062, -32015, 20553, 13642, -32749, 15629, 18777, -32415, 10195, 23300, -31024, 4429, 27063, -28621, -1481, 29944, -25286, -7343, 31848, -21126, -12966, 32714, -16277, -18166, 32514, -10898, -22774, 31253, -5163, -26640, 28973, 740, -29636, 25749, 6619, -31667, 21685, 12282, -32665, 16915, 17544, -32598, 11592, 22235, -31469, 5892, 26201, -29313}, -{0, 29944, -24318, -10196, 32597, -16277, -19380, 32014, -6620, -26640, 28252, 3695, -31254, 21685, 13642, -32765, 12965, 22235, -31024, 2958, 28620, -26202, -7343, 32164, -18778, -16916, 32514, -9490, -24808, 29635, 740, -30238, 23815, 10897, -32665, 15629, 19971, -31849, 5892, 27063, -27871, -4430, 31468, -21126, -14313, 32748, -12283, -22774, 30776, -2221, -28974, 25749, 8062, -32298, 18165, 17544, -32415, 8778, 25285, -29313, -1481, 30514, -23301, -11593, 32714, -14975, -20554, 31666, -5163, -27474, 27473, 5162, -31667, 20553, 14974, -32715, 11592, 23300, -30515, 1480, 29312, -25286, -8779, 32414, -17545, -18166, 32297, -8063, -25750, 28973, 2220, -30777, 22773, 12282, -32749, 14312, 21125, -31469, 4429, 27870, -27064, -5893, 31848, -19972, -15630, 32664, -10898, -23816, 30237, -741, -29636, 24807, 9489, -32515, 16915, 18777, -32165, 7342, 26201, -28621, -2959, 31023, -22236, -12966, 32764, -13643, -21686, 31253, -3696, -28253, 26639, 6619, -32015, 19379, 16276, -32598, 10195, 24317, -29945}, -{0, 30514, -22236, -14313, 32664, -9490, -25750, 28252, 5162, -32015, 18165, 18777, -31849, 4429, 28620, -25286, -10196, 32714, -13643, -22774, 30237, 740, -30777, 21685, 14974, -32598, 8778, 26201, -27871, -5893, 32164, -17545, -19380, 31666, -3696, -28974, 24807, 10897, -32749, 12965, 23300, -29945, -1481, 31023, -21126, -15630, 32514, -8063, -26640, 27473, 6619, -32298, 16915, 19971, -31469, 2958, 29312, -24318, -11593, 32764, -12283, -23816, 29635, 2220, -31254, 20553, 16276, -32415, 7342, 27063, -27064, -7343, 32414, -16277, -20554, 31253, -2221, -29636, 23815, 12282, -32765, 11592, 24317, -29313, -2959, 31468, -19972, -16916, 32297, -6620, -27474, 26639, 8062, -32515, 15629, 21125, -31024, 1480, 29944, -23301, -12966, 32748, -10898, -24808, 28973, 3695, -31667, 19379, 17544, -32165, 5892, 27870, -26202, -8779, 32597, -14975, -21686, 30776, -741, -30238, 22773, 13642, -32715, 10195, 25285, -28621, -4430, 31848, -18778, -18166, 32014, -5163, -28253, 25749, 9489, -32665, 14312, 22235, -30515}, -{0, 31023, -19972, -18166, 31666, -2221, -30238, 21685, 16276, -32165, 4429, 29312, -23301, -14313, 32514, -6620, -28253, 24807, 12282, -32715, 8778, 27063, -26202, -10196, 32764, -10898, -25750, 27473, 8062, -32665, 12965, 24317, -28621, -5893, 32414, -14975, -22774, 29635, 3695, -32015, 16915, 21125, -30515, -1481, 31468, -18778, -19380, 31253, -741, -30777, 20553, 17544, -31849, 2958, 29944, -22236, -15630, 32297, -5163, -28974, 23815, 13642, -32598, 7342, 27870, -25286, -11593, 32748, -9490, -26640, 26639, 9489, -32749, 11592, 25285, -27871, -7343, 32597, -13643, -23816, 28973, 5162, -32298, 15629, 22235, -29945, -2959, 31848, -17545, -20554, 30776, 740, -31254, 19379, 18777, -31469, 1480, 30514, -21126, -16916, 32014, -3696, -29636, 22773, 14974, -32415, 5892, 28620, -24318, -12966, 32664, -8063, -27474, 25749, 10897, -32765, 10195, 26201, -27064, -8779, 32714, -12283, -24808, 28252, 6619, -32515, 14312, 23300, -29313, -4430, 32164, -16277, -21686, 30237, 2220, -31667, 18165, 19971, -31024}, -{0, 31468, -17545, -21686, 29635, 5162, -32515, 12965, 25285, -27064, -10196, 32748, -8063, -28253, 23815, 14974, -32165, 2958, 30514, -19972, -19380, 30776, 2220, -32015, 15629, 23300, -28621, -7343, 32714, -10898, -26640, 25749, 12282, -32598, 5892, 29312, -22236, -16916, 31666, -741, -31254, 18165, 21125, -29945, -4430, 32414, -13643, -24808, 27473, 9489, -32765, 8778, 27870, -24318, -14313, 32297, -3696, -30238, 20553, 18777, -31024, -1481, 31848, -16277, -22774, 28973, 6619, -32665, 11592, 26201, -26202, -11593, 32664, -6620, -28974, 22773, 16276, -31849, 1480, 31023, -18778, -20554, 30237, 3695, -32298, 14312, 24317, -27871, -8779, 32764, -9490, -27474, 24807, 13642, -32415, 4429, 29944, -21126, -18166, 31253, 740, -31667, 16915, 22235, -29313, -5893, 32597, -12283, -25750, 26639, 10897, -32715, 7342, 28620, -23301, -15630, 32014, -2221, -30777, 19379, 19971, -30515, -2959, 32164, -14975, -23816, 28252, 8062, -32749, 10195, 27063, -25286, -12966, 32514, -5163, -29636, 21685, 17544, -31469}, -{0, 31848, -14975, -24808, 26639, 12282, -32415, 2958, 31023, -17545, -22774, 28252, 9489, -32715, 5892, 29944, -19972, -20554, 29635, 6619, -32749, 8778, 28620, -22236, -18166, 30776, 3695, -32515, 11592, 27063, -24318, -15630, 31666, 740, -32015, 14312, 25285, -26202, -12966, 32297, -2221, -31254, 16915, 23300, -27871, -10196, 32664, -5163, -30238, 19379, 21125, -29313, -7343, 32764, -8063, -28974, 21685, 18777, -30515, -4430, 32597, -10898, -27474, 23815, 16276, -31469, -1481, 32164, -13643, -25750, 25749, 13642, -32165, 1480, 31468, -16277, -23816, 27473, 10897, -32598, 4429, 30514, -18778, -21686, 28973, 8062, -32765, 7342, 29312, -21126, -19380, 30237, 5162, -32665, 10195, 27870, -23301, -16916, 31253, 2220, -32298, 12965, 26201, -25286, -14313, 32014, -741, -31667, 15629, 24317, -27064, -11593, 32514, -3696, -30777, 18165, 22235, -28621, -8779, 32748, -6620, -29636, 20553, 19971, -29945, -5893, 32714, -9490, -28253, 22773, 17544, -31024, -2959, 32414, -12283, -26640, 24807, 14974, -31849}, -{0, 32164, -12283, -27474, 22773, 18777, -29945, -7343, 32748, -5163, -30777, 16915, 24317, -26202, -14313, 31666, 2220, -32515, 10195, 28620, -21126, -20554, 28973, 9489, -32598, 2958, 31468, -14975, -25750, 24807, 16276, -31024, -4430, 32714, -8063, -29636, 19379, 22235, -27871, -11593, 32297, -741, -32015, 12965, 27063, -23301, -18166, 30237, 6619, -32765, 5892, 30514, -17545, -23816, 26639, 13642, -31849, -1481, 32414, -10898, -28253, 21685, 19971, -29313, -8779, 32664, -3696, -31254, 15629, 25285, -25286, -15630, 31253, 3695, -32665, 8778, 29312, -19972, -21686, 28252, 10897, -32415, 1480, 31848, -13643, -26640, 23815, 17544, -30515, -5893, 32764, -6620, -30238, 18165, 23300, -27064, -12966, 32014, 740, -32298, 11592, 27870, -22236, -19380, 29635, 8062, -32715, 4429, 31023, -16277, -24808, 25749, 14974, -31469, -2959, 32597, -9490, -28974, 20553, 21125, -28621, -10196, 32514, -2221, -31667, 14312, 26201, -24318, -16916, 30776, 5162, -32749, 7342, 29944, -18778, -22774, 27473, 12282, -32165}, -{0, 32414, -9490, -29636, 18165, 24317, -25286, -16916, 30237, 8062, -32598, 1480, 32164, -10898, -28974, 19379, 23300, -26202, -15630, 30776, 6619, -32715, 2958, 31848, -12283, -28253, 20553, 22235, -27064, -14313, 31253, 5162, -32765, 4429, 31468, -13643, -27474, 21685, 21125, -27871, -12966, 31666, 3695, -32749, 5892, 31023, -14975, -26640, 22773, 19971, -28621, -11593, 32014, 2220, -32665, 7342, 30514, -16277, -25750, 23815, 18777, -29313, -10196, 32297, 740, -32515, 8778, 29944, -17545, -24808, 24807, 17544, -29945, -8779, 32514, -741, -32298, 10195, 29312, -18778, -23816, 25749, 16276, -30515, -7343, 32664, -2221, -32015, 11592, 28620, -19972, -22774, 26639, 14974, -31024, -5893, 32748, -3696, -31667, 12965, 27870, -21126, -21686, 27473, 13642, -31469, -4430, 32764, -5163, -31254, 14312, 27063, -22236, -20554, 28252, 12282, -31849, -2959, 32714, -6620, -30777, 15629, 26201, -23301, -19380, 28973, 10897, -32165, -1481, 32597, -8063, -30238, 16915, 25285, -24318, -18166, 29635, 9489, -32415}, -{0, 32597, -6620, -31254, 12965, 28620, -18778, -24808, 23815, 19971, -27871, -14313, 30776, 8062, -32415, -1481, 32714, -5163, -31667, 11592, 29312, -17545, -25750, 22773, 21125, -27064, -15630, 30237, 9489, -32165, -2959, 32764, -3696, -32015, 10195, 29944, -16277, -26640, 21685, 22235, -26202, -16916, 29635, 10897, -31849, -4430, 32748, -2221, -32298, 8778, 30514, -14975, -27474, 20553, 23300, -25286, -18166, 28973, 12282, -31469, -5893, 32664, -741, -32515, 7342, 31023, -13643, -28253, 19379, 24317, -24318, -19380, 28252, 13642, -31024, -7343, 32514, 740, -32665, 5892, 31468, -12283, -28974, 18165, 25285, -23301, -20554, 27473, 14974, -30515, -8779, 32297, 2220, -32749, 4429, 31848, -10898, -29636, 16915, 26201, -22236, -21686, 26639, 16276, -29945, -10196, 32014, 3695, -32765, 2958, 32164, -9490, -30238, 15629, 27063, -21126, -22774, 25749, 17544, -29313, -11593, 31666, 5162, -32715, 1480, 32414, -8063, -30777, 14312, 27870, -19972, -23816, 24807, 18777, -28621, -12966, 31253, 6619, -32598}, -{0, 32714, -3696, -32298, 7342, 31468, -10898, -30238, 14312, 28620, -17545, -26640, 20553, 24317, -23301, -21686, 25749, 18777, -27871, -15630, 29635, 12282, -31024, -8779, 32014, 5162, -32598, -1481, 32764, -2221, -32515, 5892, 31848, -9490, -30777, 12965, 29312, -16277, -27474, 19379, 25285, -22236, -22774, 24807, 19971, -27064, -16916, 28973, 13642, -30515, -10196, 31666, 6619, -32415, -2959, 32748, -741, -32665, 4429, 32164, -8063, -31254, 11592, 29944, -14975, -28253, 18165, 26201, -21126, -23816, 23815, 21125, -26202, -18166, 28252, 14974, -29945, -11593, 31253, 8062, -32165, -4430, 32664, 740, -32749, 2958, 32414, -6620, -31667, 10195, 30514, -13643, -28974, 16915, 27063, -19972, -24808, 22773, 22235, -25286, -19380, 27473, 16276, -29313, -12966, 30776, 9489, -31849, -5893, 32514, 2220, -32765, 1480, 32597, -5163, -32015, 8778, 31023, -12283, -29636, 15629, 27870, -18778, -25750, 21685, 23300, -24318, -20554, 26639, 17544, -28621, -14313, 30237, 10897, -31469, -7343, 32297, 3695, -32715}, -{0, 32764, -741, -32749, 1480, 32714, -2221, -32665, 2958, 32597, -3696, -32515, 4429, 32414, -5163, -32298, 5892, 32164, -6620, -32015, 7342, 31848, -8063, -31667, 8778, 31468, -9490, -31254, 10195, 31023, -10898, -30777, 11592, 30514, -12283, -30238, 12965, 29944, -13643, -29636, 14312, 29312, -14975, -28974, 15629, 28620, -16277, -28253, 16915, 27870, -17545, -27474, 18165, 27063, -18778, -26640, 19379, 26201, -19972, -25750, 20553, 25285, -21126, -24808, 21685, 24317, -22236, -23816, 22773, 23300, -23301, -22774, 23815, 22235, -24318, -21686, 24807, 21125, -25286, -20554, 25749, 19971, -26202, -19380, 26639, 18777, -27064, -18166, 27473, 17544, -27871, -16916, 28252, 16276, -28621, -15630, 28973, 14974, -29313, -14313, 29635, 13642, -29945, -12966, 30237, 12282, -30515, -11593, 30776, 10897, -31024, -10196, 31253, 9489, -31469, -8779, 31666, 8062, -31849, -7343, 32014, 6619, -32165, -5893, 32297, 5162, -32415, -4430, 32514, 3695, -32598, -2959, 32664, 2220, -32715, -1481, 32748, 740, -32765}, -{0, 32748, 2220, -32598, -4430, 32297, 6619, -31849, -8779, 31253, 10897, -30515, -12966, 29635, 14974, -28621, -16916, 27473, 18777, -26202, -20554, 24807, 22235, -23301, -23816, 21685, 25285, -19972, -26640, 18165, 27870, -16277, -28974, 14312, 29944, -12283, -30777, 10195, 31468, -8063, -32015, 5892, 32414, -3696, -32665, 1480, 32764, 740, -32715, -2959, 32514, 5162, -32165, -7343, 31666, 9489, -31024, -11593, 30237, 13642, -29313, -15630, 28252, 17544, -27064, -19380, 25749, 21125, -24318, -22774, 22773, 24317, -21126, -25750, 19379, 27063, -17545, -28253, 15629, 29312, -13643, -30238, 11592, 31023, -9490, -31667, 7342, 32164, -5163, -32515, 2958, 32714, -741, -32765, -1481, 32664, 3695, -32415, -5893, 32014, 8062, -31469, -10196, 30776, 12282, -29945, -14313, 28973, 16276, -27871, -18166, 26639, 19971, -25286, -21686, 23815, 23300, -22236, -24808, 20553, 26201, -18778, -27474, 16915, 28620, -14975, -29636, 12965, 30514, -10898, -31254, 8778, 31848, -6620, -32298, 4429, 32597, -2221, -32749}, -{0, 32664, 5162, -31849, -10196, 30237, 14974, -27871, -19380, 24807, 23300, -21126, -26640, 16915, 29312, -12283, -31254, 7342, 32414, -2221, -32765, -2959, 32297, 8062, -31024, -12966, 28973, 17544, -26202, -21686, 22773, 25285, -18778, -28253, 14312, 30514, -9490, -32015, 4429, 32714, 740, -32598, -5893, 31666, 10897, -29945, -15630, 27473, 19971, -24318, -23816, 20553, 27063, -16277, -29636, 11592, 31468, -6620, -32515, 1480, 32748, 3695, -32165, -8779, 30776, 13642, -28621, -18166, 25749, 22235, -22236, -25750, 18165, 28620, -13643, -30777, 8778, 32164, -3696, -32749, -1481, 32514, 6619, -31469, -11593, 29635, 16276, -27064, -20554, 23815, 24317, -19972, -27474, 15629, 29944, -10898, -31667, 5892, 32597, -741, -32715, -4430, 32014, 9489, -30515, -14313, 28252, 18777, -25286, -22774, 21685, 26201, -17545, -28974, 12965, 31023, -8063, -32298, 2958, 32764, 2220, -32415, -7343, 31253, 12282, -29313, -16916, 26639, 21125, -23301, -24808, 19379, 27870, -14975, -30238, 10195, 31848, -5163, -32665}, -{0, 32514, 8062, -30515, -15630, 26639, 22235, -21126, -27474, 14312, 31023, -6620, -32665, -1481, 32297, 9489, -29945, -16916, 25749, 23300, -19972, -28253, 12965, 31468, -5163, -32749, -2959, 32014, 10897, -29313, -18166, 24807, 24317, -18778, -28974, 11592, 31848, -3696, -32765, -4430, 31666, 12282, -28621, -19380, 23815, 25285, -17545, -29636, 10195, 32164, -2221, -32715, -5893, 31253, 13642, -27871, -20554, 22773, 26201, -16277, -30238, 8778, 32414, -741, -32598, -7343, 30776, 14974, -27064, -21686, 21685, 27063, -14975, -30777, 7342, 32597, 740, -32415, -8779, 30237, 16276, -26202, -22774, 20553, 27870, -13643, -31254, 5892, 32714, 2220, -32165, -10196, 29635, 17544, -25286, -23816, 19379, 28620, -12283, -31667, 4429, 32764, 3695, -31849, -11593, 28973, 18777, -24318, -24808, 18165, 29312, -10898, -32015, 2958, 32748, 5162, -31469, -12966, 28252, 19971, -23301, -25750, 16915, 29944, -9490, -32298, 1480, 32664, 6619, -31024, -14313, 27473, 21125, -22236, -26640, 15629, 30514, -8063, -32515}, -{0, 32297, 10897, -28621, -20554, 21685, 27870, -12283, -32015, 1480, 32514, 9489, -29313, -19380, 22773, 27063, -13643, -31667, 2958, 32664, 8062, -29945, -18166, 23815, 26201, -14975, -31254, 4429, 32748, 6619, -30515, -16916, 24807, 25285, -16277, -30777, 5892, 32764, 5162, -31024, -15630, 25749, 24317, -17545, -30238, 7342, 32714, 3695, -31469, -14313, 26639, 23300, -18778, -29636, 8778, 32597, 2220, -31849, -12966, 27473, 22235, -19972, -28974, 10195, 32414, 740, -32165, -11593, 28252, 21125, -21126, -28253, 11592, 32164, -741, -32415, -10196, 28973, 19971, -22236, -27474, 12965, 31848, -2221, -32598, -8779, 29635, 18777, -23301, -26640, 14312, 31468, -3696, -32715, -7343, 30237, 17544, -24318, -25750, 15629, 31023, -5163, -32765, -5893, 30776, 16276, -25286, -24808, 16915, 30514, -6620, -32749, -4430, 31253, 14974, -26202, -23816, 18165, 29944, -8063, -32665, -2959, 31666, 13642, -27064, -22774, 19379, 29312, -9490, -32515, -1481, 32014, 12282, -27871, -21686, 20553, 28620, -10898, -32298}, -{0, 32014, 13642, -26202, -24808, 15629, 31468, -2221, -32415, -11593, 27473, 23300, -17545, -30777, 4429, 32664, 9489, -28621, -21686, 19379, 29944, -6620, -32765, -7343, 29635, 19971, -21126, -28974, 8778, 32714, 5162, -30515, -18166, 22773, 27870, -10898, -32515, -2959, 31253, 16276, -24318, -26640, 12965, 32164, 740, -31849, -14313, 25749, 25285, -14975, -31667, 1480, 32297, 12282, -27064, -23816, 16915, 31023, -3696, -32598, -10196, 28252, 22235, -18778, -30238, 5892, 32748, 8062, -29313, -20554, 20553, 29312, -8063, -32749, -5893, 30237, 18777, -22236, -28253, 10195, 32597, 3695, -31024, -16916, 23815, 27063, -12283, -32298, -1481, 31666, 14974, -25286, -25750, 14312, 31848, -741, -32165, -12966, 26639, 24317, -16277, -31254, 2958, 32514, 10897, -27871, -22774, 18165, 30514, -5163, -32715, -8779, 28973, 21125, -19972, -29636, 7342, 32764, 6619, -29945, -19380, 21685, 28620, -9490, -32665, -4430, 30776, 17544, -23301, -27474, 11592, 32414, 2220, -31469, -15630, 24807, 26201, -13643, -32015}, -{0, 31666, 16276, -23301, -28253, 8778, 32764, 8062, -28621, -22774, 16915, 31468, -741, -31849, -15630, 23815, 27870, -9490, -32749, -7343, 28973, 22235, -17545, -31254, 1480, 32014, 14974, -24318, -27474, 10195, 32714, 6619, -29313, -21686, 18165, 31023, -2221, -32165, -14313, 24807, 27063, -10898, -32665, -5893, 29635, 21125, -18778, -30777, 2958, 32297, 13642, -25286, -26640, 11592, 32597, 5162, -29945, -20554, 19379, 30514, -3696, -32415, -12966, 25749, 26201, -12283, -32515, -4430, 30237, 19971, -19972, -30238, 4429, 32514, 12282, -26202, -25750, 12965, 32414, 3695, -30515, -19380, 20553, 29944, -5163, -32598, -11593, 26639, 25285, -13643, -32298, -2959, 30776, 18777, -21126, -29636, 5892, 32664, 10897, -27064, -24808, 14312, 32164, 2220, -31024, -18166, 21685, 29312, -6620, -32715, -10196, 27473, 24317, -14975, -32015, -1481, 31253, 17544, -22236, -28974, 7342, 32748, 9489, -27871, -23816, 15629, 31848, 740, -31469, -16916, 22773, 28620, -8063, -32765, -8779, 28252, 23300, -16277, -31667}, -{0, 31253, 18777, -19972, -30777, 1480, 31666, 17544, -21126, -30238, 2958, 32014, 16276, -22236, -29636, 4429, 32297, 14974, -23301, -28974, 5892, 32514, 13642, -24318, -28253, 7342, 32664, 12282, -25286, -27474, 8778, 32748, 10897, -26202, -26640, 10195, 32764, 9489, -27064, -25750, 11592, 32714, 8062, -27871, -24808, 12965, 32597, 6619, -28621, -23816, 14312, 32414, 5162, -29313, -22774, 15629, 32164, 3695, -29945, -21686, 16915, 31848, 2220, -30515, -20554, 18165, 31468, 740, -31024, -19380, 19379, 31023, -741, -31469, -18166, 20553, 30514, -2221, -31849, -16916, 21685, 29944, -3696, -32165, -15630, 22773, 29312, -5163, -32415, -14313, 23815, 28620, -6620, -32598, -12966, 24807, 27870, -8063, -32715, -11593, 25749, 27063, -9490, -32765, -10196, 26639, 26201, -10898, -32749, -8779, 27473, 25285, -12283, -32665, -7343, 28252, 24317, -13643, -32515, -5893, 28973, 23300, -14975, -32298, -4430, 29635, 22235, -16277, -32015, -2959, 30237, 21125, -17545, -31667, -1481, 30776, 19971, -18778, -31254}, -{0, 30776, 21125, -16277, -32298, -5893, 28252, 25285, -10898, -32765, -11593, 24807, 28620, -5163, -32165, -16916, 20553, 31023, 740, -30515, -21686, 15629, 32414, 6619, -27871, -25750, 10195, 32748, 12282, -24318, -28974, 4429, 32014, 17544, -19972, -31254, -1481, 30237, 22235, -14975, -32515, -7343, 27473, 26201, -9490, -32715, -12966, 23815, 29312, -3696, -31849, -18166, 19379, 31468, 2220, -29945, -22774, 14312, 32597, 8062, -27064, -26640, 8778, 32664, 13642, -23301, -29636, 2958, 31666, 18777, -18778, -31667, -2959, 29635, 23300, -13643, -32665, -8779, 26639, 27063, -8063, -32598, -14313, 22773, 29944, -2221, -31469, -19380, 18165, 31848, 3695, -29313, -23816, 12965, 32714, 9489, -26202, -27474, 7342, 32514, 14974, -22236, -30238, 1480, 31253, 19971, -17545, -32015, -4430, 28973, 24317, -12283, -32749, -10196, 25749, 27870, -6620, -32415, -15630, 21685, 30514, -741, -31024, -20554, 16915, 32164, 5162, -28621, -24808, 11592, 32764, 10897, -25286, -28253, 5892, 32297, 16276, -21126, -30777}, -{0, 30237, 23300, -12283, -32765, -12966, 22773, 30514, 740, -29945, -23816, 11592, 32748, 13642, -22236, -30777, -1481, 29635, 24317, -10898, -32715, -14313, 21685, 31023, 2220, -29313, -24808, 10195, 32664, 14974, -21126, -31254, -2959, 28973, 25285, -9490, -32598, -15630, 20553, 31468, 3695, -28621, -25750, 8778, 32514, 16276, -19972, -31667, -4430, 28252, 26201, -8063, -32415, -16916, 19379, 31848, 5162, -27871, -26640, 7342, 32297, 17544, -18778, -32015, -5893, 27473, 27063, -6620, -32165, -18166, 18165, 32164, 6619, -27064, -27474, 5892, 32014, 18777, -17545, -32298, -7343, 26639, 27870, -5163, -31849, -19380, 16915, 32414, 8062, -26202, -28253, 4429, 31666, 19971, -16277, -32515, -8779, 25749, 28620, -3696, -31469, -20554, 15629, 32597, 9489, -25286, -28974, 2958, 31253, 21125, -14975, -32665, -10196, 24807, 29312, -2221, -31024, -21686, 14312, 32714, 10897, -24318, -29636, 1480, 30776, 22235, -13643, -32749, -11593, 23815, 29944, -741, -30515, -22774, 12965, 32764, 12282, -23301, -30238}, -{0, 29635, 25285, -8063, -32165, -19380, 15629, 32714, 12282, -22236, -31254, -4430, 27473, 27870, -3696, -31024, -22774, 11592, 32664, 16276, -18778, -32298, -8779, 24807, 29944, 740, -29313, -25750, 7342, 32014, 19971, -14975, -32749, -12966, 21685, 31468, 5162, -27064, -28253, 2958, 30776, 23300, -10898, -32598, -16916, 18165, 32414, 9489, -24318, -30238, -1481, 28973, 26201, -6620, -31849, -20554, 14312, 32764, 13642, -21126, -31667, -5893, 26639, 28620, -2221, -30515, -23816, 10195, 32514, 17544, -17545, -32515, -10196, 23815, 30514, 2220, -28621, -26640, 5892, 31666, 21125, -13643, -32765, -14313, 20553, 31848, 6619, -26202, -28974, 1480, 30237, 24317, -9490, -32415, -18166, 16915, 32597, 10897, -23301, -30777, -2959, 28252, 27063, -5163, -31469, -21686, 12965, 32748, 14974, -19972, -32015, -7343, 25749, 29312, -741, -29945, -24808, 8778, 32297, 18777, -16277, -32665, -11593, 22773, 31023, 3695, -27871, -27474, 4429, 31253, 22235, -12283, -32715, -15630, 19379, 32164, 8062, -25286, -29636}, -{0, 28973, 27063, -3696, -30515, -24808, 7342, 31666, 22235, -10898, -32415, -19380, 14312, 32748, 16276, -17545, -32665, -12966, 20553, 32164, 9489, -23301, -31254, -5893, 25749, 29944, 2220, -27871, -28253, 1480, 29635, 26201, -5163, -31024, -23816, 8778, 32014, 21125, -12283, -32598, -18166, 15629, 32764, 14974, -18778, -32515, -11593, 21685, 31848, 8062, -24318, -30777, -4430, 26639, 29312, 740, -28621, -27474, 2958, 30237, 25285, -6620, -31469, -22774, 10195, 32297, 19971, -13643, -32715, -16916, 16915, 32714, 13642, -19972, -32298, -10196, 22773, 31468, 6619, -25286, -30238, -2959, 27473, 28620, -741, -29313, -26640, 4429, 30776, 24317, -8063, -31849, -21686, 11592, 32514, 18777, -14975, -32765, -15630, 18165, 32597, 12282, -21126, -32015, -8779, 23815, 31023, 5162, -26202, -29636, -1481, 28252, 27870, -2221, -29945, -25750, 5892, 31253, 23300, -9490, -32165, -20554, 12965, 32664, 17544, -16277, -32749, -14313, 19379, 32414, 10897, -22236, -31667, -7343, 24807, 30514, 3695, -27064, -28974}, -{0, 28252, 28620, 740, -27871, -28974, -1481, 27473, 29312, 2220, -27064, -29636, -2959, 26639, 29944, 3695, -26202, -30238, -4430, 25749, 30514, 5162, -25286, -30777, -5893, 24807, 31023, 6619, -24318, -31254, -7343, 23815, 31468, 8062, -23301, -31667, -8779, 22773, 31848, 9489, -22236, -32015, -10196, 21685, 32164, 10897, -21126, -32298, -11593, 20553, 32414, 12282, -19972, -32515, -12966, 19379, 32597, 13642, -18778, -32665, -14313, 18165, 32714, 14974, -17545, -32749, -15630, 16915, 32764, 16276, -16277, -32765, -16916, 15629, 32748, 17544, -14975, -32715, -18166, 14312, 32664, 18777, -13643, -32598, -19380, 12965, 32514, 19971, -12283, -32415, -20554, 11592, 32297, 21125, -10898, -32165, -21686, 10195, 32014, 22235, -9490, -31849, -22774, 8778, 31666, 23300, -8063, -31469, -23816, 7342, 31253, 24317, -6620, -31024, -24808, 5892, 30776, 25285, -5163, -30515, -25750, 4429, 30237, 26201, -3696, -29945, -26640, 2958, 29635, 27063, -2221, -29313, -27474, 1480, 28973, 27870, -741, -28621, -28253}, -{0, 27473, 29944, 5162, -24318, -31667, -10196, 20553, 32597, 14974, -16277, -32715, -19380, 11592, 32014, 23300, -6620, -30515, -26640, 1480, 28252, 29312, 3695, -25286, -31254, -8779, 21685, 32414, 13642, -17545, -32765, -18166, 12965, 32297, 22235, -8063, -31024, -25750, 2958, 28973, 28620, 2220, -26202, -30777, -7343, 22773, 32164, 12282, -18778, -32749, -16916, 14312, 32514, 21125, -9490, -31469, -24808, 4429, 29635, 27870, 740, -27064, -30238, -5893, 23815, 31848, 10897, -19972, -32665, -15630, 15629, 32664, 19971, -10898, -31849, -23816, 5892, 30237, 27063, -741, -27871, -29636, -4430, 24807, 31468, 9489, -21126, -32515, -14313, 16915, 32748, 18777, -12283, -32165, -22774, 7342, 30776, 26201, -2221, -28621, -28974, -2959, 25749, 31023, 8062, -22236, -32298, -12966, 18165, 32764, 17544, -13643, -32415, -21686, 8778, 31253, 25285, -3696, -29313, -28253, -1481, 26639, 30514, 6619, -23301, -32015, -11593, 19379, 32714, 16276, -14975, -32598, -20554, 10195, 31666, 24317, -5163, -29945, -27474}, -{0, 26639, 31023, 9489, -19972, -32749, -18166, 11592, 31666, 25285, -2221, -27871, -30238, -7343, 21685, 32597, 16276, -13643, -32165, -23816, 4429, 28973, 29312, 5162, -23301, -32298, -14313, 15629, 32514, 22235, -6620, -29945, -28253, -2959, 24807, 31848, 12282, -17545, -32715, -20554, 8778, 30776, 27063, 740, -26202, -31254, -10196, 19379, 32764, 18777, -10898, -31469, -25750, 1480, 27473, 30514, 8062, -21126, -32665, -16916, 12965, 32014, 24317, -3696, -28621, -29636, -5893, 22773, 32414, 14974, -14975, -32415, -22774, 5892, 29635, 28620, 3695, -24318, -32015, -12966, 16915, 32664, 21125, -8063, -30515, -27474, -1481, 25749, 31468, 10897, -18778, -32765, -19380, 10195, 31253, 26201, -741, -27064, -30777, -8779, 20553, 32714, 17544, -12283, -31849, -24808, 2958, 28252, 29944, 6619, -22236, -32515, -15630, 14312, 32297, 23300, -5163, -29313, -28974, -4430, 23815, 32164, 13642, -16277, -32598, -21686, 7342, 30237, 27870, 2220, -25286, -31667, -11593, 18165, 32748, 19971, -9490, -31024, -26640}, -{0, 25749, 31848, 13642, -14975, -32165, -24808, 1480, 26639, 31468, 12282, -16277, -32415, -23816, 2958, 27473, 31023, 10897, -17545, -32598, -22774, 4429, 28252, 30514, 9489, -18778, -32715, -21686, 5892, 28973, 29944, 8062, -19972, -32765, -20554, 7342, 29635, 29312, 6619, -21126, -32749, -19380, 8778, 30237, 28620, 5162, -22236, -32665, -18166, 10195, 30776, 27870, 3695, -23301, -32515, -16916, 11592, 31253, 27063, 2220, -24318, -32298, -15630, 12965, 31666, 26201, 740, -25286, -32015, -14313, 14312, 32014, 25285, -741, -26202, -31667, -12966, 15629, 32297, 24317, -2221, -27064, -31254, -11593, 16915, 32514, 23300, -3696, -27871, -30777, -10196, 18165, 32664, 22235, -5163, -28621, -30238, -8779, 19379, 32748, 21125, -6620, -29313, -29636, -7343, 20553, 32764, 19971, -8063, -29945, -28974, -5893, 21685, 32714, 18777, -9490, -30515, -28253, -4430, 22773, 32597, 17544, -10898, -31024, -27474, -2959, 23815, 32414, 16276, -12283, -31469, -26640, -1481, 24807, 32164, 14974, -13643, -31849, -25750}, -{0, 24807, 32414, 17544, -9490, -29945, -29636, -8779, 18165, 32514, 24317, -741, -25286, -32298, -16916, 10195, 30237, 29312, 8062, -18778, -32598, -23816, 1480, 25749, 32164, 16276, -10898, -30515, -28974, -7343, 19379, 32664, 23300, -2221, -26202, -32015, -15630, 11592, 30776, 28620, 6619, -19972, -32715, -22774, 2958, 26639, 31848, 14974, -12283, -31024, -28253, -5893, 20553, 32748, 22235, -3696, -27064, -31667, -14313, 12965, 31253, 27870, 5162, -21126, -32765, -21686, 4429, 27473, 31468, 13642, -13643, -31469, -27474, -4430, 21685, 32764, 21125, -5163, -27871, -31254, -12966, 14312, 31666, 27063, 3695, -22236, -32749, -20554, 5892, 28252, 31023, 12282, -14975, -31849, -26640, -2959, 22773, 32714, 19971, -6620, -28621, -30777, -11593, 15629, 32014, 26201, 2220, -23301, -32665, -19380, 7342, 28973, 30514, 10897, -16277, -32165, -25750, -1481, 23815, 32597, 18777, -8063, -29313, -30238, -10196, 16915, 32297, 25285, 740, -24318, -32515, -18166, 8778, 29635, 29944, 9489, -17545, -32415, -24808}, -{0, 23815, 32714, 21125, -3696, -26202, -32298, -18166, 7342, 28252, 31468, 14974, -10898, -29945, -30238, -11593, 14312, 31253, 28620, 8062, -17545, -32165, -26640, -4430, 20553, 32664, 24317, 740, -23301, -32749, -21686, 2958, 25749, 32414, 18777, -6620, -27871, -31667, -15630, 10195, 29635, 30514, 12282, -13643, -31024, -28974, -8779, 16915, 32014, 27063, 5162, -19972, -32598, -24808, -1481, 22773, 32764, 22235, -2221, -25286, -32515, -19380, 5892, 27473, 31848, 16276, -9490, -29313, -30777, -12966, 12965, 30776, 29312, 9489, -16277, -31849, -27474, -5893, 19379, 32514, 25285, 2220, -22236, -32765, -22774, 1480, 24807, 32597, 19971, -5163, -27064, -32015, -16916, 8778, 28973, 31023, 13642, -12283, -30515, -29636, -10196, 15629, 31666, 27870, 6619, -18778, -32415, -25750, -2959, 21685, 32748, 23300, -741, -24318, -32665, -20554, 4429, 26639, 32164, 17544, -8063, -28621, -31254, -14313, 11592, 30237, 29944, 10897, -14975, -31469, -28253, -7343, 18165, 32297, 26201, 3695, -21126, -32715, -23816}, -{0, 22773, 32748, 24317, 2220, -21126, -32598, -25750, -4430, 19379, 32297, 27063, 6619, -17545, -31849, -28253, -8779, 15629, 31253, 29312, 10897, -13643, -30515, -30238, -12966, 11592, 29635, 31023, 14974, -9490, -28621, -31667, -16916, 7342, 27473, 32164, 18777, -5163, -26202, -32515, -20554, 2958, 24807, 32714, 22235, -741, -23301, -32765, -23816, -1481, 21685, 32664, 25285, 3695, -19972, -32415, -26640, -5893, 18165, 32014, 27870, 8062, -16277, -31469, -28974, -10196, 14312, 30776, 29944, 12282, -12283, -29945, -30777, -14313, 10195, 28973, 31468, 16276, -8063, -27871, -32015, -18166, 5892, 26639, 32414, 19971, -3696, -25286, -32665, -21686, 1480, 23815, 32764, 23300, 740, -22236, -32715, -24808, -2959, 20553, 32514, 26201, 5162, -18778, -32165, -27474, -7343, 16915, 31666, 28620, 9489, -14975, -31024, -29636, -11593, 12965, 30237, 30514, 13642, -10898, -29313, -31254, -15630, 8778, 28252, 31848, 17544, -6620, -27064, -32298, -19380, 4429, 25749, 32597, 21125, -2221, -24318, -32749, -22774}, -{0, 21685, 32514, 27063, 8062, -14975, -30515, -30777, -15630, 7342, 26639, 32597, 22235, 740, -21126, -32415, -27474, -8779, 14312, 30237, 31023, 16276, -6620, -26202, -32665, -22774, -1481, 20553, 32297, 27870, 9489, -13643, -29945, -31254, -16916, 5892, 25749, 32714, 23300, 2220, -19972, -32165, -28253, -10196, 12965, 29635, 31468, 17544, -5163, -25286, -32749, -23816, -2959, 19379, 32014, 28620, 10897, -12283, -29313, -31667, -18166, 4429, 24807, 32764, 24317, 3695, -18778, -31849, -28974, -11593, 11592, 28973, 31848, 18777, -3696, -24318, -32765, -24808, -4430, 18165, 31666, 29312, 12282, -10898, -28621, -32015, -19380, 2958, 23815, 32748, 25285, 5162, -17545, -31469, -29636, -12966, 10195, 28252, 32164, 19971, -2221, -23301, -32715, -25750, -5893, 16915, 31253, 29944, 13642, -9490, -27871, -32298, -20554, 1480, 22773, 32664, 26201, 6619, -16277, -31024, -30238, -14313, 8778, 27473, 32414, 21125, -741, -22236, -32598, -26640, -7343, 15629, 30776, 30514, 14974, -8063, -27064, -32515, -21686}, -{0, 20553, 32014, 29312, 13642, -8063, -26202, -32749, -24808, -5893, 15629, 30237, 31468, 18777, -2221, -22236, -32415, -28253, -11593, 10195, 27473, 32597, 23300, 3695, -17545, -31024, -30777, -16916, 4429, 23815, 32664, 27063, 9489, -12283, -28621, -32298, -21686, -1481, 19379, 31666, 29944, 14974, -6620, -25286, -32765, -25750, -7343, 14312, 29635, 31848, 19971, -741, -21126, -32165, -28974, -12966, 8778, 26639, 32714, 24317, 5162, -16277, -30515, -31254, -18166, 2958, 22773, 32514, 27870, 10897, -10898, -27871, -32515, -22774, -2959, 18165, 31253, 30514, 16276, -5163, -24318, -32715, -26640, -8779, 12965, 28973, 32164, 21125, 740, -19972, -31849, -29636, -14313, 7342, 25749, 32764, 25285, 6619, -14975, -29945, -31667, -19380, 1480, 21685, 32297, 28620, 12282, -9490, -27064, -32665, -23816, -4430, 16915, 30776, 31023, 17544, -3696, -23301, -32598, -27474, -10196, 11592, 28252, 32414, 22235, 2220, -18778, -31469, -30238, -15630, 5892, 24807, 32748, 26201, 8062, -13643, -29313, -32015, -20554}, -{0, 19379, 31253, 31023, 18777, -741, -19972, -31469, -30777, -18166, 1480, 20553, 31666, 30514, 17544, -2221, -21126, -31849, -30238, -16916, 2958, 21685, 32014, 29944, 16276, -3696, -22236, -32165, -29636, -15630, 4429, 22773, 32297, 29312, 14974, -5163, -23301, -32415, -28974, -14313, 5892, 23815, 32514, 28620, 13642, -6620, -24318, -32598, -28253, -12966, 7342, 24807, 32664, 27870, 12282, -8063, -25286, -32715, -27474, -11593, 8778, 25749, 32748, 27063, 10897, -9490, -26202, -32765, -26640, -10196, 10195, 26639, 32764, 26201, 9489, -10898, -27064, -32749, -25750, -8779, 11592, 27473, 32714, 25285, 8062, -12283, -27871, -32665, -24808, -7343, 12965, 28252, 32597, 24317, 6619, -13643, -28621, -32515, -23816, -5893, 14312, 28973, 32414, 23300, 5162, -14975, -29313, -32298, -22774, -4430, 15629, 29635, 32164, 22235, 3695, -16277, -29945, -32015, -21686, -2959, 16915, 30237, 31848, 21125, 2220, -17545, -30515, -31667, -20554, -1481, 18165, 30776, 31468, 19971, 740, -18778, -31024, -31254, -19380}, -{0, 18165, 30237, 32164, 23300, 6619, -12283, -27064, -32765, -27474, -12966, 5892, 22773, 32014, 30514, 18777, 740, -17545, -29945, -32298, -23816, -7343, 11592, 26639, 32748, 27870, 13642, -5163, -22236, -31849, -30777, -19380, -1481, 16915, 29635, 32414, 24317, 8062, -10898, -26202, -32715, -28253, -14313, 4429, 21685, 31666, 31023, 19971, 2220, -16277, -29313, -32515, -24808, -8779, 10195, 25749, 32664, 28620, 14974, -3696, -21126, -31469, -31254, -20554, -2959, 15629, 28973, 32597, 25285, 9489, -9490, -25286, -32598, -28974, -15630, 2958, 20553, 31253, 31468, 21125, 3695, -14975, -28621, -32665, -25750, -10196, 8778, 24807, 32514, 29312, 16276, -2221, -19972, -31024, -31667, -21686, -4430, 14312, 28252, 32714, 26201, 10897, -8063, -24318, -32415, -29636, -16916, 1480, 19379, 30776, 31848, 22235, 5162, -13643, -27871, -32749, -26640, -11593, 7342, 23815, 32297, 29944, 17544, -741, -18778, -30515, -32015, -22774, -5893, 12965, 27473, 32764, 27063, 12282, -6620, -23301, -32165, -30238, -18166}, -{0, 16915, 28973, 32714, 27063, 13642, -3696, -19972, -30515, -32298, -24808, -10196, 7342, 22773, 31666, 31468, 22235, 6619, -10898, -25286, -32415, -30238, -19380, -2959, 14312, 27473, 32748, 28620, 16276, -741, -17545, -29313, -32665, -26640, -12966, 4429, 20553, 30776, 32164, 24317, 9489, -8063, -23301, -31849, -31254, -21686, -5893, 11592, 25749, 32514, 29944, 18777, 2220, -14975, -27871, -32765, -28253, -15630, 1480, 18165, 29635, 32597, 26201, 12282, -5163, -21126, -31024, -32015, -23816, -8779, 8778, 23815, 32014, 31023, 21125, 5162, -12283, -26202, -32598, -29636, -18166, -1481, 15629, 28252, 32764, 27870, 14974, -2221, -18778, -29945, -32515, -25750, -11593, 5892, 21685, 31253, 31848, 23300, 8062, -9490, -24318, -32165, -30777, -20554, -4430, 12965, 26639, 32664, 29312, 17544, 740, -16277, -28621, -32749, -27474, -14313, 2958, 19379, 30237, 32414, 25285, 10897, -6620, -22236, -31469, -31667, -22774, -7343, 10195, 24807, 32297, 30514, 19971, 3695, -13643, -27064, -32715, -28974, -16916}, -{0, 15629, 27473, 32664, 29944, 19971, 5162, -10898, -24318, -31849, -31667, -23816, -10196, 5892, 20553, 30237, 32597, 27063, 14974, -741, -16277, -27871, -32715, -29636, -19380, -4430, 11592, 24807, 32014, 31468, 23300, 9489, -6620, -21126, -30515, -32515, -26640, -14313, 1480, 16915, 28252, 32748, 29312, 18777, 3695, -12283, -25286, -32165, -31254, -22774, -8779, 7342, 21685, 30776, 32414, 26201, 13642, -2221, -17545, -28621, -32765, -28974, -18166, -2959, 12965, 25749, 32297, 31023, 22235, 8062, -8063, -22236, -31024, -32298, -25750, -12966, 2958, 18165, 28973, 32764, 28620, 17544, 2220, -13643, -26202, -32415, -30777, -21686, -7343, 8778, 22773, 31253, 32164, 25285, 12282, -3696, -18778, -29313, -32749, -28253, -16916, -1481, 14312, 26639, 32514, 30514, 21125, 6619, -9490, -23301, -31469, -32015, -24808, -11593, 4429, 19379, 29635, 32714, 27870, 16276, 740, -14975, -27064, -32598, -30238, -20554, -5893, 10195, 23815, 31666, 31848, 24317, 10897, -5163, -19972, -29945, -32665, -27474, -15630}, -{0, 14312, 25749, 32014, 31848, 25285, 13642, -741, -14975, -26202, -32165, -31667, -24808, -12966, 1480, 15629, 26639, 32297, 31468, 24317, 12282, -2221, -16277, -27064, -32415, -31254, -23816, -11593, 2958, 16915, 27473, 32514, 31023, 23300, 10897, -3696, -17545, -27871, -32598, -30777, -22774, -10196, 4429, 18165, 28252, 32664, 30514, 22235, 9489, -5163, -18778, -28621, -32715, -30238, -21686, -8779, 5892, 19379, 28973, 32748, 29944, 21125, 8062, -6620, -19972, -29313, -32765, -29636, -20554, -7343, 7342, 20553, 29635, 32764, 29312, 19971, 6619, -8063, -21126, -29945, -32749, -28974, -19380, -5893, 8778, 21685, 30237, 32714, 28620, 18777, 5162, -9490, -22236, -30515, -32665, -28253, -18166, -4430, 10195, 22773, 30776, 32597, 27870, 17544, 3695, -10898, -23301, -31024, -32515, -27474, -16916, -2959, 11592, 23815, 31253, 32414, 27063, 16276, 2220, -12283, -24318, -31469, -32298, -26640, -15630, -1481, 12965, 24807, 31666, 32164, 26201, 14974, 740, -13643, -25286, -31849, -32015, -25750, -14313}, -{0, 12965, 23815, 30776, 32714, 29312, 21125, 9489, -3696, -16277, -26202, -31849, -32298, -27474, -18166, -5893, 7342, 19379, 28252, 32514, 31468, 25285, 14974, 2220, -10898, -22236, -29945, -32765, -30238, -22774, -11593, 1480, 14312, 24807, 31253, 32597, 28620, 19971, 8062, -5163, -17545, -27064, -32165, -32015, -26640, -16916, -4430, 8778, 20553, 28973, 32664, 31023, 24317, 13642, 740, -12283, -23301, -30515, -32749, -29636, -21686, -10196, 2958, 15629, 25749, 31666, 32414, 27870, 18777, 6619, -6620, -18778, -27871, -32415, -31667, -25750, -15630, -2959, 10195, 21685, 29635, 32748, 30514, 23300, 12282, -741, -13643, -24318, -31024, -32665, -28974, -20554, -8779, 4429, 16915, 26639, 32014, 32164, 27063, 17544, 5162, -8063, -19972, -28621, -32598, -31254, -24808, -14313, -1481, 11592, 22773, 30237, 32764, 29944, 22235, 10897, -2221, -14975, -25286, -31469, -32515, -28253, -19380, -7343, 5892, 18165, 27473, 32297, 31848, 26201, 16276, 3695, -9490, -21126, -29313, -32715, -30777, -23816, -12966}, -{0, 11592, 21685, 28973, 32514, 31848, 27063, 18777, 8062, -3696, -14975, -24318, -30515, -32765, -30777, -24808, -15630, -4430, 7342, 18165, 26639, 31666, 32597, 29312, 22235, 12282, 740, -10898, -21126, -28621, -32415, -32015, -27474, -19380, -8779, 2958, 14312, 23815, 30237, 32748, 31023, 25285, 16276, 5162, -6620, -17545, -26202, -31469, -32665, -29636, -22774, -12966, -1481, 10195, 20553, 28252, 32297, 32164, 27870, 19971, 9489, -2221, -13643, -23301, -29945, -32715, -31254, -25750, -16916, -5893, 5892, 16915, 25749, 31253, 32714, 29944, 23300, 13642, 2220, -9490, -19972, -27871, -32165, -32298, -28253, -20554, -10196, 1480, 12965, 22773, 29635, 32664, 31468, 26201, 17544, 6619, -5163, -16277, -25286, -31024, -32749, -30238, -23816, -14313, -2959, 8778, 19379, 27473, 32014, 32414, 28620, 21125, 10897, -741, -12283, -22236, -29313, -32598, -31667, -26640, -18166, -7343, 4429, 15629, 24807, 30776, 32764, 30514, 24317, 14974, 3695, -8063, -18778, -27064, -31849, -32515, -28974, -21686, -11593}, -{0, 10195, 19379, 26639, 31253, 32764, 31023, 26201, 18777, 9489, -741, -10898, -19972, -27064, -31469, -32749, -30777, -25750, -18166, -8779, 1480, 11592, 20553, 27473, 31666, 32714, 30514, 25285, 17544, 8062, -2221, -12283, -21126, -27871, -31849, -32665, -30238, -24808, -16916, -7343, 2958, 12965, 21685, 28252, 32014, 32597, 29944, 24317, 16276, 6619, -3696, -13643, -22236, -28621, -32165, -32515, -29636, -23816, -15630, -5893, 4429, 14312, 22773, 28973, 32297, 32414, 29312, 23300, 14974, 5162, -5163, -14975, -23301, -29313, -32415, -32298, -28974, -22774, -14313, -4430, 5892, 15629, 23815, 29635, 32514, 32164, 28620, 22235, 13642, 3695, -6620, -16277, -24318, -29945, -32598, -32015, -28253, -21686, -12966, -2959, 7342, 16915, 24807, 30237, 32664, 31848, 27870, 21125, 12282, 2220, -8063, -17545, -25286, -30515, -32715, -31667, -27474, -20554, -11593, -1481, 8778, 18165, 25749, 30776, 32748, 31468, 27063, 19971, 10897, 740, -9490, -18778, -26202, -31024, -32765, -31254, -26640, -19380, -10196}, -{0, 8778, 16915, 23815, 28973, 32014, 32714, 31023, 27063, 21125, 13642, 5162, -3696, -12283, -19972, -26202, -30515, -32598, -32298, -29636, -24808, -18166, -10196, -1481, 7342, 15629, 22773, 28252, 31666, 32764, 31468, 27870, 22235, 14974, 6619, -2221, -10898, -18778, -25286, -29945, -32415, -32515, -30238, -25750, -19380, -11593, -2959, 5892, 14312, 21685, 27473, 31253, 32748, 31848, 28620, 23300, 16276, 8062, -741, -9490, -17545, -24318, -29313, -32165, -32665, -30777, -26640, -20554, -12966, -4430, 4429, 12965, 20553, 26639, 30776, 32664, 32164, 29312, 24317, 17544, 9489, 740, -8063, -16277, -23301, -28621, -31849, -32749, -31254, -27474, -21686, -14313, -5893, 2958, 11592, 19379, 25749, 30237, 32514, 32414, 29944, 25285, 18777, 10897, 2220, -6620, -14975, -22236, -27871, -31469, -32765, -31667, -28253, -22774, -15630, -7343, 1480, 10195, 18165, 24807, 29635, 32297, 32597, 30514, 26201, 19971, 12282, 3695, -5163, -13643, -21126, -27064, -31024, -32715, -32015, -28974, -23816, -16916, -8779}, -{0, 7342, 14312, 20553, 25749, 29635, 32014, 32764, 31848, 29312, 25285, 19971, 13642, 6619, -741, -8063, -14975, -21126, -26202, -29945, -32165, -32749, -31667, -28974, -24808, -19380, -12966, -5893, 1480, 8778, 15629, 21685, 26639, 30237, 32297, 32714, 31468, 28620, 24317, 18777, 12282, 5162, -2221, -9490, -16277, -22236, -27064, -30515, -32415, -32665, -31254, -28253, -23816, -18166, -11593, -4430, 2958, 10195, 16915, 22773, 27473, 30776, 32514, 32597, 31023, 27870, 23300, 17544, 10897, 3695, -3696, -10898, -17545, -23301, -27871, -31024, -32598, -32515, -30777, -27474, -22774, -16916, -10196, -2959, 4429, 11592, 18165, 23815, 28252, 31253, 32664, 32414, 30514, 27063, 22235, 16276, 9489, 2220, -5163, -12283, -18778, -24318, -28621, -31469, -32715, -32298, -30238, -26640, -21686, -15630, -8779, -1481, 5892, 12965, 19379, 24807, 28973, 31666, 32748, 32164, 29944, 26201, 21125, 14974, 8062, 740, -6620, -13643, -19972, -25286, -29313, -31849, -32765, -32015, -29636, -25750, -20554, -14313, -7343}, -{0, 5892, 11592, 16915, 21685, 25749, 28973, 31253, 32514, 32714, 31848, 29944, 27063, 23300, 18777, 13642, 8062, 2220, -3696, -9490, -14975, -19972, -24318, -27871, -30515, -32165, -32765, -32298, -30777, -28253, -24808, -20554, -15630, -10196, -4430, 1480, 7342, 12965, 18165, 22773, 26639, 29635, 31666, 32664, 32597, 31468, 29312, 26201, 22235, 17544, 12282, 6619, 740, -5163, -10898, -16277, -21126, -25286, -28621, -31024, -32415, -32749, -32015, -30238, -27474, -23816, -19380, -14313, -8779, -2959, 2958, 8778, 14312, 19379, 23815, 27473, 30237, 32014, 32748, 32414, 31023, 28620, 25285, 21125, 16276, 10897, 5162, -741, -6620, -12283, -17545, -22236, -26202, -29313, -31469, -32598, -32665, -31667, -29636, -26640, -22774, -18166, -12966, -7343, -1481, 4429, 10195, 15629, 20553, 24807, 28252, 30776, 32297, 32764, 32164, 30514, 27870, 24317, 19971, 14974, 9489, 3695, -2221, -8063, -13643, -18778, -23301, -27064, -29945, -31849, -32715, -32515, -31254, -28974, -25750, -21686, -16916, -11593, -5893}, -{0, 4429, 8778, 12965, 16915, 20553, 23815, 26639, 28973, 30776, 32014, 32664, 32714, 32164, 31023, 29312, 27063, 24317, 21125, 17544, 13642, 9489, 5162, 740, -3696, -8063, -12283, -16277, -19972, -23301, -26202, -28621, -30515, -31849, -32598, -32749, -32298, -31254, -29636, -27474, -24808, -21686, -18166, -14313, -10196, -5893, -1481, 2958, 7342, 11592, 15629, 19379, 22773, 25749, 28252, 30237, 31666, 32514, 32764, 32414, 31468, 29944, 27870, 25285, 22235, 18777, 14974, 10897, 6619, 2220, -2221, -6620, -10898, -14975, -18778, -22236, -25286, -27871, -29945, -31469, -32415, -32765, -32515, -31667, -30238, -28253, -25750, -22774, -19380, -15630, -11593, -7343, -2959, 1480, 5892, 10195, 14312, 18165, 21685, 24807, 27473, 29635, 31253, 32297, 32748, 32597, 31848, 30514, 28620, 26201, 23300, 19971, 16276, 12282, 8062, 3695, -741, -5163, -9490, -13643, -17545, -21126, -24318, -27064, -29313, -31024, -32165, -32715, -32665, -32015, -30777, -28974, -26640, -23816, -20554, -16916, -12966, -8779, -4430}, -{0, 2958, 5892, 8778, 11592, 14312, 16915, 19379, 21685, 23815, 25749, 27473, 28973, 30237, 31253, 32014, 32514, 32748, 32714, 32414, 31848, 31023, 29944, 28620, 27063, 25285, 23300, 21125, 18777, 16276, 13642, 10897, 8062, 5162, 2220, -741, -3696, -6620, -9490, -12283, -14975, -17545, -19972, -22236, -24318, -26202, -27871, -29313, -30515, -31469, -32165, -32598, -32765, -32665, -32298, -31667, -30777, -29636, -28253, -26640, -24808, -22774, -20554, -18166, -15630, -12966, -10196, -7343, -4430, -1481, 1480, 4429, 7342, 10195, 12965, 15629, 18165, 20553, 22773, 24807, 26639, 28252, 29635, 30776, 31666, 32297, 32664, 32764, 32597, 32164, 31468, 30514, 29312, 27870, 26201, 24317, 22235, 19971, 17544, 14974, 12282, 9489, 6619, 3695, 740, -2221, -5163, -8063, -10898, -13643, -16277, -18778, -21126, -23301, -25286, -27064, -28621, -29945, -31024, -31849, -32415, -32715, -32749, -32515, -32015, -31254, -30238, -28974, -27474, -25750, -23816, -21686, -19380, -16916, -14313, -11593, -8779, -5893, -2959}, -{0, 1480, 2958, 4429, 5892, 7342, 8778, 10195, 11592, 12965, 14312, 15629, 16915, 18165, 19379, 20553, 21685, 22773, 23815, 24807, 25749, 26639, 27473, 28252, 28973, 29635, 30237, 30776, 31253, 31666, 32014, 32297, 32514, 32664, 32748, 32764, 32714, 32597, 32414, 32164, 31848, 31468, 31023, 30514, 29944, 29312, 28620, 27870, 27063, 26201, 25285, 24317, 23300, 22235, 21125, 19971, 18777, 17544, 16276, 14974, 13642, 12282, 10897, 9489, 8062, 6619, 5162, 3695, 2220, 740, -741, -2221, -3696, -5163, -6620, -8063, -9490, -10898, -12283, -13643, -14975, -16277, -17545, -18778, -19972, -21126, -22236, -23301, -24318, -25286, -26202, -27064, -27871, -28621, -29313, -29945, -30515, -31024, -31469, -31849, -32165, -32415, -32598, -32715, -32765, -32749, -32665, -32515, -32298, -32015, -31667, -31254, -30777, -30238, -29636, -28974, -28253, -27474, -26640, -25750, -24808, -23816, -22774, -21686, -20554, -19380, -18166, -16916, -15630, -14313, -12966, -11593, -10196, -8779, -7343, -5893, -4430, -2959, -1481} -}; \ No newline at end of file diff --git a/openair1/PHY/NR_TRANSPORT/nr_prach_common.c b/openair1/PHY/NR_TRANSPORT/nr_prach_common.c index 8cc5951b19..a95c519d43 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_prach_common.c +++ b/openair1/PHY/NR_TRANSPORT/nr_prach_common.c @@ -127,8 +127,6 @@ void compute_nr_prach_seq(uint8_t short_sequence, LOG_D( PHY, "compute_prach_seq: done init prach_tables\n" ); - int16_t *x_u_time = calloc(1, sizeof(int32_t)*N_ZC); - for (i=0; i>1); - x_u_time[k<<1] = (int16_t)nr_ru[nr_ru_index<<1]; - x_u_time[1+(k<<1)] = (int16_t)nr_ru[1+(nr_ru_index<<1)]; + // multiply by inverse of 2 (required since ru is exp[j 2\pi n]) + X_u[i][k] = ((uint32_t*)nr_ru)[(((k*(1+(inv_u*k)))%N_ZC)*nr_ZC_inv[2])%N_ZC]; } - - int16_t *x_u_freq = (int16_t*)X_u[i]; - bzero(x_u_freq,sizeof(int32_t)*N_ZC); - for (int line=0; line>19); - x_u_freq[1+(line<<1)] = x_u_freq[1+(line<<1)] + (im>>19); - } - } - -#ifdef PRACH_DEBUG - for (k=0; k>16)); - } -#endif } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_UE_COMPUTE_PRACH, VCD_FUNCTION_OUT); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 1d8f3a9caf..1a330da02c 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -523,9 +523,9 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, } else { LOG_I(NR_MAC,"[RAPROC] RA-Msg3 received\n"); - LOG_D(NR_MAC,"[RAPROC] Received Msg3:\n"); + LOG_I(NR_MAC,"[RAPROC] Received Msg3:\n"); for (int k = 0; k < sdu_lenP; k++) { - LOG_D(NR_MAC,"(%i): 0x%x\n",k,sduP[k]); + LOG_I(NR_MAC,"(%i): 0x%x\n",k,sduP[k]); } // UE Contention Resolution Identity From 1ee7d7e5514e363a9b7edd7e45b8e980a1b13c6e Mon Sep 17 00:00:00 2001 From: rmagueta Date: Thu, 18 Mar 2021 17:39:01 +0000 Subject: [PATCH 211/231] Remove some hard code values --- openair1/PHY/NR_TRANSPORT/nr_prach.c | 2 +- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 26 ++++++++++++++++--- .../LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c | 1 + .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 4 +-- 4 files changed, 27 insertions(+), 6 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/nr_prach.c b/openair1/PHY/NR_TRANSPORT/nr_prach.c index 1d971a8831..0c1fde07a2 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_prach.c +++ b/openair1/PHY/NR_TRANSPORT/nr_prach.c @@ -681,7 +681,7 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, preamble_shift -= NCS; if (preamble_shift < 0) - preamble_shift+=N_ZC; + preamble_shift+=((N_ZC/NCS)*NCS); } } else { // This is the high-speed case new_dft = 0; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 0b96a287b7..2bf5ab437f 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -837,6 +837,7 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra int rbSize = 8; if (nr_mac->sched_ctrlCommon == NULL){ + LOG_D(NR_MAC,"generate_Msg2: Filling nr_mac->sched_ctrlCommon\n"); nr_mac->sched_ctrlCommon = calloc(1,sizeof(*nr_mac->sched_ctrlCommon)); nr_mac->sched_ctrlCommon->search_space = calloc(1,sizeof(*nr_mac->sched_ctrlCommon->search_space)); nr_mac->sched_ctrlCommon->coreset = calloc(1,sizeof(*nr_mac->sched_ctrlCommon->coreset)); @@ -890,6 +891,12 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols); AssertFatal(startSymbolIndex >= 0, "StartSymbolIndex is negative\n"); + if (nrOfSymbols == 2) { + nr_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData = 1; + } else { + nr_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData = 2; + } + // look up the PDCCH PDU for this CC, BWP, and CORESET. If it does not exist, create it. This is especially // important if we have multiple RAs, and the DLSCH has to reuse them, so we need to mark them const int bwpid = bwp->bwp_Id; @@ -939,6 +946,10 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra mcsTableIdx = 2; } + AssertFatal(nr_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData == 1 || nr_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData == 2, + "nr_mac->schedCtrlCommon->numDmrsCdmGrpsNoData %d is not possible", + nr_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData); + pdsch_pdu_rel15->pduBitmap = 0; pdsch_pdu_rel15->rnti = ra->RA_rnti; pdsch_pdu_rel15->pduIndex = pduindex; @@ -959,7 +970,7 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra pdsch_pdu_rel15->dmrsConfigType = bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1; pdsch_pdu_rel15->dlDmrsScramblingId = *scc->physCellId; pdsch_pdu_rel15->SCID = 0; - pdsch_pdu_rel15->numDmrsCdmGrpsNoData = 2; + pdsch_pdu_rel15->numDmrsCdmGrpsNoData = nr_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData; pdsch_pdu_rel15->dmrsPorts = 1; pdsch_pdu_rel15->resourceAlloc = 1; pdsch_pdu_rel15->rbStart = rbStart; @@ -1108,12 +1119,15 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra // Bytes to be transmitted uint8_t *buf = (uint8_t *) harq->tb; uint16_t mac_pdu_length = nr_write_ce_dlsch_pdu(module_idP, nr_mac->sched_ctrlCommon, buf, 255, ra->cont_res_id); + LOG_D(NR_MAC,"Encoded contention resolution mac_pdu_length %d\n",mac_pdu_length); uint16_t mac_sdu_length = mac_rrc_nr_data_req(module_idP, CC_id, frameP, CCCH, ra->rnti, 1, &buf[mac_pdu_length+2]); ((NR_MAC_SUBHEADER_SHORT *) &buf[mac_pdu_length])->R = 0; ((NR_MAC_SUBHEADER_SHORT *) &buf[mac_pdu_length])->F = 0; ((NR_MAC_SUBHEADER_SHORT *) &buf[mac_pdu_length])->LCID = DL_SCH_LCID_CCCH; - ((NR_MAC_SUBHEADER_SHORT *) &buf[mac_pdu_length])->L = mac_sdu_length * 8; - mac_pdu_length = mac_pdu_length + mac_sdu_length + 2; + ((NR_MAC_SUBHEADER_SHORT *) &buf[mac_pdu_length])->L = mac_sdu_length; + mac_pdu_length = mac_pdu_length + mac_sdu_length + sizeof(NR_MAC_SUBHEADER_SHORT); + + LOG_D(NR_MAC,"Encoded RRCSetup Piggyback (%d + 2 bytes), mac_pdu_length %d\n",mac_sdu_length,mac_pdu_length); // Calculate number of symbols int startSymbolIndex, nrOfSymbols; @@ -1130,6 +1144,11 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra long dmrsConfigType = bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1; uint8_t N_PRB_DMRS = 0; + + AssertFatal(nr_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData == 1 || nr_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData == 2, + "nr_mac->schedCtrlCommon->numDmrsCdmGrpsNoData %d is not possible", + nr_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData); + if (dmrsConfigType==NFAPI_NR_DMRS_TYPE1) { N_PRB_DMRS = nr_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData * 6; } @@ -1153,6 +1172,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra uint16_t *vrb_map = cc[CC_id].vrb_map; do { rbSize++; + LOG_D(NR_MAC,"Calling nr_compute_tbs with N_PRB_DMRS %d, N_DMRS_SLOT %d\n",N_PRB_DMRS,N_DMRS_SLOT); harq->tb_size = nr_compute_tbs(nr_get_Qm_dl(mcsIndex, mcsTableIdx), nr_get_code_rate_dl(mcsIndex, mcsTableIdx), rbSize, nrOfSymbols, N_PRB_DMRS * N_DMRS_SLOT, 0, tb_scaling,1) >> 3; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index a60685c586..1b2f60625b 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -243,6 +243,7 @@ void schedule_control_sib1(module_id_t module_id, uint16_t *vrb_map = RC.nrmac[module_id]->common_channels[CC_id].vrb_map; if (gNB_mac->sched_ctrlCommon == NULL){ + LOG_D(NR_MAC,"schedule_control_common: Filling nr_mac->sched_ctrlCommon\n"); gNB_mac->sched_ctrlCommon = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon)); gNB_mac->sched_ctrlCommon->search_space = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon->search_space)); gNB_mac->sched_ctrlCommon->coreset = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon->coreset)); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 1a330da02c..db7735af7f 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -522,8 +522,8 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, } else { - LOG_I(NR_MAC,"[RAPROC] RA-Msg3 received\n"); - LOG_I(NR_MAC,"[RAPROC] Received Msg3:\n"); + LOG_I(NR_MAC,"[RAPROC] RA-Msg3 received (sdu_lenP %d)\n",sdu_lenP); + LOG_D(NR_MAC,"[RAPROC] Received Msg3:\n"); for (int k = 0; k < sdu_lenP; k++) { LOG_I(NR_MAC,"(%i): 0x%x\n",k,sduP[k]); } From b067406097781d543f260e42479d5d317532bdd7 Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Thu, 18 Mar 2021 18:49:16 +0000 Subject: [PATCH 212/231] Fix msg1-FrequencyStart in config files for SA --- .../GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf | 2 +- .../GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf index dd18cf624e..0bd9861ad9 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf @@ -104,7 +104,7 @@ gNBs = #prach_msg1_FDM #0 = one, 1=two, 2=four, 3=eight prach_msg1_FDM = 0; - prach_msg1_FrequencyStart = 0; + prach_msg1_FrequencyStart = 27; zeroCorrelationZoneConfig = 13; preambleReceivedTargetPower = -96; #preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf index 001e5b917a..9a666d4c6b 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf @@ -104,7 +104,7 @@ gNBs = #prach_msg1_FDM #0 = one, 1=two, 2=four, 3=eight prach_msg1_FDM = 0; - prach_msg1_FrequencyStart = 0; + prach_msg1_FrequencyStart = 27; zeroCorrelationZoneConfig = 13; preambleReceivedTargetPower = -96; #preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) From 5b8e2734e2ec6371186110e2b412422ac97b539c Mon Sep 17 00:00:00 2001 From: hardy Date: Thu, 18 Mar 2021 21:46:56 +0100 Subject: [PATCH 213/231] updating xNB start detection for Benetel --- ci-scripts/ran.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci-scripts/ran.py b/ci-scripts/ran.py index 5a88a096a3..783adb98e6 100644 --- a/ci-scripts/ran.py +++ b/ci-scripts/ran.py @@ -465,7 +465,7 @@ class RANManagement(): self.prematureExit = True return else: - mySSH.command('stdbuf -o0 cat enb_' + self.testCase_id + '.log | egrep --text --color=never -i "wait|sync|Starting"', '\$', 4) + mySSH.command('stdbuf -o0 cat enb_' + self.testCase_id + '.log | egrep --text --color=never -i "wait|sync|Starting|Started"', '\$', 4) if rruCheck: result = re.search('wait RUs', mySSH.getBefore()) else: From a2fc1a5d3b14c46cdb53179aba7d678929d9e640 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Fri, 19 Mar 2021 11:10:24 +0100 Subject: [PATCH 214/231] [CI][DOCKER] display intermediate logs for CI purpose Signed-off-by: Raphael Defosseux --- ci-scripts/cls_containerize.py | 41 +++++++++++++++++++------------- cmake_targets/build_oai | 5 ++++ cmake_targets/tools/build_helper | 5 ++++ docker/Dockerfile.eNB.rhel8.2 | 2 +- docker/Dockerfile.eNB.ubuntu18 | 2 +- docker/Dockerfile.gNB.rhel8.2 | 2 +- docker/Dockerfile.gNB.ubuntu18 | 2 +- docker/Dockerfile.lteUE.rhel8.2 | 2 +- docker/Dockerfile.lteUE.ubuntu18 | 2 +- docker/Dockerfile.nrUE.rhel8.2 | 2 +- docker/Dockerfile.nrUE.ubuntu18 | 2 +- 11 files changed, 42 insertions(+), 25 deletions(-) diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index 850f9fa0e0..d58e49b20b 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -189,7 +189,7 @@ class Containerize(): mySSH.command('mkdir -p tmp/entitlement/', '\$', 5) mySSH.command('sudo cp /etc/rhsm/ca/redhat-uep.pem tmp/ca/', '\$', 5) mySSH.command('sudo cp /etc/pki/entitlement/*.pem tmp/entitlement/', '\$', 5) - + sharedimage = 'ran-build' # Let's remove any previous run artifacts if still there mySSH.command(self.cli + ' image prune --force', '\$', 5) @@ -198,22 +198,7 @@ class Containerize(): mySSH.command(self.cli + ' image rm ' + image + ':' + imageTag, '\$', 5) # Build the shared image mySSH.command(self.cli + ' build --target ' + sharedimage + ' --tag ' + sharedimage + ':' + imageTag + ' --file docker/Dockerfile.ran' + self.dockerfileprefix + ' --build-arg NEEDED_GIT_PROXY="http://proxy.eurecom.fr:8080" . > cmake_targets/log/ran-build.log 2>&1', '\$', 1600) - # Build the target image(s) - previousImage = sharedimage + ':' + imageTag - danglingShaOnes=[] - for image,pattern in imageNames: - # the archived Dockerfiles have "ran-build:latest" as base image - # we need to update them with proper tag - mySSH.command('sed -i -e "s#' + sharedimage + ':latest#' + sharedimage + ':' + imageTag + '#" docker/Dockerfile.' + pattern + self.dockerfileprefix, '\$', 5) - mySSH.command(self.cli + ' build --target ' + image + ' --tag ' + image + ':' + imageTag + ' --file docker/Dockerfile.' + pattern + self.dockerfileprefix + ' . > cmake_targets/log/' + image + '.log 2>&1', '\$', 1200) - # Retrieving the dangling image(s) for the log collection - mySSH.command(self.cli + ' images --filter "dangling=true" --filter "since=' + previousImage + '" -q | sed -e "s#^#sha=#"', '\$', 5) - result = re.search('sha=(?P[a-zA-Z0-9\-\_]+)', mySSH.getBefore()) - if result is not None: - danglingShaOnes.append((image, result.group('imageShaOne'))) - previousImage = image + ':' + imageTag - - # First verify if images were properly created. + # First verify if the shared image was properly created. status = True mySSH.command(self.cli + ' image inspect --format=\'Size = {{.Size}} bytes\' ' + sharedimage + ':' + imageTag, '\$', 5) if (mySSH.getBefore().count('No such object') != 0) or (mySSH.getBefore().count('no such image') != 0): @@ -238,7 +223,29 @@ class Containerize(): self.allImagesSize['ran-build'] = str(round(imageSize,1)) + ' Gbytes' else: logging.debug('ran-build size is unknown') + # If the shared image failed, no need to continue + if not status: + mySSH.close() + logging.error('\u001B[1m Building OAI Images Failed\u001B[0m') + HTML.CreateHtmlTestRow(self.imageKind, 'KO', CONST.ALL_PROCESSES_OK) + HTML.CreateHtmlTabFooter(False) + sys.exit(1) + + # Build the target image(s) + previousImage = sharedimage + ':' + imageTag + danglingShaOnes=[] for image,pattern in imageNames: + # the archived Dockerfiles have "ran-build:latest" as base image + # we need to update them with proper tag + mySSH.command('sed -i -e "s#' + sharedimage + ':latest#' + sharedimage + ':' + imageTag + '#" docker/Dockerfile.' + pattern + self.dockerfileprefix, '\$', 5) + mySSH.command(self.cli + ' build --target ' + image + ' --tag ' + image + ':' + imageTag + ' --file docker/Dockerfile.' + pattern + self.dockerfileprefix + ' . > cmake_targets/log/' + image + '.log 2>&1', '\$', 1200) + # Retrieving the dangling image(s) for the log collection + mySSH.command(self.cli + ' images --filter "dangling=true" --filter "since=' + previousImage + '" -q | sed -e "s#^#sha=#"', '\$', 5) + result = re.search('sha=(?P[a-zA-Z0-9\-\_]+)', mySSH.getBefore()) + if result is not None: + danglingShaOnes.append((image, result.group('imageShaOne'))) + previousImage = image + ':' + imageTag + # checking the status of the build mySSH.command(self.cli + ' image inspect --format=\'Size = {{.Size}} bytes\' ' + image + ':' + imageTag, '\$', 5) if (mySSH.getBefore().count('No such object') != 0) or (mySSH.getBefore().count('no such image') != 0): logging.error('Could not build properly ' + image) diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index 960b241047..dbcadba103 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -50,6 +50,7 @@ REL="Rel15" HW="None" TP="None" EPC=0 +VERBOSE_CI=0 VERBOSE_COMPILE=0 CFLAGS_PROCESSOR_USER="" RUN_GROUP=0 @@ -324,6 +325,10 @@ function main() { HWLAT_TEST=1 echo_info "Will compile hw latency test program" shift;; + --verbose-ci) + VERBOSE_CI=1 + echo_info "Will compile with verbose instructions in CI Docker env" + shift;; --verbose-compile) VERBOSE_COMPILE=1 echo_info "Will compile with verbose instructions" diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper index 0c3dbfd048..9b8363fc2b 100755 --- a/cmake_targets/tools/build_helper +++ b/cmake_targets/tools/build_helper @@ -221,6 +221,11 @@ compilations() { ret=$? } > $dlog/$2.$REL.txt 2>&1 set -e + if [ "$VERBOSE_CI" == "1" ]; then + echo_info "====== Start of log for $2.$REL.txt ======" + cat $dlog/$2.$REL.txt + echo_info "====== End of log for $2.$REL.txt ======" + fi if [[ $ret -ne 0 ]]; then check_warnings "$dlog/$2.$REL.txt" check_errors "$dlog/$2.$REL.txt" diff --git a/docker/Dockerfile.eNB.rhel8.2 b/docker/Dockerfile.eNB.rhel8.2 index 05d9b62a6d..aa8b9aa228 100644 --- a/docker/Dockerfile.eNB.rhel8.2 +++ b/docker/Dockerfile.eNB.rhel8.2 @@ -35,7 +35,7 @@ COPY . . RUN /bin/sh oaienv && \ cd cmake_targets && \ mkdir -p log && \ - ./build_oai --eNB --ninja -w USRP + ./build_oai --eNB --ninja -w USRP --verbose-ci # debug #RUN ldconfig -v && ldd /oai-ran/targets/bin/lte-softmodem.Rel15 diff --git a/docker/Dockerfile.eNB.ubuntu18 b/docker/Dockerfile.eNB.ubuntu18 index 1ecd166ead..95d7194c31 100644 --- a/docker/Dockerfile.eNB.ubuntu18 +++ b/docker/Dockerfile.eNB.ubuntu18 @@ -35,7 +35,7 @@ COPY . . RUN /bin/sh oaienv && \ cd cmake_targets && \ mkdir -p log && \ - ./build_oai --eNB --ninja -w USRP + ./build_oai --eNB --ninja -w USRP --verbose-ci RUN apt-get install -y python3-pip && \ pip3 install --ignore-installed pyyaml && \ diff --git a/docker/Dockerfile.gNB.rhel8.2 b/docker/Dockerfile.gNB.rhel8.2 index 4621b4df9e..6969c691fd 100644 --- a/docker/Dockerfile.gNB.rhel8.2 +++ b/docker/Dockerfile.gNB.rhel8.2 @@ -35,7 +35,7 @@ COPY . . RUN /bin/sh oaienv && \ cd cmake_targets && \ mkdir -p log && \ - ./build_oai --gNB --ninja -w USRP + ./build_oai --gNB --ninja -w USRP --verbose-ci #debug #RUN ldconfig -v diff --git a/docker/Dockerfile.gNB.ubuntu18 b/docker/Dockerfile.gNB.ubuntu18 index e492aa1a62..276d6989c4 100644 --- a/docker/Dockerfile.gNB.ubuntu18 +++ b/docker/Dockerfile.gNB.ubuntu18 @@ -35,7 +35,7 @@ COPY . . RUN /bin/sh oaienv && \ cd cmake_targets && \ mkdir -p log && \ - ./build_oai --gNB --ninja -w USRP + ./build_oai --gNB --ninja -w USRP --verbose-ci #debug RUN ldconfig -v diff --git a/docker/Dockerfile.lteUE.rhel8.2 b/docker/Dockerfile.lteUE.rhel8.2 index 6b31646095..e22343d63c 100644 --- a/docker/Dockerfile.lteUE.rhel8.2 +++ b/docker/Dockerfile.lteUE.rhel8.2 @@ -35,7 +35,7 @@ COPY . . RUN /bin/sh oaienv && \ cd cmake_targets && \ mkdir -p log && \ - ./build_oai --UE --ninja -w USRP + ./build_oai --UE --ninja -w USRP --verbose-ci # debug #RUN ldconfig -v && ldd /oai-ran/targets/bin/lte-uesoftmodem.Rel15 diff --git a/docker/Dockerfile.lteUE.ubuntu18 b/docker/Dockerfile.lteUE.ubuntu18 index 9ef9bb01a7..6af2e61991 100644 --- a/docker/Dockerfile.lteUE.ubuntu18 +++ b/docker/Dockerfile.lteUE.ubuntu18 @@ -35,7 +35,7 @@ COPY . . RUN /bin/sh oaienv && \ cd cmake_targets && \ mkdir -p log && \ - ./build_oai --UE --ninja -w USRP + ./build_oai --UE --ninja -w USRP --verbose-ci # debug #RUN ldconfig -v diff --git a/docker/Dockerfile.nrUE.rhel8.2 b/docker/Dockerfile.nrUE.rhel8.2 index 119086fa6b..01988fd6ff 100644 --- a/docker/Dockerfile.nrUE.rhel8.2 +++ b/docker/Dockerfile.nrUE.rhel8.2 @@ -35,7 +35,7 @@ COPY . . RUN /bin/sh oaienv && \ cd cmake_targets && \ mkdir -p log && \ - ./build_oai --nrUE --ninja -w USRP + ./build_oai --nrUE --ninja -w USRP --verbose-ci # debug #RUN ldconfig -v diff --git a/docker/Dockerfile.nrUE.ubuntu18 b/docker/Dockerfile.nrUE.ubuntu18 index f1a27a3c01..c96bcf80ef 100644 --- a/docker/Dockerfile.nrUE.ubuntu18 +++ b/docker/Dockerfile.nrUE.ubuntu18 @@ -35,7 +35,7 @@ COPY . . RUN /bin/sh oaienv && \ cd cmake_targets && \ mkdir -p log && \ - ./build_oai --nrUE --ninja -w USRP + ./build_oai --nrUE --ninja -w USRP --verbose-ci # debug #RUN ldconfig -v From 38f3ca2b35fbbb9be9adecd7c99abcd4449223f4 Mon Sep 17 00:00:00 2001 From: hardy Date: Fri, 19 Mar 2021 13:04:10 +0100 Subject: [PATCH 215/231] fix workspace corruption issue --- ci-scripts/xml_files/benetel_multi_node_build.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ci-scripts/xml_files/benetel_multi_node_build.xml b/ci-scripts/xml_files/benetel_multi_node_build.xml index 7d22675568..5ac28951b4 100644 --- a/ci-scripts/xml_files/benetel_multi_node_build.xml +++ b/ci-scripts/xml_files/benetel_multi_node_build.xml @@ -33,6 +33,7 @@ Build_eNB Build eNB --eNB -t benetel4g -w None + True 0 0 @@ -42,6 +43,7 @@ Build_eNB Build gNB --gNB -t benetel5g -w None + True 1 1 From 76638ec283b2e5f8f68177c08971b39d5b3a4cec Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Fri, 19 Mar 2021 13:55:01 +0100 Subject: [PATCH 216/231] [CI][DOCKER] handling the case of build not successful Signed-off-by: Raphael Defosseux --- ci-scripts/cls_containerize.py | 68 ++++++++++++------------- ci-scripts/docker_log_split.py | 92 ++++++++++++++++++++++++++++++++++ 2 files changed, 124 insertions(+), 36 deletions(-) create mode 100644 ci-scripts/docker_log_split.py diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index d58e49b20b..1e9d93ef4a 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -192,10 +192,11 @@ class Containerize(): sharedimage = 'ran-build' # Let's remove any previous run artifacts if still there - mySSH.command(self.cli + ' image prune --force', '\$', 5) - mySSH.command(self.cli + ' image rm ' + sharedimage + ':' + imageTag, '\$', 5) + mySSH.command(self.cli + ' image prune --force', '\$', 30) + mySSH.command(self.cli + ' image rm ' + sharedimage + ':' + imageTag, '\$', 30) for image,pattern in imageNames: - mySSH.command(self.cli + ' image rm ' + image + ':' + imageTag, '\$', 5) + mySSH.command(self.cli + ' image rm ' + image + ':' + imageTag, '\$', 30) + # Build the shared image mySSH.command(self.cli + ' build --target ' + sharedimage + ' --tag ' + sharedimage + ':' + imageTag + ' --file docker/Dockerfile.ran' + self.dockerfileprefix + ' --build-arg NEEDED_GIT_PROXY="http://proxy.eurecom.fr:8080" . > cmake_targets/log/ran-build.log 2>&1', '\$', 1600) # First verify if the shared image was properly created. @@ -225,31 +226,35 @@ class Containerize(): logging.debug('ran-build size is unknown') # If the shared image failed, no need to continue if not status: + # Recover the name of the failed container? + mySSH.command(self.cli + ' image prune --force', '\$', 30) mySSH.close() logging.error('\u001B[1m Building OAI Images Failed\u001B[0m') HTML.CreateHtmlTestRow(self.imageKind, 'KO', CONST.ALL_PROCESSES_OK) HTML.CreateHtmlTabFooter(False) sys.exit(1) + else: + # Recover build logs, for the moment only possible when build is successful + mySSH.command(self.cli + ' create --name test ' + sharedimage + ':' + imageTag, '\$', 5) + mySSH.command('mkdir -p cmake_targets/log/ran-build', '\$', 5) + mySSH.command(self.cli + ' cp test:/oai-ran/cmake_targets/log/. cmake_targets/log/ran-build', '\$', 5) + mySSH.command(self.cli + ' rm -f test', '\$', 5) # Build the target image(s) - previousImage = sharedimage + ':' + imageTag - danglingShaOnes=[] for image,pattern in imageNames: # the archived Dockerfiles have "ran-build:latest" as base image # we need to update them with proper tag mySSH.command('sed -i -e "s#' + sharedimage + ':latest#' + sharedimage + ':' + imageTag + '#" docker/Dockerfile.' + pattern + self.dockerfileprefix, '\$', 5) mySSH.command(self.cli + ' build --target ' + image + ' --tag ' + image + ':' + imageTag + ' --file docker/Dockerfile.' + pattern + self.dockerfileprefix + ' . > cmake_targets/log/' + image + '.log 2>&1', '\$', 1200) - # Retrieving the dangling image(s) for the log collection - mySSH.command(self.cli + ' images --filter "dangling=true" --filter "since=' + previousImage + '" -q | sed -e "s#^#sha=#"', '\$', 5) - result = re.search('sha=(?P[a-zA-Z0-9\-\_]+)', mySSH.getBefore()) - if result is not None: - danglingShaOnes.append((image, result.group('imageShaOne'))) - previousImage = image + ':' + imageTag # checking the status of the build mySSH.command(self.cli + ' image inspect --format=\'Size = {{.Size}} bytes\' ' + image + ':' + imageTag, '\$', 5) + # split the log + mySSH.command('mkdir -p cmake_targets/log/' + image, '\$', 5) + mySSH.command('python3 ci-scripts/docker_log_split.py --logfilename=cmake_targets/log/' + image + '.log', '\$', 5) if (mySSH.getBefore().count('No such object') != 0) or (mySSH.getBefore().count('no such image') != 0): logging.error('Could not build properly ' + image) status = False + # Here we should check if the last container corresponds to a failed command and destroy it else: result = re.search('Size *= *(?P[0-9\-]+) *bytes', mySSH.getBefore()) if result is not None: @@ -269,29 +274,13 @@ class Containerize(): self.allImagesSize[image] = str(round(imageSize,1)) + ' Gbytes' else: logging.debug('ran-build size is unknown') - if not status: - mySSH.close() - logging.error('\u001B[1m Building OAI Images Failed\u001B[0m') - HTML.CreateHtmlTestRow(self.imageKind, 'KO', CONST.ALL_PROCESSES_OK) - #HTML.CreateHtmlNextTabHeaderTestRow(self.collectInfo, self.allImagesSize) - HTML.CreateHtmlTabFooter(False) - sys.exit(1) + # Now pruning dangling images in between target builds + mySSH.command(self.cli + ' image prune --force', '\$', 30) - # Recover build logs, for the moment only possible when build is successful - mySSH.command(self.cli + ' create --name test ' + sharedimage + ':' + imageTag, '\$', 5) - mySSH.command('mkdir -p cmake_targets/log/ran-build', '\$', 5) - mySSH.command(self.cli + ' cp test:/oai-ran/cmake_targets/log/. cmake_targets/log/ran-build', '\$', 5) - mySSH.command(self.cli + ' rm -f test', '\$', 5) - for image,shaone in danglingShaOnes: - mySSH.command('mkdir -p cmake_targets/log/' + image, '\$', 5) - mySSH.command(self.cli + ' create --name test ' + shaone, '\$', 5) - mySSH.command(self.cli + ' cp test:/oai-ran/cmake_targets/log/. cmake_targets/log/' + image, '\$', 5) - mySSH.command(self.cli + ' rm -f test', '\$', 5) - mySSH.command(self.cli + ' image prune --force', '\$', 5) - mySSH.command('cd cmake_targets', '\$', 5) - mySSH.command('mkdir -p build_log_' + self.testCase_id, '\$', 5) + # Analyzing the logs + mySSH.command('cd ' + lSourcePath + '/cmake_targets', '\$', 5) mySSH.command('mv log/* ' + 'build_log_' + self.testCase_id, '\$', 5) - + mySSH.command('cd ' + lSourcePath + '/cmake_targets', '\$', 5) mySSH.command('rm -f build_log_' + self.testCase_id + '.zip || true', '\$', 5) if (os.path.isfile('./build_log_' + self.testCase_id + '.zip')): @@ -303,7 +292,7 @@ class Containerize(): mySSH.command('rm -f build_log_' + self.testCase_id + '.zip','\$', 5) mySSH.close() ZipFile('build_log_' + self.testCase_id + '.zip').extractall('.') - + #Trying to identify the errors and warnings for each built images imageNames1 = imageNames shared = ('ran-build','ran') @@ -335,9 +324,16 @@ class Containerize(): files[fil] = errorandwarnings self.collectInfo[image] = files - logging.info('\u001B[1m Building OAI Image(s) Pass\u001B[0m') - HTML.CreateHtmlTestRow(self.imageKind, 'OK', CONST.ALL_PROCESSES_OK) - HTML.CreateHtmlNextTabHeaderTestRow(self.collectInfo, self.allImagesSize) + if status: + logging.info('\u001B[1m Building OAI Image(s) Pass\u001B[0m') + HTML.CreateHtmlTestRow(self.imageKind, 'OK', CONST.ALL_PROCESSES_OK) + HTML.CreateHtmlNextTabHeaderTestRow(self.collectInfo, self.allImagesSize) + else: + logging.error('\u001B[1m Building OAI Images Failed\u001B[0m') + HTML.CreateHtmlTestRow(self.imageKind, 'KO', CONST.ALL_PROCESSES_OK) + HTML.CreateHtmlNextTabHeaderTestRow(self.collectInfo, self.allImagesSize) + HTML.CreateHtmlTabFooter(False) + sys.exit(1) def DeployObject(self, HTML, EPC): if self.eNB_serverId[self.eNB_instance] == '0': diff --git a/ci-scripts/docker_log_split.py b/ci-scripts/docker_log_split.py new file mode 100644 index 0000000000..8c3c9e41dc --- /dev/null +++ b/ci-scripts/docker_log_split.py @@ -0,0 +1,92 @@ +#/* +# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more +# * contributor license agreements. See the NOTICE file distributed with +# * this work for additional information regarding copyright ownership. +# * The OpenAirInterface Software Alliance licenses this file to You under +# * the OAI Public License, Version 1.1 (the "License"); you may not use this file +# * except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * http://www.openairinterface.org/?page_id=698 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# *------------------------------------------------------------------------------- +# * For more information about the OpenAirInterface (OAI) Software Alliance: +# * contact@openairinterface.org +# */ +#--------------------------------------------------------------------- +# Python for CI of OAI-eNB + COTS-UE +# +# Required Python Version +# Python 3.x +# +# Required Python Package +# pexpect +#--------------------------------------------------------------------- + + +#----------------------------------------------------------- +# Import Libs +#----------------------------------------------------------- +import sys # arg +import re # reg +import os +import subprocess + + +class SplitReport(): + def __init__(self): + self.logfilename = '' + self.destinationFolder = '' + + def split(self): + self.destinationFolder = self.logfilename.replace(".log","") + if os.path.isfile(self.logfilename): + newImageLog = open(self.logfilename + '.new', 'w') + copyFlag = True + with open(self.logfilename, 'r') as imageLog: + for line in imageLog: + header = False + ret = re.search('====== Start of log for ([0-9\.A-Za-z\-\_]+) ======', line) + if ret is not None: + copyFlag = False + header = True + detailedLogFile = open(self.destinationFolder + '/' + ret.group(1), 'w') + if copyFlag: + newImageLog.write(line) + ret = re.search('====== End of log for ([0-9\.A-Za-z\-\_]+) ======', line) + if ret is not None: + copyFlag = True + detailedLogFile.close() + elif not copyFlag and not header: + detailedLogFile.write(line) + imageLog.close() + newImageLog.close() + os.rename(self.logfilename + '.new', self.logfilename) + else: + print('Cannot split unfound file') + +#-------------------------------------------------------------------------------------------------------- +# +# Start of main +# +#-------------------------------------------------------------------------------------------------------- + +argvs = sys.argv +argc = len(argvs) + +SP = SplitReport() + +while len(argvs) > 1: + myArgv = argvs.pop(1) + if re.match('^\-\-logfilename=(.+)$', myArgv, re.IGNORECASE): + matchReg = re.match('^\-\-logfilename=(.+)$', myArgv, re.IGNORECASE) + SP.logfilename = matchReg.group(1) + +SP.split() + +sys.exit(0) From 144457c258f99ece8d30f0f2efd620a86747e503 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Fri, 19 Mar 2021 14:34:42 +0100 Subject: [PATCH 217/231] [CI][DOCKER] fix indentation Signed-off-by: Raphael Defosseux --- ci-scripts/cls_containerize.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index 1e9d93ef4a..4f61faada9 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -246,11 +246,11 @@ class Containerize(): # we need to update them with proper tag mySSH.command('sed -i -e "s#' + sharedimage + ':latest#' + sharedimage + ':' + imageTag + '#" docker/Dockerfile.' + pattern + self.dockerfileprefix, '\$', 5) mySSH.command(self.cli + ' build --target ' + image + ' --tag ' + image + ':' + imageTag + ' --file docker/Dockerfile.' + pattern + self.dockerfileprefix + ' . > cmake_targets/log/' + image + '.log 2>&1', '\$', 1200) - # checking the status of the build - mySSH.command(self.cli + ' image inspect --format=\'Size = {{.Size}} bytes\' ' + image + ':' + imageTag, '\$', 5) # split the log mySSH.command('mkdir -p cmake_targets/log/' + image, '\$', 5) mySSH.command('python3 ci-scripts/docker_log_split.py --logfilename=cmake_targets/log/' + image + '.log', '\$', 5) + # checking the status of the build + mySSH.command(self.cli + ' image inspect --format=\'Size = {{.Size}} bytes\' ' + image + ':' + imageTag, '\$', 5) if (mySSH.getBefore().count('No such object') != 0) or (mySSH.getBefore().count('no such image') != 0): logging.error('Could not build properly ' + image) status = False @@ -279,6 +279,7 @@ class Containerize(): # Analyzing the logs mySSH.command('cd ' + lSourcePath + '/cmake_targets', '\$', 5) + mySSH.command('mkdir -p build_log_' + self.testCase_id, '\$', 5) mySSH.command('mv log/* ' + 'build_log_' + self.testCase_id, '\$', 5) mySSH.command('cd ' + lSourcePath + '/cmake_targets', '\$', 5) @@ -332,8 +333,8 @@ class Containerize(): logging.error('\u001B[1m Building OAI Images Failed\u001B[0m') HTML.CreateHtmlTestRow(self.imageKind, 'KO', CONST.ALL_PROCESSES_OK) HTML.CreateHtmlNextTabHeaderTestRow(self.collectInfo, self.allImagesSize) - HTML.CreateHtmlTabFooter(False) - sys.exit(1) + HTML.CreateHtmlTabFooter(False) + sys.exit(1) def DeployObject(self, HTML, EPC): if self.eNB_serverId[self.eNB_instance] == '0': From 13a204f02775982ade80245d62dd2a35b6c50253 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Fri, 19 Mar 2021 17:32:53 +0100 Subject: [PATCH 218/231] [CI][DOCKER] handle build failure, and Merge Requests do not build shared image to speed up process Signed-off-by: Raphael Defosseux --- ci-scripts/cls_containerize.py | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index 4f61faada9..0debe42468 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -174,6 +174,7 @@ class Containerize(): # if the branch is not develop, then it is a merge request and we need to do # the potential merge. Note that merge conflicts should already been checked earlier imageTag = 'develop' + sharedTag = 'develop' if (self.ranAllowMerge): imageTag = 'ci-temp' if self.ranTargetBranch == '': @@ -193,17 +194,19 @@ class Containerize(): sharedimage = 'ran-build' # Let's remove any previous run artifacts if still there mySSH.command(self.cli + ' image prune --force', '\$', 30) - mySSH.command(self.cli + ' image rm ' + sharedimage + ':' + imageTag, '\$', 30) + if (not self.ranAllowMerge): + mySSH.command(self.cli + ' image rm ' + sharedimage + ':' + sharedTag, '\$', 30) for image,pattern in imageNames: mySSH.command(self.cli + ' image rm ' + image + ':' + imageTag, '\$', 30) - # Build the shared image - mySSH.command(self.cli + ' build --target ' + sharedimage + ' --tag ' + sharedimage + ':' + imageTag + ' --file docker/Dockerfile.ran' + self.dockerfileprefix + ' --build-arg NEEDED_GIT_PROXY="http://proxy.eurecom.fr:8080" . > cmake_targets/log/ran-build.log 2>&1', '\$', 1600) + # Build the shared image only on Push Events (not on Merge Requests) + if (not self.ranAllowMerge): + mySSH.command(self.cli + ' build --target ' + sharedimage + ' --tag ' + sharedimage + ':' + sharedTag + ' --file docker/Dockerfile.ran' + self.dockerfileprefix + ' --build-arg NEEDED_GIT_PROXY="http://proxy.eurecom.fr:8080" . > cmake_targets/log/ran-build.log 2>&1', '\$', 1600) # First verify if the shared image was properly created. status = True - mySSH.command(self.cli + ' image inspect --format=\'Size = {{.Size}} bytes\' ' + sharedimage + ':' + imageTag, '\$', 5) - if (mySSH.getBefore().count('No such object') != 0) or (mySSH.getBefore().count('no such image') != 0): - logging.error('Could not build properly ran-build') + mySSH.command(self.cli + ' image inspect --format=\'Size = {{.Size}} bytes\' ' + sharedimage + ':' + sharedTag, '\$', 5) + if mySSH.getBefore().count('o such image') != 0: + logging.error('\u001B[1m Could not build properly ran-build\u001B[0m') status = False else: result = re.search('Size *= *(?P[0-9\-]+) *bytes', mySSH.getBefore()) @@ -227,6 +230,7 @@ class Containerize(): # If the shared image failed, no need to continue if not status: # Recover the name of the failed container? + mySSH.command(self.cli + ' ps --quiet --filter "status=exited" -n1 | xargs ' + self.cli + ' rm -f', '\$', 5) mySSH.command(self.cli + ' image prune --force', '\$', 30) mySSH.close() logging.error('\u001B[1m Building OAI Images Failed\u001B[0m') @@ -235,7 +239,7 @@ class Containerize(): sys.exit(1) else: # Recover build logs, for the moment only possible when build is successful - mySSH.command(self.cli + ' create --name test ' + sharedimage + ':' + imageTag, '\$', 5) + mySSH.command(self.cli + ' create --name test ' + sharedimage + ':' + sharedTag, '\$', 5) mySSH.command('mkdir -p cmake_targets/log/ran-build', '\$', 5) mySSH.command(self.cli + ' cp test:/oai-ran/cmake_targets/log/. cmake_targets/log/ran-build', '\$', 5) mySSH.command(self.cli + ' rm -f test', '\$', 5) @@ -244,17 +248,19 @@ class Containerize(): for image,pattern in imageNames: # the archived Dockerfiles have "ran-build:latest" as base image # we need to update them with proper tag - mySSH.command('sed -i -e "s#' + sharedimage + ':latest#' + sharedimage + ':' + imageTag + '#" docker/Dockerfile.' + pattern + self.dockerfileprefix, '\$', 5) + mySSH.command('sed -i -e "s#' + sharedimage + ':latest#' + sharedimage + ':' + sharedTag + '#" docker/Dockerfile.' + pattern + self.dockerfileprefix, '\$', 5) mySSH.command(self.cli + ' build --target ' + image + ' --tag ' + image + ':' + imageTag + ' --file docker/Dockerfile.' + pattern + self.dockerfileprefix + ' . > cmake_targets/log/' + image + '.log 2>&1', '\$', 1200) # split the log mySSH.command('mkdir -p cmake_targets/log/' + image, '\$', 5) mySSH.command('python3 ci-scripts/docker_log_split.py --logfilename=cmake_targets/log/' + image + '.log', '\$', 5) # checking the status of the build mySSH.command(self.cli + ' image inspect --format=\'Size = {{.Size}} bytes\' ' + image + ':' + imageTag, '\$', 5) - if (mySSH.getBefore().count('No such object') != 0) or (mySSH.getBefore().count('no such image') != 0): - logging.error('Could not build properly ' + image) + if mySSH.getBefore().count('o such image') != 0: + logging.error('\u001B[1m Could not build properly ' + image + '\u001B[0m') status = False # Here we should check if the last container corresponds to a failed command and destroy it + mySSH.command(self.cli + ' ps --quiet --filter "status=exited" -n1 | xargs ' + self.cli + ' rm -f', '\$', 5) + self.allImagesSize[image] = 'N/A -- Build Failed' else: result = re.search('Size *= *(?P[0-9\-]+) *bytes', mySSH.getBefore()) if result is not None: @@ -274,6 +280,7 @@ class Containerize(): self.allImagesSize[image] = str(round(imageSize,1)) + ' Gbytes' else: logging.debug('ran-build size is unknown') + self.allImagesSize[image] = 'unknown' # Now pruning dangling images in between target builds mySSH.command(self.cli + ' image prune --force', '\$', 30) From 6f2622900e5df923f2380f764ec9bc1379bc6150 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Sat, 20 Mar 2021 21:20:30 +0100 Subject: [PATCH 219/231] [CI] renaming the scenario Signed-off-by: Raphael Defosseux --- .../{fr1_image_build.xml => container_image_build.xml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename ci-scripts/xml_files/{fr1_image_build.xml => container_image_build.xml} (96%) diff --git a/ci-scripts/xml_files/fr1_image_build.xml b/ci-scripts/xml_files/container_image_build.xml similarity index 96% rename from ci-scripts/xml_files/fr1_image_build.xml rename to ci-scripts/xml_files/container_image_build.xml index 19452c3644..430729c49c 100644 --- a/ci-scripts/xml_files/fr1_image_build.xml +++ b/ci-scripts/xml_files/container_image_build.xml @@ -22,7 +22,7 @@ --> build-tab - Build + Build Container Images wrench 000001 From e419ae05bdceae7f0c02a62bdfe4ec981d238411 Mon Sep 17 00:00:00 2001 From: hardy Date: Fri, 19 Mar 2021 13:30:50 +0100 Subject: [PATCH 220/231] adding benetel to overnight trig --- ci-scripts/Jenkinsfile-tmp-multi-enb-benetel | 293 ++++++++++++++++++ ci-scripts/Jenkinsfile-tmp-multi-enb-nsa | 14 +- ci-scripts/Jenkinsfile-trig-nsa | 18 +- ci-scripts/xml_files/fr1_multi_node_build.xml | 2 + 4 files changed, 318 insertions(+), 9 deletions(-) create mode 100644 ci-scripts/Jenkinsfile-tmp-multi-enb-benetel diff --git a/ci-scripts/Jenkinsfile-tmp-multi-enb-benetel b/ci-scripts/Jenkinsfile-tmp-multi-enb-benetel new file mode 100644 index 0000000000..8ac2e6adff --- /dev/null +++ b/ci-scripts/Jenkinsfile-tmp-multi-enb-benetel @@ -0,0 +1,293 @@ +#!/bin/groovy +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +// Template Jenkins Declarative Pipeline script to run Test w/ RF HW + +// Location of the python executor node shall be in the same subnet as the others servers +def pythonExecutor = params.pythonExecutor + +// Location of the test XML file to be run +def testXMLFile = params.pythonTestXmlFile +def mainPythonAllXmlFiles = "" +def buildStageStatus = true + +// Name of the test stage +def testStageName = params.pipelineTestStageName + +// Name of the phone resource +def ciSmartPhonesResource1 = params.SmartPhonesResource1 +def ciSmartPhonesResource2 = params.SmartPhonesResource2 + +// Global Parameters. Normally they should be populated when the master job +// triggers the slave job with parameters +def eNB_Repository +def eNB_Branch +def eNB_CommitID +def eNB_AllowMergeRequestProcess +def eNB_TargetBranch + +pipeline { + agent { + label pythonExecutor + } + options { + disableConcurrentBuilds() + ansiColor('xterm') + lock(extra: [[resource: ciSmartPhonesResource2]], resource: ciSmartPhonesResource1) + } + stages { + stage("Build Init") { + steps { + // update the build name and description + buildName "${params.eNB_MR}" + buildDescription "Branch : ${params.eNB_Branch}" + } + } + stage ("Verify Parameters") { + steps { + script { + echo '\u2705 \u001B[32mVerify Parameters\u001B[0m' + def allParametersPresent = true + + // It is already to late to check it + if (params.pythonExecutor != null) { + echo "eNB CI executor node : ${pythonExecutor}" + } + // If not present picking a default Stage Name + if (params.pipelineTestStageName == null) { + // picking default + testStageName = 'Template Test Stage' + } + + if (params.SmartPhonesResource1 == null) { + allParametersPresent = false + } + if (params.SmartPhonesResource2 == null) { + allParametersPresent = false + } + // 1st eNB parameters + if (params.eNB_IPAddress == null) { + allParametersPresent = false + } + if (params.eNB_SourceCodePath == null) { + allParametersPresent = false + } + if (params.eNB_Credentials == null) { + allParametersPresent = false + } + // 2nd eNB parameters + if (params.eNB1_IPAddress == null) { + allParametersPresent = false + } + if (params.eNB1_SourceCodePath == null) { + allParametersPresent = false + } + if (params.eNB1_Credentials == null) { + allParametersPresent = false + } + // 3rd eNB parameters + if (params.eNB2_IPAddress == null) { + allParametersPresent = false + } + if (params.eNB2_SourceCodePath == null) { + allParametersPresent = false + } + if (params.eNB2_Credentials == null) { + allParametersPresent = false + } + // the following 4 parameters should be pushed by the master trigger + // if not present, take the job GIT variables (used for developing) + if (params.eNB_Repository == null) { + eNB_Repository = env.GIT_URL + } else { + eNB_Repository = params.eNB_Repository + } + echo "eNB_Repository : ${eNB_Repository}" + if (params.eNB_Branch == null) { + eNB_Branch = env.GIT_BRANCH + } else { + eNB_Branch = params.eNB_Branch + } + echo "eNB_Branch : ${eNB_Branch}" + if (params.eNB_CommitID == null) { + eNB_CommitID = env.GIT_COMMIT + } else { + eNB_CommitID = params.eNB_CommitID + } + echo "eNB_CommitID : ${eNB_CommitID}" + if (params.eNB_AllowMergeRequestProcess!= null) { + eNB_AllowMergeRequestProcess = params.eNB_AllowMergeRequestProcess + if (eNB_AllowMergeRequestProcess) { + if (params.eNB_TargetBranch != null) { + eNB_TargetBranch = params.eNB_TargetBranch + } else { + eNB_TargetBranch = 'develop' + } + echo "eNB_TargetBranch : ${eNB_TargetBranch}" + } + } + + if (params.EPC_IPAddress == null) { + allParametersPresent = false + } + if (params.EPC_Type == null) { + allParametersPresent = false + } + if (params.EPC_SourceCodePath == null) { + allParametersPresent = false + } + if (params.EPC_Credentials == null) { + allParametersPresent = false + } + + if (params.ADB_IPAddress == null) { + allParametersPresent = false + } + if (params.ADB_Credentials == null) { + allParametersPresent = false + } + + if (allParametersPresent) { + echo "All parameters are present" + if (eNB_AllowMergeRequestProcess) { + sh "git fetch" + sh "./ci-scripts/doGitLabMerge.sh --src-branch ${eNB_Branch} --src-commit ${eNB_CommitID} --target-branch ${eNB_TargetBranch} --target-commit latest" + } else { + sh "git fetch" + sh "git checkout -f ${eNB_CommitID}" + } + } else { + echo "Some parameters are missing" + sh "./ci-scripts/fail.sh" + } + } + } + } + stage ("Build and Test") { + steps { + script { + dir ('ci-scripts') { + echo "\u2705 \u001B[32m${testStageName}\u001B[0m" + // If not present picking a default XML file + if (params.pythonTestXmlFile == null) { + // picking default + testXMLFile = 'xml_files/enb_usrpB210_band7_50PRB.xml' + echo "Test XML file(default): ${testXMLFile}" + mainPythonAllXmlFiles += "--XMLTestFile=" + testXMLFile + " " + } else { + String[] myXmlTestSuite = testXMLFile.split("\\r?\\n") + for (xmlFile in myXmlTestSuite) { + if (fileExists(xmlFile)) { + mainPythonAllXmlFiles += "--XMLTestFile=" + xmlFile + " " + echo "Test XML file : ${xmlFile}" + } + } + } + withCredentials([ + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB_Credentials}", usernameVariable: 'eNB_Username', passwordVariable: 'eNB_Password'], + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB1_Credentials}", usernameVariable: 'eNB1_Username', passwordVariable: 'eNB1_Password'], + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB2_Credentials}", usernameVariable: 'eNB2_Username', passwordVariable: 'eNB2_Password'], + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.EPC_Credentials}", usernameVariable: 'EPC_Username', passwordVariable: 'EPC_Password'], + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.ADB_Credentials}", usernameVariable: 'ADB_Username', passwordVariable: 'ADB_Password'] + ]) { + sh "python3 main.py --mode=InitiateHtml --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} ${mainPythonAllXmlFiles}" + String[] myXmlTestSuite = testXMLFile.split("\\r?\\n") + for (xmlFile in myXmlTestSuite) { + if (fileExists(xmlFile)) { + try { + sh "python3 main.py --mode=TesteNB --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath} --eNB1IPAddress=${params.eNB1_IPAddress} --eNB1UserName=${eNB1_Username} --eNB1Password=${eNB1_Password} --eNB1SourceCodePath=${params.eNB1_SourceCodePath} --eNB2IPAddress=${params.eNB2_IPAddress} --eNB2UserName=${eNB2_Username} --eNB2Password=${eNB2_Password} --eNB2SourceCodePath=${params.eNB2_SourceCodePath} --EPCIPAddress=${params.EPC_IPAddress} --EPCType=${params.EPC_Type} --EPCUserName=${EPC_Username} --EPCPassword=${EPC_Password} --EPCSourceCodePath=${params.EPC_SourceCodePath} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} --XMLTestFile=${xmlFile}" + } catch (Exception e) { + currentBuild.result = 'FAILURE' + buildStageStatus = false + } + } + } + sh "python3 main.py --mode=FinalizeHtml --finalStatus=${buildStageStatus} --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password}" + } + } + } + } + } + stage('Log Collection') { + parallel { + stage('Log Collection (eNB - Build)') { + steps { + withCredentials([ + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB_Credentials}", usernameVariable: 'eNB_Username', passwordVariable: 'eNB_Password'] + ]) { + echo '\u2705 \u001B[32mLog Collection (eNB - Build)\u001B[0m' + sh "python3 ci-scripts/main.py --mode=LogCollectBuild --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath}" + + echo '\u2705 \u001B[32mLog Transfer (eNB - Build)\u001B[0m' + sh "sshpass -p \'${eNB_Password}\' scp -o 'StrictHostKeyChecking no' -o 'ConnectTimeout 10' ${eNB_Username}@${params.eNB_IPAddress}:${eNB_SourceCodePath}/cmake_targets/build.log.zip ./build.log.${env.BUILD_ID}.zip || true" + } + script { + if(fileExists("build.log.${env.BUILD_ID}.zip")) { + archiveArtifacts "build.log.${env.BUILD_ID}.zip" + } + } + } + } + stage('Log Collection (eNB - Run)') { + steps { + withCredentials([ + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB_Credentials}", usernameVariable: 'eNB_Username', passwordVariable: 'eNB_Password'] + ]) { + echo '\u2705 \u001B[32mLog Collection (eNB - Run)\u001B[0m' + sh "python3 ci-scripts/main.py --mode=LogCollecteNB --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath}" + + echo '\u2705 \u001B[32mLog Transfer (eNB - Run)\u001B[0m' + sh "sshpass -p \'${eNB_Password}\' scp -o 'StrictHostKeyChecking no' -o 'ConnectTimeout 10' ${eNB_Username}@${params.eNB_IPAddress}:${eNB_SourceCodePath}/cmake_targets/enb.log.zip ./enb.log.${env.BUILD_ID}.zip || true" + } + script { + if(fileExists("enb.log.${env.BUILD_ID}.zip")) { + archiveArtifacts "enb.log.${env.BUILD_ID}.zip" + } + if(fileExists("ci-scripts/test_results.html")) { + sh "mv ci-scripts/test_results.html test_results-${JOB_NAME}.html" + sh "sed -i -e 's#TEMPLATE_JOB_NAME#${JOB_NAME}#' -e 's@build #TEMPLATE_BUILD_ID@build #${BUILD_ID}@' -e 's#Build-ID: TEMPLATE_BUILD_ID#Build-ID: ${BUILD_ID}#' -e 's#TEMPLATE_STAGE_NAME#${testStageName}#' test_results-${JOB_NAME}.html" + archiveArtifacts "test_results-${JOB_NAME}.html" + } + } + } + } + } + } + } + + post { + always { + script { + if (params.pipelineZipsConsoleLog != null) { + if (params.pipelineZipsConsoleLog) { + echo "Archiving Jenkins console log" + sh "wget --no-check-certificate --no-proxy ${env.JENKINS_URL}/job/${env.JOB_NAME}/${env.BUILD_ID}/consoleText -O consoleText.log || true" + sh "zip -m consoleText.log.${env.BUILD_ID}.zip consoleText.log || true" + if(fileExists("consoleText.log.${env.BUILD_ID}.zip")) { + archiveArtifacts "consoleText.log.${env.BUILD_ID}.zip" + } + } + } + } + } + } +} diff --git a/ci-scripts/Jenkinsfile-tmp-multi-enb-nsa b/ci-scripts/Jenkinsfile-tmp-multi-enb-nsa index f312f05e45..66d12eed33 100644 --- a/ci-scripts/Jenkinsfile-tmp-multi-enb-nsa +++ b/ci-scripts/Jenkinsfile-tmp-multi-enb-nsa @@ -34,8 +34,9 @@ def buildStageStatus = true def testStageName = params.pipelineTestStageName // Name of the phone resource -def ciSmartPhoneResource1 = params.smartphonesResource1 -def ciSmartPhoneResource2 = params.smartphonesResource2 +def ciSmartPhonesResource1 = params.SmartPhonesResource1 +def ciSmartPhonesResource2 = params.SmartPhonesResource2 +def ciSmartPhonesResource3 = params.SmartPhonesResource3 // Global Parameters. Normally they should be populated when the master job // triggers the slave job with parameters @@ -52,7 +53,7 @@ pipeline { options { disableConcurrentBuilds() ansiColor('xterm') - lock(extra: [[resource: ciSmartPhoneResource2]], resource: ciSmartPhoneResource1) + lock(extra: [[resource: ciSmartPhonesResource2],[resource: ciSmartPhonesResource3]], resource: ciSmartPhonesResource1) } stages { stage("Build Init") { @@ -78,10 +79,13 @@ pipeline { testStageName = 'Template Test Stage' } - if (params.smartphonesResource1 == null) { + if (params.SmartPhonesResource1 == null) { allParametersPresent = false } - if (params.smartphonesResource2 == null) { + if (params.SmartPhonesResource2 == null) { + allParametersPresent = false + } + if (params.SmartPhonesResource3== null) { allParametersPresent = false } // 1st eNB parameters diff --git a/ci-scripts/Jenkinsfile-trig-nsa b/ci-scripts/Jenkinsfile-trig-nsa index 3bb5bfd359..3dd5ce3b50 100644 --- a/ci-scripts/Jenkinsfile-trig-nsa +++ b/ci-scripts/Jenkinsfile-trig-nsa @@ -33,19 +33,21 @@ pipeline { label pythonExecutor } stages { - stage ("NSA Test Loop") { + stage ("Launcher") { steps { - script { + script { + //retrieve MR that are opened nd with tag READY_TO_BE_MERGED MR_LIST= sh returnStdout: true, script: 'curl --silent "https://gitlab.eurecom.fr/api/v4/projects/oai%2Fopenairinterface5g/merge_requests?state=opened&per_page=100&labels=READY_TO_BE_MERGED" | jq ".[].iid" || true ' echo "List of selected MR:\n${MR_LIST}" - def MR_ARRAY = MR_LIST.split('\n') + def MR_ARRAY = MR_LIST.split('\n') + //for every selected MR, retrieve the branch name and the latest commit for (MR in MR_ARRAY) { SRC_BRANCH=sh returnStdout: true, script: """curl --silent "https://gitlab.eurecom.fr/api/v4/projects/oai%2Fopenairinterface5g/merge_requests/${MR}" | jq ".source_branch" || true """ SRC_BRANCH=SRC_BRANCH.trim() COMMIT_ID=sh returnStdout: true, script: """curl --silent "https://gitlab.eurecom.fr/api/v4/projects/oai%2Fopenairinterface5g/merge_requests/${MR}" | jq ".sha" || true """ COMMIT_ID=COMMIT_ID.trim() echo "Testing NSA on : ${MR} ${SRC_BRANCH} ${COMMIT_ID}" - //calling sub job + //calling NSA sub job build job: "RAN-CI-NSA-B210", wait : false, propagate : false, parameters: [ string(name: 'eNB_MR', value: String.valueOf(MR)), string(name: 'eNB_Branch', value: String.valueOf(SRC_BRANCH)), @@ -53,6 +55,14 @@ pipeline { string(name: 'eNB_TargetBranch', value: String.valueOf(TARGET_BRANCH)), booleanParam(name: 'eNB_AllowMergeRequestProcess', value: Boolean.valueOf(ALLOW_MERGE)) ] + //calling Benetel sub job + build job: "RAN-CI-BENETEL", wait : false, propagate : false, parameters: [ + string(name: 'eNB_MR', value: String.valueOf(MR)), + string(name: 'eNB_Branch', value: String.valueOf(SRC_BRANCH)), + string(name: 'eNB_CommitID', value: String.valueOf(COMMIT_ID)), + string(name: 'eNB_TargetBranch', value: String.valueOf(TARGET_BRANCH)), + booleanParam(name: 'eNB_AllowMergeRequestProcess', value: Boolean.valueOf(ALLOW_MERGE)) + ] } } } diff --git a/ci-scripts/xml_files/fr1_multi_node_build.xml b/ci-scripts/xml_files/fr1_multi_node_build.xml index 7b4eacef3a..57c4685341 100644 --- a/ci-scripts/xml_files/fr1_multi_node_build.xml +++ b/ci-scripts/xml_files/fr1_multi_node_build.xml @@ -37,6 +37,7 @@ 0 0 True + True @@ -53,6 +54,7 @@ 1 1 True + True From e82915c4b1c4b198821394544ce95d53f4df5b71 Mon Sep 17 00:00:00 2001 From: Luis Pereira Date: Mon, 22 Mar 2021 15:28:15 +0100 Subject: [PATCH 221/231] Revert "Fix msg1-FrequencyStart in config files for SA" This reverts commit b067406097781d543f260e42479d5d317532bdd7 --- .../GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf | 2 +- .../GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf index 0bd9861ad9..dd18cf624e 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf @@ -104,7 +104,7 @@ gNBs = #prach_msg1_FDM #0 = one, 1=two, 2=four, 3=eight prach_msg1_FDM = 0; - prach_msg1_FrequencyStart = 27; + prach_msg1_FrequencyStart = 0; zeroCorrelationZoneConfig = 13; preambleReceivedTargetPower = -96; #preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf index 9a666d4c6b..001e5b917a 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf @@ -104,7 +104,7 @@ gNBs = #prach_msg1_FDM #0 = one, 1=two, 2=four, 3=eight prach_msg1_FDM = 0; - prach_msg1_FrequencyStart = 27; + prach_msg1_FrequencyStart = 0; zeroCorrelationZoneConfig = 13; preambleReceivedTargetPower = -96; #preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) From b6513faa82b36f70b11e316d65ad3c1ec115ba13 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Mon, 22 Mar 2021 20:07:14 +0000 Subject: [PATCH 222/231] Fix PRACH msg1-FrequencyStart/k1 --- openair1/PHY/NR_TRANSPORT/nr_prach.c | 42 +++++++++++-------------- openair1/PHY/NR_UE_TRANSPORT/nr_prach.c | 31 +++++++++--------- openair2/LAYER2/NR_MAC_UE/config_ue.c | 8 +++-- openair2/LAYER2/NR_MAC_gNB/config.c | 7 +++-- 4 files changed, 43 insertions(+), 45 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/nr_prach.c b/openair1/PHY/NR_TRANSPORT/nr_prach.c index bc9ca0db5e..9577860ab8 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_prach.c +++ b/openair1/PHY/NR_TRANSPORT/nr_prach.c @@ -171,9 +171,6 @@ void rx_nr_prach_ru(RU_t *ru, int16_t *prach[ru->nb_rx]; int prach_sequence_length = ru->config.prach_config.prach_sequence_length.value; - - int msg1_frequencystart = ru->config.prach_config.num_prach_fd_occasions_list[numRA].k1.value; - int sample_offset_slot = (prachStartSymbol==0?0:fp->ofdm_symbol_size*prachStartSymbol+fp->nb_prefix_samples0+fp->nb_prefix_samples*(prachStartSymbol-1)); //to be checked for mu=0; @@ -195,8 +192,7 @@ void rx_nr_prach_ru(RU_t *ru, int16_t *prach2; if (prach_sequence_length == 0) { - LOG_D(PHY,"PRACH (ru %d) in %d.%d, format %d, msg1_frequencyStart %d\n", - ru->idx,frame,slot2,prachFormat,msg1_frequencystart); + LOG_D(PHY,"PRACH (ru %d) in %d.%d, format %d\n", ru->idx,frame,slot2,prachFormat); AssertFatal(prachFormat<4,"Illegal prach format %d for length 839\n",prachFormat); switch (prachFormat) { case 0: @@ -218,8 +214,8 @@ void rx_nr_prach_ru(RU_t *ru, } } else { - LOG_D(PHY,"PRACH (ru %d) in %d.%d, format %s, msg1_frequencyStart %d,startSymbol %d\n", - ru->idx,frame,slot,prachfmt[prachFormat],msg1_frequencystart,prachStartSymbol); + LOG_D(PHY,"PRACH (ru %d) in %d.%d, format %s,startSymbol %d\n", + ru->idx,frame,slot,prachfmt[prachFormat],prachStartSymbol); switch (prachFormat) { case 4: //A1 @@ -284,15 +280,15 @@ void rx_nr_prach_ru(RU_t *ru, K=1; kbar=2; } - int n_ra_prb = msg1_frequencystart; - int k = (12*n_ra_prb) - 6*fp->N_RB_UL; + + int k1 = (int16_t)ru->config.prach_config.num_prach_fd_occasions_list[numRA].k1.value; int N_ZC = (prach_sequence_length==0)?839:139; - if (k<0) k+=(fp->ofdm_symbol_size); - - k*=K; - k+=kbar; + if (k1<0) k1+=(fp->ofdm_symbol_size); + + k1*=K; + k1+=kbar; int reps=1; @@ -653,7 +649,7 @@ void rx_nr_prach_ru(RU_t *ru, int16_t rxsigF_tmp[N_ZC<<1]; // if (k+N_ZC > dftlen) { // PRACH signal is split around DC int16_t *rxsigF2=rxsigF[aa]; - int k2=k<<1; + int k2=k1<<1; for (int j=0;jnum_prach_fd_occasions_list[prach_pdu->num_ra].num_root_sequences.value; NCS = prach_pdu->num_cs;//cfg->num_prach_fd_occasions_list[0].prach_zero_corr_conf.value; int prach_sequence_length = cfg->prach_sequence_length.value; - int msg1_frequencystart = cfg->num_prach_fd_occasions_list[prach_pdu->num_ra].k1.value; // int num_unused_root_sequences = cfg->num_prach_fd_occasions_list[0].num_unused_root_sequences.value; // cfg->num_prach_fd_occasions_list[0].unused_root_sequences_list @@ -734,7 +728,8 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, prach_ifft = gNB->prach_vars.prach_ifft; prachF = gNB->prach_vars.prachF; if (LOG_DEBUGFLAG(PRACH)){ - if ((frame&1023) < 20) LOG_D(PHY,"PRACH (gNB) : running rx_prach for subframe %d, msg1_frequencystart %d, rootSequenceIndex %d\n", subframe,msg1_frequencystart,rootSequenceIndex); + if ((frame&1023) < 20) LOG_D(PHY,"PRACH (gNB) : running rx_prach for subframe %d, rootSequenceIndex %d\n", + subframe, rootSequenceIndex); } start_meas(&gNB->rx_prach); @@ -936,14 +931,13 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, if (LOG_DUMPFLAG(PRACH)) { //int en = dB_fixed(signal_energy((int32_t*)&rxsigF[0][0],840)); // if (en>60) { - int k = (12*n_ra_prb) - 6*fp->N_RB_UL; + int k1 = (int16_t)cfg->num_prach_fd_occasions_list[prach_pdu->num_ra].k1.value; - if (k<0) k+=fp->ofdm_symbol_size; - - k*=12; - k+=13; - k*=2; + if (k1<0) k1+=fp->ofdm_symbol_size; + k1*=12; + k1+=13; + k1*=2; LOG_M("rxsigF.m","prach_rxF",&rxsigF[0][0],12288,1,1); LOG_M("prach_rxF_comp0.m","prach_rxF_comp0",prachF,1024,1,1); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c b/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c index 0ba02c6bac..8c41b23c89 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c @@ -71,7 +71,7 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ int16_t Ncp = 0, amp, *prach, *prach2, *prachF, *Xu; int32_t Xu_re, Xu_im; - int prach_start, prach_sequence_length, i, prach_len, dftlen, mu, kbar, K, n_ra_prb, k, prachStartSymbol, sample_offset_slot; + int prach_start, prach_sequence_length, i, prach_len, dftlen, mu, kbar, K, k1, prachStartSymbol, sample_offset_slot; //int restricted_Type; prach = prach_tmp; @@ -83,7 +83,6 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ mu = nrUE_config->prach_config.prach_sub_c_spacing; restricted_set = prach_pdu->restricted_set; rootSequenceIndex = prach_pdu->root_seq_id; - n_ra_prb = prach_pdu->freq_msg1; NCS = prach_pdu->num_cs; prach_fmt_id = prach_pdu->prach_format; preamble_index = prach_resources->ra_PreambleIndex; @@ -93,7 +92,7 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ first_nonzero_root_idx = 0; kbar = 1; K = 24; - k = 12*n_ra_prb - 6*fp->N_RB_UL; + k1 = (int16_t)prach_pdu->freq_msg1; prachStartSymbol = prach_pdu->prach_start_symbol; //restricted_Type = 0; @@ -185,7 +184,7 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ // now generate PRACH signal #ifdef NR_PRACH_DEBUG if (NCS>0) - LOG_I(PHY, "PRACH [UE %d] generate PRACH in slot %d for RootSeqIndex %d, Preamble Index %d, PRACH Format %s, NCS %d (N_ZC %d): Preamble_offset %d, Preamble_shift %d msg1 frequency start %d\n", + LOG_I(PHY, "PRACH [UE %d] generate PRACH in slot %d for RootSeqIndex %d, Preamble Index %d, PRACH Format %s, NCS %d (N_ZC %d): Preamble_offset %d, Preamble_shift %dn", Mod_id, slot, rootSequenceIndex, @@ -194,8 +193,7 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ NCS, N_ZC, preamble_offset, - preamble_shift, - n_ra_prb); + preamble_shift); #endif // nsymb = (frame_parms->Ncp==0) ? 14:12; @@ -209,17 +207,16 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ kbar = 2; } - if (k<0) - k += fp->ofdm_symbol_size; + if (k1<0) + k1 += fp->ofdm_symbol_size; - k *= K; - k += kbar; - k *= 2; + k1 *= K; + k1 += kbar; + k1 *= 2; - LOG_I(PHY, "PRACH [UE %d] in slot %d, placing PRACH in position %d, msg1 frequency start %d, preamble_offset %d, first_nonzero_root_idx %d\n", Mod_id, + LOG_I(PHY, "PRACH [UE %d] in slot %d, placing PRACH in position %d, preamble_offset %d, first_nonzero_root_idx %d\n", Mod_id, slot, - k, - n_ra_prb, + k1, preamble_offset, first_nonzero_root_idx); @@ -344,10 +341,10 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ Xu_re = (((int32_t)Xu[offset<<1]*amp)>>15); Xu_im = (((int32_t)Xu[1+(offset<<1)]*amp)>>15); - prachF[k++]= ((Xu_re*nr_ru[offset2<<1]) - (Xu_im*nr_ru[1+(offset2<<1)]))>>15; - prachF[k++]= ((Xu_im*nr_ru[offset2<<1]) + (Xu_re*nr_ru[1+(offset2<<1)]))>>15; + prachF[k1++]= ((Xu_re*nr_ru[offset2<<1]) - (Xu_im*nr_ru[1+(offset2<<1)]))>>15; + prachF[k1++]= ((Xu_im*nr_ru[offset2<<1]) + (Xu_re*nr_ru[1+(offset2<<1)]))>>15; - if (k==dftlen) k=0; + if (k1==dftlen) k1=0; } #if defined (PRACH_WRITE_OUTPUT_DEBUG) diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index c45430bb45..361113b179 100755 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -31,6 +31,7 @@ */ //#include "mac_defs.h" +#include #include "NR_MAC_UE/mac_proto.h" #include "NR_MAC-CellGroupConfig.h" #include "LAYER2/NR_MAC_COMMON/nr_mac_common.h" @@ -309,8 +310,11 @@ void config_common_ue(NR_UE_MAC_INST_t *mac, cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.choice.l139; else cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.choice.l839; - - cfg->prach_config.num_prach_fd_occasions_list[i].k1 = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FrequencyStart; + cfg->prach_config.num_prach_fd_occasions_list[i].k1 = + (NRRIV2PRBOFFSET(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE) + + scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FrequencyStart + + (get_N_RA_RB(cfg->prach_config.prach_sub_c_spacing, scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing ) * i))*12 - + 6*scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; cfg->prach_config.num_prach_fd_occasions_list[i].prach_zero_corr_conf = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.zeroCorrelationZoneConfig; cfg->prach_config.num_prach_fd_occasions_list[i].num_root_sequences = compute_nr_root_seq(scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup, nb_preambles, mac->frame_type, frequency_range); //cfg->prach_config.num_prach_fd_occasions_list[i].num_unused_root_sequences = ??? diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 2e661dfb73..d27531427f 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -208,8 +208,11 @@ void config_common(int Mod_idP, int pdsch_AntennaPorts, NR_ServingCellConfigComm cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index.value = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.choice.l839; cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index.tl.tag = NFAPI_NR_CONFIG_PRACH_ROOT_SEQUENCE_INDEX_TAG; cfg->num_tlv++; - cfg->prach_config.num_prach_fd_occasions_list[i].k1.value = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FrequencyStart + (get_N_RA_RB( cfg->prach_config.prach_sub_c_spacing.value, scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing ) * i); -//k1= msg1_FrequencyStart + 12 (no. of FDM)(RB for PRACH occasion); + cfg->prach_config.num_prach_fd_occasions_list[i].k1.value = + (NRRIV2PRBOFFSET(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE) + + scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FrequencyStart + + (get_N_RA_RB(cfg->prach_config.prach_sub_c_spacing.value, scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing ) * i))*12 - + 6*scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; cfg->prach_config.num_prach_fd_occasions_list[i].k1.tl.tag = NFAPI_NR_CONFIG_K1_TAG; cfg->num_tlv++; cfg->prach_config.num_prach_fd_occasions_list[i].prach_zero_corr_conf.value = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.zeroCorrelationZoneConfig; From 7c2591f31875fe1b3a9f8a9a8a5c9ecd6e827be5 Mon Sep 17 00:00:00 2001 From: Roberto Louro Magueta Date: Tue, 23 Mar 2021 16:04:01 +0100 Subject: [PATCH 223/231] Revert "Fix PRACH msg1-FrequencyStart/k1" This reverts commit b6513faa82b36f70b11e316d65ad3c1ec115ba13 --- openair1/PHY/NR_TRANSPORT/nr_prach.c | 42 ++++++++++++++----------- openair1/PHY/NR_UE_TRANSPORT/nr_prach.c | 31 +++++++++--------- openair2/LAYER2/NR_MAC_UE/config_ue.c | 8 ++--- openair2/LAYER2/NR_MAC_gNB/config.c | 7 ++--- 4 files changed, 45 insertions(+), 43 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/nr_prach.c b/openair1/PHY/NR_TRANSPORT/nr_prach.c index 9577860ab8..bc9ca0db5e 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_prach.c +++ b/openair1/PHY/NR_TRANSPORT/nr_prach.c @@ -171,6 +171,9 @@ void rx_nr_prach_ru(RU_t *ru, int16_t *prach[ru->nb_rx]; int prach_sequence_length = ru->config.prach_config.prach_sequence_length.value; + + int msg1_frequencystart = ru->config.prach_config.num_prach_fd_occasions_list[numRA].k1.value; + int sample_offset_slot = (prachStartSymbol==0?0:fp->ofdm_symbol_size*prachStartSymbol+fp->nb_prefix_samples0+fp->nb_prefix_samples*(prachStartSymbol-1)); //to be checked for mu=0; @@ -192,7 +195,8 @@ void rx_nr_prach_ru(RU_t *ru, int16_t *prach2; if (prach_sequence_length == 0) { - LOG_D(PHY,"PRACH (ru %d) in %d.%d, format %d\n", ru->idx,frame,slot2,prachFormat); + LOG_D(PHY,"PRACH (ru %d) in %d.%d, format %d, msg1_frequencyStart %d\n", + ru->idx,frame,slot2,prachFormat,msg1_frequencystart); AssertFatal(prachFormat<4,"Illegal prach format %d for length 839\n",prachFormat); switch (prachFormat) { case 0: @@ -214,8 +218,8 @@ void rx_nr_prach_ru(RU_t *ru, } } else { - LOG_D(PHY,"PRACH (ru %d) in %d.%d, format %s,startSymbol %d\n", - ru->idx,frame,slot,prachfmt[prachFormat],prachStartSymbol); + LOG_D(PHY,"PRACH (ru %d) in %d.%d, format %s, msg1_frequencyStart %d,startSymbol %d\n", + ru->idx,frame,slot,prachfmt[prachFormat],msg1_frequencystart,prachStartSymbol); switch (prachFormat) { case 4: //A1 @@ -280,15 +284,15 @@ void rx_nr_prach_ru(RU_t *ru, K=1; kbar=2; } - - int k1 = (int16_t)ru->config.prach_config.num_prach_fd_occasions_list[numRA].k1.value; + int n_ra_prb = msg1_frequencystart; + int k = (12*n_ra_prb) - 6*fp->N_RB_UL; int N_ZC = (prach_sequence_length==0)?839:139; - if (k1<0) k1+=(fp->ofdm_symbol_size); - - k1*=K; - k1+=kbar; + if (k<0) k+=(fp->ofdm_symbol_size); + + k*=K; + k+=kbar; int reps=1; @@ -649,7 +653,7 @@ void rx_nr_prach_ru(RU_t *ru, int16_t rxsigF_tmp[N_ZC<<1]; // if (k+N_ZC > dftlen) { // PRACH signal is split around DC int16_t *rxsigF2=rxsigF[aa]; - int k2=k1<<1; + int k2=k<<1; for (int j=0;jnum_prach_fd_occasions_list[prach_pdu->num_ra].num_root_sequences.value; NCS = prach_pdu->num_cs;//cfg->num_prach_fd_occasions_list[0].prach_zero_corr_conf.value; int prach_sequence_length = cfg->prach_sequence_length.value; + int msg1_frequencystart = cfg->num_prach_fd_occasions_list[prach_pdu->num_ra].k1.value; // int num_unused_root_sequences = cfg->num_prach_fd_occasions_list[0].num_unused_root_sequences.value; // cfg->num_prach_fd_occasions_list[0].unused_root_sequences_list @@ -728,8 +734,7 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, prach_ifft = gNB->prach_vars.prach_ifft; prachF = gNB->prach_vars.prachF; if (LOG_DEBUGFLAG(PRACH)){ - if ((frame&1023) < 20) LOG_D(PHY,"PRACH (gNB) : running rx_prach for subframe %d, rootSequenceIndex %d\n", - subframe, rootSequenceIndex); + if ((frame&1023) < 20) LOG_D(PHY,"PRACH (gNB) : running rx_prach for subframe %d, msg1_frequencystart %d, rootSequenceIndex %d\n", subframe,msg1_frequencystart,rootSequenceIndex); } start_meas(&gNB->rx_prach); @@ -931,13 +936,14 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, if (LOG_DUMPFLAG(PRACH)) { //int en = dB_fixed(signal_energy((int32_t*)&rxsigF[0][0],840)); // if (en>60) { - int k1 = (int16_t)cfg->num_prach_fd_occasions_list[prach_pdu->num_ra].k1.value; + int k = (12*n_ra_prb) - 6*fp->N_RB_UL; - if (k1<0) k1+=fp->ofdm_symbol_size; + if (k<0) k+=fp->ofdm_symbol_size; + + k*=12; + k+=13; + k*=2; - k1*=12; - k1+=13; - k1*=2; LOG_M("rxsigF.m","prach_rxF",&rxsigF[0][0],12288,1,1); LOG_M("prach_rxF_comp0.m","prach_rxF_comp0",prachF,1024,1,1); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c b/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c index 8c41b23c89..0ba02c6bac 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c @@ -71,7 +71,7 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ int16_t Ncp = 0, amp, *prach, *prach2, *prachF, *Xu; int32_t Xu_re, Xu_im; - int prach_start, prach_sequence_length, i, prach_len, dftlen, mu, kbar, K, k1, prachStartSymbol, sample_offset_slot; + int prach_start, prach_sequence_length, i, prach_len, dftlen, mu, kbar, K, n_ra_prb, k, prachStartSymbol, sample_offset_slot; //int restricted_Type; prach = prach_tmp; @@ -83,6 +83,7 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ mu = nrUE_config->prach_config.prach_sub_c_spacing; restricted_set = prach_pdu->restricted_set; rootSequenceIndex = prach_pdu->root_seq_id; + n_ra_prb = prach_pdu->freq_msg1; NCS = prach_pdu->num_cs; prach_fmt_id = prach_pdu->prach_format; preamble_index = prach_resources->ra_PreambleIndex; @@ -92,7 +93,7 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ first_nonzero_root_idx = 0; kbar = 1; K = 24; - k1 = (int16_t)prach_pdu->freq_msg1; + k = 12*n_ra_prb - 6*fp->N_RB_UL; prachStartSymbol = prach_pdu->prach_start_symbol; //restricted_Type = 0; @@ -184,7 +185,7 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ // now generate PRACH signal #ifdef NR_PRACH_DEBUG if (NCS>0) - LOG_I(PHY, "PRACH [UE %d] generate PRACH in slot %d for RootSeqIndex %d, Preamble Index %d, PRACH Format %s, NCS %d (N_ZC %d): Preamble_offset %d, Preamble_shift %dn", + LOG_I(PHY, "PRACH [UE %d] generate PRACH in slot %d for RootSeqIndex %d, Preamble Index %d, PRACH Format %s, NCS %d (N_ZC %d): Preamble_offset %d, Preamble_shift %d msg1 frequency start %d\n", Mod_id, slot, rootSequenceIndex, @@ -193,7 +194,8 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ NCS, N_ZC, preamble_offset, - preamble_shift); + preamble_shift, + n_ra_prb); #endif // nsymb = (frame_parms->Ncp==0) ? 14:12; @@ -207,16 +209,17 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ kbar = 2; } - if (k1<0) - k1 += fp->ofdm_symbol_size; + if (k<0) + k += fp->ofdm_symbol_size; - k1 *= K; - k1 += kbar; - k1 *= 2; + k *= K; + k += kbar; + k *= 2; - LOG_I(PHY, "PRACH [UE %d] in slot %d, placing PRACH in position %d, preamble_offset %d, first_nonzero_root_idx %d\n", Mod_id, + LOG_I(PHY, "PRACH [UE %d] in slot %d, placing PRACH in position %d, msg1 frequency start %d, preamble_offset %d, first_nonzero_root_idx %d\n", Mod_id, slot, - k1, + k, + n_ra_prb, preamble_offset, first_nonzero_root_idx); @@ -341,10 +344,10 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ Xu_re = (((int32_t)Xu[offset<<1]*amp)>>15); Xu_im = (((int32_t)Xu[1+(offset<<1)]*amp)>>15); - prachF[k1++]= ((Xu_re*nr_ru[offset2<<1]) - (Xu_im*nr_ru[1+(offset2<<1)]))>>15; - prachF[k1++]= ((Xu_im*nr_ru[offset2<<1]) + (Xu_re*nr_ru[1+(offset2<<1)]))>>15; + prachF[k++]= ((Xu_re*nr_ru[offset2<<1]) - (Xu_im*nr_ru[1+(offset2<<1)]))>>15; + prachF[k++]= ((Xu_im*nr_ru[offset2<<1]) + (Xu_re*nr_ru[1+(offset2<<1)]))>>15; - if (k1==dftlen) k1=0; + if (k==dftlen) k=0; } #if defined (PRACH_WRITE_OUTPUT_DEBUG) diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index 361113b179..c45430bb45 100755 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -31,7 +31,6 @@ */ //#include "mac_defs.h" -#include #include "NR_MAC_UE/mac_proto.h" #include "NR_MAC-CellGroupConfig.h" #include "LAYER2/NR_MAC_COMMON/nr_mac_common.h" @@ -310,11 +309,8 @@ void config_common_ue(NR_UE_MAC_INST_t *mac, cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.choice.l139; else cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.choice.l839; - cfg->prach_config.num_prach_fd_occasions_list[i].k1 = - (NRRIV2PRBOFFSET(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE) + - scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FrequencyStart + - (get_N_RA_RB(cfg->prach_config.prach_sub_c_spacing, scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing ) * i))*12 - - 6*scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; + + cfg->prach_config.num_prach_fd_occasions_list[i].k1 = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FrequencyStart; cfg->prach_config.num_prach_fd_occasions_list[i].prach_zero_corr_conf = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.zeroCorrelationZoneConfig; cfg->prach_config.num_prach_fd_occasions_list[i].num_root_sequences = compute_nr_root_seq(scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup, nb_preambles, mac->frame_type, frequency_range); //cfg->prach_config.num_prach_fd_occasions_list[i].num_unused_root_sequences = ??? diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index d27531427f..2e661dfb73 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -208,11 +208,8 @@ void config_common(int Mod_idP, int pdsch_AntennaPorts, NR_ServingCellConfigComm cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index.value = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.choice.l839; cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index.tl.tag = NFAPI_NR_CONFIG_PRACH_ROOT_SEQUENCE_INDEX_TAG; cfg->num_tlv++; - cfg->prach_config.num_prach_fd_occasions_list[i].k1.value = - (NRRIV2PRBOFFSET(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE) + - scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FrequencyStart + - (get_N_RA_RB(cfg->prach_config.prach_sub_c_spacing.value, scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing ) * i))*12 - - 6*scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; + cfg->prach_config.num_prach_fd_occasions_list[i].k1.value = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FrequencyStart + (get_N_RA_RB( cfg->prach_config.prach_sub_c_spacing.value, scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing ) * i); +//k1= msg1_FrequencyStart + 12 (no. of FDM)(RB for PRACH occasion); cfg->prach_config.num_prach_fd_occasions_list[i].k1.tl.tag = NFAPI_NR_CONFIG_K1_TAG; cfg->num_tlv++; cfg->prach_config.num_prach_fd_occasions_list[i].prach_zero_corr_conf.value = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.zeroCorrelationZoneConfig; From 8c13604d619138ca4c3796a8aa6cf184dcd7b800 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Tue, 23 Mar 2021 15:22:36 +0000 Subject: [PATCH 224/231] Fix PRACH with k1 = msg1-FrequencyStart + initialUplinkBWPStart --- openair2/LAYER2/NR_MAC_UE/config_ue.c | 3 ++- openair2/LAYER2/NR_MAC_gNB/config.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index c45430bb45..4d4dd45415 100755 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -31,6 +31,7 @@ */ //#include "mac_defs.h" +#include #include "NR_MAC_UE/mac_proto.h" #include "NR_MAC-CellGroupConfig.h" #include "LAYER2/NR_MAC_COMMON/nr_mac_common.h" @@ -310,7 +311,7 @@ void config_common_ue(NR_UE_MAC_INST_t *mac, else cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.choice.l839; - cfg->prach_config.num_prach_fd_occasions_list[i].k1 = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FrequencyStart; + cfg->prach_config.num_prach_fd_occasions_list[i].k1 = NRRIV2PRBOFFSET(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE) + scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FrequencyStart + (get_N_RA_RB(cfg->prach_config.prach_sub_c_spacing, scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing ) * i); cfg->prach_config.num_prach_fd_occasions_list[i].prach_zero_corr_conf = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.zeroCorrelationZoneConfig; cfg->prach_config.num_prach_fd_occasions_list[i].num_root_sequences = compute_nr_root_seq(scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup, nb_preambles, mac->frame_type, frequency_range); //cfg->prach_config.num_prach_fd_occasions_list[i].num_unused_root_sequences = ??? diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 2e661dfb73..1524fa71ec 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -208,7 +208,7 @@ void config_common(int Mod_idP, int pdsch_AntennaPorts, NR_ServingCellConfigComm cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index.value = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.choice.l839; cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index.tl.tag = NFAPI_NR_CONFIG_PRACH_ROOT_SEQUENCE_INDEX_TAG; cfg->num_tlv++; - cfg->prach_config.num_prach_fd_occasions_list[i].k1.value = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FrequencyStart + (get_N_RA_RB( cfg->prach_config.prach_sub_c_spacing.value, scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing ) * i); + cfg->prach_config.num_prach_fd_occasions_list[i].k1.value = NRRIV2PRBOFFSET(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE) + scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FrequencyStart + (get_N_RA_RB( cfg->prach_config.prach_sub_c_spacing.value, scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing ) * i); //k1= msg1_FrequencyStart + 12 (no. of FDM)(RB for PRACH occasion); cfg->prach_config.num_prach_fd_occasions_list[i].k1.tl.tag = NFAPI_NR_CONFIG_K1_TAG; cfg->num_tlv++; From ee047b88e99c8dccaa438a612f3d21744f8c7fb4 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Tue, 23 Mar 2021 17:59:31 +0000 Subject: [PATCH 225/231] Remove TC-RNTI at PHY when RA procedure does not succeeded --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 2 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c | 12 +++++++++++- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 3 +++ openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 2 ++ 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 2bf5ab437f..3d7458dedf 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -1378,7 +1378,7 @@ void nr_check_Msg4_Ack(module_id_t module_id, int CC_id, frame_t frame, sub_fram NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info; NR_UE_harq_t *harq = &UE_info->UE_sched_ctrl[UE_id].harq_processes[current_harq_pid]; - LOG_D(MAC, "ue %d, rnti %d, harq is waiting %d, round %d, frame %d %d, harq id %d\n", UE_id, ra->rnti, harq->is_waiting, harq->round, frame, slot, current_harq_pid); + LOG_D(NR_MAC, "ue %d, rnti %d, harq is waiting %d, round %d, frame %d %d, harq id %d\n", UE_id, ra->rnti, harq->is_waiting, harq->round, frame, slot, current_harq_pid); if (harq->is_waiting == 0) { diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index fa609cddbe..37aeabe07c 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -1756,12 +1756,22 @@ void mac_remove_nr_ue(module_id_t mod_id, rnti_t rnti) if (pthread_mutex_lock(&rnti_to_remove_mutex)) exit(1); if (rnti_to_remove_count == 10) exit(1); rnti_to_remove[rnti_to_remove_count] = rnti; - LOG_W(MAC, "to remove in mac rnti_to_remove[%d]=%d\n", rnti_to_remove_count, rnti); + LOG_W(NR_MAC, "to remove in mac rnti_to_remove[%d] = 0x%04x\n", rnti_to_remove_count, rnti); rnti_to_remove_count++; if (pthread_mutex_unlock(&rnti_to_remove_mutex)) exit(1); } } +void nr_mac_remove_ra_rnti_ue(module_id_t mod_id, rnti_t rnti) { + // Hack to remove UE in the phy (following the same procedure as in function mac_remove_nr_ue) + if (pthread_mutex_lock(&rnti_to_remove_mutex)) exit(1); + if (rnti_to_remove_count == 10) exit(1); + rnti_to_remove[rnti_to_remove_count] = rnti; + LOG_W(NR_MAC, "to remove in mac rnti_to_remove[%d] = 0x%04x\n", rnti_to_remove_count, rnti); + rnti_to_remove_count++; + if (pthread_mutex_unlock(&rnti_to_remove_mutex)) exit(1); +} + uint8_t nr_get_tpc(int target, uint8_t cqi, int incr) { // al values passed to this function are x10 diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 83060215e9..fa973844cb 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -492,6 +492,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, if(no_sig) { LOG_W(NR_MAC, "Random Access %i failed at state %i\n", i, ra->state); + nr_mac_remove_ra_rnti_ue(gnb_mod_idP, ra->rnti); nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra); } else { @@ -516,6 +517,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, if(ra->cfra) { LOG_I(NR_MAC, "(ue %i, rnti 0x%04x) CFRA procedure succeeded!\n", UE_id, ra->rnti); + nr_mac_remove_ra_rnti_ue(gnb_mod_idP, ra->rnti); nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra); free(ra->preambles.preamble_list); UE_info->active[UE_id] = true; @@ -555,6 +557,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, continue; LOG_W(NR_MAC, "Random Access %i failed at state %i\n", i, ra->state); + nr_mac_remove_ra_rnti_ue(gnb_mod_idP, ra->rnti); nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra); } } diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index 78de26b5b9..a7d9bc43b1 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -312,6 +312,8 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *secon void mac_remove_nr_ue(module_id_t mod_id, rnti_t rnti); +void nr_mac_remove_ra_rnti_ue(module_id_t mod_id, rnti_t rnti); + int allocate_nr_CCEs(gNB_MAC_INST *nr_mac, NR_BWP_Downlink_t *bwp, NR_ControlResourceSet_t *coreset, From 86f70e27771fd3d4d01e5595580378656878c7af Mon Sep 17 00:00:00 2001 From: rmagueta Date: Tue, 23 Mar 2021 20:13:23 +0000 Subject: [PATCH 226/231] Add RA support for up to NUMBER_OF_NR_ULSCH_MAX UEs --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 4 ++-- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 3d7458dedf..3816fe0b50 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -577,7 +577,8 @@ void nr_initiate_ra_proc(module_id_t module_idP, LOG_D(MAC, "%s() Msg2[%04d%d] SFN/SF:%04d%d\n", __FUNCTION__, ra->Msg2_frame, ra->Msg2_slot, frameP, slotP); int loop = 0; - if (!ra->cfra) { + // This condition allows for the usage of a preconfigured rnti for the first UE + if (!ra->cfra || ra->rnti == 0) { do { ra->rnti = (taus() % 65518) + 1; loop++; @@ -1385,7 +1386,6 @@ void nr_check_Msg4_Ack(module_id_t module_id, int CC_id, frame_t frame, sub_fram if (harq->round == 0) { nr_clear_ra_proc(module_id, CC_id, frame, ra); - free(ra->preambles.preamble_list); UE_info->active[UE_id] = true; LOG_I(NR_MAC, "(ue %i, rnti 0x%04x) Received Ack of RA-Msg4. CBRA procedure succeeded!\n", UE_id, ra->rnti); } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index fa973844cb..4bbe031742 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -519,7 +519,6 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, LOG_I(NR_MAC, "(ue %i, rnti 0x%04x) CFRA procedure succeeded!\n", UE_id, ra->rnti); nr_mac_remove_ra_rnti_ue(gnb_mod_idP, ra->rnti); nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra); - free(ra->preambles.preamble_list); UE_info->active[UE_id] = true; } else { From feb2b9c8bbb8de5ab0f7dab520936e4b7f2730b1 Mon Sep 17 00:00:00 2001 From: Florian Kaltenberger Date: Wed, 24 Mar 2021 10:24:24 +0100 Subject: [PATCH 227/231] adding rxdataF signal to debug output --- openair1/SIMULATION/NR_PHY/prachsim.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/openair1/SIMULATION/NR_PHY/prachsim.c b/openair1/SIMULATION/NR_PHY/prachsim.c index 4c70f24dd9..01b7356f37 100644 --- a/openair1/SIMULATION/NR_PHY/prachsim.c +++ b/openair1/SIMULATION/NR_PHY/prachsim.c @@ -177,7 +177,7 @@ int main(int argc, char **argv){ double sigma2, sigma2_dB = 0, SNR, snr0 = -2.0, snr1 = 0.0, ue_speed0 = 0.0, ue_speed1 = 0.0; double **s_re, **s_im, **r_re, **r_im, iqim = 0.0, delay_avg = 0, ue_speed = 0, fs, bw; - int i, aa, aarx, **txdata, trial, n_frames = 1, prach_start, rx_prach_start; //, ntrials=1; + int i, l, aa, aarx, **txdata, trial, n_frames = 1, prach_start, rx_prach_start; //, ntrials=1; int N_RB_UL = 106, delay = 0, NCS_config = 13, rootSequenceIndex = 1, threequarter_fs = 0, mu = 1, fd_occasion = 0, loglvl = OAILOG_INFO, numRA = 0, prachStartSymbol = 0; uint8_t snr1set = 0, ue_speed1set = 0, transmission_mode = 1, n_tx = 1, n_rx = 1, awgn_flag = 0, msg1_frequencystart = 0, num_prach_fd_occasions = 1, prach_format=0; uint8_t frame = 1, slot=19, slot_gNB=19, config_index = 98, prach_sequence_length = 1, restrictedSetConfig = 0, N_dur, N_t_slot, start_symbol; @@ -808,7 +808,18 @@ int main(int argc, char **argv){ } } - + for (l = 0; l < frame_parms->symbols_per_slot; l++) { + for (aa = 0; aa < frame_parms->nb_antennas_rx; aa++) { + nr_slot_fep_ul(frame_parms, + ru->common.rxdata[aa], + ru->common.rxdataF[aa], + l, + slot, + ru->N_TA_offset, + 0); + } + } + rx_nr_prach_ru(ru, prach_format, numRA, prachStartSymbol, prachOccasion, frame, slot); gNB->prach_vars.rxsigF = ru->prach_rxsigF[prachOccasion]; @@ -831,7 +842,8 @@ int main(int argc, char **argv){ LOG_M("prachF0.m","prachF0", &gNB->prach_vars.prachF[0], N_ZC, 1, 1); LOG_M("rxsig0.m","rxs0", &gNB->common_vars.rxdata[0][subframe*frame_parms->samples_per_subframe], frame_parms->samples_per_subframe, 1, 1); LOG_M("ru_rxsig0.m","rxs0", &ru->common.rxdata[0][subframe*frame_parms->samples_per_subframe], frame_parms->samples_per_subframe, 1, 1); - LOG_M("ru_rxsigF0.m","rxsF0", ru->prach_rxsigF[0][0], N_ZC, 1, 1); + LOG_M("ru_rxsigF0.m","rxsF0", ru->common.rxdataF[0], frame_parms->ofdm_symbol_size*frame_parms->symbols_per_slot, 1, 1); + LOG_M("ru_prach_rxsigF0.m","rxsF0", ru->prach_rxsigF[0][0], N_ZC, 1, 1); LOG_M("prach_preamble.m","prachp", &gNB->X_u[0], N_ZC, 1, 1); LOG_M("ue_prach_preamble.m","prachp", &UE->X_u[0], N_ZC, 1, 1); #endif From 4840b895ddcec84900f94985c3013cbd2db18483 Mon Sep 17 00:00:00 2001 From: Raymond Knopp Date: Wed, 24 Mar 2021 10:13:28 +0100 Subject: [PATCH 228/231] adding PRACH signal to T tracer --- common/utils/T/T_defs.h | 4 ++-- common/utils/T/T_messages.txt | 4 ++++ executables/nr-ru.c | 4 ++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/common/utils/T/T_defs.h b/common/utils/T/T_defs.h index 11c816f002..efab3e525c 100644 --- a/common/utils/T/T_defs.h +++ b/common/utils/T/T_defs.h @@ -42,9 +42,9 @@ /* maximum size of a message - increase if needed */ #if BASIC_SIMULATOR /* let's have 100 RBs functional for the basic simulator */ -# define T_BUFFER_MAX (1024*64*2) +# define T_BUFFER_MAX (1024*64*4) #else -# define T_BUFFER_MAX (1024*64*2) +# define T_BUFFER_MAX (1024*64*4) #endif /* size of the local cache for messages (must be pow(2,something)) */ diff --git a/common/utils/T/T_messages.txt b/common/utils/T/T_messages.txt index fedc50cf5d..2f52487c88 100644 --- a/common/utils/T/T_messages.txt +++ b/common/utils/T/T_messages.txt @@ -93,6 +93,10 @@ ID = GNB_PHY_PUCCH_PUSCH_IQ DESC = gNodeB input data in the frequency domain for a slot where some PUCCH or PUSCH detection was done GROUP = ALL:PHY:GRAPHIC:HEAVY:GNB FORMAT = int,frame : int,slot : buffer,rxdataF +ID = GNB_PHY_PRACH_INPUT_SIGNAL + DESC = gNodeB input data in the time domain for slots with PRACH detection + GROUP = ALL:PHY:GRAPHIC:HEAVY:GNB + FORMAT = int,frame : int,slot : int,antenna : buffer,rxdata #MAC logs ID = ENB_MAC_UE_DL_SDU diff --git a/executables/nr-ru.c b/executables/nr-ru.c index 0e6c8f2818..9086de6866 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -1343,6 +1343,10 @@ void *ru_thread( void *param ) { int prach_id=find_nr_prach_ru(ru,proc->frame_rx,proc->tti_rx,SEARCH_EXIST); uint8_t prachStartSymbol,N_dur; if (prach_id>=0) { + + T(T_GNB_PHY_PRACH_INPUT_SIGNAL, T_INT(proc->frame_rx), T_INT(proc->tti_rx), T_INT(0), + T_BUFFER(&ru->common.rxdata[0][fp->get_samples_slot_timestamp(proc->tti_rx-1,fp,0)]/*-ru->N_TA_offset*/, fp->get_samples_per_slot(proc->tti_rx,fp)*4*2)); + N_dur = get_nr_prach_duration(ru->prach_list[prach_id].fmt); /* get_nr_prach_info_from_index(ru->config.prach_config.prach_ConfigurationIndex.value, From e84d1fe678d6389d05cb4de730494cba541e0b83 Mon Sep 17 00:00:00 2001 From: Raymond Knopp Date: Wed, 24 Mar 2021 16:07:11 +0100 Subject: [PATCH 229/231] adding UL LCID 52 for CCCH with 48 bits --- openair2/LAYER2/NR_MAC_COMMON/nr_mac.h | 3 ++- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h index fa4d8d48ea..6b9060801d 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h @@ -334,11 +334,12 @@ typedef struct { #define DL_SCH_LCID_CON_RES_ID 0x3E #define DL_SCH_LCID_PADDING 0x3F -#define UL_SCH_LCID_CCCH 0x00 +#define UL_SCH_LCID_CCCH1 0x00 #define UL_SCH_LCID_SRB1 0x01 #define UL_SCH_LCID_SRB2 0x02 #define UL_SCH_LCID_SRB3 0x03 #define UL_SCH_LCID_DTCH 0x04 +#define UL_SCH_LCID_CCCH 0x34 #define UL_SCH_LCID_RECOMMENDED_BITRATE_QUERY 0x35 #define UL_SCH_LCID_MULTI_ENTRY_PHR_4_OCT 0x36 #define UL_SCH_LCID_CONFIGURED_GRANT_CONFIRMATION 0x37 diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 4bbe031742..c6a741cce9 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -238,6 +238,7 @@ void nr_process_mac_pdu( // todo break; case UL_SCH_LCID_CCCH: + case UL_SCH_LCID_CCCH1: mac_subheader_len = 1; nr_mac_rrc_data_ind(module_idP, CC_id, From 39868c400a18264c9acba4fb190a009f7d0517aa Mon Sep 17 00:00:00 2001 From: Raymond Knopp Date: Wed, 24 Mar 2021 16:07:53 +0100 Subject: [PATCH 230/231] adding format_indicator to dci_payload of msg3 --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 1 + 1 file changed, 1 insertion(+) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 3816fe0b50..b16cd600c2 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -1294,6 +1294,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra pdsch_pdu_rel15->rbStart, pdsch_pdu_rel15->BWPSize); + dci_payload.format_indicator = 1; dci_payload.time_domain_assignment.val = time_domain_assignment; dci_payload.vrb_to_prb_mapping.val = 0; dci_payload.mcs = pdsch_pdu_rel15->mcsIndex[0]; From 114508c120bb37ac4aee85c92a4b934e0d095ae2 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Wed, 24 Mar 2021 16:17:48 +0000 Subject: [PATCH 231/231] Minor fix in nr_prachsim --- openair1/SIMULATION/NR_PHY/prachsim.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openair1/SIMULATION/NR_PHY/prachsim.c b/openair1/SIMULATION/NR_PHY/prachsim.c index 01b7356f37..fb5cdfa7d4 100644 --- a/openair1/SIMULATION/NR_PHY/prachsim.c +++ b/openair1/SIMULATION/NR_PHY/prachsim.c @@ -37,6 +37,7 @@ #include "SCHED_NR_UE/phy_frame_config_nr.h" #include "PHY/phy_vars_nr_ue.h" #include "PHY/NR_REFSIG/refsig_defs_ue.h" +#include "PHY/MODULATION/nr_modulation.h" #include "PHY/MODULATION/modulation_eNB.h" #include "PHY/MODULATION/modulation_UE.h" #include "PHY/INIT/phy_init.h" @@ -815,8 +816,7 @@ int main(int argc, char **argv){ ru->common.rxdataF[aa], l, slot, - ru->N_TA_offset, - 0); + ru->N_TA_offset); } }