From f4f9d3b4d72d563713e48462ca954431b1b1ec87 Mon Sep 17 00:00:00 2001 From: Florian Kaltenberger Date: Wed, 28 Oct 2020 11:06:35 +0100 Subject: [PATCH 1/6] hardcoding ra_rnti in case of long prach for benetel --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 12 ++++++++++-- 1 file changed, 10 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 4c17ee3a0f..442149062a 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -248,8 +248,6 @@ void nr_initiate_ra_proc(module_id_t module_idP, uint8_t ul_carrier_id = 0; // 0 for NUL 1 for SUL NR_SearchSpace_t *ss; int UE_id = 0; - // ra_rnti from 5.1.3 in 38.321 - uint16_t ra_rnti=1+symbol+(slotP*14)+(freq_index*14*80)+(ul_carrier_id*14*80*8); uint16_t msg2_frame, msg2_slot,monitoring_slot_period,monitoring_offset; gNB_MAC_INST *nr_mac = RC.nrmac[module_idP]; @@ -259,6 +257,16 @@ void nr_initiate_ra_proc(module_id_t module_idP, NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; NR_RA_t *ra = &cc->ra[0]; + uint16_t ra_rnti; + + // ra_rnti from 5.1.3 in 38.321 + // FK: in case of long PRACH the phone seems to expect the subframe number instead of the slot number here. + if (scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.present==NR_RACH_ConfigCommon__prach_RootSequenceIndex_PR_l839) + ra_rnti=1+symbol+(9/*slotP*/*14)+(freq_index*14*80)+(ul_carrier_id*14*80*8); + else + ra_rnti=1+symbol+(slotP*14)+(freq_index*14*80)+(ul_carrier_id*14*80*8); + + // if the preamble received correspond to one of the listed // the UE sent a RACH either for starting RA procedure or RA procedure failed and UE retries int pr_found=0; From 144e267541e95e0bbe039a627f3055c8e474da1a Mon Sep 17 00:00:00 2001 From: Florian Kaltenberger Date: Wed, 28 Oct 2020 11:08:26 +0100 Subject: [PATCH 2/6] fixing PRACH bug in benetel_5g driver --- targets/ARCH/ETHERNET/benetel/5g/benetel.c | 1 + .../ARCH/ETHERNET/benetel/5g/dpdk_driver.c | 22 +++++------ targets/ARCH/ETHERNET/benetel/5g/low.c | 37 ++++++++++++++++++- 3 files changed, 47 insertions(+), 13 deletions(-) diff --git a/targets/ARCH/ETHERNET/benetel/5g/benetel.c b/targets/ARCH/ETHERNET/benetel/5g/benetel.c index c1ae1afcc7..2b8e0dfbfb 100644 --- a/targets/ARCH/ETHERNET/benetel/5g/benetel.c +++ b/targets/ARCH/ETHERNET/benetel/5g/benetel.c @@ -275,6 +275,7 @@ void benetel_fh_if4p5_south_out(RU_t *ru, int slot, uint64_t timestamp) { + //printf("XXX benetel_fh_if4p5_south_out %d %d %ld\n", frame, slot, timestamp); benetel_eth_state_t *s = ru->ifdevice.priv; NR_DL_FRAME_PARMS *fp; diff --git a/targets/ARCH/ETHERNET/benetel/5g/dpdk_driver.c b/targets/ARCH/ETHERNET/benetel/5g/dpdk_driver.c index b90702d331..dd50603ec5 100644 --- a/targets/ARCH/ETHERNET/benetel/5g/dpdk_driver.c +++ b/targets/ARCH/ETHERNET/benetel/5g/dpdk_driver.c @@ -86,10 +86,9 @@ static struct rte_eth_dev_tx_buffer *tx_buffer[RTE_MAX_ETHPORTS]; static struct rte_eth_conf port_conf = { .rxmode = { .split_hdr_size = 0, - .offloads = DEV_RX_OFFLOAD_CRC_STRIP, - .offloads = DEV_RX_OFFLOAD_JUMBO_FRAME, - .split_hdr_size = 0, - .max_rx_pkt_len = 9500, + .offloads = DEV_RX_OFFLOAD_JUMBO_FRAME, + .split_hdr_size = 0, + .max_rx_pkt_len = 9500, }, .txmode = { .mq_mode = ETH_MQ_TX_NONE, @@ -234,7 +233,7 @@ l2fwd_simple_forward(struct rte_mbuf *m, unsigned portid, benetel_t *bs) } // Trigger start send DL packets - if(PAYLOAD_1 == 0x13 && PAYLOAD_2 == 0xe4 && SYMBOL == 0x46 && ANT_NUM == 0x00 && SUBFRAME == 0x00 && dl_start == 0){ + if(PAYLOAD_1 == 0x13 && PAYLOAD_2 == 0xe4 && SYMBOL == 0x44 && ANT_NUM == 0x00 && SUBFRAME == 0x00 && dl_start == 0){ printf("\nU-Plane Started\n"); printf("\n====================================================\n"); @@ -253,7 +252,7 @@ l2fwd_simple_forward(struct rte_mbuf *m, unsigned portid, benetel_t *bs) p.antenna = 0; memcpy(p.iq, IQ_ptr, 5088); store_ul(bs, &p); - //if (p.symbol==0) printf("store ul f.sl.sy %d.%d.%d\n", p.frame, p.slot, p.symbol); + // if (p.symbol==0) printf("store ul f.sl.sy %d.%d.%d\n", p.frame, p.slot, p.symbol); } // U-PLANE UL ANT_0 PROCESSING @@ -268,7 +267,7 @@ l2fwd_simple_forward(struct rte_mbuf *m, unsigned portid, benetel_t *bs) int tx_frame = frame; int tx_subframe = subframe; int tx_slot = slot; - int tx_symbol = symbol + 8; + int tx_symbol = symbol + 10; if (tx_symbol > 13) { tx_symbol -= 14; @@ -286,7 +285,7 @@ l2fwd_simple_forward(struct rte_mbuf *m, unsigned portid, benetel_t *bs) ANT_NUM = 0x00; // Mask the symbol bits from UL packet received and apply the shift. - SYMBOL = ((SYMBOL & 0b00111111) + 8) % 14; + SYMBOL = ((SYMBOL & 0b00111111) + 10) % 14; ANT_NUM = 0x00; SUBFRAME = sf; @@ -307,6 +306,7 @@ l2fwd_simple_forward(struct rte_mbuf *m, unsigned portid, benetel_t *bs) memcpy(IQ_ptr, bs->buffers->dl[oai_slot] + tx_symbol * 1272*4, 1272*4); } +//printf("DL buffer f sf slot symbol %d %d %d %d (sf %d)\n", tx_frame, tx_subframe, tx_slot, tx_symbol, (int)sf); bs->buffers->dl_busy[oai_slot] &= ~(1 << tx_symbol); unlock_dl_buffer(bs->buffers, oai_slot); @@ -319,7 +319,7 @@ l2fwd_simple_forward(struct rte_mbuf *m, unsigned portid, benetel_t *bs) { // Mask the symbol bits from UL packet received and apply the shift. - SYMBOL = ((SYMBOL & 0b00111111) + 8) % 14; + SYMBOL = ((SYMBOL & 0b00111111) +10) % 14; ANT_NUM = 0x01; SUBFRAME = sf; @@ -348,10 +348,10 @@ l2fwd_simple_forward(struct rte_mbuf *m, unsigned portid, benetel_t *bs) else if(PAYLOAD_1 == 0x0d && PAYLOAD_2 == 0x28){ if (ANT_NUM == 0) { int subframe = SUBFRAME >> 4; - int slot = ((SUBFRAME & 0x0f) << 2) | ((SYMBOL >> 6) & 0x03); + //int slot = ((SUBFRAME & 0x0f) << 2) | ((SYMBOL >> 6) & 0x03); if (subframe==9) { //printf("store prach f.sf.sl %d.%d.%d %d\n", FRAME, subframe, slot, subframe * 2 + slot); - store_prach(bs, FRAME, slot /*subframe * 2 + slot*/, IQ_ptr); + store_prach(bs, FRAME, subframe * 2 + 1, IQ_ptr); } } rte_pktmbuf_free(m); diff --git a/targets/ARCH/ETHERNET/benetel/5g/low.c b/targets/ARCH/ETHERNET/benetel/5g/low.c index 984e401421..52c9f24127 100644 --- a/targets/ARCH/ETHERNET/benetel/5g/low.c +++ b/targets/ARCH/ETHERNET/benetel/5g/low.c @@ -27,17 +27,50 @@ void store_ul(benetel_t *bs, ul_packet_t *ul) { +#if 0 +struct timespec t; +static struct timespec old; +clock_gettime(CLOCK_REALTIME, &t); +printf("store_ul %d.%ld (%ld)\n", (int)(t.tv_sec % 60), t.tv_nsec, t.tv_nsec - old.tv_nsec); +old = t; +#endif + /* only antenna 0 for the moment */ if (ul->antenna != 0) return; if (ul->slot != bs->next_slot || ul->symbol != bs->next_symbol) { - printf("%s: fatal, expected frame.sl.symbol %d.%d.%d, got %d.%d.%d\n", + printf("%s: error, expected frame.sl.symbol %d.%d.%d, got %d.%d.%d\n", __FUNCTION__, bs->expected_benetel_frame, bs->next_slot, bs->next_symbol, ul->frame, ul->slot, ul->symbol); - exit(1); + } + + /* fill missing data with 0s */ + while (ul->slot != bs->next_slot || + ul->symbol != bs->next_symbol) { + lock_ul_buffer(bs->buffers, bs->next_slot); + if (bs->buffers->ul_busy[bs->next_slot] & (1 << bs->next_symbol)) { + printf("%s: warning, UL overflow (sl.symbol %d.%d)\n", __FUNCTION__, + bs->next_slot, bs->next_symbol); + } + + memset(bs->buffers->ul[bs->next_slot] + bs->next_symbol * 1272*4, + 0, 1272*4); + bs->buffers->ul_busy[bs->next_slot] |= (1 << bs->next_symbol); + signal_ul_buffer(bs->buffers, bs->next_slot); + unlock_ul_buffer(bs->buffers, bs->next_slot); + + bs->next_symbol++; + if (bs->next_symbol == 14) { + bs->next_symbol = 0; + bs->next_slot = (bs->next_slot + 1) % 20; + if (bs->next_slot == 0) { + bs->expected_benetel_frame++; + bs->expected_benetel_frame &= 255; + } + } } lock_ul_buffer(bs->buffers, bs->next_slot); From 638b5de1d246e6915452fc7ff1e9c9b2911e3d07 Mon Sep 17 00:00:00 2001 From: Florian Kaltenberger Date: Wed, 28 Oct 2020 11:28:00 +0100 Subject: [PATCH 3/6] updating config file for gNB --- targets/PROJECTS/GENERIC-LTE-EPC/CONF/benetel-5g.conf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/benetel-5g.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/benetel-5g.conf index 27fc90e5e3..b79dc52cff 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/benetel-5g.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/benetel-5g.conf @@ -203,7 +203,7 @@ gNBs = ////////// MME parameters: - mme_ip_address = ( { ipv4 = "192.168.61.195"; + mme_ip_address = ( { ipv4 = "192.168.18.99"; ipv6 = "192:168:30::17"; active = "yes"; preference = "ipv4"; @@ -225,9 +225,9 @@ gNBs = { GNB_INTERFACE_NAME_FOR_S1_MME = "eth0"; - GNB_IPV4_ADDRESS_FOR_S1_MME = "192.168.160.146/24"; + GNB_IPV4_ADDRESS_FOR_S1_MME = "192.168.18.195/24"; GNB_INTERFACE_NAME_FOR_S1U = "eth0"; - GNB_IPV4_ADDRESS_FOR_S1U = "192.168.160.146/24"; + GNB_IPV4_ADDRESS_FOR_S1U = "192.168.18.195/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 @@ -265,7 +265,7 @@ RUs = ( clock_src = "external"; local_if_name = "dpdk"; - sdr_addrs = "softmodem -m 2048 -l 6 -n 3 -b 0000:3b:00.1 --proc-type auto --file-prefix hhh -- -p 0x1"; + 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; From a129f121cc2b1cede784393b09100d4a57758217 Mon Sep 17 00:00:00 2001 From: Florian Kaltenberger Date: Wed, 28 Oct 2020 13:07:41 +0100 Subject: [PATCH 4/6] dpdk changes for 18.11 --- targets/ARCH/ETHERNET/benetel/4g/dpdk_driver.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/targets/ARCH/ETHERNET/benetel/4g/dpdk_driver.c b/targets/ARCH/ETHERNET/benetel/4g/dpdk_driver.c index 9b64f01d44..42953d1d4a 100644 --- a/targets/ARCH/ETHERNET/benetel/4g/dpdk_driver.c +++ b/targets/ARCH/ETHERNET/benetel/4g/dpdk_driver.c @@ -86,10 +86,9 @@ static struct rte_eth_dev_tx_buffer *tx_buffer[RTE_MAX_ETHPORTS]; static struct rte_eth_conf port_conf = { .rxmode = { .split_hdr_size = 0, - .offloads = DEV_RX_OFFLOAD_CRC_STRIP, - .offloads = DEV_RX_OFFLOAD_JUMBO_FRAME, - .split_hdr_size = 0, - .max_rx_pkt_len = 9500, + .offloads = DEV_RX_OFFLOAD_JUMBO_FRAME, + .split_hdr_size = 0, + .max_rx_pkt_len = 9500, }, .txmode = { .mq_mode = ETH_MQ_TX_NONE, From ba6edde8255e4bc78f366f30fe65d422a504c213 Mon Sep 17 00:00:00 2001 From: Florian Kaltenberger Date: Wed, 28 Oct 2020 13:08:05 +0100 Subject: [PATCH 5/6] updating 4g config file --- targets/PROJECTS/GENERIC-LTE-EPC/CONF/benetel-4g.conf | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/benetel-4g.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/benetel-4g.conf index 716bfd3b6b..8e7b0f64b2 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/benetel-4g.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/benetel-4g.conf @@ -174,14 +174,14 @@ eNBs = ////////// MME parameters: - mme_ip_address = ( { ipv4 = "192.168.61.195"; + mme_ip_address = ( { ipv4 = "192.168.18.99"; ipv6 = "192:168:30::17"; active = "yes"; preference = "ipv4"; } ); - enable_measurement_reports = "no"; + enable_measurement_reports = "yes"; ///X2 enable_x2 = "yes"; @@ -191,9 +191,9 @@ eNBs = NETWORK_INTERFACES : { ENB_INTERFACE_NAME_FOR_S1_MME = "eth0"; - ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.160.46"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.18.196"; ENB_INTERFACE_NAME_FOR_S1U = "eth0"; - ENB_IPV4_ADDRESS_FOR_S1U = "192.168.160.46"; + 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 @@ -224,7 +224,7 @@ RUs = ( { //local_if_name = "enp129s0f0"; local_if_name = "dpdk"; - sdr_addrs = "softmodem -m 2048 -l 8 -n 2 -b 0000:3b:00.0 --proc-type auto --file-prefix ggg -- -p 0x1"; + 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"; From 8ba0d28ace051a4e63fad4d8ff98511bbabe0548 Mon Sep 17 00:00:00 2001 From: Florian Kaltenberger Date: Wed, 28 Oct 2020 13:58:38 +0100 Subject: [PATCH 6/6] hardcoding measurement frequency to 3.6GHz. --- openair2/RRC/LTE/rrc_eNB.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 31a26d322d..9629b4399c 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -3281,7 +3281,7 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t MeasObj2->measObjectId = 2; MeasObj2->measObject.present = LTE_MeasObjectToAddMod__measObject_PR_measObjectNR_r15; - MeasObj2->measObject.choice.measObjectNR_r15.carrierFreq_r15 =641272; //634000; //(634000 = 3.51GHz) (640000 = 3.6GHz) (641272 = 3619.08MHz = 3600 + 30/1000*106*12/2) (642256 is for 3.6GHz and absoluteFrequencySSB = 642016) + MeasObj2->measObject.choice.measObjectNR_r15.carrierFreq_r15 =640000; //634000; //(634000 = 3.51GHz) (640000 = 3.6GHz) (641272 = 3619.08MHz = 3600 + 30/1000*106*12/2) (642256 is for 3.6GHz and absoluteFrequencySSB = 642016) MeasObj2->measObject.choice.measObjectNR_r15.rs_ConfigSSB_r15.measTimingConfig_r15.periodicityAndOffset_r15.present = LTE_MTC_SSB_NR_r15__periodicityAndOffset_r15_PR_sf20_r15; MeasObj2->measObject.choice.measObjectNR_r15.rs_ConfigSSB_r15.measTimingConfig_r15.periodicityAndOffset_r15.choice.sf20_r15 = 0; MeasObj2->measObject.choice.measObjectNR_r15.rs_ConfigSSB_r15.measTimingConfig_r15.ssb_Duration_r15 = LTE_MTC_SSB_NR_r15__ssb_Duration_r15_sf4;