Compare commits

...

204 Commits

Author SHA1 Message Date
Reem Bahsoun
cf95607417 run 2 DL throughput tests in a row 2025-07-25 11:56:00 +02:00
Robert Schmidt
fc1c762cf2 Merge branch 'integration_2025_w29' into 'develop'
Integration: `2025.w29`

* !3346 Add WLS as a transport option for VNF/PNF, refactor existing options
* !3455 RF simulator: Fix concurrency issues during new client connections
* !3515 Extended changes to "Initial support for RedCap" feature in gNB
* !3510 NR UE: fix PDSCH overlap with ZP CSI-RS case
* !3512 speedup NR RLC RX for AM
* !3528 fix(RLC): Count dropped DL SDUs by the RLC
* !3486 NR UE: Enable additional PDU session
* !3225 Measurement gaps
* !3526 CI: migrate RFSim5G to acamas machine
* !3527 CI: Change RU in Aerial setup from Foxconn to WNC

See merge request oai/openairinterface5g!3525
2025-07-17 10:19:17 +00:00
Robert Schmidt
4bfdcc03be Merge remote-tracking branch 'origin/aerial-wnc' into integration_2025_w29 (!3527)
CI: Change RU in Aerial setup from Foxconn to WNC

- Change frequency in the gNB config file, from 3.75GHz to 3.5GHz
- Add high throughput tests with may_fail tag (1Gbps in DL and 90Mbps in UL)
- Update Aerial tutorial to match the changes
2025-07-17 12:17:36 +02:00
Robert Schmidt
c651a648d4 Merge remote-tracking branch 'origin/ci-move-rfsim-to-phaedra' into integration_2025_w29 (!3526)
CI: migrate RFSim5G to acamas machine

Testing on acamas machine done in test pipeline (duplicate of main
RFSim5G pipeline):
https://jenkins-oai.eurecom.fr/job/RAN-RFSim-Test-5G-Acamas/

Sample run: https://jenkins-oai.eurecom.fr/job/RAN-RFSim-Test-5G-Acamas/18/
2025-07-17 12:17:05 +02:00
Reem Bahsoun
fc72ce8753 Add WNC RU in Aerial doc + update cuBB iamge name and number of cores used (related to MR 3477) 2025-07-17 10:41:31 +02:00
Reem Bahsoun
27b86205a2 Add high throuput testing on CI 2025-07-17 10:41:31 +02:00
Reem Bahsoun
fdd29779c6 Change frequency to match the WNC RU range of frequencies 2025-07-17 10:41:25 +02:00
Robert Schmidt
ec2e4c1f01 Merge remote-tracking branch 'origin/extra-pdu-session' into integration_2025_w29 (!3486)
NR UE: Enable additional PDU session

- fix a bug with wraparound of buffer_remain_ep
- Add --extra-pdu-id command line option

Testing procedure:

1. Start cn in openairinterface5g/doc/tutorial_resources/oai-cn5g with
   docker compose up
2. Start gnb:

    sudo ./nr-softmodem -O ../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf --gNBs.[0].min_rxtxtime 6 --rfsim --rfsimulator.server_address server

3. Monitor extra interfaces being created:

    watch -n 0.5 "ifconfig | grep tun"

4. Start UE:

    sudo ./nr-uesoftmodem -C 3619200000 -r 106 --numerology 1 --ssb 516  --band 78 --rfsim  --uicc0.imsi 001010000000001 --extra-pdu-id 11

5. An extra tun interface oaitun_ue1p11 should be created. Observe in
   the terminal from step 3
6. Ping the core network from both interfaces, e.g., ping -I
   oaitun_ue1p11 10.0.0.1, ping -I oaitun_ue1 10.0.0.1. This should
   generate traffic on the gNB on different LCIDs.
2025-07-17 09:45:08 +02:00
Robert Schmidt
9614bb2cca Merge remote-tracking branch 'origin/develop-measGapConfig' into integration_2025_w29 (!3225)
Measurement gaps

Scheduling measurement gaps to provide sufficient time for the UE to
re-tune its transceiver to the target carrier, complete the set of
measurements and then re-tune its transceiver back to the original
carrier.
2025-07-17 09:44:35 +02:00
Jaroslava Fiedlerova
fb6640f0e1 CI: adjust UL throughput target for 2x2 RFSim5G test on acamas
This commit reduces the UL throughput target in the 2x2 test to align
with the host’s performance capabilities. The adjustment ensures more
reliable and consistent CI results.
2025-07-16 15:13:12 +00:00
Jaroslava Fiedlerova
7ba7017fb7 CI: add sleep after UE deployment in TDD dora test
Give more time to the gNB-UE to establish the connection before ping
test is triggered.
2025-07-16 15:13:12 +00:00
Jaroslava Fiedlerova
456d7f1aab CI: Increase sleep time in RFSim5G
Based on observations from testing on acamas, the interval between DL
disruption and the UE synch check needs to be increased - the UE takes
longer to go out of sync . A sleep of 15 seconds has proven to be a
reliable value to ensure constant results.
2025-07-16 15:10:29 +00:00
Robert Schmidt
8c224fde9e Merge remote-tracking branch 'origin/txpdu_dd' into integration_2025_w29 (!3528)
fix(RLC): Count dropped DL SDUs by the RLC

When a downlink SDU was discarded by the RLC Acknowledged Mode entity
due to a full transmit buffer (tx_maxsize), the drop statistics were not
being updated. The txpdu_dd_pkts and txpdu_dd_bytes counters remained at
0. It should be noted that while the statistics are named txpdu_dd_*,
the drop at this stage occurs at the SDU level.
2025-07-16 11:12:24 +02:00
Robert Schmidt
a6b0dcc129 Merge remote-tracking branch 'origin/speedup-nr-rlc-am-rx' into integration_2025_w29 (!3512)
speedup NR RLC RX for AM

rx_list is replaced by an array of size 2^(SN size - 1) which is 131072
for an SN size of 18 bits, leading to 1048576 bytes of memory used.
(Less for smaller SN sizes.)

A lot of RX processing was to run through rx_list. When the list was big
(with some non-ideal channel), it can take some time. Removing this list
should improve things. Checking with benchmark_nr_rlc_am_entity a
speedup of more thant x10 is achieved (except for the case 1024 which is
surprisingly faster than the others in the develop branch).

The only thing that may be slower is when looking for cur->next where
the SN is different, in which case we need to look for all SN one by one
until we find something or reach the limit (rx_highest_status). These
are the functions get_first_rx_pdu() and get_next_rx_pdu().
2025-07-16 11:11:55 +02:00
Jaroslava Fiedlerova
cde021e1d9 CI: add SYS_NICE capability in some RFSim5G tests
Add SYS_NICE capability to enable setting thread priority and affinity
in rfsim5g tests. This improves execution speed in test cases with
heavier processing workloads.
2025-07-16 08:34:04 +00:00
Jaroslava Fiedlerova
3d270cf627 CI: replace nc by ncat
When migrating from RHEL (on cacofonix) to Ubuntu 22.04 (on acamas), the `nc`
command needs to be replaced by `ncat`. The version of `nc` available on Ubuntu
is the OpenBSD variant, which lacks support for some options used in our scripts.
`ncat` from the Nmap is used instead.
2025-07-16 08:20:04 +00:00
Robert Schmidt
75ea8cd33a Merge remote-tracking branch 'origin/csi_pdsch_overlap_fix' into integration_2025_w29 (!3510)
NR UE: fix PDSCH overlap with ZP CSI-RS case

When PDSCH overlap with ZP CSI-RS, nb_re_pdsch needs to be reduced by
number of CSI-RS RE.
2025-07-16 08:25:24 +02:00
Robert Schmidt
a1e92cc896 Merge remote-tracking branch 'origin/redcap_support_in_gnb' into integration_2025_w29 (!3515)
Extended changes to "Initial support for RedCap" feature in gNB

Read UE RedCap capabilities.
2025-07-16 08:24:44 +02:00
Bartosz Podrygajlo
5d7c4fe14d NR UE: Enable additional PDU session
Add new command line / config parameter --extra-pdu-id which when
configured creates an extra PDU session.

Rename --default_pdu_id to --default-pdu-id
2025-07-16 06:59:31 +02:00
Bartosz Podrygajlo
7682c407e1 Fix a wraparound bug with equal priority remaining buffer size in MAC 2025-07-16 06:38:37 +02:00
rmagueta
c3f243ca82 Inter-frequency handover documentation update 2025-07-15 16:55:41 +02:00
rmagueta
b443ec4c52 Get measurement of neighboring cells and measurement gaps working after RRCReestablishment 2025-07-15 16:55:41 +02:00
rmagueta
779d2bee52 Get new measConfig and measurementTimingConfiguration for target gNB-DU during handover 2025-07-15 16:55:41 +02:00
rmagueta
d5b9f81285 Send MeasConfig to DU, Receive MeasGapConfig from DU 2025-07-15 16:55:36 +02:00
Robert Schmidt
6c4f6a231e Merge remote-tracking branch 'origin/fix-rfsim-multi-client-out-of-order' into integration_2025_w29 (!3455)
RF simulator: Fix concurrency issues during new client connections

- Fix concurrency issues happening when a new client connects, sometimes
  leading to a total softmodem deadlock.
- trace in 4G RAR processing to debug ci result
2025-07-15 15:44:50 +02:00
Robert Schmidt
c6876ea9f0 Merge remote-tracking branch 'origin/fapi-wls-integration' into integration_2025_w29 (!3346)
Add WLS as a transport option for VNF/PNF, refactor existing options

This MR adds a new transport mechanism for the VNF and PNF split, using
the Intel WLS library, which makes use of DPDK and shared memory to
transport messages. This transport mechanism is what is used to
interface with Radisys ODU, while also working with OAI VNF/PNF.

The VNF and PNF have been refactored so that the transport-specific
functions are isolated from the rest of the logic, and as such,
interchangeable by means of function pointers.

The same change is done for the packing/unpacking procedures, allowing
to switch between FAPI and nFAPI encoding.

This MR also reduces the amount of duplicated code, by refactoring the
VNF with Aerial, which now only has the transport-relevant functions, as
well as the ones that are unique to it ( for example, the unpacking
procedures where a secondary data buffer is used for the message
payloads )

Additionally a new callback is added to the VNF to process
ERROR.indication messages, which currently only indicates which message
originated the error, and which error occurred.
2025-07-15 15:44:02 +02:00
fatich
5c52f6dc23 fix(RLC): Count dropped DL SDUs by the RLC
When a downlink SDU was discarded by the RLC Acknowledged Mode entity due to a full transmit buffer (tx_maxsize), the drop statistics were not being updated.
The `txpdu_dd_pkts` and `txpdu_dd_bytes` counters remained at 0.
It should be noted that while the statistics are named `txpdu_dd_*`, the drop at this stage occurs at the SDU level.
2025-07-15 15:32:00 +02:00
Rúben Soares Silva
d74c620956 Set PNF slot_ahead to 1 when using WLS as the transport mechanism 2025-07-15 13:00:03 +01:00
Rúben Soares Silva
d4c46c5073 Fix compilation for simulators and LTE softmodem
Add nr_fapi_p5 library to the simulators common library for access to the utility function `copy_config_request`

Add dummy VNF/PNF functions to be referenced by lte-softmodem, before LTE and NR implementations of the VNF/PNF are separated
2025-07-15 13:00:03 +01:00
Rúben Soares Silva
8d7f2a8fbd Add documentation for different VNF/PNF transport
Add a section in nfapi.md related to the different transport mechanisms available for VNF/PNF communication
Edit NR_NFAPI_archi.md to describe the VNF and PNF processing logic, as well as adding a flowchart for each of the components execution
Add the necessary patch to install the WLS library in the system
2025-07-15 13:00:03 +01:00
Rajesh Guttula
74a34daf5b Extnded changes to "Initial support for RedCap" feature in gNB
The changes done in this commit are to contribute the supporting changes
for the existing "Initial support for RedCap" feature in gNB.

In this patch, handle and store the RedCap related IE's present in "NR
UE Capability Information" msg which are

- 'supportOfRedCap-r17'
- 'supportOf16DRB-RedCap-r17'
- 'longSN-RedCap-r17'
- 'am-WithLongSN-RedCap-r17'

use 'longSN-RedCap-r17' and 'am-WithLongSN-RedCap-r17' IEs to set the SN
length to either 12 Bit or 18 Bit accordingly.
2025-07-15 13:47:30 +02:00
alexjiao
dddf34ac9b Fix PDSCH overlap with ZP CSI-RS case
When PDSCH overlap with ZP CSI-RS, nb_re_pdsch needs to be reduced by number of CSI-RS RE.
2025-07-12 10:29:57 +08:00
rmagueta
5e0307d845 Refactor code, add inter-freq neighbors, avoid mem leak
Previously, we only supported intra-frequency handovers, so the
measurements where only for intra-frequency, reusing the same
measurement object. Now that we would support inter-frequency handover,
also add multiple MeasObjects for each neighbor.
2025-07-11 18:09:23 +01:00
rmagueta
6ce4d78c19 Refactor get_MeasConfig(): create subfunctions 2025-07-11 18:09:23 +01:00
rmagueta
932b177667 Add logic for measgap scheduling 2025-07-11 18:09:23 +01:00
rmagueta
dfbb6b1509 Handle Measurement Timing Configuration in DU/MAC handler 2025-07-11 14:08:52 +01:00
rmagueta
c2d9fb3589 Add MeasGap Configuration in Radio config
Add some helper functions that will be used by the MAC handler to fill
the right MeasGap configuration based on Measurement Configuration sent
by the CU, in the next commit.
2025-07-11 14:08:01 +01:00
rmagueta
7b8427e101 UE RRC: Print warning that measurement gaps are not supported 2025-07-11 13:46:21 +01:00
rmagueta
a13a8f01af Add F1AP procedures related to measurementTimingConfiguration 2025-07-11 13:46:21 +01:00
Robert Schmidt
621aa3c12e Cleanup possible transmission interrupt states 2025-07-11 13:46:21 +01:00
Jaroslava Fiedlerova
625c8cfd51 CI: move RFSim 5G to acamas 2025-07-11 09:59:37 +00:00
Rúben Soares Silva
43c733dc89 Prevent pulling TLV tag and length over end of the buffer.
Checks whether there are at least 4 bytes available to pull tag and length values.
On tlv_list unpack, if the size is sent as 0, immediately exit the function
2025-07-11 10:01:26 +01:00
Rúben Soares Silva
1026b8121f Add VNF callback for ERROR.indication
Created a function nr_error_ind_cb for the VNF that takes a received ERROR.indication and shows some details regarding the reported error from the PNF, since up until now it was not handled and treated as an unknown message.
Proper error handling procedure not created, only shows that the error occurred.
2025-07-11 10:01:26 +01:00
Rúben Soares Silva
b8a176e38f Use existing VNF functions for P7 messages
Remove duplicated functions in fapi_vnf_p7.c, leaving only functions for messages that require usage of the secondaty data_buf for unpacking

Move vnf_info struct declaration to nfapi_vnf.h to be available in fapi_nvIPC.c
2025-07-11 10:01:26 +01:00
Rúben Soares Silva
0c21807df9 Change Aerial VNF to use existing functions to process P5 messages
Remove fapi_vnf_p5.c and .h files as they're now unused

Move scheduler functions to fapi_nvIPC.c
2025-07-11 10:01:26 +01:00
Rúben Soares Silva
a340d08bd2 Initial refactoring for P5 messages in Aerial VNF 2025-07-11 10:01:26 +01:00
Rúben Soares Silva
6d05d279b0 Implementation of VNF using WLS as message transport
Add check to vnf_nr_handle_param_response for when phy_info is not found

The WLS VNF is in charge of Enqueueing the used blocks after usage for transport, this is done by keeping track of all blocks used, and calling WLS_Enqueue for all of them upon receiving a SLOT.indication
2025-07-11 10:01:26 +01:00
Rúben Soares Silva
3d34917626 Implementation of PNF using WLS as message transport
The common library exposes functions for the PNF to return the received blocks to the VNF for it to call WLS_Enqueue on them.
This is done in order to ensure the Blocks are returned after processing, also preventing the Dequeueing of blocks that are still being used, i.e. the internal value is not -1
All saved blocks are to be enqueued at the reception of a SLOT.indication by the VNF

Additionally, the definition of NFAPI_MAX_PACKED_MESSAGE_SIZE was moved to nfapi_interface.h and removed from the other headers, this is done to allow to set the maximum message size when using WLS by only changing the value in one place

Fixup fapi_nr_message_header_unpack call in nfapi_hex_parser
2025-07-11 10:01:26 +01:00
Jaroslava Fiedlerova
e82fde247a Merge branch 'integration_2025_w28' into 'develop'
Integration: `2025.w28`

* !3517 CI: set interface name in UPF container for RFSim5G
* !3501 Fix automatic SSS detection logic
* !3503 DLSCH RB extraction: check DMRS bitmap only in DMRS symbols
* !3498 bugfix: UE AMBR is optional
* !3504 Improvements to the FHI for enabling further use cases

Closes #975

See merge request oai/openairinterface5g!3518
2025-07-11 08:03:04 +00:00
Jaroslava Fiedlerova
bc626c3234 Merge remote-tracking branch 'origin/oran_fhi_f_dpdk_21_plus' into integration_2025_w28 (!3504)
Improvements to the FHI for enabling further use cases

These changes to the FHI were primarily thought to enable the integration of
the intel ACC ( !3344 ) in parallel of the FHI.
I preferred to make a separate MR because I believe this topic is orthogonal
enough to be handled separately and because I wanted to bring even further
improvements.
The improvements that it actually brings are:

- Enable compiling and running xran F release with DPDK 21+
- Enable including a BBDEV device in addition of the ethernet device for the
  FHI when performing EAL init, which is necessary for using the intel ACC
  with the FHI.
- Fix an issue in usage of pkgconfig in xran E and F release. This enables to
  reliably build xran with the version of DPDK requested to pkgconfig while
  before this fix xran was always selecting the headers installed in /usr/local.
2025-07-09 17:36:18 +02:00
Romain Beurdouche
8e33727c37 feat(oran_fhlib_5g): pkgconfig fix for E release
E release had the same issue of not using pkgconfig properly as F release.
This issue was fixed in F release when enabling its compatibility with DPDK 21+.
This commit brings this fix to E release.
2025-07-09 14:55:44 +02:00
Romain Beurdouche
486726233d feat(oran_fhlib_5g): Enable to include a BBDEV device while initializing EAL
In order to be usable in parallel of FHI 7.2, BBDEV devices should be included in the EAL initialization that is prformed by xran.
This commit adds a way of adding the BBDEV device from OAI.
Also fixes an issue with pkgconfig in xran.
2025-07-09 14:55:44 +02:00
Romain Beurdouche
d3283c4819 feat(oran_fhlib_5g): F release works with DPDK21+
Modify xran F release patch to make it compile and run with DPDK 21+
(tested with DPDK 22.11)
2025-07-09 14:55:44 +02:00
Robert Schmidt
02bc14d8c1 get xran stats
Get xran stats in the trx_oran_get_stats function
and use trx_oran_get_stats upon stopping and ending RF.

Co-authored-by: Romain Beurdouche <romain.beurdouche@eurecom.fr>
2025-07-09 14:55:44 +02:00
Robert Schmidt
b7a6b1b7d6 Do not include xran internal data: not needed 2025-07-09 14:55:44 +02:00
Robert Schmidt
cc076eb547 Use locally available data instead of peaking into xran internals
Look up xran_fh_init/xran_fh_config through driver instead of peaking
into xran internals. Note that xran writes values back into these
structs during initialization, and hence it is important to store them
_after initialization_.

Some remarks regarding less obvious changes:
- slotnum is replaced by slots_in_sf: SLOTNUM_PER_SUBFRAME uses the time
  duration of a slot (=interval_us_local) to calculate the numbers of
  slots in a subframe, which can be done with a simple shift instead
- The prach duration should be queried from the PRACH configuration
  table. The function to query the occasion info is part of the MAC
  layer code while this information can be used outside of this layer.
  Use header `nr_prach_config.h` to not duplicate functionality.

Co-authored-by: Romain Beurdouche <romain.beurdouche@eurecom.fr>
2025-07-09 14:54:52 +02:00
Romain Beurdouche
42b5df351d Split out PRACH-specific functions into separate header
Split out type and function definitions for a cleaner separation for
some consumers of these functions. Concretely, nr_mac_common.h includes
various ASN.1 NR RRC headers, but not all consumers of these APIs might
need these headers. For instance, the next commit will use these
functions in the driver for 7.2 (it needs to compute PRACH length), but
the driver itself does not depend on nor does it need the ASN.1 NR RRC
headers. Defining a new header avoids the problem.
2025-07-09 14:49:03 +02:00
Jaroslava Fiedlerova
dc2e127c1c Merge remote-tracking branch 'origin/bugfix-ambr-is-optional' into integration_2025_w28 (!3498)
bugfix: UE AMBR is optional

This was a problem with open5gs and more than one PDU session. The core network
sets UE AMBR only once, leading to failure in the gNB for the second PDU session.
(A proper handling of AMBR has to be develop at some point in the gNB.)
2025-07-09 11:08:25 +02:00
Robert Schmidt
8dcdee85f7 Use buffers as set up by driver
The buffers are set up by the OAI xran driver, so instead of peaking
into xran internal data, access the buffers through the driver directly.

The buffers get set up through the following xran calls

In xran_5g_fronthault_config():
- src   => sFrontHaulTxBbuIoBufCtrl
- srccp => sFrontHaulTxPrbMapBbuIoBufCtrl
- dst   => sFrontHaulRxBbuIoBufCtrl
- dstcp => sFrontHaulRxPrbMapBbuIoBufCtrl

In xran_5g_prach_req()
- prach(dst)       => sFHPrachRxBbuIoBufCtrl
- prach(dst)decomp => sFHPrachRxBbuIoBufCtrlDecomp

Note that in all cases:
- the xran buffer array is [XRAN_N_FE_BUF_LEN][XRAN_MAX_SECTOR_NR][XRAN_MAX_ANTENNA_NR]
  (of [internal] type BbuIoBufCtrlStruct, but we give an sBufferList)
- the driver buffer array is [XRAN_MAX_ANTENNA_NR][XRAN_N_FE_BUF_LEN]

Hence, we switch the order of indexing, leave out the sector, and omit
the sBufferList member.
2025-07-09 08:12:48 +00:00
Robert Schmidt
3e3d872268 Avoid use of xran_get_slot_idx_from_tti() and use public API
xran_get_slot_idx_from_tti() has been introduced to access data
information from xran. However, it makes no sense, as the used macros to
calculate frame, slot, subframe, are already in the public API. Hence,
use these macros directly.

It would be possible to remove xran_get_slot_idx_from_tti(), but doing
so we would need to update the patch ID, causing trouble to users.
2025-07-09 08:12:48 +00:00
Rúben Soares Silva
9b71f1d324 Separate VNF socket send functions into separate socket library 2025-07-08 16:42:34 +01:00
Jaroslava Fiedlerova
d71e333329 Merge branch 'ci-rfsim5g-fix' into 'develop' (!3517)
CI: set interface name in UPF container for RFSim5G

This MR addresses an issue related to CN deployment, observed in the RFSim5G CI pipeline. Specifically, the IP addresses within the UPF container were not consistently bound to the correct network interfaces. This inconsistency led to incorrect IP address assignments for the N3, N4, and N6 interfaces, resulting in connectivity issues.

See merge request oai/openairinterface5g!3517
2025-07-08 15:05:31 +00:00
Jaroslava Fiedlerova
4a169f6c8a Update documentation for RFSim5G test deployments 2025-07-08 14:05:38 +02:00
Jaroslava Fiedlerova
67474f2246 Merge remote-tracking branch 'origin/issue_975' into integration_2025_w28 (!3503)
DLSCH RB extraction: check DMRS bitmap only in DMRS symbols

Closes #975
2025-07-08 11:37:52 +02:00
Jaroslava Fiedlerova
6ff8d085fb Merge remote-tracking branch 'origin/fix-sss-detection' into integration_2025_w28 (!3501)
Fix automatic SSS detection logic

When we try to detect a specific PCI and it fails, the SSS detection returns
successful detection with wrong frequency offset.
2025-07-08 11:36:46 +02:00
Jaroslava Fiedlerova
8ef0bf8462 CI: specify interface names in UPF container 2025-07-08 11:11:58 +02:00
Cedric Roux
080a90c930 bugfix: UE AMBR is optional
This was a problem with open5gs and more than one PDU session.
The core network sets UE AMBR only once, leading to failure in the gNB
for the second PDU session.

(A proper handling of AMBR has to be develop at some point in the gNB.)
2025-07-08 10:55:34 +02:00
Robert Schmidt
8bf6d5d7da Merge branch 'integration_2025_w27' into 'develop'
Integration: `2025.w27`

Closes #958

See merge request oai/openairinterface5g!3506

* !3349 Speed up docker deployment in CI
* !3360 NR UE: fix reestablishment for NTN
* !3488 Refactor F1 UE context messages, add unit tests
* !3502 bugfix for UL TBSLBRM
* !3475 Use of common functions to prepare FAPI PDUs at gNB MAC
* !3499 NR UE: enable CSI report for SISO case
* !3497 Update/refine gNB MAC stats, update L1
* remove unit test `--output-on-failure` option to avoid hitting timeout
* !3508 gNB: fix NTN UL retransmissions
* !3494 bugfix: read msg_type only after deciphering
* set `tx_amp_backoff_dB = 30;` for RFsim 2x2 to make it pass
* !3432 NR RRC Reject UE
* !3500 Various fixes for UE handling, HO doc updates
* !3398 continuously update SIB19 information for rfsim NTN LEO scenarios
2025-07-04 14:53:18 +00:00
Robert Schmidt
d76f062d14 Revert "CI: reduce number of attach tries"
Due to 5GC limitations, we sometimes need to try to attach multiple
times.

This reverts commit 874d2b73a4.
2025-07-04 12:17:49 +02:00
Robert Schmidt
06a5166f17 Merge remote-tracking branch 'origin/ntn_continuous_sib19_updates' into integration_2025_w27 (!3398)
continuously update SIB19 information for rfsim NTN LEO scenarios

Contains mainly these changes:

- gNB: add function nr_update_sib19() allowing to update SIB19
  information
- rfsimulator: update SIB19 contents every frame for LEO channel
  simulations
- NR UE: improve initial timing advance calculation from SIB19

Before, we only considered ta_Common_r17 and the SAT position from SIB19
to compute the initial timing advance value. This is good enough if the
satellite does not move too fast (e.g. GEO satellite).

Now we also consider ta_CommonDrift_r17, ta_CommonDriftVariant_r17 and
the SAT velocity together with the epoch time from SIB19. This improves
the accuracy of the initial TA computation, esp. for LEO satellite
scenarios.
2025-07-04 09:42:19 +02:00
Robert Schmidt
105d4f6dfb Merge remote-tracking branch 'origin/fixes-ue-handling' into integration_2025_w27 (!3500)
Various fixes for UE handling, HO doc updates

- On release request, search both attach and connected list to free a UE.
- on DU disconnect, only release the correspnonding UE contexts.
- When no AMF for the UE, auto-release the UE (NGAP would also send an
  answer, but better check first)
- implement a "grace period" before the DU/MAC automatically releases a
  UE: this is to avoid cases in which (for whatever reason) the UE
  release request is not honored by the CU. In order to not fill up UE
  contexts unnecessarily, the DU will eventually (after 10s) drop the UE
  context
- some clarification in HO tutorial
2025-07-04 09:41:38 +02:00
Robert Schmidt
b6a33777b9 Fix: on release command, search attach list
When the RA procedure fails at Msg4, we trigger UL failure and send a
message to the CU to request release. There was a bug in that upon the
ensueing release command, we did not search in the attach list (only
connected list). However, the UE failing at Msg4 does not have
transitioned to the connected list yet, thus not freeing the context.

Fixes: 8f62baefa6 ("Use list of UEs during RA instead of array of RA
  processes)"
2025-07-04 09:40:26 +02:00
Robert Schmidt
2ea3ab5050 Introduce UE release request grace period
It might happen that the CU does not answer a release request. In that
case, the MAC would never free the UE context, potentially blocking the
DU. Avoid this by introducing a "grace period" after which a UE context
is automatically freed at the MAC (and RLC), currently at 10s after the
30s UL failure timer.
2025-07-04 09:40:26 +02:00
Robert Schmidt
67e9c9c263 RRC: auto-generate release request when no AMF
Mark non-existing AMF UE NGAP ID through invalid INT64_MAX number
(permitted range is up to 2^40-1). Check for this range in the RAN
function, as we might otherwise pass the invalid AMF UE NGAP ID to the
agent, which would assert with

   nr-softmodem: /oai-ran/openair2/E2AP/flexric/src/lib/3gpp/enc/enc_gnb.c:83: enc_gNB_UE_asn: Assertion `gnb->amf_ue_ngap_id < 1UL << 40' failed.

In other words, don't send KPM messages for a UE which has no valid AMF
UE NGAP ID yet (which follows from the fact that the spec requires an
AMF UE NGAP ID; the previous behavior of simply sending 0 could be
considered a bug, because it's not the UE's true AMF UE NGAP ID).
2025-07-04 09:40:26 +02:00
Laurent THOMAS
90cf249018 add telnet commands trace 2025-07-04 09:34:17 +02:00
Cedric Roux
c70e336011 nr rlc: speedup RX path of RLC AM
rx_list is replaced by an array of size 2^(SN size - 1)
which is 131072 for an SN size of 18 bits, leading to
1048576 bytes of memory used. (Less for smaller SN sizes.)

A lot of RX processing was to run through rx_list. When the list was
big (with some non-ideal channel), it can take some time. Removing this
list should improve things. Checking with benchmark_nr_rlc_am_entity
a speedup of more thant x10 is achieved (except for the case 1024 which
is surprisingly faster than the others in the develop branch).

The only thing that may be slower is when looking for cur->next where
the SN is different, in which case we need to look for all SN one by
one until we find something or reach the limit (rx_highest_status).
These are the functions get_first_rx_pdu() and get_next_rx_pdu().
2025-07-03 18:57:32 +02:00
Cedric Roux
2b4eb2fb55 nr rlc: discarding a packet when RX buffer is full is a warning
We want to see it. It's not normal, may disturb the system.
2025-07-03 18:46:09 +02:00
Cedric Roux
708dca1ab9 fix compilation of nr rlc tests
./run_tests.sh in openair2/LAYER2/nr_rlc/tests was not functional anymore.
2025-07-03 18:42:30 +02:00
Robert Schmidt
125bfa1ab4 Merge remote-tracking branch 'origin/reject_UE' into integration_2025_w27 (!3432)
NR RRC Reject UE

Improvements in procedures to handle RRCReject message both at gNB and
UE. At gNB we send RRC Reject if the UE cannot be given resources to go
into connected mode.
2025-07-03 12:09:19 +02:00
Robert Schmidt
a830cc2e0a When freeing UE contexts, check in both possible lists 2025-07-03 08:27:38 +02:00
francescomani
41da4a3b3a send reject if we reach the max number of UEs allowed 2025-07-03 08:27:38 +02:00
francescomani
f9cf458b1c function to verify if we can allocare RRC resources to UE with given ID 2025-07-03 08:27:38 +02:00
francescomani
8932566d2b improvements in T302 handling at RRC UE 2025-07-03 08:27:38 +02:00
francescomani
88af2860a2 handle RRC reject at UE 2025-07-03 08:27:38 +02:00
francescomani
69ac704adc do not send DU to CU container to CU if we can't serve the UE 2025-07-03 08:27:38 +02:00
francescomani
511f2f2487 generate RRCReject if no DU to CU container in initial UL RRC message
slightly refactor rrc_gNB_generate_RRCReject() to take rrc pointer.
Remove unused/illegal fields from the DL RRC message.
2025-07-02 18:58:40 +02:00
Robert Schmidt
6a1203bb15 Set RRC reject waitTime to 10 2025-07-02 18:56:47 +02:00
Robert Schmidt
1e6fb953a8 Workaround: limit signal range for 2x2 RFsim test
Limit the signal range to avoid clipping, leading to retransmissions in
the 2x2.
2025-07-02 18:45:16 +02:00
Robert Schmidt
930324cfd2 Merge remote-tracking branch 'origin/bugfix-nas-security-msg-type' into integration_2025_w27 (!3494)
bugfix: read msg_type only after deciphering

There was a problem with accessing msg_type from the input buffer before
deciphering, giving obviously wrong value.

CI team: we should add a test in the CI with NAS ciphering + integrity
(connection to the core) set to not null (I suggest nea2/nia2). With
openair's core, this is done by setting this in the amf config file
(nia1 and nea2 at the top of the list):

    supported_integrity_algorithms:
      - "NIA2"
      - "NIA1"
      - "NIA0"
    supported_encryption_algorithms:
      - "NEA2"
      - "NEA1"
      - "NEA0"

And also put full security in the AS. This is done with this in the gnb
config file:

    security = {
      ciphering_algorithms = ( "nea2", "nea0" );
      integrity_algorithms = ( "nia2", "nia1", "nia0" );
      drb_ciphering = "yes";
      drb_integrity = "yes"
    };

Ideally we should test this with both openair UE and cots UE. But as a
strict minimum do for openair UE (this is where the bug was).

No need to do much traffic, a few ping is enough. But if you want to
check throughput with full security, why not.
2025-07-02 18:42:36 +02:00
Robert Schmidt
17cba00d17 Merge remote-tracking branch 'origin/fix_ntn_ul_retransmission' into integration_2025_w27 (!3508)
gNB: fix NTN UL retransmissions

Re-add to consider the cellSpecificKoffset_r17 for UL retransmissions.
This got lost in commit c8387d70
2025-07-02 18:42:05 +02:00
Robert Schmidt
75be2a1a59 When freeing UE contexts, check in both possible lists 2025-07-02 17:42:00 +02:00
Thomas Schlichter
5fb72906f3 gNB: fix NTN UL retransmissions
Re-add to consider the cellSpecificKoffset_r17 for UL retransmissions.
This got lost in commit c8387d706c
2025-07-01 07:48:21 +00:00
Robert Schmidt
786c9f26d5 Remove ctest option --output-on-failure in CI
Remove this option: some tests produce an excessive amount of output on
failure (e.g., googletest/benchmark). This seems to overwhelm the Python
CI code. Suppress this output, because we can always manually run this
test. A high-level "this test is ok/nok" should be fine for the CI.
2025-07-01 09:00:00 +02:00
Robert Schmidt
75f24c1e4a Merge remote-tracking branch 'origin/csi_report_siso' into integration_2025_w27 (!3499)
NR UE: enable CSI report for SISO case

Correct precoded_sinr_dB wrongly set to 0 for SISO case, also correct
ri_restriction is 0 when calculating CQI bit length for SISO.
2025-07-01 08:59:05 +02:00
Robert Schmidt
8dc12a0b35 Merge remote-tracking branch 'origin/gnb-mac-stats-cleanup' into integration_2025_w27 (!3497)
Update/refine gNB MAC stats, update L1

Only applicable with -q option.

Print a number of statistics, e.g., rx_ulsch_sdu to track UL MAC stats
timing. Remove unused time_meas_t definitions, and fix the name for the
total gNB scheduler time.

Print the RU stats in nrL1_stats.log, as some are already there, and do
not "pollute" the periodic logs when -q is enabled.

I used this to see why there are sometimes late slots with Aerial. I
used the above stats to get a general overview. This additional patch
shows that at least in RFsim, the RLC indication in rx ulsch sdu can
take up to 20us on my machine. Given that we can have multiple PDUs in
UL (10?), this can amount to a sizeable amount of time. While this is
for another MR, I thought the cleanup would be nice to have.
2025-07-01 08:58:39 +02:00
Robert Schmidt
ad1e9237d1 Merge remote-tracking branch 'origin/common_functions_to_genrate_fapi' into integration_2025_w27 (!3475)
Use of common functions to prepare FAPI PDUs at gNB MAC
2025-07-01 08:58:16 +02:00
Robert Schmidt
5d04408f5c Incorporate ru_stats_thread() stats into nrL1_stats.log
Do not pollute periodic output, and rather print those into
nrL1_stats.log. A number of them are already there anyway, so transfer
the rest. Note: ru->ifdevice.tx_fhaul is omitted, as we don't have any
IF5 split in 5G.
2025-07-01 08:54:25 +02:00
Robert Schmidt
e9a7fd475d Merge remote-tracking branch 'origin/fix_ul_tbslbrm' into integration_2025_wk26 (!3502)
bugfix for UL TBSLBRM
2025-06-30 18:40:38 +02:00
Robert Schmidt
36da6be4ab Merge remote-tracking branch 'origin/f1-refactor-ue-context' into integration_2025_wk26 (!3488)
Refactor F1 UE context messages, add unit tests

Add encoder+decoder+util functions for F1 UE context messages, and use
them in the stack. The overall goal is to unit test encoder+decoder (to
be sure that what we send is what we receive), and remove any memory
leaks related to F1 handling. Messages that have a unit test:

- F1 UE context setup request/response
- F1 UE context modification request/response
- F1 UE context release request/command/complete

This MR removes almost all remaining memory leaks that are observable in
a "standard" configuration, running SISO in RFsim. In RFsim (without
channel modelling), there are only two memory leaks shown in asan, one
in L1, and one in NGAP.
2025-06-30 18:40:02 +02:00
Robert Schmidt
66bc4deecb Merge remote-tracking branch 'origin/fix_ntn_reestablishment' into integration_2025_wk26 (!3360)
NR UE: fix reestablishment for NTN

With these changes in place we should extend the NTN/GEO rfsim CI test
to include reestablishment, too.
2025-06-30 18:39:40 +02:00
Robert Schmidt
0e9f9b92d2 Merge remote-tracking branch 'origin/docker-speedup' into integration_2025_wk26 (!3349)
Speed up docker deployment in CI

- Using docker compose up --wait instead of a custom healthcheck script:
  from: https://docs.docker.com/reference/cli/docker/compose/up/

  --wait          Wait for services to be running|healthy. Implies detached mode.
  --wait-timeout  Maximum duration in seconds to wait for the project to be running|healthy

- Speeding up the healthchecks by reducing the interval from 1-10s to
  0.5s during start period

  start_period creates a special period after the start of the container
  where the healthcheck is executed every start_interval . During this
  time the failures do not count towards the retries counter, but
  successes change the status to healthy. This allows container to reach
  healthy status much sooner.

- Using init: true to speed up docker compose down/stop

  `init: true` initializes the docker container with tini or
  alternative: tini is used to collect all the processes and correctly
  pass the termination signal to them. This allows the docker container
  to be stopped without waiting 10 seconds to kill the container

- Smallest example of this is:

    services:
      test-init:
        image: ubuntu:jammy
        command: sleep 10d
2025-06-30 18:38:02 +02:00
francescomani
a9dc588921 common function to generate FAPI DCI PDU 2025-06-30 15:13:32 +02:00
francescomani
11711c4b7b common function to generate FAPI DL DCI payload 2025-06-30 15:10:17 +02:00
francescomani
dd281eba0f common function to generate FAPI PUSCH payload 2025-06-30 14:53:19 +02:00
francescomani
bd4cc0d60b extending the scope of NR_pusch_dmrs_t 2025-06-30 14:53:19 +02:00
francescomani
266f6fcebe using sched_pusch also in RA functions and other improvements 2025-06-30 14:53:19 +02:00
francescomani
548d6ec3a1 include BWP info in sched_pdsch and use also for RA and BCH 2025-06-30 14:53:19 +02:00
francescomani
e64516d222 common function to generate FAPI PDSCH payload 2025-06-30 14:53:19 +02:00
francescomani
1eebd70cf3 use sched_pdsch in RA DL functions 2025-06-30 14:53:19 +02:00
francescomani
3b6b6e018d improve PDSCH DMRS structure with additional information 2025-06-30 14:53:19 +02:00
francescomani
ed303aa4d3 extend the use of sched_pdsch in SIB functions 2025-06-30 14:53:19 +02:00
francescomani
b238c196ea take into account no UE case for get_pdsch_bwp_start_size 2025-06-30 14:53:19 +02:00
francescomani
d868e2d7cc DLSCH RB extraction bugfix: check DMRS bitmap only in DMRS symbols 2025-06-30 14:50:43 +02:00
Laurent THOMAS
0523bcfbde fix gNB that should always perform tx in case of rfsim (like continuous-tx 2025-06-30 10:21:02 +02:00
Laurent THOMAS
1540ca3ae5 fix bug in rfsim->nb_cnx for client side. it has no usage except a cpu optimisation in case one single rfsim socket and SISO case 2025-06-30 09:06:28 +02:00
Laurent THOMAS
f7598bf528 clarify first transmission to client, split process_recv in 2 functions 2025-06-30 09:06:28 +02:00
Laurent THOMAS
68857114a6 split rfsimulator too long function in smaller ones. Clean code for bad "UE" instead of rfsim client/server. Simplify logic 2025-06-30 09:06:28 +02:00
Laurent THOMAS
b9c066329e trace in 4G RAR processing to debug ci result 2025-06-30 09:06:28 +02:00
Laurent THOMAS
98e6d60337 RF simulator: Fix concurrency issues during new client connections
Fix concurrency issues happening when a new client connects, sometimes
leading to a total softmodem deadlock.

Key changes:
- Fix sample sending on new client connection: send the first
  sample only to the newly connected client.
- Remove the --rfsimulator.hanging-workaround option
- Replace global nb_ue and Sockmutex with nb_cnx and Sockmutex
  in rfsimulator_state_t for better concurrency and clarity.
2025-06-30 09:06:28 +02:00
Robert Schmidt
43e87b669d cg_config_info_from_ue_cap_file(): avoid potential memory leaks
Avoid potential memory leaks by first reading UE capabilities file (if
present), and allocating only after the file read was successful.
2025-06-28 12:19:58 +02:00
Robert Schmidt
e33711cffa Allocate twice to avoid double free
We use the same resource for CSI meas report and RSRP (judging by the
name of the functions), but the memory allocations need to be separate
to avoid a double free:

    ==2063066==ERROR: AddressSanitizer: heap-use-after-free on address 0x7c27d43e3ce8 at pc 0x000000fcd279 bp 0x7be7cc9e7120 sp 0x7be7cc9e7118
    READ of size 8 at 0x7c27d43e3ce8 thread T6
        #0 0x000000fcd278 in SEQUENCE_free /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_SEQUENCE.c:97
        #1 0x000000fcd278 in SEQUENCE_free /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_SEQUENCE.c:69
        #2 0x000000fd6249 in SET_OF_free /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_SET_OF.c:236
        #3 0x000000fd6249 in SET_OF_free /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_SET_OF.c:220
        #4 0x000000fcd103 in SEQUENCE_free /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_SEQUENCE.c:91
        #5 0x000000fcd103 in SEQUENCE_free /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_SEQUENCE.c:69
        #6 0x000000fc90c9 in CHOICE_free /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_CHOICE.c:185
        #7 0x000000fc90c9 in CHOICE_free /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_CHOICE.c:158
        #8 0x000000fcd103 in SEQUENCE_free /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_SEQUENCE.c:91
        #9 0x000000fcd103 in SEQUENCE_free /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_SEQUENCE.c:69
        #10 0x000000fd6249 in SET_OF_free /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_SET_OF.c:236
        #11 0x000000fd6249 in SET_OF_free /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_SET_OF.c:220
        #12 0x000000fcd01a in SEQUENCE_free /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_SEQUENCE.c:88
        #13 0x000000fcd01a in SEQUENCE_free /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_SEQUENCE.c:69
        #14 0x000000fc90c9 in CHOICE_free /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_CHOICE.c:185
        #15 0x000000fc90c9 in CHOICE_free /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_CHOICE.c:158
        #16 0x000000fcd01a in SEQUENCE_free /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_SEQUENCE.c:88
        #17 0x000000fcd01a in SEQUENCE_free /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_SEQUENCE.c:69
        #18 0x000000fcd01a in SEQUENCE_free /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_SEQUENCE.c:88
        #19 0x000000fcd01a in SEQUENCE_free /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_SEQUENCE.c:69
        #20 0x000000fcd01a in SEQUENCE_free /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_SEQUENCE.c:88
        #21 0x000000fcd01a in SEQUENCE_free /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_SEQUENCE.c:69
        #22 0x0000009d78ae in ue_context_setup_request /home/richie/w/f1-refactor-ue-context/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c:692
        #23 0x00000083fee2 in rrc_add_nsa_user /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB_nsa.c:330
        #24 0x000000886e8b in rrc_gNB_process_f1_setup_req /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB_du.c:444
        #25 0x000000833942 in rrc_gnb_task /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB.c:2766
        #26 0x7fe7d5e28ee5 in asan_thread_start(void*) (/lib64/libasan.so.8+0x28ee5) (BuildId: 7f1aa7e2e600e8c9d54ce6e3d36f3d31bfe7949a)
        #27 0x7fe7d527f1d3 in start_thread (/lib64/libc.so.6+0x711d3) (BuildId: 2b3c02fe7e4d3811767175b6f323692a10a4e116)
        #28 0x7fe7d5301ceb in __GI___clone3 (/lib64/libc.so.6+0xf3ceb) (BuildId: 2b3c02fe7e4d3811767175b6f323692a10a4e116)

    0x7c27d43e3ce8 is located 24 bytes inside of 40-byte region [0x7c27d43e3cd0,0x7c27d43e3cf8)
    freed by thread T6 here:
        #0 0x7fe7d5ee5bcb in free.part.0 (/lib64/libasan.so.8+0xe5bcb) (BuildId: 7f1aa7e2e600e8c9d54ce6e3d36f3d31bfe7949a)
        #1 0x000000fd6249 in SET_OF_free /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_SET_OF.c:236
        #2 0x000000fd6249 in SET_OF_free /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_SET_OF.c:220
        #3 0x000000fcd103 in SEQUENCE_free /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_SEQUENCE.c:91
        #4 0x000000fcd103 in SEQUENCE_free /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_SEQUENCE.c:69
        #5 0x000000fc90c9 in CHOICE_free /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_CHOICE.c:185
        #6 0x000000fc90c9 in CHOICE_free /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_CHOICE.c:158
        #7 0x000000fcd103 in SEQUENCE_free /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_SEQUENCE.c:91
        #8 0x000000fcd103 in SEQUENCE_free /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_SEQUENCE.c:69
        #9 0x000000fd6249 in SET_OF_free /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_SET_OF.c:236
        #10 0x000000fd6249 in SET_OF_free /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_SET_OF.c:220
        #11 0x000000fcd01a in SEQUENCE_free /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_SEQUENCE.c:88
        #12 0x000000fcd01a in SEQUENCE_free /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_SEQUENCE.c:69
        #13 0x000000fc90c9 in CHOICE_free /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_CHOICE.c:185
        #14 0x000000fc90c9 in CHOICE_free /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_CHOICE.c:158
        #15 0x000000fcd01a in SEQUENCE_free /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_SEQUENCE.c:88
        #16 0x000000fcd01a in SEQUENCE_free /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_SEQUENCE.c:69
        #17 0x000000fcd01a in SEQUENCE_free /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_SEQUENCE.c:88
        #18 0x000000fcd01a in SEQUENCE_free /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_SEQUENCE.c:69
        #19 0x000000fcd01a in SEQUENCE_free /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_SEQUENCE.c:88
        #20 0x000000fcd01a in SEQUENCE_free /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_SEQUENCE.c:69
        #21 0x0000009d78ae in ue_context_setup_request /home/richie/w/f1-refactor-ue-context/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c:692
        #22 0x00000083fee2 in rrc_add_nsa_user /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB_nsa.c:330
        #23 0x000000886e8b in rrc_gNB_process_f1_setup_req /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB_du.c:444
        #24 0x000000833942 in rrc_gnb_task /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB.c:2766
        #25 0x7fe7d5e28ee5 in asan_thread_start(void*) (/lib64/libasan.so.8+0x28ee5) (BuildId: 7f1aa7e2e600e8c9d54ce6e3d36f3d31bfe7949a)

    previously allocated by thread T6 here:
        #0 0x7fe7d5ee6883 in calloc (/lib64/libasan.so.8+0xe6883) (BuildId: 7f1aa7e2e600e8c9d54ce6e3d36f3d31bfe7949a)
        #1 0x000000a1ac53 in get_default_secondaryCellGroup /home/richie/w/f1-refactor-ue-context/openair2/LAYER2/NR_MAC_gNB/nr_radio_config.c:3969
        #2 0x0000009d8913 in create_new_UE /home/richie/w/f1-refactor-ue-context/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c:571
        #3 0x0000009d8913 in ue_context_setup_request /home/richie/w/f1-refactor-ue-context/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c:638
        #4 0x00000083fee2 in rrc_add_nsa_user /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB_nsa.c:330
        #5 0x000000886e8b in rrc_gNB_process_f1_setup_req /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB_du.c:444
        #6 0x000000833942 in rrc_gnb_task /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB.c:2766
        #7 0x7fe7d5e28ee5 in asan_thread_start(void*) (/lib64/libasan.so.8+0x28ee5) (BuildId: 7f1aa7e2e600e8c9d54ce6e3d36f3d31bfe7949a)

    Thread T6 created by T0 here:
        #0 0x7fe7d5ede492 in pthread_create (/lib64/libasan.so.8+0xde492) (BuildId: 7f1aa7e2e600e8c9d54ce6e3d36f3d31bfe7949a)
        #1 0x0000012a4ba3 in threadCreate /home/richie/w/f1-refactor-ue-context/common/utils/system.c:283
        #2 0x0000006b5fef in itti_create_task /home/richie/w/f1-refactor-ue-context/common/utils/ocp_itti/intertask_interface.cpp:317
        #3 0x000000435c5f in create_gNB_tasks /home/richie/w/f1-refactor-ue-context/executables/nr-softmodem.c:310
        #4 0x000000435c5f in main /home/richie/w/f1-refactor-ue-context/executables/nr-softmodem.c:620
        #5 0x7fe7d52115f4 in __libc_start_call_main (/lib64/libc.so.6+0x35f4) (BuildId: 2b3c02fe7e4d3811767175b6f323692a10a4e116)
        #6 0x7fe7d52116a7 in __libc_start_main@@GLIBC_2.34 (/lib64/libc.so.6+0x36a7) (BuildId: 2b3c02fe7e4d3811767175b6f323692a10a4e116)
        #7 0x0000004672d4 in _start (/home/richie/w/f1-refactor-ue-context/build/nr-softmodem+0x4672d4) (BuildId: 81450e9a0b832ca9e36b1984ecc232efde59d424)

Closes: #958
2025-06-28 12:19:58 +02:00
Robert Schmidt
5766d7ff51 Debug core images: mount sources to right directory 2025-06-28 12:19:58 +02:00
Robert Schmidt
bd5380ed09 Make UE capabilities const: is read-only 2025-06-28 12:19:58 +02:00
Robert Schmidt
6cf7fc2bb2 Fix memory leak in nr_rrc_f1_ho_acknowledge()
Direct leak of 512 byte(s) in 1 object(s) allocated from:
        #0 0x7f37634e5e2b in realloc.part.0 (/lib64/libasan.so.8+0xe5e2b) (BuildId: 7f1aa7e2e600e8c9d54ce6e3d36f3d31bfe7949a)
        #1 0x000000fbb9ad in encode_dyn_cb /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/per_encoder.c:23
        #2 0x000000fc279e in asn_put_few_bits /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/asn_bit_data.c:220
        #3 0x000000fc279e in asn_put_few_bits /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/asn_bit_data.c:192
        #4 0x000000fc2ce5 in asn_put_many_bits /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/asn_bit_data.c:293
        #5 0x000000fb8c33 in OCTET_STRING_encode_uper /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/OCTET_STRING_uper.c:306
        #6 0x000000fd191a in SEQUENCE_encode_uper /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_SEQUENCE_uper.c:403
        #7 0x000000fd191a in SEQUENCE_encode_uper /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_SEQUENCE_uper.c:403
        #8 0x000000fcb140 in CHOICE_encode_uper /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_CHOICE_uper.c:177
        #9 0x000000fd191a in SEQUENCE_encode_uper /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_SEQUENCE_uper.c:403
        #10 0x000000fcb140 in CHOICE_encode_uper /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_CHOICE_uper.c:177
        #11 0x000000fcb140 in CHOICE_encode_uper /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_CHOICE_uper.c:177
        #12 0x000000fd191a in SEQUENCE_encode_uper /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_SEQUENCE_uper.c:403
        #13 0x000000fbc1ed in uper_encode /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/uper_encoder.c:27
        #14 0x000000fbc73a in uper_encode_to_new_buffer /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/uper_encoder.c:85
        #15 0x000000e10fbd in do_RRCReconfiguration /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/MESSAGES/asn1_msg.c:586
        #16 0x000000805712 in rrc_gNB_encode_RRCReconfiguration /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB.c:652
        #17 0x000000893860 in nr_rrc_f1_ho_acknowledge /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB_mobility.c:280
        #18 0x0000008079ac in rrc_CU_process_ue_context_setup_response /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB.c:2139
        #19 0x0000008330d8 in rrc_gnb_task /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB.c:2771
        #20 0x7f3763428ee5 in asan_thread_start(void*) (/lib64/libasan.so.8+0x28ee5) (BuildId: 7f1aa7e2e600e8c9d54ce6e3d36f3d31bfe7949a)
2025-06-28 12:19:58 +02:00
Robert Schmidt
f26cef9cbe Add invariant check to help debug
During refactoring, I had asan errors in the next line. It took me some
time to figure out that a DRB ID 0 is not valid (cf.
get_next_available_drb_id() and get_drb(), they enforce this).
2025-06-28 12:19:58 +02:00
Robert Schmidt
c3bb7dfd04 Fix memory leak in ue_context_setup_request()
Direct leak of 64 byte(s) in 1 object(s) allocated from:
        #0 0x7fc885ae6883 in calloc (/lib64/libasan.so.8+0xe6883) (BuildId: 7f1aa7e2e600e8c9d54ce6e3d36f3d31bfe7949a)
        #1 0x000000fd0ac9 in SEQUENCE_decode_uper /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_SEQUENCE_uper.c:37
        #2 0x000000fbba1c in uper_decode /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/uper_decoder.c:83
        #3 0x000000fbbbf9 in uper_decode_complete /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/uper_decoder.c:16
        #4 0x0000009d65ce in get_cg_config_info /home/richie/w/f1-refactor-ue-context/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c:485
        #5 0x0000009d65ce in ue_context_setup_request /home/richie/w/f1-refactor-ue-context/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c:619
        #6 0x00000083fea2 in rrc_add_nsa_user /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB_nsa.c:330
        #7 0x000000886c8b in rrc_gNB_process_f1_setup_req /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB_du.c:444
        #8 0x000000833902 in rrc_gnb_task /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB.c:2766
        #9 0x7fc885a28ee5 in asan_thread_start(void*) (/lib64/libasan.so.8+0x28ee5) (BuildId: 7f1aa7e2e600e8c9d54ce6e3d36f3d31bfe7949a)
    Indirect leak of 128 byte(s) in 1 object(s) allocated from:
        #0 0x7fc885ae6883 in calloc (/lib64/libasan.so.8+0xe6883) (BuildId: 7f1aa7e2e600e8c9d54ce6e3d36f3d31bfe7949a)
        #1 0x000000fd0ac9 in SEQUENCE_decode_uper /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_SEQUENCE_uper.c:37
        #2 0x000000fca638 in CHOICE_decode_uper /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_CHOICE_uper.c:84
        #3 0x000000fca638 in CHOICE_decode_uper /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_CHOICE_uper.c:84
        #4 0x000000fd058e in SEQUENCE_decode_uper /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_SEQUENCE_uper.c:118
        #5 0x000000fbba1c in uper_decode /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/uper_decoder.c:83
        #6 0x000000fbbbf9 in uper_decode_complete /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/uper_decoder.c:16
        #7 0x0000009d65ce in get_cg_config_info /home/richie/w/f1-refactor-ue-context/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c:485
        #8 0x0000009d65ce in ue_context_setup_request /home/richie/w/f1-refactor-ue-context/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c:619
        #9 0x00000083fea2 in rrc_add_nsa_user /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB_nsa.c:330
        #10 0x000000886c8b in rrc_gNB_process_f1_setup_req /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB_du.c:444
        #11 0x000000833902 in rrc_gnb_task /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB.c:2766
        #12 0x7fc885a28ee5 in asan_thread_start(void*) (/lib64/libasan.so.8+0x28ee5) (BuildId: 7f1aa7e2e600e8c9d54ce6e3d36f3d31bfe7949a)
    Indirect leak of 40 byte(s) in 1 object(s) allocated from:
        #0 0x7fc885ae6883 in calloc (/lib64/libasan.so.8+0xe6883) (BuildId: 7f1aa7e2e600e8c9d54ce6e3d36f3d31bfe7949a)
        #1 0x000000fca7d7 in CHOICE_decode_uper /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_CHOICE_uper.c:32
        #2 0x000000fca638 in CHOICE_decode_uper /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_CHOICE_uper.c:84
        #3 0x000000fd058e in SEQUENCE_decode_uper /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/constr_SEQUENCE_uper.c:118
        #4 0x000000fbba1c in uper_decode /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/uper_decoder.c:83
        #5 0x000000fbbbf9 in uper_decode_complete /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/uper_decoder.c:16
        #6 0x0000009d65ce in get_cg_config_info /home/richie/w/f1-refactor-ue-context/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c:485
        #7 0x0000009d65ce in ue_context_setup_request /home/richie/w/f1-refactor-ue-context/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c:619
        #8 0x00000083fea2 in rrc_add_nsa_user /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB_nsa.c:330
        #9 0x000000886c8b in rrc_gNB_process_f1_setup_req /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB_du.c:444
        #10 0x000000833902 in rrc_gnb_task /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB.c:2766
        #11 0x7fc885a28ee5 in asan_thread_start(void*) (/lib64/libasan.so.8+0x28ee5) (BuildId: 7f1aa7e2e600e8c9d54ce6e3d36f3d31bfe7949a)
2025-06-28 12:19:58 +02:00
Robert Schmidt
c54cbdae54 Fix memory leak in rrc_add_nsa_user_resp()
Direct leak of 72 byte(s) in 1 object(s) allocated from:
        #0 0x7f83c10e6883 in calloc (/lib64/libasan.so.8+0xe6883) (BuildId: 7f1aa7e2e600e8c9d54ce6e3d36f3d31bfe7949a)
        #1 0x000000844ec5 in rrc_add_nsa_user_resp /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB_nsa.c:413
        #2 0x0000008079d1 in rrc_CU_process_ue_context_setup_response /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB.c:2111
        #3 0x0000008330a8 in rrc_gnb_task /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB.c:2769
        #4 0x7f83c1028ee5 in asan_thread_start(void*) (/lib64/libasan.so.8+0x28ee5) (BuildId: 7f1aa7e2e600e8c9d54ce6e3d36f3d31bfe7949a)
    Indirect leak of 40 byte(s) in 1 object(s) allocated from:
        #0 0x7f83c10e6883 in calloc (/lib64/libasan.so.8+0xe6883) (BuildId: 7f1aa7e2e600e8c9d54ce6e3d36f3d31bfe7949a)
        #1 0x000000844f9d in get_default_reconfig /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB_nsa.c:343
        #2 0x000000844f9d in rrc_add_nsa_user_resp /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB_nsa.c:416
        #3 0x0000008079d1 in rrc_CU_process_ue_context_setup_response /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB.c:2111
        #4 0x0000008330a8 in rrc_gnb_task /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB.c:2769
        #5 0x7f83c1028ee5 in asan_thread_start(void*) (/lib64/libasan.so.8+0x28ee5) (BuildId: 7f1aa7e2e600e8c9d54ce6e3d36f3d31bfe7949a)
    Indirect leak of 64 byte(s) in 1 object(s) allocated from:
        #0 0x7f83c10e6883 in calloc (/lib64/libasan.so.8+0xe6883) (BuildId: 7f1aa7e2e600e8c9d54ce6e3d36f3d31bfe7949a)
        #1 0x000000844f28 in get_default_reconfig /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB_nsa.c:335
        #2 0x000000844f28 in rrc_add_nsa_user_resp /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB_nsa.c:416
        #3 0x0000008079d1 in rrc_CU_process_ue_context_setup_response /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB.c:2111
        #4 0x0000008330a8 in rrc_gnb_task /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB.c:2769
        #5 0x7f83c1028ee5 in asan_thread_start(void*) (/lib64/libasan.so.8+0x28ee5) (BuildId: 7f1aa7e2e600e8c9d54ce6e3d36f3d31bfe7949a)
    Indirect leak of 327 byte(s) in 1 object(s) allocated from:
        #0 0x7f83c10e6f0b in malloc (/lib64/libasan.so.8+0xe6f0b) (BuildId: 7f1aa7e2e600e8c9d54ce6e3d36f3d31bfe7949a)
        #1 0x000000fb51ec in OCTET_STRING_fromBuf /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/OCTET_STRING.c:184
        #2 0x000000844fd3 in get_default_reconfig /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB_nsa.c:344
        #3 0x000000844fd3 in rrc_add_nsa_user_resp /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB_nsa.c:416
        #4 0x0000008079d1 in rrc_CU_process_ue_context_setup_response /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB.c:2111
        #5 0x0000008330a8 in rrc_gnb_task /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB.c:2769
        #6 0x7f83c1028ee5 in asan_thread_start(void*) (/lib64/libasan.so.8+0x28ee5) (BuildId: 7f1aa7e2e600e8c9d54ce6e3d36f3d31bfe7949a)
2025-06-28 12:19:58 +02:00
Robert Schmidt
d4ad31bd1d Correctly free E1AP context mod request
Direct leak of 48 byte(s) in 1 object(s) allocated from:
        #0 0x7fea71ee6f0b in malloc (/lib64/libasan.so.8+0xe6f0b) (BuildId: 7f1aa7e2e600e8c9d54ce6e3d36f3d31bfe7949a)
        #1 0x0000007f29c0 in malloc_or_fail /home/richie/w/f1-refactor-ue-context/common/utils/utils.h:86
        #2 0x0000007f29c0 in cuup_notify_reestablishment /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB.c:872
        #3 0x000000808002 in rrc_CU_process_ue_context_setup_response /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB.c:2126
        #4 0x0000008330d8 in rrc_gnb_task /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB.c:2770
        #5 0x7fea71e28ee5 in asan_thread_start(void*) (/lib64/libasan.so.8+0x28ee5) (BuildId: 7f1aa7e2e600e8c9d54ce6e3d36f3d31bfe7949a)
2025-06-28 12:19:58 +02:00
Robert Schmidt
ec3ce8a387 Free at F1 Setup Response at MAC
The F1 Setup Response is stored for possible look up of information.
Free it at the end to avoid memory leaks.
2025-06-28 12:19:58 +02:00
Robert Schmidt
7c65929ece Free cell F1 Setup Request after DU disconnection
Direct leak of 72 byte(s) in 1 object(s) allocated from:
        #0 0x7fea71ee6883 in calloc (/lib64/libasan.so.8+0xe6883) (BuildId: 7f1aa7e2e600e8c9d54ce6e3d36f3d31bfe7949a)
        #1 0x000000886124 in rrc_gNB_process_f1_setup_req /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB_du.c:384
        #2 0x000000833902 in rrc_gnb_task /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB.c:2765
        #3 0x7fea71e28ee5 in asan_thread_start(void*) (/lib64/libasan.so.8+0x28ee5) (BuildId: 7f1aa7e2e600e8c9d54ce6e3d36f3d31bfe7949a)
    Indirect leak of 16592 byte(s) in 1 object(s) allocated from:
        #0 0x7fea71ee6883 in calloc (/lib64/libasan.so.8+0xe6883) (BuildId: 7f1aa7e2e600e8c9d54ce6e3d36f3d31bfe7949a)
        #1 0x000000886171 in rrc_gNB_process_f1_setup_req /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB_du.c:391
        #2 0x000000833902 in rrc_gnb_task /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB.c:2765
        #3 0x7fea71e28ee5 in asan_thread_start(void*) (/lib64/libasan.so.8+0x28ee5) (BuildId: 7f1aa7e2e600e8c9d54ce6e3d36f3d31bfe7949a)
    Indirect leak of 102 byte(s) in 1 object(s) allocated from:
        #0 0x7fea71ee6883 in calloc (/lib64/libasan.so.8+0xe6883) (BuildId: 7f1aa7e2e600e8c9d54ce6e3d36f3d31bfe7949a)
        #1 0x000000adb79a in calloc_or_fail /home/richie/w/f1-refactor-ue-context/common/utils/utils.h:74
        #2 0x000000adb79a in copy_f1ap_gnb_du_system_info /home/richie/w/f1-refactor-ue-context/openair2/F1AP/lib/f1ap_interface_management.c:933
        #3 0x000000ae60c9 in cp_f1ap_setup_request /home/richie/w/f1-refactor-ue-context/openair2/F1AP/lib/f1ap_interface_management.c:959
        #4 0x0000008861c0 in rrc_gNB_process_f1_setup_req /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB_du.c:394
        #5 0x000000833902 in rrc_gnb_task /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB.c:2765
        #6 0x7fea71e28ee5 in asan_thread_start(void*) (/lib64/libasan.so.8+0x28ee5) (BuildId: 7f1aa7e2e600e8c9d54ce6e3d36f3d31bfe7949a)

    Indirect leak of 32 byte(s) in 1 object(s) allocated from:
        #0 0x7fea71ee6883 in calloc (/lib64/libasan.so.8+0xe6883) (BuildId: 7f1aa7e2e600e8c9d54ce6e3d36f3d31bfe7949a)
        #1 0x000000adb667 in calloc_or_fail /home/richie/w/f1-refactor-ue-context/common/utils/utils.h:74
        #2 0x000000adb667 in copy_f1ap_gnb_du_system_info /home/richie/w/f1-refactor-ue-context/openair2/F1AP/lib/f1ap_interface_management.c:924
        #3 0x000000ae60c9 in cp_f1ap_setup_request /home/richie/w/f1-refactor-ue-context/openair2/F1AP/lib/f1ap_interface_management.c:959
        #4 0x0000008861c0 in rrc_gNB_process_f1_setup_req /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB_du.c:394
        #5 0x000000833902 in rrc_gnb_task /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB.c:2765
        #6 0x7fea71e28ee5 in asan_thread_start(void*) (/lib64/libasan.so.8+0x28ee5) (BuildId: 7f1aa7e2e600e8c9d54ce6e3d36f3d31bfe7949a)

    Indirect leak of 15 byte(s) in 1 object(s) allocated from:
        #0 0x7fea71ee0c80 in strdup (/lib64/libasan.so.8+0xe0c80) (BuildId: 7f1aa7e2e600e8c9d54ce6e3d36f3d31bfe7949a)
        #1 0x000000ae5f57 in cp_f1ap_setup_request /home/richie/w/f1-refactor-ue-context/openair2/F1AP/lib/f1ap_interface_management.c:950
        #2 0x0000008861c0 in rrc_gNB_process_f1_setup_req /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB_du.c:394
        #3 0x000000833902 in rrc_gnb_task /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB.c:2765
        #4 0x7fea71e28ee5 in asan_thread_start(void*) (/lib64/libasan.so.8+0x28ee5) (BuildId: 7f1aa7e2e600e8c9d54ce6e3d36f3d31bfe7949a)

    Indirect leak of 7 byte(s) in 1 object(s) allocated from:
        #0 0x7fea71ee6883 in calloc (/lib64/libasan.so.8+0xe6883) (BuildId: 7f1aa7e2e600e8c9d54ce6e3d36f3d31bfe7949a)
        #1 0x000000ae5c28 in calloc_or_fail /home/richie/w/f1-refactor-ue-context/common/utils/utils.h:74
        #2 0x000000ae5c28 in copy_f1ap_served_cell_info /home/richie/w/f1-refactor-ue-context/openair2/F1AP/lib/f1ap_interface_management.c:913
        #3 0x000000ae609a in cp_f1ap_setup_request /home/richie/w/f1-refactor-ue-context/openair2/F1AP/lib/f1ap_interface_management.c:957
        #4 0x0000008861c0 in rrc_gNB_process_f1_setup_req /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB_du.c:394
        #5 0x000000833902 in rrc_gnb_task /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB.c:2765
        #6 0x7fea71e28ee5 in asan_thread_start(void*) (/lib64/libasan.so.8+0x28ee5) (BuildId: 7f1aa7e2e600e8c9d54ce6e3d36f3d31bfe7949a)

    Indirect leak of 4 byte(s) in 1 object(s) allocated from:
        #0 0x7fea71ee6f0b in malloc (/lib64/libasan.so.8+0xe6f0b) (BuildId: 7f1aa7e2e600e8c9d54ce6e3d36f3d31bfe7949a)
        #1 0x000000ae5ae7 in malloc_or_fail /home/richie/w/f1-refactor-ue-context/common/utils/utils.h:86
        #2 0x000000ae5ae7 in copy_f1ap_served_cell_info /home/richie/w/f1-refactor-ue-context/openair2/F1AP/lib/f1ap_interface_management.c:907
        #3 0x000000ae609a in cp_f1ap_setup_request /home/richie/w/f1-refactor-ue-context/openair2/F1AP/lib/f1ap_interface_management.c:957
        #4 0x0000008861c0 in rrc_gNB_process_f1_setup_req /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB_du.c:394
        #5 0x000000833902 in rrc_gnb_task /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB.c:2765
        #6 0x7fea71e28ee5 in asan_thread_start(void*) (/lib64/libasan.so.8+0x28ee5) (BuildId: 7f1aa7e2e600e8c9d54ce6e3d36f3d31bfe7949a)

    Indirect leak of 3 byte(s) in 1 object(s) allocated from:
        #0 0x7fea71ee6883 in calloc (/lib64/libasan.so.8+0xe6883) (BuildId: 7f1aa7e2e600e8c9d54ce6e3d36f3d31bfe7949a)
        #1 0x000000adb713 in calloc_or_fail /home/richie/w/f1-refactor-ue-context/common/utils/utils.h:74
        #2 0x000000adb713 in copy_f1ap_gnb_du_system_info /home/richie/w/f1-refactor-ue-context/openair2/F1AP/lib/f1ap_interface_management.c:927
        #3 0x000000ae60c9 in cp_f1ap_setup_request /home/richie/w/f1-refactor-ue-context/openair2/F1AP/lib/f1ap_interface_management.c:959
        #4 0x0000008861c0 in rrc_gNB_process_f1_setup_req /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB_du.c:394
        #5 0x000000833902 in rrc_gnb_task /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB.c:2765
        #6 0x7fea71e28ee5 in asan_thread_start(void*) (/lib64/libasan.so.8+0x28ee5) (BuildId: 7f1aa7e2e600e8c9d54ce6e3d36f3d31bfe7949a)
2025-06-28 12:19:58 +02:00
Robert Schmidt
5b9d682fde Free F1 Setup Response after sending 2025-06-28 12:19:58 +02:00
Robert Schmidt
c6954d3f9d Free UE capabilities memory when removing UE context
Direct leak of 32 byte(s) in 1 object(s) allocated from:
        #0 0x7f672d6e5e2b in realloc.part.0 (/lib64/libasan.so.8+0xe5e2b) (BuildId: 7f1aa7e2e600e8c9d54ce6e3d36f3d31bfe7949a)
        #1 0x000000fbb4ed in encode_dyn_cb /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/per_encoder.c:23
        #2 0x000000fbbeeb in _uper_encode_flush_outp /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/uper_encoder.c:126
        #3 0x000000fbbeeb in uper_encode /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/uper_encoder.c:36
        #4 0x000000fbc27a in uper_encode_to_new_buffer /home/richie/w/f1-refactor-ue-context/build/openair2/RRC/LTE/MESSAGES/uper_encoder.c:85
        #5 0x00000081037c in handle_ueCapabilityInformation /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB.c:1549
        #6 0x000000813ced in rrc_gNB_decode_dcch /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB.c:1902
        #7 0x0000008334f2 in rrc_gnb_task /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB.c:2741
        #8 0x7f672d628ee5 in asan_thread_start(void*) (/lib64/libasan.so.8+0x28ee5) (BuildId: 7f1aa7e2e600e8c9d54ce6e3d36f3d31bfe7949a)
2025-06-28 12:19:58 +02:00
Robert Schmidt
332b2644e4 Fix memory leak in cg_config_info_from_ue_cap_file()
Indirect leak of 40 byte(s) in 1 object(s) allocated from:
        #0 0x7f7b2b4e6883 in calloc (/lib64/libasan.so.8+0xe6883) (BuildId: 7f1aa7e2e600e8c9d54ce6e3d36f3d31bfe7949a)
        #1 0x00000083e6e6 in calloc_or_fail /home/richie/w/f1-refactor-ue-context/common/utils/utils.h:74
        #2 0x00000083e6e6 in cg_config_info_from_ue_cap_file /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB_nsa.c:82
        #3 0x00000083e6e6 in rrc_add_nsa_user /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB_nsa.c:145
        #4 0x000000886bcb in rrc_gNB_process_f1_setup_req /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB_du.c:444
        #5 0x000000833902 in rrc_gnb_task /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB.c:2766
        #6 0x7f7b2b428ee5 in asan_thread_start(void*) (/lib64/libasan.so.8+0x28ee5) (BuildId: 7f1aa7e2e600e8c9d54ce6e3d36f3d31bfe7949a)

    Indirect leak of 128 byte(s) in 1 object(s) allocated from:
        #0 0x7f7b2b4e6883 in calloc (/lib64/libasan.so.8+0xe6883) (BuildId: 7f1aa7e2e600e8c9d54ce6e3d36f3d31bfe7949a)
        #1 0x00000083e745 in calloc_or_fail /home/richie/w/f1-refactor-ue-context/common/utils/utils.h:74
        #2 0x00000083e745 in cg_config_info_from_ue_cap_file /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB_nsa.c:84
        #3 0x00000083e745 in rrc_add_nsa_user /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB_nsa.c:145
        #4 0x000000886bcb in rrc_gNB_process_f1_setup_req /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB_du.c:444
        #5 0x000000833902 in rrc_gnb_task /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB.c:2766
        #6 0x7f7b2b428ee5 in asan_thread_start(void*) (/lib64/libasan.so.8+0x28ee5) (BuildId: 7f1aa7e2e600e8c9d54ce6e3d36f3d31bfe7949a)

    Direct leak of 64 byte(s) in 1 object(s) allocated from:
        #0 0x7f7b2b4e6883 in calloc (/lib64/libasan.so.8+0xe6883) (BuildId: 7f1aa7e2e600e8c9d54ce6e3d36f3d31bfe7949a)
        #1 0x00000083e6a5 in calloc_or_fail /home/richie/w/f1-refactor-ue-context/common/utils/utils.h:74
        #2 0x00000083e6a5 in cg_config_info_from_ue_cap_file /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB_nsa.c:80
        #3 0x00000083e6a5 in rrc_add_nsa_user /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB_nsa.c:145
        #4 0x000000886bcb in rrc_gNB_process_f1_setup_req /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB_du.c:444
        #5 0x000000833902 in rrc_gnb_task /home/richie/w/f1-refactor-ue-context/openair2/RRC/NR/rrc_gNB.c:2766
        #6 0x7f7b2b428ee5 in asan_thread_start(void*) (/lib64/libasan.so.8+0x28ee5) (BuildId: 7f1aa7e2e600e8c9d54ce6e3d36f3d31bfe7949a)
2025-06-28 12:19:58 +02:00
Robert Schmidt
1a2aa1266c Remove more unused types 2025-06-28 12:19:58 +02:00
Robert Schmidt
abb3eff285 Use F1 UE context Release Complete in stack
Use the new type and remove the old one.
2025-06-28 12:19:58 +02:00
Robert Schmidt
bbb6b3f7ad Add F1AP UE context release complete message enc/dec + test
See commit "Add F1AP UE context setup request message enc/dec + test"
for more details on the approach taken.
2025-06-28 12:19:58 +02:00
Robert Schmidt
e3b8121035 Use F1 UE Context Release Command in stack
Use the new type and remove the old one.
2025-06-28 12:19:58 +02:00
Robert Schmidt
ec7a7973fb Add F1AP UE context release command message enc/dec + test
See commit "Add F1AP UE context setup request message enc/dec + test"
for more details on the approach taken.
2025-06-28 12:19:58 +02:00
Robert Schmidt
f7d747164d Use F1 UE context Release Request in stack
Switch to the new type, remove the old one.
2025-06-28 12:19:58 +02:00
Robert Schmidt
d13c94457a Add F1AP UE context release request message enc/dec + test
See commit "Add F1AP UE context setup request message enc/dec + test"
for more details on the approach taken.
2025-06-28 12:19:57 +02:00
Robert Schmidt
4d08801e9a Refactor: use malloc to avoid mem leaks
Move the filling of DRBs to set up for UE context setup/modification
request into the corresponding functions, and use malloc() deliberately
to avoid memory leaks. In fact fill_drb_to_be_setup_from_e1_resp()
allocates memory dynamically (and has to do that), so the easiest is to
do the same for DRBs. The most straight-forward way seems to be to then
dynamically allocate all memory for F1 UE context setup/modification
request messages, and free with the corresponding free functions,
which removes a couple of memory leaks.
2025-06-28 12:19:57 +02:00
Robert Schmidt
04b5e1d7da Use F1 UE context setup/mod Response in stack
Similarly to the commit "Use F1 UE context setup/modif Request in
stack", we do both UE context setup/modification response at once
because of some functions that are shared by the MAC message handler.
2025-06-28 12:19:57 +02:00
Robert Schmidt
5c6aa46b03 Add F1AP UE context modification response message enc/dec + tes
See commit "Add F1AP UE context setup request message enc/dec + test"
for more details on the approach taken.
2025-06-28 12:19:57 +02:00
Robert Schmidt
6956e6ed11 Add F1AP UE context setup response message enc/dec + test
See commit "Add F1AP UE context setup request message enc/dec + test"
for more details on the approach taken.
2025-06-28 12:19:57 +02:00
Robert Schmidt
014e67fccd Use F1 UE context setup/modif Request in stack
Use the new, tested F1 UE context setup request and modification
requests in the stack.

We have to do both at once, because there are some functions that are
used by handlers for both messages, notably

- handle_ue_context_drbs_setup()
- handle_ue_context_srbs_setup()

(+ and some functions called by those two). For instance, the first uses
the (new/old) type f1ap_drb_to_be_setup_t/f1ap_drb_to_setup_t which is
shared. The alternative would be to duplicate the functionality
temporarily, and I want to avoid unnecessary code churn.
2025-06-28 12:19:57 +02:00
Robert Schmidt
807e44d604 Add F1AP UE context modification request message enc/dec + test
See commit "Add F1AP UE context setup request message enc/dec + test"
for more details on the approach taken.
2025-06-28 12:19:57 +02:00
Robert Schmidt
da915d21e0 Add F1AP UE context setup request message enc/dec + test
Reintroduce separate message types to simplify the encoding/decoding,
including shorter names.  The old types will be removed once everything
has been migrated to the new encoder/decoder, which should ensure that
everything is properly migrated to the unit-tested encoder/decoders.

Also, for each type of F1 message (F1 UE context setup request,
response, modification request, ...) introduce a separate type to avoid
to mistakenly use wrong fields, which can lead to bugs. In this regard,
the DL PDCP SN bit size in the DRB-ToBeSetup list of the UE context
setup request is optional, as it will also be used in the UE context
modification request DRB SetupMod list (which avoids quite some code
duplication). The encoder checks that this IE is present, though.
2025-06-28 12:19:57 +02:00
Reem Bahsoun
249812e10d Clarify HO doc: describe where to put neighbour configuration 2025-06-28 11:49:32 +02:00
Robert Schmidt
a6c319e84b Update handover documentation
Point out that an error message is expected, after user feedback
pointing out this somewhat confusing behavior.
2025-06-28 11:49:32 +02:00
Robert Schmidt
cd1aaab014 Remove only UEs belonging to DU that disconnected
The previous condition was wrong: if a UE did not have the assoc_id of
the DU that connected (i.e., it was connected to another DU then the one
disconnecting), it was marked for deletion. Instead, skip those UEs.
2025-06-28 11:49:32 +02:00
Jaroslava Fiedlerova
874d2b73a4 CI: reduce number of attach tries 2025-06-27 20:16:48 +02:00
Jaroslava Fiedlerova
1407784130 CI: RFSim 5G – Wait for IP address assignment before starting traffic test 2025-06-27 20:16:48 +02:00
Jaroslava Fiedlerova
136a59b42c CI: increase deployment interval for Cassandra database 2025-06-27 20:16:48 +02:00
Jaroslava Fiedlerova
63bdaaa1cb CI: remove unused attributes in cls_containerize.py 2025-06-27 20:16:48 +02:00
Jaroslava Fiedlerova
f7b3e04cf9 CI: new healthcheck condition for OTA docker deployments
This modification aims to improve health status detection by using PRACH IO as
an indicator of the gNB's status (container is marked as "healthy" when the
PRACH IO value in gNB nrL1_stats.log exceeds 0.0 dB.). The new condition accounts
for scenarios where the container may not exit or produce error codes (e.g.,
“sleep” logs or "error code overflow" messages).
2025-06-27 20:16:48 +02:00
Jaroslava Fiedlerova
2d39851983 CI: adjustment of DeployObject to speedup deployment
- using docker compose up --wait instead of a custom healthcheck script

Co-authored-by: Bartosz Podrygajlo <bartosz.podrygajlo@openairinterface.org>
2025-06-27 20:16:48 +02:00
Jaroslava Fiedlerova
33d011b2cb CI: adjust YAML files to speedup deployment/undeployment in rfsim5g
- `init: true` initializes the docker container with tini or alternative - it is
  used to collect all the processes and correctly pass the termination signal to
  them, this allows the docker container to be stopped without waiting 10 seconds
  to kill the container
- speeding up the healthchecks by reducing the interval from 1-10s to 0.5s during
  start period

Co-authored-by: Bartosz Podrygajlo <bartosz.podrygajlo@openairinterface.org>
2025-06-27 20:16:43 +02:00
francescomani
8e4b760c86 bugfix for UL TBSLBRM 2025-06-27 17:14:06 +02:00
Laurent THOMAS
fb85a8cda3 clarify and indent correctly the function initial sync 2025-06-27 15:21:47 +02:00
Laurent THOMAS
10ff80815f when we try to detect a specific PCI, and it fails, the SSS detection return successful detection, with wrong frequency offset 2025-06-27 15:21:13 +02:00
Robert Schmidt
8cee8ad661 Remove f1ap_lib_extern.h: use headers directly 2025-06-27 11:40:54 +02:00
Robert Schmidt
3a4440a99c Generalize F1AP_LIB_FIND_IE() to work with list container
F1AP_LIB_FIND_IE() is used to look up elements in a list, but was
hitherto hardcoded to use "protocolIEs" as an intermediate struct. A
follow-up commit will use this macro where we don't have protocolIEs,
but "iE_Extensions". Hence, modify to make it work for that case (and
others) as well.
2025-06-27 11:40:54 +02:00
Robert Schmidt
e991f26ff1 Factor out NSSAI, to be used in other messages lates 2025-06-27 11:40:54 +02:00
Robert Schmidt
9f0373e051 F1AP lib: introduce macros to simplify implementation
Introduce generic _F1_CHECK_EXP(), which is like the macros for checking
values (_F1_EQ_CHECK_INT() etc). Reuse the same for introducing
_F1_EQ_CHECK_OPTIONAL_IE that will be used to write the check for
optional fields more concisely.

CP_OPT_BYTE_ARRAY() FREE_OPT_BYTE_ARRAY() are macros to wrap handling of
optional byte arrays.

_F1_MALLOC() simplifies allocations and is similar to asn1cCallocOne(),
but provided to avoid confusion (since more than ASN.1 structures will
use it).

All will be used in the following commits.
2025-06-27 11:40:54 +02:00
Robert Schmidt
e4857991fc F1 PRINT_ERROR(): show file/line no for debuggability
Somewhat align with the E1 PRINT_ERROR(), but extend with information.
2025-06-27 11:40:54 +02:00
Robert Schmidt
8a772d362f Remove useless parameter for UE context modification response callback 2025-06-27 11:40:54 +02:00
Robert Schmidt
d1541a8329 Remove useless parameter for UE context setup response callback 2025-06-27 11:40:54 +02:00
Robert Schmidt
b19dff31e1 Print gNB MAC stats in phy-test mode as well
There is no PRACH, so the condition to print stats would never be
reached.

Fixes: 0301b239a2 ("print stats only after scheduler started")
2025-06-27 11:40:54 +02:00
Jaroslava Fiedlerova
20f4951bfe CI: use CN with NAS ciphering + integrity in OAIUE and SA-2x2 pipelines 2025-06-27 11:04:37 +02:00
Rúben Soares Silva
bfaec58ca5 Separate PNF socket send functions into separate socket library 2025-06-27 09:56:46 +01:00
alexjiao
35d0314be5 NR UE: enable CSI report for SISO case
Correct precoded_sinr_dB wrongly set to 0 for SISO case.
Also correct ri_restriction is 0 when calculating CQI bit length for SISO.
2025-06-27 10:45:51 +08:00
Rúben Soares Silva
f986f6843a Fix non-SCTP socket communication for P5 messages between PNF and VNF.
Switches the used socket type in pnf_interface.c and vnf_interface.c.
These values must always be the same in both components so the same socket type is used in both
2025-06-26 16:57:08 +01:00
Rúben Soares Silva
ca940e62f9 Add default PNF timing_info value for when the TLV is not sent
Intended to allow FAPI PNF to work without this nFAPI TLV being sent
2025-06-26 16:57:08 +01:00
Rúben Soares Silva
471b563ac7 Add send function pointers to PNF 2025-06-26 16:57:08 +01:00
Rúben Soares Silva
52a0ceac04 Add send function pointers to VNF 2025-06-26 16:57:08 +01:00
Rúben Soares Silva
2089655a97 Change VNF to use functions pointers to pack/unpack messages.
Adds 3 new function pointers to the P5 and P7 VNF structures, allowing to configure which function to use to pack/unpack the messages, as well as unpack the message header, being then used seamlessly regardless of using the FAPI or nFAPI functions.
2025-06-26 16:57:08 +01:00
Rúben Soares Silva
00b5eba192 Change PNF to use functions pointers to pack/unpack messages.
Adds 3 new function pointers to the P5 and P7 PNF structures, allowing to configure which function to use to pack/unpack the messages, as well as unpack the message header, being then used seamlessly regardless of using the FAPI or nFAPI functions.

Changes the header unpack and message unpack functions to return true on success and false on failure, instead of an int
2025-06-26 16:57:08 +01:00
Rúben Soares Silva
1ea164468f Refactor fapi_nr_p5_message_unpack to have the same signature as nfapi_nr_p5_message_header_unpack.
This change is done in preparation to add the header unpack functions to the VNF and PNF structures as function pointers, used to peek the message headers prior to processing.
Add a faux fapi_nr_p7_message_header_unpack with the same signature as nfapi_nr_p7_message_header_unpack, to be used for the P7 header unpack function pointer.
2025-06-26 16:57:08 +01:00
Rúben Soares Silva
d66986a23f Use P5 copy function for config.request instead of memcpy 2025-06-26 16:57:08 +01:00
Robert Schmidt
528e42c357 Update/refine MAC stats
Print a number of statistics, e.g., rx_ulsch_sdu to track UL MAC stats
timing. Remove unused time_meas_t definitions, and fix the name for the
total gNB scheduler time.
2025-06-26 12:09:28 +02:00
Thomas Schlichter
ed54e0bbd1 NR_UE: make lcids_bj_pos an array of nr_lcordered_info_t pointers instead of structure elements
This makes the array itself smaller and allows to store just a pointer in select_logical_channels() instead of copying the complete structure element.
2025-06-24 14:56:35 +00:00
Jaroslava Fiedlerova
c7cb7896a0 CI: add a test with AS ciphering + integrity 2025-06-24 16:43:26 +02:00
Thomas Schlichter
5856c89741 NR UE: do not select a suspended LCID for scheduling
This fixes a lifelock in nr_ue_get_sdu(), because select_logical_channels() would select
a suspended LCID for scheduling, but fill_mac_sdu() would not provide data for it.
2025-06-24 14:42:20 +00:00
Thomas Schlichter
c3a11c4717 NR UE: fix condition when to print the error message in write_reorder_clear_context()
We should print the error message when the mutex cannot be locked because it is already locked.
Unfortunately, the if() condition was inverted...
2025-06-24 14:41:53 +00:00
Cedric Roux
319f5961a1 bugfix: read msg_type only after deciphering 2025-06-24 13:42:06 +02:00
Thomas Schlichter
7b991c4dbf NR UE: exit from configure_ntn_ta() if ntn_Config_r17 is not provided 2025-06-20 13:58:55 +00:00
Thomas Schlichter
a3bb97b6b7 gNB: set invalid NTN parameters in prepare_scc(), so fix_scc() will free them when not used 2025-06-20 13:55:45 +00:00
Thomas Schlichter
ef416234d9 NR UE: enable logging of NTN RRC timer information
To verify the NTN epoch time and NTN timer calculations, enable the logging by default.
This only affects NTN configurations.
2025-06-20 11:43:59 +00:00
Thomas Schlichter
1bb781b08c NR UE: trigger RRC timers based on RX frame and slot
For NTN Epoch time calculations, we need to know the RX frame number.
2025-06-20 11:24:06 +00:00
Thomas Schlichter
960f2e7101 NR UE: allow the epochTime-r17 in NTN-Config-r17 to be in the future
The implementation is limited to epoch times that are not more than 5.12 seconds in the future (allowed are up to 10.24 seconds)
and ntn-UlSyncValidityDuration < 5.12 seconds (allowed are up to 90 seconds).

To fix this limitation, the hyper frame number HFN has to be introduced at the OAI UE!
2025-06-20 11:24:06 +00:00
Thomas Schlichter
a9a6ab367b NR UE: fix autonomous_ta to be applied only when we also adjust the DL sync 2025-06-20 11:24:06 +00:00
Thomas Schlichter
786f4877bc rfsimulator: for LEO NTN, update SIB19 information once for each frame 2025-06-20 11:24:06 +00:00
Thomas Schlichter
e91fb33da3 NR UE: also use ta_CommonDriftVariant_r17 to calculate the initial timing advance 2025-06-20 11:24:06 +00:00
Thomas Schlichter
22866c3c1e NR UE: for consistency, rename ntn_ta_commondrift to N_common_ta_drift 2025-06-20 11:21:01 +00:00
Thomas Schlichter
f7ab814a3c NR UE: remove unused elements from struc fapi_nr_dl_ntn_config_command_pdu 2025-06-20 11:18:59 +00:00
Thomas Schlichter
7ba63a2052 rfsimulator: for LEO NTN, calculate SAT acceleration towards gNB to determine ta-CommonDriftVariant-r17 2025-06-20 11:18:59 +00:00
Thomas Schlichter
ece430b6c3 NR UE: use shorter member names for position_t structure 2025-06-20 11:18:59 +00:00
Thomas Schlichter
f1d612c01b NR UE: improve initial timing advance calculation from SIB19
Before, we only considered ta_Common_r17 and the SAT position from SIB19 to compute the initial timing advance value.
This is good enough if the satellite does not move too fast (e.g. GEO satellite).

Now we also consider ta_CommonDrift_r17 and the SAT velocity together with the epoch time from SIB19.
This improves the accuracy of the initial TA computation, esp. for LEO satellite scenarios.
2025-06-20 11:18:48 +00:00
Thomas Schlichter
42bc0d4eb3 rfsimulator: update SIB19 contents every second for LEO channel simulations 2025-06-20 11:15:49 +00:00
Thomas Schlichter
99f3628569 gNB: add function nr_update_sib19() allowing to update SIB19 information 2025-06-20 11:15:49 +00:00
Thomas Schlichter
0ddba90874 ci: test reestablishment for NTN GEO 2025-06-20 08:33:52 +00:00
Thomas Schlichter
ffc0cd43a2 for NTN GEO scenario increase ul_AM_RLC.t_PollRetransmit timer to 2 seconds 2025-06-20 08:33:52 +00:00
Thomas Schlichter
400926115e NR UE: fix reestablishment for NTN
During reestablishment the UE goes back to not synchronized state.
While the synchronizatin is running, we trash frames using the function readFrame().
And when we successfully synchronize, we skip samples to align with the start of the frame using syncInFrame().

In rfsimulator mode, both of these functions send dummy data using the function dummyWrite().
Unfortunately, the writeTimestamp provided to that function was always assuming a duration from RX to TX of NR_UE_CAPABILITY_SLOT_RX_TO_TX.
But in NTN mode, this value is changed when receiving SIB19.
Therefore we have to consider this changed value instead of the static one.
2025-06-20 08:33:52 +00:00
Robert Schmidt
44618f45d2 Remove unused ul_handle 2025-06-19 13:36:00 +02:00
261 changed files with 12706 additions and 9106 deletions

View File

@@ -715,6 +715,11 @@ add_library(NFAPI_LIB ${NFAPI_SRC})
target_link_libraries(NFAPI_LIB PUBLIC nfapi_common)
target_link_libraries(NFAPI_LIB PUBLIC nr_fapi_p5 nr_fapi_p7)
if(OAI_WLS)
target_compile_definitions(NFAPI_LIB PRIVATE ENABLE_WLS)
else()
target_compile_definitions(NFAPI_LIB PRIVATE ENABLE_SOCKET)
endif()
include_directories(${NFAPI_DIR}/nfapi/public_inc)
include_directories(${NFAPI_DIR}/nfapi/inc)
@@ -728,6 +733,9 @@ add_library(NFAPI_PNF_LIB ${NFAPI_PNF_SRC})
target_link_libraries(NFAPI_PNF_LIB PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs)
target_link_libraries(NFAPI_PNF_LIB PUBLIC nr_fapi_p7)
if(OAI_WLS)
target_compile_definitions(NFAPI_PNF_LIB PRIVATE ENABLE_WLS)
endif()
include_directories(${NFAPI_DIR}/pnf/public_inc)
include_directories(${NFAPI_DIR}/pnf/inc)
@@ -746,6 +754,9 @@ endif()
include_directories(${NFAPI_DIR}/vnf/public_inc)
include_directories(${NFAPI_DIR}/vnf/inc)
if(OAI_WLS)
target_compile_definitions(NFAPI_VNF_LIB PRIVATE ENABLE_WLS)
endif()
# nFAPI user defined code
#############################
set(NFAPI_USER_SRC
@@ -755,11 +766,15 @@ set(NFAPI_USER_SRC
${NFAPI_USER_DIR}/gnb_ind_vars.c
)
add_library(NFAPI_USER_LIB ${NFAPI_USER_SRC})
if(OAI_WLS)
target_compile_definitions(NFAPI_USER_LIB PRIVATE ENABLE_WLS)
elseif (OAI_AERIAL)
target_compile_definitions(NFAPI_USER_LIB PRIVATE ENABLE_AERIAL)
else()
target_compile_definitions(NFAPI_USER_LIB PRIVATE ENABLE_SOCKET)
endif()
target_link_libraries(NFAPI_USER_LIB PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs UTIL)
target_link_libraries(NFAPI_USER_LIB PRIVATE nr_fapi_p7)
if(OAI_AERIAL)
target_compile_definitions(NFAPI_USER_LIB PRIVATE ENABLE_AERIAL)
endif()
include_directories(${NFAPI_USER_DIR})
# Layer 1
@@ -1047,7 +1062,7 @@ add_library(PHY_NR_COMMON ${PHY_NR_SRC_COMMON})
target_link_libraries(PHY_NR_COMMON PUBLIC UTIL)
add_library(PHY_NR ${PHY_NR_SRC})
target_link_libraries(PHY_NR nr_phy_common nr_common)
target_link_libraries(PHY_NR nr_phy_common nr_common nr_fapi_p5)
add_library(PHY_NR_NO_AVX_256 ${PHY_NR_SRC})
target_link_libraries(PHY_NR_NO_AVX_256 nr_phy_common nr_common)
@@ -1839,6 +1854,12 @@ target_link_libraries(nr-softmodem PRIVATE pthread m CONFIG_LIB rt sctp)
target_link_libraries(nr-softmodem PRIVATE ${T_LIB})
target_link_libraries(nr-softmodem PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs)
target_link_libraries(nr-softmodem PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs)
add_boolean_option(OAI_WLS OFF "Activate OAI's WLS driver" OFF)
if (OAI_WLS)
target_link_libraries(nr-softmodem PUBLIC wls_integration_lib)
else()
target_link_libraries(nr-softmodem PUBLIC nfapi_socket_lib)
endif()
add_boolean_option(OAI_AERIAL OFF "Activate OAI's AERIAL driver" OFF)
if (OAI_AERIAL)
target_compile_definitions(nr-softmodem PUBLIC ENABLE_AERIAL)

View File

@@ -65,9 +65,9 @@ oc-cn5g:
Host: avra
NetworkScript: echo "inet 172.21.6.102"
RunIperf3Server: False
Deploy: "! scripts/oc-cn5g-deploy.sh /opt/oai-cn5g-fed-develop-2025-jan oaicicd-core-for-ci-ran"
Undeploy: "! scripts/oc-cn5g-undeploy.sh /opt/oai-cn5g-fed-develop-2025-jan oaicicd-core-for-ci-ran"
LogCollect: "! scripts/oc-cn5g-logcollect.sh /opt/oai-cn5g-fed-develop-2025-jan oaicicd-core-for-ci-ran %%log_dir%%"
Deploy: "! scripts/oc-cn5g-deploy.sh /opt/oai-cn5g-fed-develop-2025-jun oaicicd-core-for-ci-ran"
Undeploy: "! scripts/oc-cn5g-undeploy.sh /opt/oai-cn5g-fed-develop-2025-jun oaicicd-core-for-ci-ran"
LogCollect: "! scripts/oc-cn5g-logcollect.sh /opt/oai-cn5g-fed-develop-2025-jun oaicicd-core-for-ci-ran %%log_dir%%"
oc-cn5g-20897:
Host: cacofonix
@@ -89,8 +89,8 @@ matix-cn5g:
Host: matix
NetworkScript: docker exec prod-trf-gen ip a show dev eth0
RunIperf3Server: False
Deploy: "cd /opt/oai-cn5g-fed-v2/docker-compose && python3 ./core-network.py --type start-basic"
Undeploy: "cd /opt/oai-cn5g-fed-v2/docker-compose && python3 ./core-network.py --type stop-basic"
Deploy: "cd /opt/oai-cn5g-fed-v2-jun-2025/docker-compose && python3 ./core-network.py --type start-basic"
Undeploy: "cd /opt/oai-cn5g-fed-v2-jun-2025/docker-compose && python3 ./core-network.py --type stop-basic"
LogCollect:
- "docker logs oai-smf > %%log_dir%%/oai-smf.log"
- "docker logs oai-amf > %%log_dir%%/oai-amf.log"

View File

@@ -152,19 +152,6 @@ def GetImageName(ssh, svcName, file):
else:
return ret.stdout.strip()
def GetServiceHealth(ssh, svcName, file):
if svcName is None:
return False, f"Service {svcName} not found in {file}"
image = GetImageName(ssh, svcName, file)
if 'db_init' in svcName or 'db-init' in svcName: # exits with 0, there cannot be healthy
return True, f"Service {svcName} healthy, image {image}"
for _ in range(8):
result = ssh.run(f"docker compose -f {file} ps --format json {svcName} | jq -r 'if type==\"array\" then .[0].Health else .Health end'", silent=True)
if result.stdout == 'healthy':
return True, f"Service {svcName} healthy, image {image}"
time.sleep(5)
return False, f"Failed to deploy: service {svcName}"
def ExistEnvFilePrint(ssh, wd, prompt='env vars in existing'):
ret = ssh.run(f'cat {wd}/.env', silent=True, reportNonZero=False)
if ret.returncode != 0:
@@ -311,7 +298,6 @@ class Containerize():
self.yamlPath = ['', '', '']
self.services = ['', '', '']
self.deploymentTag = ''
self.eNB_logFile = ['', '', '']
self.testCase_id = ''
@@ -320,17 +306,6 @@ class Containerize():
self.dockerfileprefix = ''
self.host = ''
self.deployedContainers = []
self.tsharkStarted = False
self.pingContName = ''
self.pingOptions = ''
self.pingLossThreshold = ''
self.svrContName = ''
self.svrOptions = ''
self.cliContName = ''
self.cliOptions = ''
self.imageToCopy = ''
#checkers from xml
self.ran_checkers={}
self.num_attempts = 1
@@ -712,7 +687,7 @@ class Containerize():
HTML.CreateHtmlTestRowQueue("Build unit tests", 'OK', [dockerfile])
# it worked, build and execute tests, and close connection
ret = cmd.run(f'docker run -a STDOUT --workdir /oai-ran/build/ --env LD_LIBRARY_PATH=/oai-ran/build/ --rm ran-unittests:{baseTag} ctest --output-on-failure --no-label-summary -j$(nproc)')
ret = cmd.run(f'docker run -a STDOUT --workdir /oai-ran/build/ --env LD_LIBRARY_PATH=/oai-ran/build/ --rm ran-unittests:{baseTag} ctest --no-label-summary -j$(nproc)')
cmd.run(f'docker rmi ran-unittests:{baseTag}')
build_log_name = f'build_log_{self.testCase_id}'
CopyLogsToExecutor(cmd, lSourcePath, build_log_name)
@@ -872,31 +847,24 @@ class Containerize():
if num_attempts <= 0:
raise ValueError(f'Invalid value for num_attempts: {num_attempts}, must be greater than 0')
for attempt in range(num_attempts):
imagesInfo = []
healthInfo = []
logging.info(f'will start services {services}')
status = ssh.run(f'docker compose -f {wd_yaml} up -d -- {services}')
if status.returncode != 0:
status = ssh.run(f'docker compose -f {wd_yaml} up -d --wait --wait-timeout 60 -- {services}')
info = ssh.run(f"docker compose -f {wd_yaml} ps --all --format=\'table {{{{.Service}}}} [{{{{.Image}}}}] {{{{.Status}}}}\' -- {services} | column -t")
deployed = status.returncode == 0
if not deployed:
msg = f'cannot deploy services {services}: {status.stdout}'
logging.error(msg)
HTML.CreateHtmlTestRowQueue('N/A', 'NOK', [msg])
return False
for svc in services.split():
health, msg = GetServiceHealth(ssh, svc, f'{wd_yaml}')
logging.info(msg)
imagesInfo.append(msg)
healthInfo.append(health)
deployed = all(healthInfo)
if deployed:
else:
break
elif (attempt < num_attempts - 1):
warning_msg = f'Restart services {services}'
if (attempt < num_attempts - 1):
warning_msg = (f'Failed to deploy on attempt {attempt}, restart services {services}')
logging.warning(warning_msg)
imagesInfo.append(warning_msg)
HTML.CreateHtmlTestRowQueue('N/A', 'NOK', ['\n'.join(imagesInfo)])
HTML.CreateHtmlTestRowQueue('N/A', 'NOK', [warning_msg])
for svc in services.split():
CopyinServiceLog(ssh, lSourcePath, yaml_dir, svc, wd_yaml, f'{svc}-{HTML.testCase_id}-attempt{attempt}.log')
ssh.run(f'docker compose -f {wd_yaml} down -- {services}')
imagesInfo = info.stdout.splitlines()[1:]
logging.debug(f'{info.stdout.splitlines()[1:]}')
if deployed:
HTML.CreateHtmlTestRowQueue('N/A', 'OK', ['\n'.join(imagesInfo)])
else:

View File

@@ -43,19 +43,12 @@ gNBs =
# downlinkConfigCommon
#frequencyInfoDL
# this is 3300.24 + 134*12*30e3 = 3348.48 MHz (5G NR GSCN: 7741)
absoluteFrequencySSB = 649920;
#652860; #should be 649920
#647520;
#647540;
#649920;
#650208;
#647540;
# center frequency = 3350.01 MHz
# selected SSB frequency = 3349.92 MHz
absoluteFrequencySSB = 623328;
dl_frequencyBand = 78;
# this is 3300.24 MHz
dl_absoluteFrequencyPointA = 646724;
#649104;
#646724;
# frequency point A = 3300.87 MHz
dl_absoluteFrequencyPointA = 620058;
#scs-SpecificCarrierList
dl_offstToCarrier = 0;
# subcarrierSpacing

View File

@@ -195,6 +195,15 @@ gNBs =
}
);
rlc = {
srb = {
t_poll_retransmit = "ms2000"
}
drb_am = {
t_poll_retransmit = "ms2000"
}
}
MACRLCs = (
{
num_cc = 1;

View File

@@ -213,7 +213,7 @@ security = {
# preferred ciphering algorithms
# the first one of the list that an UE supports in chosen
# valid values: nea0, nea1, nea2, nea3
ciphering_algorithms = ( "nea0" );
ciphering_algorithms = ( "nea2", "nea0" );
# preferred integrity algorithms
# the first one of the list that an UE supports in chosen
@@ -223,7 +223,7 @@ security = {
# setting 'drb_ciphering' to "no" disables ciphering for DRBs, no matter
# what 'ciphering_algorithms' configures; same thing for 'drb_integrity'
drb_ciphering = "yes";
drb_integrity = "no";
drb_integrity = "yes";
};
log_config :

View File

@@ -212,7 +212,7 @@ security = {
# preferred ciphering algorithms
# the first one of the list that an UE supports in chosen
# valid values: nea0, nea1, nea2, nea3
ciphering_algorithms = ( "nea0" );
ciphering_algorithms = ( "nea2", "nea0" );
# preferred integrity algorithms
# the first one of the list that an UE supports in chosen
@@ -222,7 +222,7 @@ security = {
# setting 'drb_ciphering' to "no" disables ciphering for DRBs, no matter
# what 'ciphering_algorithms' configures; same thing for 'drb_integrity'
drb_ciphering = "yes";
drb_integrity = "no";
drb_integrity = "yes";
};
log_config :

View File

@@ -185,6 +185,7 @@ L1s = (
num_cc = 1;
tr_n_preference = "local_mac";
prach_dtx_threshold = 120;
tx_amp_backoff_dB = 30;
}
);

View File

@@ -19,6 +19,9 @@ Ref :
DL & UL scheduling timing : 17.0
UL Indication : 1.0
Slot Indication : 13.0
feprx : 151.0
feptx_ofdm (per port, half_slot) : 57
feptx_total : 148
DeviationThreshold :
feprx : 0.25
feptx_prec : 0.25
@@ -32,3 +35,6 @@ DeviationThreshold :
DL & UL scheduling timing : 0.25
UL Indication : 1.00
Slot Indication : 0.50
feprx : 0.25
feptx_ofdm (per port, half_slot) : 0.25
feptx_total : 0.25

View File

@@ -19,6 +19,9 @@ Ref :
DL & UL scheduling timing : 5.0
UL Indication : 1.0
Slot Indication : 6.0
feprx : 44.0
feptx_ofdm (per port, half_slot) : 31
feptx_total : 58
DeviationThreshold :
feprx : 0.25
feptx_prec : 0.25
@@ -32,3 +35,6 @@ DeviationThreshold :
DL & UL scheduling timing : 0.50
UL Indication : 1.00
Slot Indication : 0.50
feprx : 0.25
feptx_ofdm (per port, half_slot) : 0.25
feptx_total : 0.25

View File

@@ -19,6 +19,9 @@ Ref :
DL & UL scheduling timing : 8.0
UL Indication : 3.0
Slot Indication : 9.0
feprx : 85.0
feptx_ofdm (per port, half_slot) : 31
feptx_total : 92
DeviationThreshold :
feprx : 0.25
feptx_prec : 0.25
@@ -32,3 +35,6 @@ DeviationThreshold :
DL & UL scheduling timing : 0.35
UL Indication : 1.00
Slot Indication : 0.35
feprx : 0.25
feptx_ofdm (per port, half_slot) : 0.25
feptx_total : 0.25

View File

@@ -19,6 +19,9 @@ Ref :
DL & UL scheduling timing : 4.0
UL Indication : 2.0
Slot Indication : 5.0
feprx : 43.0
feptx_ofdm (per port, half_slot) : 30
feptx_total : 57
DeviationThreshold :
feprx : 0.25
feptx_prec : 0.25
@@ -32,3 +35,6 @@ DeviationThreshold :
DL & UL scheduling timing : 0.50
UL Indication : 1.00
Slot Indication : 0.50
feprx : 0.25
feptx_ofdm (per port, half_slot) : 0.25
feptx_total : 0.25

View File

@@ -80,16 +80,16 @@
<class>Attach_UE</class>
<desc>Attach OAI UE (Wait for IP)</desc>
<id>rfsim5g_ue rfsim5g_ue2 rfsim5g_ue3</id>
<nodes>cacofonix cacofonix cacofonix</nodes>
<nodes>acamas acamas acamas</nodes>
</testCase>
<testCase id="020021">
<class>Ping</class>
<desc>Ping ext-dn from all NR-UEs</desc>
<id>rfsim5g_ue rfsim5g_ue2 rfsim5g_ue3</id>
<nodes>cacofonix cacofonix cacofonix</nodes>
<nodes>acamas acamas acamas</nodes>
<svr_id>rfsim5g_5gc_fixed_ip</svr_id>
<svr_node>cacofonix</svr_node>
<svr_node>acamas</svr_node>
<ping_args>-c 20 -i0.25</ping_args>
<ping_packetloss_threshold>5</ping_packetloss_threshold>
</testCase>

View File

@@ -93,7 +93,7 @@
<testCase id="000030">
<class>IdleSleep</class>
<desc>Sleep</desc>
<idle_sleep_time_in_sec>5</idle_sleep_time_in_sec>
<idle_sleep_time_in_sec>15</idle_sleep_time_in_sec>
</testCase>
<testCase id="000031">
@@ -106,7 +106,7 @@
<class>Attach_UE</class>
<desc>Attach OAI UE (Wait for IP)</desc>
<id>rfsim5g_ue</id>
<nodes>cacofonix</nodes>
<nodes>acamas</nodes>
</testCase>
<testCase id="000024">
@@ -122,9 +122,9 @@
<class>Ping</class>
<desc>Ping ext-dn from all NR-UEs</desc>
<id>rfsim5g_ue</id>
<nodes>cacofonix</nodes>
<nodes>acamas</nodes>
<svr_id>rfsim5g_ext_dn</svr_id>
<svr_node>cacofonix</svr_node>
<svr_node>acamas</svr_node>
<ping_args>-c 20 -i0.25</ping_args>
<ping_packetloss_threshold>5</ping_packetloss_threshold>
</testCase>
@@ -132,8 +132,8 @@
<testCase id="030020">
<class>Custom_Command</class>
<desc>Simulate a DL radio channel with noise (3 dB)</desc>
<node>cacofonix</node>
<command>echo channelmod modify 0 noise_power_dB 3 | nc --send-only 192.168.71.181 8091</command>
<node>acamas</node>
<command>echo channelmod modify 0 noise_power_dB 3 | ncat --send-only 192.168.71.181 8091</command>
</testCase>
<testCase id="030021">
@@ -141,9 +141,9 @@
<desc>Iperf (DL/5Mbps/UDP)(30 sec)</desc>
<iperf_args>-u -b 5M -t 20 -R</iperf_args>
<id>rfsim5g_ue</id>
<nodes>cacofonix</nodes>
<nodes>acamas</nodes>
<svr_id>rfsim5g_ext_dn</svr_id>
<svr_node>cacofonix</svr_node>
<svr_node>acamas</svr_node>
<iperf_packetloss_threshold>5</iperf_packetloss_threshold>
<iperf_bitrate_threshold>90</iperf_bitrate_threshold>
</testCase>
@@ -153,9 +153,9 @@
<desc>Iperf (UL/3Mbps/UDP)(30 sec)</desc>
<iperf_args>-u -b 3M -t 20</iperf_args>
<id>rfsim5g_ue</id>
<nodes>cacofonix</nodes>
<nodes>acamas</nodes>
<svr_id>rfsim5g_ext_dn</svr_id>
<svr_node>cacofonix</svr_node>
<svr_node>acamas</svr_node>
<iperf_packetloss_threshold>5</iperf_packetloss_threshold>
<iperf_bitrate_threshold>90</iperf_bitrate_threshold>
</testCase>
@@ -163,17 +163,17 @@
<testCase id="040001">
<class>Custom_Command</class>
<desc>Trigger Reestablishment</desc>
<node>cacofonix</node>
<command>echo ci force_reestab | nc 192.168.71.171 9090 | grep -E 'Reset RLC counters of UE RNTI [0-9a-f]{4} to trigger reestablishment'</command>
<node>acamas</node>
<command>echo ci force_reestab | ncat 192.168.71.171 9090 | grep -E 'Reset RLC counters of UE RNTI [0-9a-f]{4} to trigger reestablishment'</command>
</testCase>
<testCase id="020022">
<class>Ping</class>
<desc>Ping ext-dn from NR-UE</desc>
<id>rfsim5g_ue</id>
<nodes>cacofonix</nodes>
<nodes>acamas</nodes>
<svr_id>rfsim5g_ext_dn</svr_id>
<svr_node>cacofonix</svr_node>
<svr_node>acamas</svr_node>
<ping_args>-c 20 -i0.5 -w25</ping_args>
<ping_packetloss_threshold>80</ping_packetloss_threshold>
</testCase>
@@ -181,57 +181,57 @@
<testCase id="040002">
<class>Custom_Command</class>
<desc>Verify Reestablishment</desc>
<node>cacofonix</node>
<command>echo ci get_reestab_count | nc 192.168.71.150 9090 | grep -E 'UE RNTI [0-9a-f]{4} reestab 1'</command>
<node>acamas</node>
<command>echo ci get_reestab_count | ncat 192.168.71.150 9090 | grep -E 'UE RNTI [0-9a-f]{4} reestab 1'</command>
</testCase>
<testCase id="040021">
<class>Custom_Command</class>
<desc>Simulate a disruption of DL radio channel (ploss 55)</desc>
<node>cacofonix</node>
<command>echo channelmod modify 0 ploss 55 | nc 192.168.71.181 8091</command>
<node>acamas</node>
<command>echo channelmod modify 0 ploss 55 | ncat 192.168.71.181 8091</command>
</testCase>
<testCase id="040022">
<class>Custom_Command</class>
<desc>Get UE sync state (UE ID 0)</desc>
<node>cacofonix</node>
<command>echo ciUE sync_state 0 | nc 192.168.71.181 8091 | grep -E UE_NOT_SYNC</command>
<node>acamas</node>
<command>echo ciUE sync_state 0 | ncat 192.168.71.181 8091 | grep -E UE_NOT_SYNC</command>
</testCase>
<testCase id="040023">
<class>Custom_Command</class>
<desc>Restoration of the original DL channel conditions (ploss 20)</desc>
<node>cacofonix</node>
<command>echo channelmod modify 0 ploss 20 | nc 192.168.71.181 8091</command>
<node>acamas</node>
<command>echo channelmod modify 0 ploss 20 | ncat 192.168.71.181 8091</command>
</testCase>
<testCase id="040024">
<class>Custom_Command</class>
<desc>Get UE sync state (UE ID 0)</desc>
<node>cacofonix</node>
<command>echo ciUE sync_state 0 | nc 192.168.71.181 8091 | grep -E UE_CONNECTED</command>
<node>acamas</node>
<command>echo ciUE sync_state 0 | ncat 192.168.71.181 8091 | grep -E UE_CONNECTED</command>
</testCase>
<testCase id="040025">
<class>Custom_Command</class>
<desc>Trigger Handover</desc>
<node>cacofonix</node>
<command>echo ci trigger_f1_ho | nc 192.168.71.150 9090</command>
<node>acamas</node>
<command>echo ci trigger_f1_ho | ncat 192.168.71.150 9090</command>
</testCase>
<testCase id="040026">
<class>Custom_Command</class>
<desc>UE (1) connected to DU-PCI 0?</desc>
<node>cacofonix</node>
<command>echo ci fetch_du_by_ue_id 1 | nc 192.168.71.150 9090 | grep "3584"</command>
<node>acamas</node>
<command>echo ci fetch_du_by_ue_id 1 | ncat 192.168.71.150 9090 | grep "3584"</command>
</testCase>
<testCase id="040027">
<class>Custom_Command</class>
<desc>UE (1) connected to DU-PCI 1?</desc>
<node>cacofonix</node>
<command>echo ci fetch_du_by_ue_id 1 | nc 192.168.71.150 9090 | grep "3585"</command>
<node>acamas</node>
<command>echo ci fetch_du_by_ue_id 1 | ncat 192.168.71.150 9090 | grep "3585"</command>
</testCase>
<testCase id="100021">

View File

@@ -73,16 +73,16 @@
<class>Attach_UE</class>
<desc>Attach OAI UE (Wait for IP)</desc>
<id>rfsim5g_ue</id>
<nodes>cacofonix</nodes>
<nodes>acamas</nodes>
</testCase>
<testCase id="020011">
<class>Ping</class>
<desc>Ping ext-dn from NR-UE</desc>
<id>rfsim5g_ue</id>
<nodes>cacofonix</nodes>
<nodes>acamas</nodes>
<svr_id>rfsim5g_ext_dn</svr_id>
<svr_node>cacofonix</svr_node>
<svr_node>acamas</svr_node>
<ping_args>-c 20 -i 0.25</ping_args>
<ping_packetloss_threshold>5</ping_packetloss_threshold>
</testCase>
@@ -91,9 +91,9 @@
<class>Ping</class>
<desc>Ping NR-UE from ext-dn</desc>
<id>rfsim5g_ext_dn</id>
<nodes>cacofonix</nodes>
<nodes>acamas</nodes>
<svr_id>rfsim5g_ue</svr_id>
<svr_node>cacofonix</svr_node>
<svr_node>acamas</svr_node>
<ping_args>-c 20 -i 0.25</ping_args>
<ping_packetloss_threshold>5</ping_packetloss_threshold>
</testCase>
@@ -103,9 +103,9 @@
<desc>Iperf (DL/3Mbps/UDP)(30 sec)</desc>
<iperf_args>-u -b 3M -t 30 -R</iperf_args>
<id>rfsim5g_ue</id>
<nodes>cacofonix</nodes>
<nodes>acamas</nodes>
<svr_id>rfsim5g_ext_dn</svr_id>
<svr_node>cacofonix</svr_node>
<svr_node>acamas</svr_node>
<iperf_packetloss_threshold>5</iperf_packetloss_threshold>
<iperf_bitrate_threshold>90</iperf_bitrate_threshold>
</testCase>
@@ -115,9 +115,9 @@
<desc>Iperf (UL/3Mbps/UDP)(30 sec)</desc>
<iperf_args>-u -b 3M -t 30</iperf_args>
<id>rfsim5g_ue</id>
<nodes>cacofonix</nodes>
<nodes>acamas</nodes>
<svr_id>rfsim5g_ext_dn</svr_id>
<svr_node>cacofonix</svr_node>
<svr_node>acamas</svr_node>
<iperf_packetloss_threshold>5</iperf_packetloss_threshold>
<iperf_bitrate_threshold>90</iperf_bitrate_threshold>
</testCase>

View File

@@ -133,16 +133,16 @@
<class>Attach_UE</class>
<desc>Attach OAI UE (Wait for IP)</desc>
<id>rfsim5g_ue rfsim5g_ue2 rfsim5g_ue3 rfsim5g_ue4 rfsim5g_ue5 rfsim5g_ue6 rfsim5g_ue7 rfsim5g_ue8 rfsim5g_ue9 rfsim5g_ue10</id>
<nodes>cacofonix cacofonix cacofonix cacofonix cacofonix cacofonix cacofonix cacofonix cacofonix cacofonix</nodes>
<nodes>acamas acamas acamas acamas acamas acamas acamas acamas acamas acamas</nodes>
</testCase>
<testCase id="020001">
<class>Ping</class>
<desc>Ping ext-dn from NR-UE</desc>
<id>rfsim5g_ue</id>
<nodes>cacofonix</nodes>
<nodes>acamas</nodes>
<svr_id>rfsim5g_ext_dn</svr_id>
<svr_node>cacofonix</svr_node>
<svr_node>acamas</svr_node>
<ping_args>-c 20 -i 0.25</ping_args>
<ping_packetloss_threshold>5</ping_packetloss_threshold>
</testCase>
@@ -151,9 +151,9 @@
<class>Ping</class>
<desc>Ping NR-UE from ext-dn</desc>
<id>rfsim5g_ext_dn</id>
<nodes>cacofonix</nodes>
<nodes>acamas</nodes>
<svr_id>rfsim5g_ue</svr_id>
<svr_node>cacofonix</svr_node>
<svr_node>acamas</svr_node>
<ping_args>-c 20 -i 0.25</ping_args>
<ping_packetloss_threshold>5</ping_packetloss_threshold>
</testCase>
@@ -162,9 +162,9 @@
<class>Ping</class>
<desc>Ping ext-dn from Second NR-UE</desc>
<id>rfsim5g_ue2</id>
<nodes>cacofonix</nodes>
<nodes>acamas</nodes>
<svr_id>rfsim5g_ext_dn</svr_id>
<svr_node>cacofonix</svr_node>
<svr_node>acamas</svr_node>
<ping_args>-c 20 -i 0.25</ping_args>
<ping_packetloss_threshold>5</ping_packetloss_threshold>
</testCase>
@@ -173,9 +173,9 @@
<class>Ping</class>
<desc>Ping Second NR-UE from ext-dn</desc>
<id>rfsim5g_ext_dn</id>
<nodes>cacofonix</nodes>
<nodes>acamas</nodes>
<svr_id>rfsim5g_ue2</svr_id>
<svr_node>cacofonix</svr_node>
<svr_node>acamas</svr_node>
<ping_args>-c 20 -i 0.25</ping_args>
<ping_packetloss_threshold>5</ping_packetloss_threshold>
</testCase>
@@ -184,9 +184,9 @@
<class>Ping</class>
<desc>Ping ext-dn from both UEs</desc>
<id>rfsim5g_ue rfsim5g_ue2</id>
<nodes>cacofonix cacofonix</nodes>
<nodes>acamas acamas</nodes>
<svr_id>rfsim5g_ext_dn</svr_id>
<svr_node>cacofonix</svr_node>
<svr_node>acamas</svr_node>
<ping_args>-c 20 -i 0.25</ping_args>
<ping_packetloss_threshold>5</ping_packetloss_threshold>
</testCase>
@@ -195,9 +195,9 @@
<class>Ping</class>
<desc>Ping ext-dn from all UEs</desc>
<id>rfsim5g_ue rfsim5g_ue2 rfsim5g_ue3 rfsim5g_ue4 rfsim5g_ue5 rfsim5g_ue6 rfsim5g_ue7 rfsim5g_ue8 rfsim5g_ue9 rfsim5g_ue10</id>
<nodes>cacofonix cacofonix cacofonix cacofonix cacofonix cacofonix cacofonix cacofonix cacofonix cacofonix</nodes>
<nodes>acamas acamas acamas acamas acamas acamas acamas acamas acamas acamas</nodes>
<svr_id>rfsim5g_ext_dn</svr_id>
<svr_node>cacofonix</svr_node>
<svr_node>acamas</svr_node>
<ping_args>-c 20 -i 0.25 -s 1016</ping_args>
<ping_packetloss_threshold>5</ping_packetloss_threshold>
</testCase>
@@ -207,9 +207,9 @@
<desc>Iperf (DL/3Mbps/UDP)(30 sec)</desc>
<iperf_args>-u -b 3M -t 20 -R</iperf_args>
<id>rfsim5g_ue</id>
<nodes>cacofonix</nodes>
<nodes>acamas</nodes>
<svr_id>rfsim5g_ext_dn</svr_id>
<svr_node>cacofonix</svr_node>
<svr_node>acamas</svr_node>
<iperf_packetloss_threshold>5</iperf_packetloss_threshold>
<iperf_bitrate_threshold>90</iperf_bitrate_threshold>
</testCase>
@@ -219,9 +219,9 @@
<desc>Iperf (UL/1Mbps/UDP)(30 sec)</desc>
<iperf_args>-u -b 1M -t 20</iperf_args>
<id>rfsim5g_ue</id>
<nodes>cacofonix</nodes>
<nodes>acamas</nodes>
<svr_id>rfsim5g_ext_dn</svr_id>
<svr_node>cacofonix</svr_node>
<svr_node>acamas</svr_node>
<iperf_packetloss_threshold>5</iperf_packetloss_threshold>
<iperf_bitrate_threshold>90</iperf_bitrate_threshold>
</testCase>
@@ -230,21 +230,21 @@
<class>Attach_UE</class>
<desc>Attach OAI UE 1 and 2</desc>
<id>rfsim5g_ue rfsim5g_ue2</id>
<nodes>cacofonix cacofonix</nodes>
<nodes>acamas acamas</nodes>
</testCase>
<testCase id="444444">
<class>Detach_UE</class>
<desc>Detach OAI UE 1 and 2</desc>
<id>rfsim5g_ue rfsim5g_ue2</id>
<nodes>cacofonix cacofonix</nodes>
<nodes>acamas acamas</nodes>
</testCase>
<testCase id="444445">
<class>Detach_UE</class>
<desc>Detach OAI UE 3 to 10</desc>
<id>rfsim5g_ue3 rfsim5g_ue4 rfsim5g_ue5 rfsim5g_ue6 rfsim5g_ue7 rfsim5g_ue8 rfsim5g_ue9 rfsim5g_ue10</id>
<nodes>cacofonix cacofonix cacofonix cacofonix cacofonix cacofonix cacofonix cacofonix</nodes>
<nodes>acamas acamas acamas acamas acamas acamas acamas acamas</nodes>
</testCase>
<testCase id="100001">

View File

@@ -91,7 +91,7 @@
<class>Attach_UE</class>
<desc>Attach OAI UE (Wait for IP)</desc>
<id>rfsim5g_ue</id>
<nodes>cacofonix</nodes>
<nodes>acamas</nodes>
</testCase>
<testCase id="000004">
@@ -104,9 +104,9 @@
<class>Ping</class>
<desc>Ping ext-dn from NR-UE</desc>
<id>rfsim5g_ue</id>
<nodes>cacofonix</nodes>
<nodes>acamas</nodes>
<svr_id>rfsim5g_ext_dn</svr_id>
<svr_node>cacofonix</svr_node>
<svr_node>acamas</svr_node>
<ping_args> -c 20 -i0.5</ping_args>
<ping_packetloss_threshold>80</ping_packetloss_threshold>
</testCase>
@@ -115,9 +115,9 @@
<class>Ping</class>
<desc>Ping NR-UE from ext-dn</desc>
<id>rfsim5g_ext_dn</id>
<nodes>cacofonix</nodes>
<nodes>acamas</nodes>
<svr_id>rfsim5g_ue</svr_id>
<svr_node>cacofonix</svr_node>
<svr_node>acamas</svr_node>
<ping_args>-c 20 -i0.2</ping_args>
<ping_packetloss_threshold>5</ping_packetloss_threshold>
</testCase>
@@ -127,9 +127,9 @@
<desc>Iperf (DL/3Mbps/UDP)(30 sec)</desc>
<iperf_args>-u -b 3M -t 20 -R</iperf_args>
<id>rfsim5g_ue</id>
<nodes>cacofonix</nodes>
<nodes>acamas</nodes>
<svr_id>rfsim5g_ext_dn</svr_id>
<svr_node>cacofonix</svr_node>
<svr_node>acamas</svr_node>
<iperf_packetloss_threshold>5</iperf_packetloss_threshold>
<iperf_bitrate_threshold>90</iperf_bitrate_threshold>
</testCase>
@@ -139,9 +139,9 @@
<desc>Iperf (UL/1Mbps/UDP)(30 sec)</desc>
<iperf_args>-u -b 1M -t 20</iperf_args>
<id>rfsim5g_ue</id>
<nodes>cacofonix</nodes>
<nodes>acamas</nodes>
<svr_id>rfsim5g_ext_dn</svr_id>
<svr_node>cacofonix</svr_node>
<svr_node>acamas</svr_node>
<iperf_packetloss_threshold>5</iperf_packetloss_threshold>
<iperf_bitrate_threshold>90</iperf_bitrate_threshold>
</testCase>
@@ -149,15 +149,15 @@
<testCase id="040001">
<class>Custom_Command</class>
<desc>Force Msg3 C-RNTI RA</desc>
<node>cacofonix</node>
<command>echo ciUE force_crnti_ra | nc 192.168.71.150 8091</command>
<node>acamas</node>
<command>echo ciUE force_crnti_ra | ncat 192.168.71.150 8091</command>
</testCase>
<testCase id="040002">
<class>Custom_Command</class>
<desc>Force RRC_IDLE (UE ID 0)</desc>
<node>cacofonix</node>
<command>echo ciUE force_RRC_IDLE | nc 192.168.71.150 8091</command>
<node>acamas</node>
<command>echo ciUE force_RRC_IDLE | ncat 192.168.71.150 8091</command>
</testCase>
<testCase id="100001">

View File

@@ -73,16 +73,16 @@
<class>Attach_UE</class>
<desc>Attach OAI UE (Wait for IP)</desc>
<id>rfsim5g_ue</id>
<nodes>cacofonix</nodes>
<nodes>acamas</nodes>
</testCase>
<testCase id="020001">
<class>Ping</class>
<desc>Ping ext-dn from NR-UE</desc>
<id>rfsim5g_ue</id>
<nodes>cacofonix</nodes>
<nodes>acamas</nodes>
<svr_id>rfsim5g_ext_dn</svr_id>
<svr_node>cacofonix</svr_node>
<svr_node>acamas</svr_node>
<ping_args>-c 20 -i 0.25</ping_args>
<ping_packetloss_threshold>5</ping_packetloss_threshold>
</testCase>
@@ -91,9 +91,9 @@
<class>Ping</class>
<desc>Ping NR-UE from ext-dn</desc>
<id>rfsim5g_ext_dn</id>
<nodes>cacofonix</nodes>
<nodes>acamas</nodes>
<svr_id>rfsim5g_ue</svr_id>
<svr_node>cacofonix</svr_node>
<svr_node>acamas</svr_node>
<ping_args>-c 20 -i 0.25</ping_args>
<ping_packetloss_threshold>5</ping_packetloss_threshold>
</testCase>
@@ -103,21 +103,21 @@
<desc>Iperf (DL/10Mbps/UDP)(30 sec)</desc>
<iperf_args>-u -b 10M -t 20 -R</iperf_args>
<id>rfsim5g_ue</id>
<nodes>cacofonix</nodes>
<nodes>acamas</nodes>
<svr_id>rfsim5g_ext_dn</svr_id>
<svr_node>cacofonix</svr_node>
<svr_node>acamas</svr_node>
<iperf_packetloss_threshold>5</iperf_packetloss_threshold>
<iperf_bitrate_threshold>90</iperf_bitrate_threshold>
</testCase>
<testCase id="030002">
<class>Iperf</class>
<desc>Iperf (UL/4Mbps/UDP)(30 sec)</desc>
<iperf_args>-u -b 4M -t 20</iperf_args>
<desc>Iperf (UL/3Mbps/UDP)(30 sec)</desc>
<iperf_args>-u -b 3M -t 20</iperf_args>
<id>rfsim5g_ue</id>
<nodes>cacofonix</nodes>
<nodes>acamas</nodes>
<svr_id>rfsim5g_ext_dn</svr_id>
<svr_node>cacofonix</svr_node>
<svr_node>acamas</svr_node>
<iperf_packetloss_threshold>5</iperf_packetloss_threshold>
<iperf_bitrate_threshold>90</iperf_bitrate_threshold>
</testCase>

View File

@@ -49,7 +49,7 @@
<testCase id="004000">
<class>Custom_Command</class>
<desc>Clean-Up any residual volume</desc>
<node>cacofonix</node>
<node>acamas</node>
<command>docker volume rm 5g_rfsimulator_fdd_phytest_rrc.config -f</command>
</testCase>
<testCase id="800813">
@@ -80,9 +80,9 @@
<class>Ping</class>
<desc>Ping gNB from NR-UE</desc>
<id>rfsim5g_ue</id>
<nodes>cacofonix</nodes>
<nodes>acamas</nodes>
<svr_id>rfsim5g_gnb_nos1</svr_id>
<svr_node>cacofonix</svr_node>
<svr_node>acamas</svr_node>
<ping_args>-c20 -i0.2</ping_args>
<ping_packetloss_threshold>0</ping_packetloss_threshold>
</testCase>
@@ -91,9 +91,9 @@
<class>Ping</class>
<desc>Ping NR-UE from gNB</desc>
<id>rfsim5g_gnb_nos1</id>
<nodes>cacofonix</nodes>
<nodes>acamas</nodes>
<svr_id>rfsim5g_ue</svr_id>
<svr_node>cacofonix</svr_node>
<svr_node>acamas</svr_node>
<ping_args>-c20 -i0.2</ping_args>
<ping_packetloss_threshold>0</ping_packetloss_threshold>
</testCase>
@@ -103,9 +103,9 @@
<desc>Iperf (DL/30kbps/UDP)(30 sec)</desc>
<iperf_args>-u -b 0.03M -t 20 -R -c 10.0.1.1</iperf_args>
<id>rfsim5g_ue</id>
<nodes>cacofonix</nodes>
<nodes>acamas</nodes>
<svr_id>rfsim5g_gnb_nos1</svr_id>
<svr_node>cacofonix</svr_node>
<svr_node>acamas</svr_node>
<iperf_packetloss_threshold>5</iperf_packetloss_threshold>
<iperf_bitrate_threshold>90</iperf_bitrate_threshold>
</testCase>
@@ -115,9 +115,9 @@
<desc>Iperf (UL/30kbps/UDP)(30 sec)</desc>
<iperf_args>-u -b 0.03M -t 20 -c 10.0.1.1</iperf_args>
<id>rfsim5g_ue</id>
<nodes>cacofonix</nodes>
<nodes>acamas</nodes>
<svr_id>rfsim5g_gnb_nos1</svr_id>
<svr_node>cacofonix</svr_node>
<svr_node>acamas</svr_node>
<iperf_packetloss_threshold>5</iperf_packetloss_threshold>
<iperf_bitrate_threshold>90</iperf_bitrate_threshold>
</testCase>

View File

@@ -29,6 +29,7 @@
800813
000000
000001
000013
020001
020002
100001
@@ -68,13 +69,20 @@
<eNB_serverId>0</eNB_serverId>
</testCase>
<testCase id="000013">
<class>Attach_UE</class>
<desc>Attach OAI UE (Wait for IP)</desc>
<id>rfsim5g_ue</id>
<nodes>acamas</nodes>
</testCase>
<testCase id="020001">
<class>Ping</class>
<desc>Ping ext-dn from NR-UE</desc>
<id>rfsim5g_ue</id>
<nodes>cacofonix</nodes>
<nodes>acamas</nodes>
<svr_id>rfsim5g_ext_dn</svr_id>
<svr_node>cacofonix</svr_node>
<svr_node>acamas</svr_node>
<ping_args>-c 20 -i0.2</ping_args>
<ping_packetloss_threshold>0</ping_packetloss_threshold>
</testCase>
@@ -83,9 +91,9 @@
<class>Ping</class>
<desc>Ping NR-UE from ext-dn</desc>
<id>rfsim5g_ext_dn</id>
<nodes>cacofonix</nodes>
<nodes>acamas</nodes>
<svr_id>rfsim5g_ue</svr_id>
<svr_node>cacofonix</svr_node>
<svr_node>acamas</svr_node>
<ping_args>-c 20 -i0.2</ping_args>
<ping_packetloss_threshold>0</ping_packetloss_threshold>
</testCase>

View File

@@ -33,6 +33,11 @@
000003
020001
020002
040001
020022
040002
020001
020002
100001
222222
</TestCaseRequestedList>
@@ -73,16 +78,16 @@
<class>Attach_UE</class>
<desc>Attach OAI UE (Wait for IP)</desc>
<id>rfsim5g_ue</id>
<nodes>cacofonix</nodes>
<nodes>acamas</nodes>
</testCase>
<testCase id="020001">
<class>Ping</class>
<desc>Ping ext-dn from NR-UE</desc>
<id>rfsim5g_ue</id>
<nodes>cacofonix</nodes>
<nodes>acamas</nodes>
<svr_id>rfsim5g_ext_dn</svr_id>
<svr_node>cacofonix</svr_node>
<svr_node>acamas</svr_node>
<ping_args>-c 20 -i 0.25</ping_args>
<ping_packetloss_threshold>5</ping_packetloss_threshold>
</testCase>
@@ -91,13 +96,40 @@
<class>Ping</class>
<desc>Ping NR-UE from ext-dn</desc>
<id>rfsim5g_ext_dn</id>
<nodes>cacofonix</nodes>
<nodes>acamas</nodes>
<svr_id>rfsim5g_ue</svr_id>
<svr_node>cacofonix</svr_node>
<svr_node>acamas</svr_node>
<ping_args>-c 20 -i 0.25</ping_args>
<ping_packetloss_threshold>5</ping_packetloss_threshold>
</testCase>
<testCase id="040001">
<class>Custom_Command</class>
<desc>Trigger Reestablishment</desc>
<node>acamas</node>
<command>echo ci force_reestab | ncat 192.168.71.140 9090 | grep -E 'Reset RLC counters of UE RNTI [0-9a-f]{4} to trigger reestablishment'</command>
<command_fail>yes</command_fail>
</testCase>
<testCase id="020022">
<class>Ping</class>
<desc>Ping ext-dn from NR-UE</desc>
<id>rfsim5g_ue</id>
<nodes>acamas</nodes>
<svr_id>rfsim5g_ext_dn</svr_id>
<svr_node>acamas</svr_node>
<ping_args>-c 20 -i0.5 -w25</ping_args>
<ping_packetloss_threshold>80</ping_packetloss_threshold>
</testCase>
<testCase id="040002">
<class>Custom_Command</class>
<desc>Verify Reestablishment</desc>
<node>acamas</node>
<command>echo ci get_reestab_count | ncat 192.168.71.140 9090 | grep -E 'UE RNTI [0-9a-f]{4} reestab 1'</command>
<command_fail>yes</command_fail>
</testCase>
<testCase id="100001">
<class>Undeploy_Object</class>
<always_exec>true</always_exec>

View File

@@ -73,16 +73,16 @@
<class>Attach_UE</class>
<desc>Attach OAI UE (Wait for IP)</desc>
<id>rfsim5g_ue</id>
<nodes>cacofonix</nodes>
<nodes>acamas</nodes>
</testCase>
<testCase id="020001">
<class>Ping</class>
<desc>Ping ext-dn from NR-UE</desc>
<id>rfsim5g_ue</id>
<nodes>cacofonix</nodes>
<nodes>acamas</nodes>
<svr_id>rfsim5g_ext_dn</svr_id>
<svr_node>cacofonix</svr_node>
<svr_node>acamas</svr_node>
<ping_args>-c 20 -i 0.25</ping_args>
<ping_packetloss_threshold>5</ping_packetloss_threshold>
</testCase>
@@ -91,9 +91,9 @@
<class>Ping</class>
<desc>Ping NR-UE from ext-dn</desc>
<id>rfsim5g_ext_dn</id>
<nodes>cacofonix</nodes>
<nodes>acamas</nodes>
<svr_id>rfsim5g_ue</svr_id>
<svr_node>cacofonix</svr_node>
<svr_node>acamas</svr_node>
<ping_args>-c 20 -i 0.25</ping_args>
<ping_packetloss_threshold>5</ping_packetloss_threshold>
</testCase>

View File

@@ -77,7 +77,7 @@
<testCase id="000005">
<class>Custom_Command</class>
<desc>Check that UE synched</desc>
<node>cacofonix</node>
<node>acamas</node>
<command>docker logs rfsim5g-oai-nr-ue-2 | grep -m 1 "PSBCH RX:OK"</command>
</testCase>

View File

@@ -30,6 +30,7 @@
004000
000000
000001
000030
020001
020002
100001
@@ -48,7 +49,7 @@
<testCase id="004000">
<class>Custom_Command</class>
<desc>Clean-Up any residual volume</desc>
<node>cacofonix</node>
<node>acamas</node>
<command>docker volume rm 5g_rfsimulator_tdd_dora_rrc.config -f</command>
</testCase>
<testCase id="800813">
@@ -75,13 +76,19 @@
<eNB_serverId>0</eNB_serverId>
</testCase>
<testCase id="000030">
<class>IdleSleep</class>
<desc>Sleep</desc>
<idle_sleep_time_in_sec>5</idle_sleep_time_in_sec>
</testCase>
<testCase id="020001">
<class>Ping</class>
<desc>Ping gNB from NR-UE</desc>
<id>rfsim5g_ue</id>
<nodes>cacofonix</nodes>
<nodes>acamas</nodes>
<svr_id>rfsim5g_gnb_nos1</svr_id>
<svr_node>cacofonix</svr_node>
<svr_node>acamas</svr_node>
<ping_args>-c20 -i0.2</ping_args>
<ping_packetloss_threshold>0</ping_packetloss_threshold>
</testCase>
@@ -90,9 +97,9 @@
<class>Ping</class>
<desc>Ping NR-UE from gNB</desc>
<id>rfsim5g_gnb_nos1</id>
<nodes>cacofonix</nodes>
<nodes>acamas</nodes>
<svr_id>rfsim5g_ue</svr_id>
<svr_node>cacofonix</svr_node>
<svr_node>acamas</svr_node>
<ping_args>-c20 -i0.2</ping_args>
<ping_packetloss_threshold>0</ping_packetloss_threshold>
</testCase>

View File

@@ -73,16 +73,16 @@
<class>Attach_UE</class>
<desc>Attach OAI UE (Wait for IP)</desc>
<id>rfsim5g_ue</id>
<nodes>cacofonix</nodes>
<nodes>acamas</nodes>
</testCase>
<testCase id="020001">
<class>Ping</class>
<desc>Ping ext-dn from NR-UE</desc>
<id>rfsim5g_ue</id>
<nodes>cacofonix</nodes>
<nodes>acamas</nodes>
<svr_id>rfsim5g_ext_dn</svr_id>
<svr_node>cacofonix</svr_node>
<svr_node>acamas</svr_node>
<ping_args>-c 20 -i 0.25</ping_args>
<ping_packetloss_threshold>5</ping_packetloss_threshold>
</testCase>
@@ -91,9 +91,9 @@
<class>Ping</class>
<desc>Ping NR-UE from ext-dn</desc>
<id>rfsim5g_ext_dn</id>
<nodes>cacofonix</nodes>
<nodes>acamas</nodes>
<svr_id>rfsim5g_ue</svr_id>
<svr_node>cacofonix</svr_node>
<svr_node>acamas</svr_node>
<ping_args>-c 20 -i 0.25</ping_args>
<ping_packetloss_threshold>5</ping_packetloss_threshold>
</testCase>
@@ -103,9 +103,9 @@
<desc>Iperf (DL/3Mbps/UDP)(30 sec)</desc>
<iperf_args>-u -b 3M -t 20 -R</iperf_args>
<id>rfsim5g_ue</id>
<nodes>cacofonix</nodes>
<nodes>acamas</nodes>
<svr_id>rfsim5g_ext_dn</svr_id>
<svr_node>cacofonix</svr_node>
<svr_node>acamas</svr_node>
<iperf_packetloss_threshold>5</iperf_packetloss_threshold>
<iperf_bitrate_threshold>90</iperf_bitrate_threshold>
</testCase>
@@ -115,9 +115,9 @@
<desc>Iperf (UL/1Mbps/UDP)(30 sec)</desc>
<iperf_args>-u -b 1M -t 20</iperf_args>
<id>rfsim5g_ue</id>
<nodes>cacofonix</nodes>
<nodes>acamas</nodes>
<svr_id>rfsim5g_ext_dn</svr_id>
<svr_node>cacofonix</svr_node>
<svr_node>acamas</svr_node>
<iperf_packetloss_threshold>5</iperf_packetloss_threshold>
<iperf_bitrate_threshold>90</iperf_bitrate_threshold>
</testCase>

View File

@@ -34,6 +34,7 @@
000111
000011
000022
200022
000033
000222
222222
@@ -105,6 +106,17 @@
<iperf_bitrate_threshold>80</iperf_bitrate_threshold>
</testCase>
<testCase id="200022">
<class>Iperf</class>
<desc>Optional iperf (DL/UDP/1000M)(30 sec)(single-ue profile)</desc>
<may_fail>true</may_fail>
<iperf_args>-u -b 1000M -t 30 -R</iperf_args>
<svr_id>oc-cn5g-20897-aerial</svr_id>
<id>up2-aerial</id>
<iperf_packetloss_threshold>25</iperf_packetloss_threshold>
<iperf_bitrate_threshold>80</iperf_bitrate_threshold>
</testCase>
<testCase id="000033">
<class>Iperf</class>
<desc>iperf (UL/UDP/40M)(30 sec)(single-ue profile)</desc>

View File

@@ -10,7 +10,7 @@ services:
CASSANDRA_ENDPOINT_SNITCH: GossipingPropertyFileSnitch
healthcheck:
test: /bin/bash -c "nodetool status"
interval: 10s
interval: 20s
timeout: 5s
retries: 5

View File

@@ -2,6 +2,7 @@ services:
mysql:
container_name: "rfsim5g-mysql"
image: mysql:8.0
init: true
volumes:
- ../5g_rfsimulator/oai_db.sql:/docker-entrypoint-initdb.d/oai_db.sql
- ../5g_rfsimulator/mysql-healthcheck.sh:/tmp/mysql-healthcheck.sh
@@ -13,6 +14,8 @@ services:
- MYSQL_ROOT_PASSWORD=linux
healthcheck:
test: /bin/bash -c "/tmp/mysql-healthcheck.sh"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 30
@@ -46,6 +49,7 @@ services:
oai-upf:
container_name: "rfsim5g-oai-upf"
image: oaisoftwarealliance/oai-upf:v2.1.9
init: true
environment:
- TZ=Europe/Paris
volumes:
@@ -61,13 +65,16 @@ services:
networks:
public_net:
ipv4_address: 192.168.71.134
interface_name: eth0
traffic_net:
ipv4_address: 192.168.72.134
interface_name: eth1
oai-ext-dn:
privileged: true
container_name: rfsim5g-oai-ext-dn
image: oaisoftwarealliance/trf-gen-cn5g:focal
init: true
entrypoint: /bin/bash -c \
"iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE;"\
"ip route add 12.1.1.0/24 via 192.168.72.134 dev eth0; sleep infinity"
@@ -78,6 +85,8 @@ services:
ipv4_address: 192.168.72.135
healthcheck:
test: /bin/bash -c "ping -c 2 192.168.72.134"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 5
@@ -87,6 +96,8 @@ services:
container_name: rfsim5g-oai-cu
cap_drop:
- ALL
cap_add:
- SYS_NICE
environment:
USE_ADDITIONAL_OPTIONS: --log_config.global_log_options level,nocolor,time
--rfsimulator.options chanmod
@@ -103,6 +114,8 @@ services:
- ../../conf_files/gnb-cu.sa.band78.106prb.conf:/opt/oai-gnb/etc/gnb.conf
healthcheck:
test: /bin/bash -c "pgrep nr-softmodem"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 5
@@ -112,6 +125,8 @@ services:
container_name: rfsim5g-oai-du-pci0
cap_drop:
- ALL
cap_add:
- SYS_NICE
environment:
USE_ADDITIONAL_OPTIONS: --rfsim
--log_config.global_log_options level,nocolor,time
@@ -130,6 +145,8 @@ services:
- ../../conf_files/gnb-du.sa.band78.106prb.rfsim.conf:/opt/oai-gnb/etc/gnb.conf
healthcheck:
test: /bin/bash -c "pgrep nr-softmodem"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 5
@@ -139,6 +156,8 @@ services:
container_name: rfsim5g-oai-du-pci1
cap_drop:
- ALL
cap_add:
- SYS_NICE
environment:
USE_ADDITIONAL_OPTIONS: --rfsim
--log_config.global_log_options level,nocolor,time
@@ -161,6 +180,8 @@ services:
- ../../conf_files/gnb-du.sa.band78.106prb.rfsim.conf:/opt/oai-gnb/etc/gnb.conf
healthcheck:
test: /bin/bash -c "pgrep nr-softmodem"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 5
@@ -173,13 +194,13 @@ services:
cap_add:
- NET_ADMIN # for interface bringup
- NET_RAW # for ping
- SYS_NICE
environment:
USE_ADDITIONAL_OPTIONS: --rfsim --log_config.global_log_options level,nocolor,time
-r 106 --numerology 1 -C 3619200000
--uicc0.imsi 208990100001100
--rfsimulator.options chanmod
--rfsimulator.serveraddr server
--rfsimulator.hanging-workaround 1
--telnetsrv --telnetsrv.shrmod ciUE --telnetsrv.listenaddr 192.168.71.181 --telnetsrv.listenport 8091
--channelmod.modellist_rfsimu_1.[0].model_name rfsimu_channel_ue0
--channelmod.modellist_rfsimu_1.[1].model_name rfsimu_channel_ue1
@@ -193,6 +214,8 @@ services:
- ../../conf_files/nrue.uicc.conf:/opt/oai-nr-ue/etc/nr-ue.conf
healthcheck:
test: /bin/bash -c "pgrep nr-uesoftmodem"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 5

View File

@@ -2,6 +2,7 @@ services:
mysql:
container_name: "rfsim5g-mysql"
image: mysql:8.0
init: true
volumes:
- ../5g_rfsimulator/oai_db.sql:/docker-entrypoint-initdb.d/oai_db.sql
- ../5g_rfsimulator/mysql-healthcheck.sh:/tmp/mysql-healthcheck.sh
@@ -15,6 +16,8 @@ services:
test: /bin/bash -c "/tmp/mysql-healthcheck.sh"
interval: 10s
timeout: 5s
start_period: 10s
start_interval: 500ms
retries: 30
networks:
public_net:
@@ -46,6 +49,7 @@ services:
oai-upf:
container_name: "rfsim5g-oai-upf"
image: oaisoftwarealliance/oai-upf:v2.1.9
init: true
environment:
- TZ=Europe/Paris
volumes:
@@ -61,12 +65,15 @@ services:
networks:
public_net:
ipv4_address: 192.168.71.134
interface_name: eth0
traffic_net:
ipv4_address: 192.168.72.134
interface_name: eth1
oai-ext-dn:
privileged: true
container_name: rfsim5g-oai-ext-dn
image: oaisoftwarealliance/trf-gen-cn5g:focal
init: true
entrypoint: /bin/bash -c \
"iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE;"\
"ip route add 12.1.1.0/24 via 192.168.72.134 dev eth0; sleep infinity"
@@ -80,6 +87,8 @@ services:
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
start_interval: 500ms
oai-gnb:
image: ${REGISTRY:-oaisoftwarealliance}/${GNB_IMG:-oai-gnb}:${TAG:-develop}
container_name: rfsim5g-oai-gnb
@@ -99,6 +108,8 @@ services:
test: /bin/bash -c "pgrep nr-softmodem"
interval: 10s
timeout: 5s
start_period: 10s
start_interval: 500ms
retries: 5
ipc: host
oai-nr-ue:
@@ -126,6 +137,8 @@ services:
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
start_interval: 500ms
ipc: host
networks:

View File

@@ -67,6 +67,18 @@ All the following commands **SHALL** be run from the `ci-scripts/yaml_files/5g_r
For a deployment with the gNB split in CU and DU components, please refer to the `../5g_f1_rfsimulator` folder.
For a deployment with the gNB split in CU-CP, CU-UP, and DU components, please refer to the `../5g_rfsimulator_e1` folder.
Note: **These instructions require `docker compose` v2.36.0 or later** due to the
use of the `interface_name` property, which is necessary for ensuring consistent
IP address assignment to the container interface.
If you're using an older version of `docker compose`, you may encounter the following
error:
```
validating docker-compose.yaml: services.oai-upf.networks.public_net Additional property interface_name is not allowed
```
To update to the required version, you can follow the official Docker documentation:
https://docs.docker.com/compose/install/linux/
## 2.1. Deploy OAI 5G Core Network ##
```bash
@@ -546,8 +558,7 @@ section in the file for details. This includes an image build service as well as
code compilation service. This is necessary as the executable has to be linked
against the same libraries that are present in the executing image. This might
take a while the first time but other that that is very fast. Here is a list of
commands (wait between each command). Tested with `docker compose` v2.27.0
commands (wait between each command). Tested with `docker compose` v2.36.2.
This command deploys OAI 5G Core Network
```bash

View File

@@ -2,6 +2,7 @@ services:
mysql:
container_name: "rfsim5g-mysql"
image: mysql:8.0
init: true
volumes:
- ./oai_db.sql:/docker-entrypoint-initdb.d/oai_db.sql
- ./mysql-healthcheck.sh:/tmp/mysql-healthcheck.sh
@@ -13,6 +14,8 @@ services:
- MYSQL_ROOT_PASSWORD=linux
healthcheck:
test: /bin/bash -c "/tmp/mysql-healthcheck.sh"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 30
@@ -46,6 +49,7 @@ services:
oai-upf:
container_name: "rfsim5g-oai-upf"
image: oaisoftwarealliance/oai-upf:v2.1.9
init: true
environment:
- TZ=Europe/Paris
volumes:
@@ -61,12 +65,15 @@ services:
networks:
public_net:
ipv4_address: 192.168.71.134
interface_name: eth0
traffic_net:
ipv4_address: 192.168.72.134
interface_name: eth1
oai-ext-dn:
privileged: true
container_name: rfsim5g-oai-ext-dn
image: oaisoftwarealliance/trf-gen-cn5g:focal
init: true
entrypoint: /bin/bash -c \
"iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE;"\
"ip route add 12.1.1.0/24 via 192.168.72.134 dev eth0; sleep infinity"
@@ -77,12 +84,16 @@ services:
ipv4_address: 192.168.72.135
healthcheck:
test: /bin/bash -c "ping -c 2 192.168.72.134"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 5
oai-gnb:
image: ${REGISTRY:-oaisoftwarealliance}/${GNB_IMG:-oai-gnb}:${TAG:-develop}
container_name: rfsim5g-oai-gnb
cap_add:
- SYS_NICE
cap_drop:
- ALL
environment:
@@ -97,6 +108,8 @@ services:
- ../../conf_files/gnb.sa.band78.106prb.rfsim.yaml:/opt/oai-gnb/etc/gnb.yaml
healthcheck:
test: /bin/bash -c "pgrep nr-softmodem"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 5
@@ -108,6 +121,7 @@ services:
cap_add:
- NET_ADMIN # for interface bringup
- NET_RAW # for ping
- SYS_NICE
environment:
USE_ADDITIONAL_OPTIONS: -E --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001100 -C 3319680000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time
depends_on:
@@ -121,6 +135,8 @@ services:
- ../../conf_files/nrue.uicc.yaml:/opt/oai-nr-ue/etc/nr-ue.yaml
healthcheck:
test: /bin/bash -c "pgrep nr-uesoftmodem"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 5
@@ -132,6 +148,7 @@ services:
cap_add:
- NET_ADMIN # for interface bringup
- NET_RAW # for ping
- SYS_NICE
environment:
USE_ADDITIONAL_OPTIONS: -E --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001101 -C 3319680000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time
depends_on:
@@ -145,6 +162,8 @@ services:
- ../../conf_files/nrue.uicc.conf:/opt/oai-nr-ue/etc/nr-ue.conf
healthcheck:
test: /bin/bash -c "pgrep nr-uesoftmodem"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 5
@@ -156,6 +175,7 @@ services:
cap_add:
- NET_ADMIN # for interface bringup
- NET_RAW # for ping
- SYS_NICE
environment:
USE_ADDITIONAL_OPTIONS: -E --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001102 -C 3319680000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time
depends_on:
@@ -169,6 +189,8 @@ services:
- ../../conf_files/nrue.uicc.conf:/opt/oai-nr-ue/etc/nr-ue.conf
healthcheck:
test: /bin/bash -c "pgrep nr-uesoftmodem"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 5
@@ -180,6 +202,7 @@ services:
cap_add:
- NET_ADMIN # for interface bringup
- NET_RAW # for ping
- SYS_NICE
environment:
USE_ADDITIONAL_OPTIONS: -E --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001103 -C 3319680000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time
depends_on:
@@ -193,6 +216,8 @@ services:
- ../../conf_files/nrue.uicc.conf:/opt/oai-nr-ue/etc/nr-ue.conf
healthcheck:
test: /bin/bash -c "pgrep nr-uesoftmodem"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 5
@@ -204,6 +229,7 @@ services:
cap_add:
- NET_ADMIN # for interface bringup
- NET_RAW # for ping
- SYS_NICE
environment:
USE_ADDITIONAL_OPTIONS: -E --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001104 -C 3319680000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time
depends_on:
@@ -217,6 +243,8 @@ services:
- ../../conf_files/nrue.uicc.conf:/opt/oai-nr-ue/etc/nr-ue.conf
healthcheck:
test: /bin/bash -c "pgrep nr-uesoftmodem"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 5
@@ -228,6 +256,7 @@ services:
cap_add:
- NET_ADMIN # for interface bringup
- NET_RAW # for ping
- SYS_NICE
environment:
USE_ADDITIONAL_OPTIONS: -E --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001105 -C 3319680000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time
depends_on:
@@ -241,6 +270,8 @@ services:
- ../../conf_files/nrue.uicc.conf:/opt/oai-nr-ue/etc/nr-ue.conf
healthcheck:
test: /bin/bash -c "pgrep nr-uesoftmodem"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 5
@@ -252,6 +283,7 @@ services:
cap_add:
- NET_ADMIN # for interface bringup
- NET_RAW # for ping
- SYS_NICE
environment:
USE_ADDITIONAL_OPTIONS: -E --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001106 -C 3319680000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time
depends_on:
@@ -265,6 +297,8 @@ services:
- ../../conf_files/nrue.uicc.conf:/opt/oai-nr-ue/etc/nr-ue.conf
healthcheck:
test: /bin/bash -c "pgrep nr-uesoftmodem"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 5
@@ -276,6 +310,7 @@ services:
cap_add:
- NET_ADMIN # for interface bringup
- NET_RAW # for ping
- SYS_NICE
environment:
USE_ADDITIONAL_OPTIONS: -E --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001107 -C 3319680000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time
depends_on:
@@ -289,6 +324,8 @@ services:
- ../../conf_files/nrue.uicc.conf:/opt/oai-nr-ue/etc/nr-ue.conf
healthcheck:
test: /bin/bash -c "pgrep nr-uesoftmodem"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 5
@@ -300,6 +337,7 @@ services:
cap_add:
- NET_ADMIN # for interface bringup
- NET_RAW # for ping
- SYS_NICE
environment:
USE_ADDITIONAL_OPTIONS: -E --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001108 -C 3319680000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time
depends_on:
@@ -313,6 +351,8 @@ services:
- ../../conf_files/nrue.uicc.conf:/opt/oai-nr-ue/etc/nr-ue.conf
healthcheck:
test: /bin/bash -c "pgrep nr-uesoftmodem"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 5
@@ -324,6 +364,7 @@ services:
cap_add:
- NET_ADMIN # for interface bringup
- NET_RAW # for ping
- SYS_NICE
environment:
USE_ADDITIONAL_OPTIONS: -E --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001109 -C 3319680000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time
depends_on:
@@ -337,6 +378,8 @@ services:
- ../../conf_files/nrue.uicc.conf:/opt/oai-nr-ue/etc/nr-ue.conf
healthcheck:
test: /bin/bash -c "pgrep nr-uesoftmodem"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 5

View File

@@ -2,6 +2,7 @@ services:
mysql:
container_name: "rfsim5g-mysql"
image: mysql:8.0
init: true
volumes:
- ../5g_rfsimulator/oai_db.sql:/docker-entrypoint-initdb.d/oai_db.sql
- ../5g_rfsimulator/mysql-healthcheck.sh:/tmp/mysql-healthcheck.sh
@@ -13,6 +14,8 @@ services:
- MYSQL_ROOT_PASSWORD=linux
healthcheck:
test: /bin/bash -c "/tmp/mysql-healthcheck.sh"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 30
@@ -46,6 +49,7 @@ services:
oai-upf:
container_name: "rfsim5g-oai-upf"
image: oaisoftwarealliance/oai-upf:v2.1.9
init: true
environment:
- TZ=Europe/Paris
volumes:
@@ -61,12 +65,15 @@ services:
networks:
public_net:
ipv4_address: 192.168.71.134
interface_name: eth0
traffic_net:
ipv4_address: 192.168.72.134
interface_name: eth1
oai-ext-dn:
privileged: true
container_name: rfsim5g-oai-ext-dn
image: oaisoftwarealliance/trf-gen-cn5g:focal
init: true
entrypoint: /bin/bash -c \
"iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE;"\
"ip route add 12.1.1.0/24 via 192.168.72.134 dev eth0; sleep infinity"
@@ -77,6 +84,8 @@ services:
ipv4_address: 192.168.72.135
healthcheck:
test: /bin/bash -c "ping -c 2 192.168.72.134"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 5
@@ -97,6 +106,8 @@ services:
- ../../conf_files/gnb.sa.band78.24prb.rfsim.conf:/opt/oai-gnb/etc/gnb.conf
healthcheck:
test: /bin/bash -c "pgrep nr-softmodem"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 5
@@ -124,6 +135,8 @@ services:
- ../../conf_files/nrue.uicc.conf:/opt/oai-nr-ue/etc/nr-ue.conf
healthcheck:
test: /bin/bash -c "pgrep nr-uesoftmodem"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 5

View File

@@ -2,6 +2,7 @@ services:
mysql:
container_name: "rfsim5g-mysql"
image: mysql:8.0
init: true
volumes:
- ../5g_rfsimulator/oai_db.sql:/docker-entrypoint-initdb.d/oai_db.sql
- ../5g_rfsimulator/mysql-healthcheck.sh:/tmp/mysql-healthcheck.sh
@@ -13,6 +14,8 @@ services:
- MYSQL_ROOT_PASSWORD=linux
healthcheck:
test: /bin/bash -c "/tmp/mysql-healthcheck.sh"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 30
@@ -46,6 +49,7 @@ services:
oai-upf:
container_name: "rfsim5g-oai-upf"
image: oaisoftwarealliance/oai-upf:v2.1.9
init: true
environment:
- TZ=Europe/Paris
volumes:
@@ -61,12 +65,15 @@ services:
networks:
public_net:
ipv4_address: 192.168.71.134
interface_name: eth0
traffic_net:
ipv4_address: 192.168.72.134
interface_name: eth1
oai-ext-dn:
privileged: true
container_name: rfsim5g-oai-ext-dn
image: oaisoftwarealliance/trf-gen-cn5g:focal
init: true
entrypoint: /bin/bash -c \
"iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE;"\
"ip route add 12.1.1.0/24 via 192.168.72.134 dev eth0; sleep infinity"
@@ -77,6 +84,8 @@ services:
ipv4_address: 192.168.72.135
healthcheck:
test: /bin/bash -c "ping -c 2 192.168.72.134"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 5
@@ -85,6 +94,8 @@ services:
container_name: rfsim5g-oai-gnb
cap_drop:
- ALL
cap_add:
- SYS_NICE
environment:
USE_ADDITIONAL_OPTIONS: --rfsim --log_config.global_log_options level,nocolor,time
ASAN_OPTIONS: detect_leaks=0
@@ -97,6 +108,8 @@ services:
- ../../conf_files/gnb.sa.band78.273prb.rfsim.2x2.conf:/opt/oai-gnb/etc/gnb.conf
healthcheck:
test: /bin/bash -c "pgrep nr-softmodem"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 5
@@ -109,6 +122,7 @@ services:
cap_add:
- NET_ADMIN # for interface bringup
- NET_RAW # for ping
- SYS_NICE
environment:
USE_ADDITIONAL_OPTIONS: --rfsim -r 273 --numerology 1 --band 78 -C 3450720000 --ssb 1518 --ue-nb-ant-tx 2 --uicc0.imsi 208990100001100 --ue-nb-ant-rx 2 --uecap_file /opt/oai-nr-ue/etc/uecap.xml --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time
depends_on:
@@ -123,6 +137,8 @@ services:
- ../../conf_files/nrue.uicc.conf:/opt/oai-nr-ue/etc/nr-ue.conf
healthcheck:
test: /bin/bash -c "pgrep nr-uesoftmodem"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 5

View File

@@ -2,6 +2,7 @@ services:
mysql:
container_name: "rfsim5g-mysql"
image: mysql:8.0
init: true
volumes:
- ../5g_rfsimulator/oai_db.sql:/docker-entrypoint-initdb.d/oai_db.sql
- ../5g_rfsimulator/mysql-healthcheck.sh:/tmp/mysql-healthcheck.sh
@@ -13,6 +14,8 @@ services:
- MYSQL_ROOT_PASSWORD=linux
healthcheck:
test: /bin/bash -c "/tmp/mysql-healthcheck.sh"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 30
@@ -46,6 +49,7 @@ services:
oai-upf:
container_name: "rfsim5g-oai-upf"
image: oaisoftwarealliance/oai-upf:v2.1.9
init: true
environment:
- TZ=Europe/Paris
volumes:
@@ -61,8 +65,10 @@ services:
networks:
core_net:
ipv4_address: 192.168.71.134
interface_name: eth0
traffic_net:
ipv4_address: 192.168.72.134
interface_name: eth1
oai-cucp:
image: ${REGISTRY:-oaisoftwarealliance}/${GNB_IMG:-oai-gnb}:${TAG:-develop}
@@ -87,6 +93,8 @@ services:
- ../../conf_files/gnb-cucp.sa.f1.conf:/opt/oai-gnb/etc/gnb.conf
healthcheck:
test: /bin/bash -c "pgrep nr-softmodem"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 5
@@ -116,6 +124,8 @@ services:
- ../../conf_files/gnb-cuup.sa.f1.conf:/opt/oai-gnb/etc/gnb.conf
healthcheck:
test: /bin/bash -c "pgrep nr-cuup"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 5
@@ -148,6 +158,8 @@ services:
- ../../conf_files/gnb-cuup.sa.f1.conf:/opt/oai-gnb/etc/gnb.conf
healthcheck:
test: /bin/bash -c "pgrep nr-cuup"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 5
@@ -180,6 +192,8 @@ services:
- ../../conf_files/gnb-cuup.sa.f1.conf:/opt/oai-gnb/etc/gnb.conf
healthcheck:
test: /bin/bash -c "pgrep nr-cuup"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 5
@@ -209,6 +223,8 @@ services:
- ../../conf_files/gnb-du.sa.band78.106prb.rfsim.conf:/opt/oai-gnb/etc/gnb.conf
healthcheck:
test: /bin/bash -c "pgrep nr-softmodem"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 5
@@ -241,6 +257,8 @@ services:
- ../../conf_files/gnb-du.sa.band78.106prb.rfsim.conf:/opt/oai-gnb/etc/gnb.conf
healthcheck:
test: /bin/bash -c "pgrep nr-softmodem"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 5
@@ -273,6 +291,8 @@ services:
- ../../conf_files/gnb-du.sa.band78.106prb.rfsim.conf:/opt/oai-gnb/etc/gnb.conf
healthcheck:
test: /bin/bash -c "pgrep nr-softmodem"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 5
@@ -301,6 +321,8 @@ services:
- ../../conf_files/nrue.uicc.conf:/opt/oai-nr-ue/etc/nr-ue.conf
healthcheck:
test: /bin/bash -c "pgrep nr-uesoftmodem"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 5
@@ -329,6 +351,8 @@ services:
- ../../conf_files/nrue.uicc.conf:/opt/oai-nr-ue/etc/nr-ue.conf
healthcheck:
test: /bin/bash -c "pgrep nr-uesoftmodem"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 5
@@ -358,6 +382,8 @@ services:
- ../../conf_files/nrue.uicc.conf:/opt/oai-nr-ue/etc/nr-ue.conf
healthcheck:
test: /bin/bash -c "pgrep nr-uesoftmodem"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 5

View File

@@ -2,6 +2,7 @@ services:
mysql:
container_name: "rfsim5g-mysql"
image: mysql:8.0
init: true
volumes:
- ../5g_rfsimulator/oai_db.sql:/docker-entrypoint-initdb.d/oai_db.sql
- ../5g_rfsimulator/mysql-healthcheck.sh:/tmp/mysql-healthcheck.sh
@@ -13,6 +14,8 @@ services:
- MYSQL_ROOT_PASSWORD=linux
healthcheck:
test: /bin/bash -c "/tmp/mysql-healthcheck.sh"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 30
@@ -46,6 +49,7 @@ services:
oai-upf:
container_name: "rfsim5g-oai-upf"
image: oaisoftwarealliance/oai-upf:v2.1.9
init: true
environment:
- TZ=Europe/Paris
volumes:
@@ -61,12 +65,15 @@ services:
networks:
public_net:
ipv4_address: 192.168.71.134
interface_name: eth0
traffic_net:
ipv4_address: 192.168.72.134
interface_name: eth1
oai-ext-dn:
privileged: true
container_name: rfsim5g-oai-ext-dn
image: oaisoftwarealliance/trf-gen-cn5g:focal
init: true
entrypoint: /bin/bash -c \
"iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE;"\
"ip route add 12.1.1.0/24 via 192.168.72.134 dev eth0; sleep infinity"
@@ -77,6 +84,8 @@ services:
ipv4_address: 192.168.72.135
healthcheck:
test: /bin/bash -c "ping -c 2 192.168.72.134"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 5
@@ -96,6 +105,8 @@ services:
- ../../conf_files/gnb.sa.band261.u3.32prb.rfsim.conf:/opt/oai-gnb/etc/gnb.conf
healthcheck:
test: /bin/bash -c "pgrep nr-softmodem"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 5
@@ -124,6 +135,8 @@ services:
ipv4_address: 192.168.71.150
healthcheck:
test: /bin/bash -c "pgrep nr-uesoftmodem"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 5

View File

@@ -2,6 +2,7 @@ services:
mysql:
container_name: "rfsim5g-mysql"
image: mysql:8.0
init: true
volumes:
- ../5g_rfsimulator/oai_db.sql:/docker-entrypoint-initdb.d/oai_db.sql
- ../5g_rfsimulator/mysql-healthcheck.sh:/tmp/mysql-healthcheck.sh
@@ -13,6 +14,8 @@ services:
- MYSQL_ROOT_PASSWORD=linux
healthcheck:
test: /bin/bash -c "/tmp/mysql-healthcheck.sh"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 30
@@ -46,6 +49,7 @@ services:
oai-upf:
container_name: "rfsim5g-oai-upf"
image: oaisoftwarealliance/oai-upf:v2.1.9
init: true
environment:
- TZ=Europe/Paris
volumes:
@@ -61,12 +65,15 @@ services:
networks:
public_net:
ipv4_address: 192.168.71.134
interface_name: eth0
traffic_net:
ipv4_address: 192.168.72.134
interface_name: eth1
oai-ext-dn:
privileged: true
container_name: rfsim5g-oai-ext-dn
image: oaisoftwarealliance/trf-gen-cn5g:focal
init: true
entrypoint: /bin/bash -c \
"iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE;"\
"ip route add 12.1.1.0/24 via 192.168.72.134 dev eth0; sleep infinity"
@@ -77,6 +84,8 @@ services:
ipv4_address: 192.168.72.135
healthcheck:
test: /bin/bash -c "ping -c 2 192.168.72.134"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 5
@@ -87,7 +96,9 @@ services:
- ALL
environment:
USE_ADDITIONAL_OPTIONS: --rfsim --log_config.global_log_options level,nocolor,time
ASAN_OPTIONS: detect_leaks=0
--telnetsrv --telnetsrv.listenaddr 192.168.71.140
--telnetsrv.shrmod ci
ASAN_OPTIONS: detect_leaks=0:detect_odr_violation=0
depends_on:
- oai-ext-dn
networks:
@@ -97,6 +108,8 @@ services:
- ../../conf_files/gnb.sa.band254.u0.25prb.rfsim.ntn.conf:/opt/oai-gnb/etc/gnb.conf
healthcheck:
test: /bin/bash -c "pgrep nr-softmodem"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 5
@@ -122,6 +135,8 @@ services:
- ../../conf_files/nrue.uicc.conf:/opt/oai-nr-ue/etc/nr-ue.conf
healthcheck:
test: /bin/bash -c "pgrep nr-uesoftmodem"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 5

View File

@@ -13,6 +13,8 @@ services:
- MYSQL_ROOT_PASSWORD=linux
healthcheck:
test: /bin/bash -c "/tmp/mysql-healthcheck.sh"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 30
@@ -61,8 +63,10 @@ services:
networks:
public_net:
ipv4_address: 192.168.71.134
interface_name: eth0
traffic_net:
ipv4_address: 192.168.72.134
interface_name: eth1
oai-ext-dn:
privileged: true
container_name: rfsim5g-oai-ext-dn
@@ -77,6 +81,8 @@ services:
ipv4_address: 192.168.72.135
healthcheck:
test: /bin/bash -c "ping -c 2 192.168.72.134"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 5
@@ -97,6 +103,8 @@ services:
- ../../conf_files/gnb.sa.band254.u0.25prb.rfsim.ntn-leo.conf:/opt/oai-gnb/etc/gnb.conf
healthcheck:
test: /bin/bash -c "pgrep nr-softmodem"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 5
@@ -129,6 +137,8 @@ services:
- ../../conf_files/nrue.uicc.ntn-leo.conf:/opt/oai-nr-ue/etc/nr-ue.conf
healthcheck:
test: /bin/bash -c "pgrep nr-uesoftmodem"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 5

View File

@@ -18,6 +18,8 @@ services:
- ../../conf_files/nrue.uicc.conf:/opt/oai-nr-ue/etc/nr-ue.conf
healthcheck:
test: /bin/bash -c "pgrep nr-uesoftmodem"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 5
@@ -43,6 +45,8 @@ services:
- ../../conf_files/nrue.uicc.conf:/opt/oai-nr-ue/etc/nr-ue.conf
healthcheck:
test: /bin/bash -c "pgrep nr-uesoftmodem"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 5
@@ -56,11 +60,3 @@ networks:
- subnet: 192.168.71.128/26
driver_opts:
com.docker.network.bridge.name: "rfsim5g-public"
traffic_net:
driver: bridge
name: rfsim5g-oai-traffic-net
ipam:
config:
- subnet: 192.168.72.128/26
driver_opts:
com.docker.network.bridge.name: "rfsim5g-traffic"

View File

@@ -2,6 +2,7 @@ services:
mysql:
container_name: "rfsim5g-mysql"
image: mysql:8.0
init: true
volumes:
- ../5g_rfsimulator/oai_db.sql:/docker-entrypoint-initdb.d/oai_db.sql
- ../5g_rfsimulator/mysql-healthcheck.sh:/tmp/mysql-healthcheck.sh
@@ -13,6 +14,8 @@ services:
- MYSQL_ROOT_PASSWORD=linux
healthcheck:
test: /bin/bash -c "/tmp/mysql-healthcheck.sh"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 30
@@ -46,6 +49,7 @@ services:
oai-upf:
container_name: "rfsim5g-oai-upf"
image: oaisoftwarealliance/oai-upf:v2.1.9
init: true
environment:
- TZ=Europe/Paris
volumes:
@@ -61,12 +65,15 @@ services:
networks:
public_net:
ipv4_address: 192.168.71.134
interface_name: eth0
traffic_net:
ipv4_address: 192.168.72.134
interface_name: eth1
oai-ext-dn:
privileged: true
container_name: rfsim5g-oai-ext-dn
image: oaisoftwarealliance/trf-gen-cn5g:focal
init: true
entrypoint: /bin/bash -c \
"iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE;"\
"ip route add 12.1.1.0/24 via 192.168.72.134 dev eth0; sleep infinity"
@@ -77,6 +84,8 @@ services:
ipv4_address: 192.168.72.135
healthcheck:
test: /bin/bash -c "ping -c 2 192.168.72.134"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 5
@@ -99,6 +108,8 @@ services:
- ../../conf_files/gnb-vnf.sa.band66.u0.25prb.nfapi.conf:/opt/oai-gnb/etc/gnb.conf
healthcheck:
test: /bin/bash -c "pgrep nr-softmodem"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 5
@@ -121,6 +132,8 @@ services:
- ../../conf_files/gnb-pnf.band66.rfsim.conf:/opt/oai-gnb/etc/gnb.conf
healthcheck:
test: /bin/bash -c "pgrep nr-softmodem"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 5
@@ -146,6 +159,8 @@ services:
- ../../conf_files/nrue.uicc.conf:/opt/oai-nr-ue/etc/nr-ue.conf
healthcheck:
test: /bin/bash -c "pgrep nr-uesoftmodem"
start_period: 10s
start_interval: 500ms
interval: 10s
timeout: 5s
retries: 5

View File

@@ -14,7 +14,9 @@ services:
volumes:
- ../../conf_files/gnb.sa.band77.273prb.usrpn310.2x2.conf:/opt/oai-gnb/etc/gnb.conf
healthcheck:
test: /bin/bash -c "pgrep nr-softmodem"
interval: 10s
test: /bin/bash -c "/opt/oai-gnb/bin/check-prach-io.sh"
start_period: 15s
start_interval: 500ms
interval: 5s
timeout: 5s
retries: 5

View File

@@ -14,7 +14,9 @@ services:
volumes:
- ../../conf_files/gnb.sa.band77.162prb.usrpn310.2x2.conf:/opt/oai-gnb/etc/gnb.conf
healthcheck:
test: /bin/bash -c "pgrep nr-softmodem"
interval: 10s
test: /bin/bash -c "/opt/oai-gnb/bin/check-prach-io.sh"
start_period: 15s
start_interval: 500ms
interval: 5s
timeout: 5s
retries: 5

View File

@@ -16,7 +16,7 @@ services:
- ../../conf_files/gnb-vnf.sa.band77.162prb.nfapi.4x4.conf:/opt/oai-gnb/etc/gnb.conf
healthcheck:
test: /bin/bash -c "pgrep nr-softmodem"
interval: 15s
interval: 5s
timeout: 5s
retries: 5
oai-pnf:
@@ -35,7 +35,9 @@ services:
volumes:
- ../../conf_files/gnb-pnf.band77.usrpn310.4x4.conf:/opt/oai-gnb/etc/gnb.conf
healthcheck:
test: /bin/bash -c "pgrep nr-softmodem"
interval: 15s
test: /bin/bash -c "/opt/oai-gnb/bin/check-prach-io.sh"
start_period: 15s
start_interval: 500ms
interval: 5s
timeout: 5s
retries: 5

View File

@@ -16,7 +16,9 @@ services:
volumes:
- ../../conf_files/gnb.sa.band78.106prb.n310.7ds2u.conf:/opt/oai-gnb/etc/gnb.conf
healthcheck:
test: /bin/bash -c "pgrep nr-softmodem"
interval: 10s
test: /bin/bash -c "/opt/oai-gnb/bin/check-prach-io.sh"
start_period: 15s
start_interval: 500ms
interval: 5s
timeout: 5s
retries: 5
retries: 10

View File

@@ -22,10 +22,12 @@ services:
oai-net:
ipv4_address: 172.21.18.20
healthcheck:
test: /bin/bash -c "pgrep nr-softmodem"
interval: 10s
test: /bin/bash -c "/opt/oai-gnb/bin/check-prach-io.sh"
start_period: 15s
start_interval: 500ms
interval: 5s
timeout: 5s
retries: 5
retries: 10
networks:
oai-net:
driver: macvlan

View File

@@ -21,10 +21,12 @@ services:
oai-net:
ipv4_address: 172.21.18.20
healthcheck:
test: /bin/bash -c "pgrep nr-softmodem"
interval: 10s
test: /bin/bash -c "/opt/oai-gnb/bin/check-prach-io.sh"
start_period: 15s
start_interval: 500ms
interval: 5s
timeout: 5s
retries: 5
retries: 10
networks:
oai-net:
driver: macvlan

View File

@@ -21,10 +21,13 @@ services:
oai-net:
ipv4_address: 172.21.18.20
healthcheck:
test: /bin/bash -c "pgrep nr-softmodem"
interval: 10s
test: /bin/bash -c "/opt/oai-gnb/bin/check-prach-io.sh"
start_period: 15s
start_interval: 500ms
interval: 5s
timeout: 5s
retries: 5
retries: 10
networks:
oai-net:
driver: macvlan

View File

@@ -99,7 +99,7 @@ Options:
USRP, BLADERF, LMSSDR, IRIS, SIMU, AW2SORI, AERIAL, None (Default)
Adds this RF board support (in external packages installation and in compilation)
-t | --transport
Selects the transport protocol type, options: None, Ethernet, benetel4g, benetel5g, oran_fhlib_5g, oran_fhlib_5g_mplane
Selects the transport protocol type, options: None, Ethernet, benetel4g, benetel5g, oran_fhlib_5g, oran_fhlib_5g_mplane, WLS
-P | --phy_simulators
Makes the unitary tests Layer 1 simulators
-s | --check
@@ -308,6 +308,9 @@ function main() {
TARGET_LIST="$TARGET_LIST $2"
CMAKE_CMD="$CMAKE_CMD -DOAI_FHI72=ON -DOAI_FHI72_MPLANE=ON"
;;
"WLS"|"Wls"|"wls")
CMAKE_CMD="$CMAKE_CMD -DOAI_WLS=ON"
;;
"None")
;;
*)

View File

@@ -126,12 +126,9 @@ find_package_handle_standard_args(xran
VERSION_VAR xran_VERSION
)
# in proper usage of cmake, include directory should only contain "api", but not header files under "src" directory;
# however, we use xran_dev_get_ctx() and xran_dev_get_ctx_by_id() functions which are defined in xran_common.h;
# since xran_common.h is under "src" directory, we have to include it in ${xran_INCLUDE_DIRS}
if(xran_FOUND)
set(xran_LIBRARIES ${xran_LIBRARY})
set(xran_INCLUDE_DIRS ${xran_INCLUDE_DIR} ${xran_INCLUDE_DIR}/../src)
set(xran_INCLUDE_DIRS ${xran_INCLUDE_DIR})
endif()
if(xran_FOUND AND NOT TARGET xran::xran)

View File

@@ -0,0 +1,209 @@
diff --git a/wls_lib/Makefile b/wls_lib/Makefile
index 2f8e4b2..e657488 100644
--- a/wls_lib/Makefile
+++ b/wls_lib/Makefile
@@ -1,20 +1,6 @@
-###############################################################################
-#
-# Copyright (c) 2021 Intel.
-#
-# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
-#
-# 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.
-#
-###############################################################################
+################################################################
+# <COPYRIGHT_TAG>
+################################################################
MYCUSTOMTAB=' '
MYCUSTOMSPACE='============================================================================================'
@@ -24,11 +10,17 @@ MYCUSTOMSPACE1='------------------------------------------------------------'
# Tools configuration
##############################################################
ifeq ($(WIRELESS_SDK_TOOLCHAIN),icc)
-CC := icc
+ CC := icc
CPP := icpc
-AS := as
-AR := ar
-LD := icc
+ AS := as
+ AR := ar
+ LD := icc
+else ifeq ($(WIRELESS_SDK_TOOLCHAIN),gcc)
+ CC := gcc
+ CPP := g++
+ AS := as
+ AR := ar
+ LD := gcc
else ifeq ($(WIRELESS_SDK_TOOLCHAIN),icx)
CC := icx
CPP := icx
@@ -44,9 +36,9 @@ ifeq ($(WIRELESS_SDK_TARGET_ISA),sse)
else ifeq ($(WIRELESS_SDK_TARGET_ISA),avx2)
TARGET_PROCESSOR := -xCORE-AVX2
else ifeq ($(WIRELESS_SDK_TARGET_ISA),avx512)
- TARGET_PROCESSOR := -xCORE-AVX512
+ TARGET_PROCESSOR := -march=skylake-avx512
else ifeq ($(WIRELESS_SDK_TARGET_ISA),snc)
- TARGET_PROCESSOR := -xicelake-server
+ TARGET_PROCESSOR := -march=icelake-server
else ifeq ($(WIRELESS_SDK_TARGET_ISA),spr)
TARGET_PROCESSOR := -march=sapphirerapids
endif
@@ -66,15 +58,38 @@ PROJECT_DIR := ./
BUILDDIR := make
PROJECT_BINARY := $(PROJECT_NAME).so
+PKGCONF ?= pkg-config
+LIBDPDK_VERSION=20.11.3
+
+ifeq ($(shell $(PKGCONF) --modversion "libdpdk = '$(LIBDPDK_VERSION)'"),$(LIBDPDK_VERSION))
+ DPDK_INSTALLED=1
+else
+ DPDK_INSTALLED=0
+endif
+
ifeq ($(RTE_SDK),)
-$(error "Please define RTE_SDK environment variable")
+ifeq ($(DPDK_INSTALLED),0)
+$(error "Please define RTE_SDK environment variable OR install DPDK version $(LIBDPDK_VERSION)")
+endif
endif
-RTE_INC := $(shell PKG_CONFIG_PATH=/usr/lib64/pkgconfig:$(RTE_SDK)/build/meson-uninstalled pkgconf --cflags-only-I libdpdk)
+# At least one of the options is defined
+
+ifneq ($(RTE_SDK),)
+ RTE_INC := $(shell PKG_CONFIG_PATH=/usr/lib64/pkgconfig:$(RTE_SDK)/build/meson-uninstalled pkgconf --cflags-only-I libdpdk)
+else ifeq ($(DPDK_INSTALLED),1)
+ RTE_INC := $(shell PKG_CONFIG_PATH=/usr/lib64/pkgconfig $(PKGCONF) --cflags-only-I libdpdk)
+endif
CC_SRC = wls_lib_dpdk.c \
syslib.c
+CC_HDR = syslib.h \
+ ttypes.h \
+ wls.h \
+ wls_debug.h \
+ wls_lib.h
+
CC_FLAGS += -std=gnu11 -Wall -Wno-deprecated-declarations \
-fdata-sections \
-ffunction-sections \
@@ -84,18 +99,19 @@ CC_FLAGS += -std=gnu11 -Wall -Wno-deprecated-declarations \
-Wimplicit-function-declaration \
-g -O3 -mcmodel=large $(TARGET_PROCESSOR)
-INC := -I$(RTE_INC)
+INC := -I$(RTE_INC) -I../intel_fapi/
DEF :=
AS_FLAGS :=
AR_FLAGS := rc
PROJECT_OBJ_DIR := $(BUILDDIR)/obj
+PROJECT_DEP_DIR := $(PROJECT_OBJ_DIR)/$(PROJECT_NAME).dep.d
CC_OBJS := $(patsubst %.c,%.o,$(CC_SRC))
AS_OBJS := $(patsubst %.s,%.o,$(AS_SRC))
OBJS := $(CC_OBJS) $(AS_OBJS) $(LIBS)
-DIRLIST := $(addprefix $(PROJECT_OBJ_DIR)/,$(sort $(dir $(OBJS))))
+DIRLIST := $(addprefix $(PROJECT_OBJ_DIR)/,$(sort $(dir $(OBJS)))) $(PROJECT_DEP_DIR)
CC_OBJTARGETS := $(addprefix $(PROJECT_OBJ_DIR)/,$(CC_OBJS))
@@ -104,9 +120,7 @@ CC_FLAGS_FULL := $(CC_FLAGS) $(INC) $(DEF)
AS_FLAGS := $(AS_FLAGS) $(INC)
-PROJECT_DEP_FILE := $(PROJECT_OBJ_DIR)/$(PROJECT_NAME).dep
-
-ifeq ($(wildcard $(PROJECT_DEP_FILE)),$(PROJECT_DEP_FILE))
+ifeq ($(wildcard $(PROJECT_DEP_DIR)),$(PROJECT_DEP_DIR))
GENERATE_DEPS :=
else
@@ -119,11 +133,11 @@ all : welcome_line $(PROJECT_BINARY)
.PHONY : clear_dep
clear_dep:
- @$(RM) $(PROJECT_DEP_FILE)
- @echo [DEP] $(subst $(PROJECT_OBJ_DIR)/,,$(PROJECT_DEP_FILE))
+ @echo [DEP] rm $(PROJECT_DEP_DIR)/$(@F).dep
+ @$(RM) $(PROJECT_DEP_DIR)/$(@F).dep
-$(CC_DEPS) :
- @$(CC) -MM $(subst __up__,../,$(subst __dep__,,$@)) -MT $(PROJECT_OBJ_DIR)/$(patsubst %.c,%.o,$(subst __up__,../,$(subst __dep__,,$@))) $(CC_FLAGS_FULL) >> $(PROJECT_DEP_FILE)
+$(CC_DEPS) : $(PROJECT_DEP_DIR)
+ @$(CC) $(CC_FLAGS_FULL) -MM $(subst __up__,../,$(subst __dep__,,$@)) -MT $(PROJECT_OBJ_DIR)/$(patsubst %.c,%.o,$(subst __up__,../,$(subst __dep__,,$@))) >> $(PROJECT_DEP_DIR)/$(@F).dep
.PHONY : generate_deps
generate_deps : clear_dep $(CC_DEPS)
@@ -136,17 +150,17 @@ echo_start_build :
$(DIRLIST) :
-@$(MD) $@
-$(CC_OBJTARGETS) :
+$(CC_OBJTARGETS) : $(GENERATE_DEPS)
@echo [CC] $(subst $(PROJECT_OBJ_DIR)/,,$@)
@$(CC) -c $(CC_FLAGS_FULL) -o"$@" $(patsubst %.o,%.c,$(subst $(PROJECT_OBJ_DIR)/,,$@))
-$(AS_OBJTARGETS) :
+$(AS_OBJTARGETS) : $(CC_OBJTARGETS) $(CPP_OBJTARGETS)
@echo [AS] $(subst $(PROJECT_OBJ_DIR)/,,$@)
@$(AS) $(AS_FLAGS) -o"$@" $(patsubst %.o,%.s,$(subst $(PROJECT_OBJ_DIR)/,,$@))
-ifeq ($(wildcard $(PROJECT_DEP_FILE)),$(PROJECT_DEP_FILE))
+ifeq ($(wildcard $(PROJECT_DEP_DIR)),$(PROJECT_DEP_DIR))
-include $(PROJECT_DEP_FILE)
+include $(PROJECT_DEP_DIR)/*
endif
@@ -156,7 +170,7 @@ clean:
@$(RM) $(CC_OBJTARGETS) $(AS_OBJTARGETS)
ifneq ($(wildcard $(PROJECT_DIR)/$(PROJECT_MAKE)),)
@echo [CLEAN] : $(PROJECT_NAME)
- @$(RM) $(PROJECT_BINARY) $(PROJECT_BINARY_LIB) $(PROJECT_DEP_FILE)
+ @$(RM) -rf $(PROJECT_BINARY) $(PROJECT_BINARY_LIB) $(PROJECT_DEP_DIR)
endif
xclean: clean
@@ -172,7 +186,24 @@ welcome_line :
debug : all
release : all
-$(PROJECT_BINARY) : $(DIRLIST) echo_start_build $(GENERATE_DEPS) $(PRE_BUILD) $(CC_OBJTARGETS) $(AS_OBJTARGETS)
+$(PROJECT_BINARY) : $(DIRLIST) echo_start_build $(GENERATE_DEPS) $(CC_OBJTARGETS) $(AS_OBJTARGETS)
@echo [AR] $(subst $(BUILDDIR)/,,$@)
@$(CC) $(CC_OBJTARGETS) $(AS_OBJTARGETS) -shared -fPIC -o $@
+##############################################################
+# Install configuration
+##############################################################
+
+INSTALL_DIR := /usr/local
+INCLUDE_DIR := $(INSTALL_DIR)/include/
+
+.PHONY : install
+install: $(PROJECT_BINARY) install_headers
+ @echo [INSTALL] : $(PROJECT_BINARY)
+ @$(CP) $(PROJECT_BINARY) $(INSTALL_DIR)/lib
+
+.PHONY : install_headers
+install_headers: $(CC_SRC)
+ @echo [INSTALL] : $(PROJECT_NAME) headers
+ @$(MD) $(INCLUDE_DIR)
+ @$(CP) $(CC_HDR) $(INCLUDE_DIR)

View File

@@ -1,5 +1,5 @@
diff --git a/fhi_lib/app/src/common.h b/fhi_lib/app/src/common.h
index 7508117..ce17ebd 100644
index 7508117..318508b 100644
--- a/fhi_lib/app/src/common.h
+++ b/fhi_lib/app/src/common.h
@@ -28,7 +28,7 @@
@@ -7,12 +7,12 @@ index 7508117..ce17ebd 100644
#include <rte_mbuf.h>
-#define VERSIONX "oran_e_maintenance_release_v1.0"
+#define VERSIONX "oran_e_maintenance_release_v1.5"
+#define VERSIONX "oran_e_maintenance_release_v1.6"
#define APP_O_DU 0
#define APP_O_RU 1
diff --git a/fhi_lib/lib/Makefile b/fhi_lib/lib/Makefile
index de141bf..fa2923f 100644
index de141bf..c2a448d 100644
--- a/fhi_lib/lib/Makefile
+++ b/fhi_lib/lib/Makefile
@@ -23,12 +23,25 @@ MYCUSTOMSPACE1='------------------------------------------------------------'
@@ -50,9 +50,9 @@ index de141bf..fa2923f 100644
-RTE_INC := $(shell PKG_CONFIG_PATH=/usr/lib64/pkgconfig:$(RTE_SDK)/build/meson-uninstalled pkgconf --cflags-only-I libdpdk)
+ifeq ($(TARGET), x86)
+RTE_INC := $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH):/usr/lib64/pkgconfig:$(RTE_SDK)/build/meson-uninstalled pkgconf --cflags-only-I libdpdk)
+RTE_INC := $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH):/usr/lib64/pkgconfig:$(RTE_SDK)/build/meson-uninstalled pkg-config --cflags-only-I libdpdk)
+else ifeq ($(TARGET), armv8)
+RTE_INC := $(pkgconf --cflags-only-I libdpdk)
+RTE_INC := $(shell pkg-config --cflags-only-I libdpdk)
+endif
API_DIR := $(PROJECT_DIR)/api
SRC_DIR := $(PROJECT_DIR)/src
@@ -85,7 +85,7 @@ index de141bf..fa2923f 100644
CC_FLAGS += -std=gnu11 -Wall -Wno-deprecated-declarations \
-fdata-sections \
@@ -112,12 +132,21 @@ CC_FLAGS += -std=gnu11 -Wall -Wno-deprecated-declarations \
@@ -112,14 +132,23 @@ CC_FLAGS += -std=gnu11 -Wall -Wno-deprecated-declarations \
-fPIC \
-Wall \
-Wimplicit-function-declaration \
@@ -110,8 +110,11 @@ index de141bf..fa2923f 100644
+ -Werror -Wno-unused-variable -std=c++14
+endif
INC := -I$(API_DIR) -I$(ETH_DIR) -I$(SRC_DIR) -I$(RTE_INC)
-INC := -I$(API_DIR) -I$(ETH_DIR) -I$(SRC_DIR) -I$(RTE_INC)
+INC := -I$(API_DIR) -I$(ETH_DIR) -I$(SRC_DIR) $(RTE_INC)
DEF :=
ifeq ($(MLOG),1)
INC += -I$(MLOG_DIR)/source
@@ -150,8 +179,13 @@ CPP_SNC_OBJTARGETS := $(addprefix $(PROJECT_OBJ_DIR)/,$(CPP_OBJS_SNC))
AS_OBJTARGETS := $(addprefix $(PROJECT_OBJ_DIR)/,$(AS_OBJS))

View File

@@ -1,5 +1,5 @@
diff --git a/fhi_lib/app/src/common.h b/fhi_lib/app/src/common.h
index ac5f471..9ebbcab 100644
index ac5f471..5efcce3 100644
--- a/fhi_lib/app/src/common.h
+++ b/fhi_lib/app/src/common.h
@@ -28,7 +28,7 @@
@@ -7,12 +7,12 @@ index ac5f471..9ebbcab 100644
#include <rte_mbuf.h>
-#define VERSIONX "oran_f_release_v1.0"
+#define VERSIONX "oran_f_release_v1.3"
+#define VERSIONX "oran_f_release_v1.4"
#define APP_O_DU 0
#define APP_O_RU 1
diff --git a/fhi_lib/lib/Makefile b/fhi_lib/lib/Makefile
index eccc4ae..b1b8f4b 100644
index eccc4ae..a97fdc6 100644
--- a/fhi_lib/lib/Makefile
+++ b/fhi_lib/lib/Makefile
@@ -23,24 +23,46 @@ MYCUSTOMSPACE1='------------------------------------------------------------'
@@ -83,9 +83,9 @@ index eccc4ae..b1b8f4b 100644
RTE_TARGET ?= x86_64-native-linux-icc
-RTE_INC := $(shell PKG_CONFIG_PATH=/usr/lib64/pkgconfig:$(RTE_SDK)/build/meson-uninstalled pkgconf --cflags-only-I libdpdk)
+ifeq ($(TARGET), x86)
+RTE_INC := $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH):/usr/lib64/pkgconfig:$(RTE_SDK)/build/meson-uninstalled pkgconf --cflags-only-I libdpdk)
+RTE_INC := $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH):/usr/lib64/pkgconfig:$(RTE_SDK)/build/meson-uninstalled pkg-config --cflags-only-I libdpdk)
+else ifeq ($(TARGET), armv8)
+RTE_INC := $(pkgconf --cflags-only-I libdpdk)
+RTE_INC := $(shell pkg-config --cflags-only-I libdpdk)
+endif
API_DIR := $(PROJECT_DIR)/api
@@ -147,6 +147,15 @@ index eccc4ae..b1b8f4b 100644
ifeq ($(WIRELESS_SDK_TOOLCHAIN),icc)
CPP_FLAGS += -fp-model fast=2 -no-prec-div -no-prec-sqrt -fast-transcendentals -restrict
@@ -150,7 +187,7 @@ CPP_FLAGS += -fp-model fast -march=icelake-server -mintrinsic-promote -Wno-unus
endif
-INC := -I$(API_DIR) -I$(ETH_DIR) -I$(SRC_DIR) -I$(RTE_INC)
+INC := -I$(API_DIR) -I$(ETH_DIR) -I$(SRC_DIR) $(RTE_INC)
DEF :=
ifeq ($(MLOG),1)
INC += -I$(MLOG_DIR)/source
@@ -186,8 +223,13 @@ CPP_SNC_OBJTARGETS := $(addprefix $(PROJECT_OBJ_DIR)/,$(CPP_OBJS_SNC))
AS_OBJTARGETS := $(addprefix $(PROJECT_OBJ_DIR)/,$(AS_OBJS))
@@ -164,7 +173,7 @@ index eccc4ae..b1b8f4b 100644
CPP_FLAGS_FULL := $(CPP_FLAGS) $(CPP_COMP) $(INC) $(DEF)
CPP_FLAGS_FULL_SNC := $(CPP_FLAGS) $(CPP_COMP_SNC) $(INC) $(DEF)
diff --git a/fhi_lib/lib/api/xran_fh_o_du.h b/fhi_lib/lib/api/xran_fh_o_du.h
index bacf597..8bd7c66 100644
index bacf597..1dd6d66 100644
--- a/fhi_lib/lib/api/xran_fh_o_du.h
+++ b/fhi_lib/lib/api/xran_fh_o_du.h
@@ -141,7 +141,7 @@ extern "C" {
@@ -176,7 +185,15 @@ index bacf597..8bd7c66 100644
#define XRAN_MAX_SET_BFWS (64) /**< Assumed 64Ant, BFP 9bit with 9K jumbo frame */
#define XRAN_MAX_PKT_BURST (448+4) /**< 4x14x8 symbols per ms */
@@ -1193,6 +1193,31 @@ int32_t xran_reg_physide_cb_by_dev_id(void *pHandle, xran_fh_tti_callback_fn Cb,
@@ -419,6 +419,7 @@ struct xran_io_cfg {
uint16_t num_rxq; /**< number of RX queues per VF */
char *dpdk_dev[XRAN_VF_MAX]; /**< VFs devices */
char *bbdev_dev[1]; /**< BBDev dev name */
+ char *bbdev_vfio_vf_token[1]; /**< BBDev dev token */
int32_t bbdev_mode; /**< DPDK for BBDev */
uint32_t dpdkIoVaMode; /**< IOVA Mode */
uint32_t dpdkMemorySize; /**< DPDK max memory allocation */
@@ -1193,6 +1194,31 @@ int32_t xran_reg_physide_cb_by_dev_id(void *pHandle, xran_fh_tti_callback_fn Cb,
*/
int32_t xran_get_slot_idx (uint32_t PortId, uint32_t *nFrameIdx, uint32_t *nSubframeIdx, uint32_t *nSlotIdx, uint64_t *nSecond);
@@ -259,7 +276,7 @@ index 46e0e1d..409ef4b 100644
int xran_prepare_iq_symbol_portion(
struct rte_mbuf *mbuf,
diff --git a/fhi_lib/lib/ethernet/ethdi.c b/fhi_lib/lib/ethernet/ethdi.c
index f5b2fd6..144a65e 100644
index f5b2fd6..8fb0ec2 100644
--- a/fhi_lib/lib/ethernet/ethdi.c
+++ b/fhi_lib/lib/ethernet/ethdi.c
@@ -37,7 +37,10 @@
@@ -273,8 +290,37 @@ index f5b2fd6..144a65e 100644
#include <numa.h>
#include <rte_config.h>
#include <rte_common.h>
@@ -325,8 +328,8 @@ xran_ethdi_init_dpdk_io(char *name, const struct xran_io_cfg *io_cfg,
@@ -185,14 +188,24 @@ static void check_port_link_status(uint8_t portid)
printf("Port %d Link Up - speed %u "
"Mbps - %s\n", (uint8_t)portid,
(unsigned)link.link_speed,
+#if (RTE_VER_YEAR >= 21)
+ (link.link_duplex == RTE_ETH_LINK_FULL_DUPLEX) ?
+ ("full-duplex") : ("half-duplex\n")
+#else
(link.link_duplex == ETH_LINK_FULL_DUPLEX) ?
- ("full-duplex") : ("half-duplex\n"));
+ ("full-duplex") : ("half-duplex\n")
+#endif
+ );
else
printf("Port %d Link Down\n",
(uint8_t)portid);
}
/* clear all_ports_up flag if any link down */
+#if (RTE_VER_YEAR >= 21)
+ if (link.link_status == RTE_ETH_LINK_DOWN) {
+#else
if (link.link_status == ETH_LINK_DOWN) {
+#endif
all_ports_up = 0;
break;
}
@@ -323,10 +336,11 @@ xran_ethdi_init_dpdk_io(char *name, const struct xran_io_cfg *io_cfg,
uint64_t nWorkerCore = 1;
uint32_t coreNum = sysconf(_SC_NPROCESSORS_CONF);
char bbdev_wdev[32] = "";
+ char bbdev_vfio_vf_token[64] = "";
char bbdev_vdev[32] = "";
char iova_mode[32] = "--iova-mode=pa";
- char socket_mem[32] = "--socket-mem=8192";
@@ -284,16 +330,36 @@ index f5b2fd6..144a65e 100644
char ring_name[32] = "";
int32_t xran_port = -1;
queueid_t qi = 0;
@@ -336,7 +339,7 @@ xran_ethdi_init_dpdk_io(char *name, const struct xran_io_cfg *io_cfg,
@@ -336,8 +350,8 @@ xran_ethdi_init_dpdk_io(char *name, const struct xran_io_cfg *io_cfg,
cpu = sched_getcpu();
node = numa_node_of_cpu(cpu);
- char *argv[] = { name, core_mask, "-n2", iova_mode, socket_mem, socket_limit, "--proc-type=auto",
- "--file-prefix", name, "-a0000:00:00.0", bbdev_wdev, bbdev_vdev};
+ char *argv[] = { name, core_mask, "-n2", iova_mode, socket_mem, socket_limit, "--proc-type=auto", "--no-telemetry",
"--file-prefix", name, "-a0000:00:00.0", bbdev_wdev, bbdev_vdev};
+ "--file-prefix", name, "-a0000:00:00.0", bbdev_wdev, bbdev_vdev, bbdev_vfio_vf_token};
if (io_cfg == NULL)
@@ -481,11 +484,13 @@ xran_ethdi_init_dpdk_io(char *name, const struct xran_io_cfg *io_cfg,
return 0;
@@ -347,11 +361,17 @@ xran_ethdi_init_dpdk_io(char *name, const struct xran_io_cfg *io_cfg,
// hw-accelerated bbdev
printf("hw-accelerated bbdev %s\n", io_cfg->bbdev_dev[0]);
snprintf(bbdev_wdev, RTE_DIM(bbdev_wdev), "-a%s", io_cfg->bbdev_dev[0]);
+ if (io_cfg->bbdev_vfio_vf_token[0] != NULL) {
+ snprintf(bbdev_vfio_vf_token, RTE_DIM(bbdev_vfio_vf_token), "--vfio-vf-token=%s", io_cfg->bbdev_vfio_vf_token[0]);
+ }
} else if (io_cfg->bbdev_mode == XRAN_BBDEV_MODE_HW_OFF){
snprintf(bbdev_wdev, RTE_DIM(bbdev_wdev), "%s", "--vdev=baseband_turbo_sw");
} else if (io_cfg->bbdev_mode == XRAN_BBDEV_MODE_HW_SW){
printf("software and hw-accelerated bbdev %s\n", io_cfg->bbdev_dev[0]);
snprintf(bbdev_wdev, RTE_DIM(bbdev_wdev), "-a%s", io_cfg->bbdev_dev[0]);
+ if (io_cfg->bbdev_vfio_vf_token[0] != NULL) {
+ snprintf(bbdev_vfio_vf_token, RTE_DIM(bbdev_vfio_vf_token), "--vfio-vf-token=%s", io_cfg->bbdev_vfio_vf_token[0]);
+ }
snprintf(bbdev_vdev, RTE_DIM(bbdev_vdev), "%s", "--vdev=baseband_turbo_sw");
} else {
rte_panic("Cannot init DPDK incorrect [bbdev_mode %d]\n", io_cfg->bbdev_mode);
@@ -481,11 +501,13 @@ xran_ethdi_init_dpdk_io(char *name, const struct xran_io_cfg *io_cfg,
ctx->tx_ring[i] = rte_ring_create(ring_name, NUM_MBUFS_RING_TRX,
rte_lcore_to_socket_id(*lcore_id), RING_F_SC_DEQ);
PANIC_ON(ctx->tx_ring[i] == NULL, "failed to allocate rx ring");
@@ -307,7 +373,7 @@ index f5b2fd6..144a65e 100644
}
}
} else {
@@ -555,7 +560,7 @@ xran_ethdi_init_dpdk_io(char *name, const struct xran_io_cfg *io_cfg,
@@ -555,7 +577,7 @@ xran_ethdi_init_dpdk_io(char *name, const struct xran_io_cfg *io_cfg,
ctx->up_dl_pkt_gen_ring[i] = rte_ring_create(ring_name, NUM_MBUFS_RING,
rte_lcore_to_socket_id(*lcore_id), /*RING_F_SC_DEQ*/0);
PANIC_ON(ctx->up_dl_pkt_gen_ring[i] == NULL, "failed to allocate dl gen ring");
@@ -317,7 +383,7 @@ index f5b2fd6..144a65e 100644
return 1;
diff --git a/fhi_lib/lib/ethernet/ethernet.c b/fhi_lib/lib/ethernet/ethernet.c
index edda598..791256c 100644
index edda598..77e5ca7 100644
--- a/fhi_lib/lib/ethernet/ethernet.c
+++ b/fhi_lib/lib/ethernet/ethernet.c
@@ -37,7 +37,10 @@
@@ -331,6 +397,78 @@ index edda598..791256c 100644
#include <rte_config.h>
#include <rte_common.h>
#include <rte_log.h>
@@ -149,13 +152,22 @@ void xran_init_port(int p_id, uint16_t num_rxq, uint32_t mtu)
static uint16_t nb_txd = BURST_SIZE;
struct rte_ether_addr addr;
struct rte_eth_rxmode rxmode = {
+#if (RTE_VER_YEAR >= 21)
+ .mtu = MAX_RX_LEN,
+#else
.split_hdr_size = 0,
.max_rx_pkt_len = MAX_RX_LEN,
.offloads = DEV_RX_OFFLOAD_JUMBO_FRAME
+#endif
};
struct rte_eth_txmode txmode = {
+#if (RTE_VER_YEAR >= 21)
+ .mq_mode = RTE_ETH_MQ_TX_NONE,
+ .offloads = RTE_ETH_TX_OFFLOAD_MULTI_SEGS
+#else
.mq_mode = ETH_MQ_TX_NONE,
.offloads = DEV_TX_OFFLOAD_MULTI_SEGS
+#endif
};
struct rte_eth_conf port_conf = {
.rxmode = rxmode,
@@ -174,8 +186,13 @@ void xran_init_port(int p_id, uint16_t num_rxq, uint32_t mtu)
uint32_t num_mbufs = 0;
if (mtu <= 1500) {
+#if (RTE_VER_YEAR >= 21)
+ rxmode.offloads &= ~RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO;
+ rxmode.mtu = RTE_ETHER_MAX_LEN;
+#else
rxmode.offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
rxmode.max_rx_pkt_len = RTE_ETHER_MAX_LEN;
+#endif
data_room_size = MBUF_POOL_ELM_SMALL;
}
@@ -184,10 +201,19 @@ void xran_init_port(int p_id, uint16_t num_rxq, uint32_t mtu)
drv_name = dev_info.driver_name;
printf("initializing port %d for TX, drv=%s\n", p_id, drv_name);
- if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE){
+#if (RTE_VER_YEAR >= 21)
+ if (dev_info.tx_offload_capa & RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE)
+#else
+ if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
+#endif
+ {
printf("set DEV_TX_OFFLOAD_MBUF_FAST_FREE\n");
port_conf.txmode.offloads |=
+#if (RTE_VER_YEAR >= 21)
+ RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE;
+#else
DEV_TX_OFFLOAD_MBUF_FAST_FREE;
+#endif
}
rte_eth_macaddr_get(p_id, &addr);
@@ -293,8 +319,13 @@ void xran_add_eth_hdr_vlan(struct rte_ether_addr *dst, uint16_t ethertype, struc
PANIC_ON(h == NULL, "mbuf prepend of ether_hdr failed");
/* Fill in the ethernet header. */
+#if (RTE_VER_YEAR >= 21)
+ rte_eth_macaddr_get(mb->port, &h->src_addr); /* set source addr */
+ h->dst_addr = *dst; /* set dst addr */
+#else
rte_eth_macaddr_get(mb->port, &h->s_addr); /* set source addr */
h->d_addr = *dst; /* set dst addr */
+#endif
h->ether_type = rte_cpu_to_be_16(ethertype); /* ethertype too */
#if 0
struct rte_ether_addr *s = &h->s_addr;
diff --git a/fhi_lib/lib/src/xran_bfp_ref.cpp b/fhi_lib/lib/src/xran_bfp_ref.cpp
index e6d3067..8e0abee 100644
--- a/fhi_lib/lib/src/xran_bfp_ref.cpp
@@ -565,7 +703,7 @@ index 789c6fd..a768efb 100644
#include <rte_common.h>
#include <rte_eal.h>
diff --git a/fhi_lib/lib/src/xran_delay_measurement.c b/fhi_lib/lib/src/xran_delay_measurement.c
index 4c943c8..d9e7983 100644
index 4c943c8..7db51a8 100644
--- a/fhi_lib/lib/src/xran_delay_measurement.c
+++ b/fhi_lib/lib/src/xran_delay_measurement.c
@@ -23,7 +23,10 @@
@@ -579,6 +717,155 @@ index 4c943c8..d9e7983 100644
#include <assert.h>
#include <err.h>
#include <arpa/inet.h>
@@ -572,16 +575,28 @@ int xran_generate_delay_meas(uint16_t port_id, void* handle, uint8_t actionType,
PANIC_ON(h == NULL, "mbuf prepend of ether_hdr failed");
/* Fill in the ethernet header. */
+#if (RTE_VER_YEAR >= 21)
+ rte_eth_macaddr_get(port_id, &h->src_addr); /* set source addr */
+#else
rte_eth_macaddr_get(port_id, &h->s_addr); /* set source addr */
+#endif
if (p_xran_dev_ctx->fh_init.io_cfg.id)
{
// rte_ether_addr_copy( (struct rte_ether_addr *)p_xran_dev_ctx->fh_init.p_o_du_addr[port_id],&h->d_addr);
+#if (RTE_VER_YEAR >= 21)
+ h->dst_addr = ctx->entities[port_id][ID_O_DU]; /* set dst addr */
+#else
h->d_addr = ctx->entities[port_id][ID_O_DU]; /* set dst addr */
+#endif
}
else
{
+#if (RTE_VER_YEAR >= 21)
+ h->dst_addr = ctx->entities[port_id][ID_O_RU]; /* set dst addr */
+#else
h->d_addr = ctx->entities[port_id][ID_O_RU]; /* set dst addr */
+#endif
// rte_ether_addr_copy( (struct rte_ether_addr *)p_xran_dev_ctx->fh_init.p_o_ru_addr[port_id],&h->d_addr);
}
@@ -752,7 +767,11 @@ int xran_generate_delay_meas(uint16_t port_id, void* handle, uint8_t actionType,
int8_t *pa = &p_xran_dev_ctx->fh_init.p_o_du_addr[0];
printf("DST_MAC: %02"PRIx8" %02"PRIx8" %02"PRIx8" %02"PRIx8" %02"PRIx8" %02"PRIx8"\n", pa[0],pa[1],pa[2],pa[3],pa[4],pa[5]);
#endif
+#if (RTE_VER_YEAR >= 21)
+ rte_ether_addr_copy((struct rte_ether_addr *)&p_xran_dev_ctx->fh_init.p_o_du_addr[0], (struct rte_ether_addr *)&h->dst_addr.addr_bytes[0]);
+#else
rte_ether_addr_copy((struct rte_ether_addr *)&p_xran_dev_ctx->fh_init.p_o_du_addr[0], (struct rte_ether_addr *)&h->d_addr.addr_bytes[0]);
+#endif
}
else
@@ -761,13 +780,25 @@ int xran_generate_delay_meas(uint16_t port_id, void* handle, uint8_t actionType,
int8_t *pb = &p_xran_dev_ctx->fh_init.p_o_ru_addr[0];
printf("DST_MAC: %02"PRIx8" %02"PRIx8" %02"PRIx8" %02"PRIx8" %02"PRIx8" %02"PRIx8"\n", pb[0],pb[1],pb[2],pb[3],pb[4],pb[5]);
#endif
+#if (RTE_VER_YEAR >= 21)
+ rte_ether_addr_copy((struct rte_ether_addr *)&p_xran_dev_ctx->fh_init.p_o_ru_addr[0], (struct rte_ether_addr *)&h->dst_addr.addr_bytes[0]);
+#else
rte_ether_addr_copy((struct rte_ether_addr *)&p_xran_dev_ctx->fh_init.p_o_ru_addr[0], (struct rte_ether_addr *)&h->d_addr.addr_bytes[0]);
+#endif
}
#ifdef XRAN_OWD_DEBUG_PKTS
+#if (RTE_VER_YEAR >= 21)
+ uint8_t *pc = &h->src_addr.addr_bytes[0];
+#else
uint8_t *pc = &h->s_addr.addr_bytes[0];
+#endif
printf(" Src MAC from packet: %02"PRIx8" %02"PRIx8" %02"PRIx8" %02"PRIx8" %02"PRIx8" %02"PRIx8"\n", pc[0],pc[1],pc[2],pc[3],pc[4],pc[5]);
+#if (RTE_VER_YEAR >= 21)
+ uint8_t *pd = &h->dst_addr.addr_bytes[0];
+#else
uint8_t *pd = &h->d_addr.addr_bytes[0];
+#endif
printf(" Dst MAC from packet: %02"PRIx8" %02"PRIx8" %02"PRIx8" %02"PRIx8" %02"PRIx8" %02"PRIx8"\n", pd[0],pd[1],pd[2],pd[3],pd[4],pd[5]);
#endif
// Copy dest address from above
@@ -862,9 +893,15 @@ int xran_process_delmeas_request(struct rte_mbuf *pkt, void* handle, struct xran
// 11) Fill the ethernet header properly by swapping src and dest addressed from the copied frame
eth_hdr = rte_pktmbuf_mtod(pkt1, struct rte_ether_hdr *);
/* Swap dest and src mac addresses. */
+#if (RTE_VER_YEAR >= 21)
+ rte_ether_addr_copy(&eth_hdr->dst_addr, &addr);
+ rte_ether_addr_copy(&eth_hdr->src_addr, &eth_hdr->dst_addr);
+ rte_ether_addr_copy(&addr, &eth_hdr->src_addr);
+#else
rte_ether_addr_copy(&eth_hdr->d_addr, &addr);
rte_ether_addr_copy(&eth_hdr->s_addr, &eth_hdr->d_addr);
rte_ether_addr_copy(&addr, &eth_hdr->s_addr);
+#endif
// Still need to check ol_flags state and update if necessary
// Compute the delay td12 and save
// Still need to define the DB to save the info and run averages
@@ -872,9 +909,17 @@ int xran_process_delmeas_request(struct rte_mbuf *pkt, void* handle, struct xran
// 12) Send the response right away
#ifdef XRAN_OWD_DEBUG_PKTS
struct rte_ether_hdr *h = (struct rte_ether_hdr *)rte_pktmbuf_mtod(pkt1, struct rte_ether_hdr*);
+#if (RTE_VER_YEAR >= 21)
+ uint8_t *pc = &h->src_addr.addr_bytes[0];
+#else
uint8_t *pc = &h->s_addr.addr_bytes[0];
+#endif
printf(" Src MAC from packet: %02"PRIx8" %02"PRIx8" %02"PRIx8" %02"PRIx8" %02"PRIx8" %02"PRIx8"\n", pc[0],pc[1],pc[2],pc[3],pc[4],pc[5]);
+#if (RTE_VER_YEAR >= 21)
+ uint8_t *pd = &h->dst_addr.addr_bytes[0];
+#else
uint8_t *pd = &h->d_addr.addr_bytes[0];
+#endif
printf(" Dst MAC from packet: %02"PRIx8" %02"PRIx8" %02"PRIx8" %02"PRIx8" %02"PRIx8" %02"PRIx8"\n", pd[0],pd[1],pd[2],pd[3],pd[4],pd[5]);
// printf("EtherType: %04"PRIx16" \n",&h->ether_type);
#endif
@@ -1100,9 +1145,15 @@ int xran_process_delmeas_rem_request(struct rte_mbuf *pkt, void* handle, struct
// 9) Fill the ethernet header properly by swapping src and dest addressed from the copied frame
eth_hdr = rte_pktmbuf_mtod(pkt1, struct rte_ether_hdr *);
/* Swap dest and src mac addresses. */
+#if (RTE_VER_YEAR >= 21)
+ rte_ether_addr_copy(&eth_hdr->dst_addr, &addr);
+ rte_ether_addr_copy(&eth_hdr->src_addr, &eth_hdr->dst_addr);
+ rte_ether_addr_copy(&addr, &eth_hdr->src_addr);
+#else
rte_ether_addr_copy(&eth_hdr->d_addr, &addr);
rte_ether_addr_copy(&eth_hdr->s_addr, &eth_hdr->d_addr);
rte_ether_addr_copy(&addr, &eth_hdr->s_addr);
+#endif
// 10) Send the response right away
pdm = (struct xran_ecpri_del_meas_pkt*)rte_pktmbuf_mtod_offset(pkt1, struct xran_ecpri_del_meas_pkt *, sizeof(struct rte_ether_hdr) );
pdm->cmnhdr.bits.ecpri_payl_size = 10 + powdc->owdm_PlLength; // 10 correponds to the xran_ecpri_delay_meas_pl minus the dummy_bytes field which now allows the user to select the length for this field to be sent
@@ -1177,9 +1228,15 @@ int xran_process_delmeas_rem_request_w_fup(struct rte_mbuf* pkt, void* handle, s
// 7) Fill the ethernet header properly by swapping src and dest addressed from the copied frame
eth_hdr = rte_pktmbuf_mtod(pkt1, struct rte_ether_hdr *);
/* Swap dest and src mac addresses. */
+#if (RTE_VER_YEAR >= 21)
+ rte_ether_addr_copy(&eth_hdr->dst_addr, &addr);
+ rte_ether_addr_copy(&eth_hdr->src_addr, &eth_hdr->dst_addr);
+ rte_ether_addr_copy(&addr, &eth_hdr->src_addr);
+#else
rte_ether_addr_copy(&eth_hdr->d_addr, &addr);
rte_ether_addr_copy(&eth_hdr->s_addr, &eth_hdr->d_addr);
rte_ether_addr_copy(&addr, &eth_hdr->s_addr);
+#endif
// 8) Duplicate packet to be used for the follow up packet
pkt2 = rte_pktmbuf_copy(pkt1, _eth_mbuf_pool, 0, UINT32_MAX);
// 9) Record the current timestamp when the request with follow up is being sent
@@ -1283,9 +1340,15 @@ int xran_process_delmeas_follow_up(struct rte_mbuf *pkt, void* handle, struct xr
// 9) Fill the ethernet header properly by swapping src and dest addressed from the copied frame
eth_hdr = rte_pktmbuf_mtod(pkt1, struct rte_ether_hdr *);
/* Swap dest and src mac addresses. */
+#if (RTE_VER_YEAR >= 21)
+ rte_ether_addr_copy(&eth_hdr->dst_addr, &addr);
+ rte_ether_addr_copy(&eth_hdr->src_addr, &eth_hdr->dst_addr);
+ rte_ether_addr_copy(&addr, &eth_hdr->src_addr);
+#else
rte_ether_addr_copy(&eth_hdr->d_addr, &addr);
rte_ether_addr_copy(&eth_hdr->s_addr, &eth_hdr->d_addr);
rte_ether_addr_copy(&addr, &eth_hdr->s_addr);
+#endif
pdm = (struct xran_ecpri_del_meas_pkt*)rte_pktmbuf_mtod_offset(pkt1, struct xran_ecpri_del_meas_pkt *, sizeof(struct rte_ether_hdr) );
pdm->cmnhdr.bits.ecpri_payl_size = 10 + powdc->owdm_PlLength; // 10 correponds to the xran_ecpri_delay_meas_pl minus the dummy_bytes field which now allows the user to select the length for this field to be sent
pdm->cmnhdr.bits.ecpri_payl_size = rte_cpu_to_be_16(pdm->cmnhdr.bits.ecpri_payl_size);
diff --git a/fhi_lib/lib/src/xran_dev.c b/fhi_lib/lib/src/xran_dev.c
index 4acade1..c939edc 100644
--- a/fhi_lib/lib/src/xran_dev.c
@@ -1377,7 +1664,7 @@ index 72249bc..6b30084 100644
#include <rte_config.h>
diff --git a/fhi_lib/lib/src/xran_tx_proc.c b/fhi_lib/lib/src/xran_tx_proc.c
index 45a17a8..28c5568 100644
index 45a17a8..85ce6fa 100644
--- a/fhi_lib/lib/src/xran_tx_proc.c
+++ b/fhi_lib/lib/src/xran_tx_proc.c
@@ -35,7 +35,11 @@
@@ -1392,6 +1679,58 @@ index 45a17a8..28c5568 100644
#include <rte_common.h>
#include <rte_eal.h>
@@ -1514,7 +1518,11 @@ xran_process_tx_sym_cp_on_opt(void* pHandle, uint8_t ctx_id, uint32_t tti, int32
mb_oran_hdr_ext->buf_addr = ext_buff;
mb_oran_hdr_ext->buf_iova = ((struct rte_mempool_objhdr*)RTE_PTR_SUB(mb_base, rte_mempool_objhdr_size))->iova + RTE_PTR_DIFF(ext_buff, mb_base);
mb_oran_hdr_ext->buf_len = ext_buff_len;
+#if (RTE_VER_YEAR >= 21)
+ mb_oran_hdr_ext->ol_flags |= RTE_MBUF_F_EXTERNAL;
+#else
mb_oran_hdr_ext->ol_flags |= EXT_ATTACHED_MBUF;
+#endif
mb_oran_hdr_ext->shinfo = p_share_data;
mb_oran_hdr_ext->data_off = (uint16_t)RTE_MIN((uint16_t)RTE_PKTMBUF_HEADROOM, (uint16_t)mb_oran_hdr_ext->buf_len) - rte_ether_hdr_size;
mb_oran_hdr_ext->data_len = (uint16_t)(mb_oran_hdr_ext->data_len + rte_ether_hdr_size);
@@ -1532,8 +1540,13 @@ xran_process_tx_sym_cp_on_opt(void* pHandle, uint8_t ctx_id, uint32_t tti, int32
/* Fill in the ethernet header. */
#ifndef TRANSMIT_BURST
+#if (RTE_VER_YEAR >= 21)
+ rte_eth_macaddr_get(mb_oran_hdr_ext->port, &((struct rte_ether_hdr*)pStart)->src_addr); /* set source addr */
+ ((struct rte_ether_hdr*)pStart)->dst_addr = eth_ctx->entities[vf_id][ID_O_RU]; /* set dst addr */
+#else
rte_eth_macaddr_get(mb_oran_hdr_ext->port, &((struct rte_ether_hdr*)pStart)->s_addr); /* set source addr */
((struct rte_ether_hdr*)pStart)->d_addr = eth_ctx->entities[vf_id][ID_O_RU]; /* set dst addr */
+#endif
((struct rte_ether_hdr*)pStart)->ether_type = ETHER_TYPE_ECPRI_BE; /* ethertype */
#endif
nPktSize = sizeof(struct rte_ether_hdr)
@@ -1878,7 +1891,11 @@ xran_process_tx_srs_cp_on(void* pHandle, uint8_t ctx_id, uint32_t tti, int32_t s
mb_oran_hdr_ext->buf_addr = ext_buff;
mb_oran_hdr_ext->buf_iova = ((struct rte_mempool_objhdr*)RTE_PTR_SUB(mb_base, rte_mempool_objhdr_size))->iova + RTE_PTR_DIFF(ext_buff, mb_base);
mb_oran_hdr_ext->buf_len = ext_buff_len;
+#if (RTE_VER_YEAR >= 21)
+ mb_oran_hdr_ext->ol_flags |= RTE_MBUF_F_EXTERNAL;
+#else
mb_oran_hdr_ext->ol_flags |= EXT_ATTACHED_MBUF;
+#endif
mb_oran_hdr_ext->shinfo = p_share_data;
mb_oran_hdr_ext->data_off = (uint16_t)RTE_MIN((uint16_t)RTE_PKTMBUF_HEADROOM, (uint16_t)mb_oran_hdr_ext->buf_len) - rte_ether_hdr_size;
mb_oran_hdr_ext->data_len = (uint16_t)(mb_oran_hdr_ext->data_len + rte_ether_hdr_size);
@@ -1887,8 +1904,13 @@ xran_process_tx_srs_cp_on(void* pHandle, uint8_t ctx_id, uint32_t tti, int32_t s
pStart = (char*)((char*)mb_oran_hdr_ext->buf_addr + mb_oran_hdr_ext->data_off);
/* Fill in the ethernet header. */
+#if (RTE_VER_YEAR >= 21)
+ rte_eth_macaddr_get(mb_oran_hdr_ext->port, &((struct rte_ether_hdr*)pStart)->src_addr); /* set source addr */
+ ((struct rte_ether_hdr*)pStart)->dst_addr = eth_ctx->entities[vf_id][ID_O_RU]; /* set dst addr */
+#else
rte_eth_macaddr_get(mb_oran_hdr_ext->port, &((struct rte_ether_hdr*)pStart)->s_addr); /* set source addr */
((struct rte_ether_hdr*)pStart)->d_addr = eth_ctx->entities[vf_id][ID_O_RU]; /* set dst addr */
+#endif
((struct rte_ether_hdr*)pStart)->ether_type = ETHER_TYPE_ECPRI_BE; /* ethertype */
nPktSize = sizeof(struct rte_ether_hdr)
diff --git a/fhi_lib/lib/src/xran_up_api.c b/fhi_lib/lib/src/xran_up_api.c
index fe22a1f..3fd369b 100644
--- a/fhi_lib/lib/src/xran_up_api.c

View File

@@ -1415,6 +1415,11 @@ uint32_t nr_timer_elapsed_time(const NR_timer_t *timer)
return timer->counter;
}
uint32_t nr_timer_remaining_time(const NR_timer_t *timer)
{
return timer->target - timer->counter;
}
void nr_timer_setup(NR_timer_t *timer, const uint32_t target, const uint32_t step)
{
timer->target = target;

View File

@@ -222,6 +222,12 @@ bool nr_timer_is_active(const NR_timer_t *timer);
* @return Time passed since start of timer
*/
uint32_t nr_timer_elapsed_time(const NR_timer_t *timer);
/**
* @brief To return how much time is left until the timer expires
* @param timer Timer to be checked
* @return Time left until the timer expires
*/
uint32_t nr_timer_remaining_time(const NR_timer_t *timer);
int set_default_nta_offset(frequency_range_t freq_range, uint32_t samples_per_subframe);

View File

@@ -692,8 +692,8 @@ void run_telnetsrv(void) {
break;
}
if (telnetparams.telnetdbg > 0)
TELNET_LOG("Command received: readc %i filled %i \"%s\"\n", readc, filled, buf);
//if (telnetparams.telnetdbg > 0)
TELNET_LOG("Command received: readc %i filled %i \"%s\"\n", readc, filled, buf);
if (buf[0] == '!') {
if (buf[1] == '!') {

View File

@@ -41,12 +41,12 @@ PTP enabled switches and grandmaster clock we have tested with:
These are the radio units we've used for testing:
| Vendor | Software Version |
|-------------|------------------|
| Foxconn RPQN-7801E RU | 2.6.9r254 |
| Foxconn RPQN-7801E RU | 3.1.15_0p4 |
| Foxconn RPQN-7801E RU | v3.2.0q.551.12.E.rc2.srs-AIO |
| Vendor | Software Version |
|-----------------------|-----------------------------|
| Foxconn RPQN-7801E RU | 2.6.9r254 |
| Foxconn RPQN-7801E RU | 3.1.15_0p4 |
| Foxconn RPQN-7801E RU | 3.2.0q.551.12.E.rc2.srs-AIO |
| WNC R1220-078LE | 1.9.0 |
The UEs that have been tested and confirmed working with Aerial are the following:
@@ -80,7 +80,7 @@ To set up the L1 and install the components manually refer to this [instructions
| Applicative Threads | Allocated CPUs |
|------------------------|----------------|
| PTP & PHC2SYS Services | 41 |
| OAI `nr-softmodem` | 13-20 |
| OAI `nr-softmodem` | 13-14 |
## PTP configuration
@@ -230,10 +230,10 @@ After preparing the L1 software, the container needs to be committed to create a
In this file the RU MAC address needs to be specified before commiting the image.
```bash
~$ docker commit nv-cubb cubb-build:24-3
~$ docker commit nv-cubb cubb-build:25-1
~$ docker image ls
..
cubb-build 24-3 824156e0334c 2 weeks ago 23.9GB
cubb-build 25-1 824156e0334c 2 weeks ago 23.9GB
-..
```

View File

@@ -139,6 +139,10 @@ These modes of operation are supported:
- evaluation of CQI report
- MAC scheduling of SR reception
- Intra-frequency handover
- Inter-frequency handover
- Measurement gaps are automatically computed at the DU if the CU has neighbor information and the configured
neighbors include cells operating on different frequencies
- DUs must be synchronized with each other for the measurements to be properly performed
- Initial support for RedCap
- Scheduling of SIBs (2, 19)

View File

@@ -1,53 +1,90 @@
# global
This document describes the broad way in which the VNF and PNF work internally,
from configuration, to P5 and P7 message exchange and processing.
Their internal processing is broadly independent on which transport mechanism
is responsible for exchanging data between the 2 components.
xnf is pnf or vnf
To read more about the transport mechanisms available, and how to run the split, please refer to
[this file](./nfapi.md).
The xnf starting functions are configure_nfapi_xnf()
[[_TOC_]]
The OAI code that read the configuration parameters call these functions that will create autonomous thread for xnf control part
# VNF/PNF Split
These control threads create a SCTP socket by Linux API call (no use of OpenAir internal architecture with SCTP itti thread).
The gNB is split into VNF(L2+) and PNF(L1)
The main() function of softmodem has to create and start the other threads+loop on event for appropriate work: RF Rx in pnf, NGAP, GTP-U, X2, RLC, PDCP for vnf
These component are configured via the functions:
NFAPI has it's own code directly on Linux+Posix, it doesn't reuse any piece of the OpenAir framework: SCTP thread, thread creation and management, ...
- configure_nr_nfapi_vnf()
- configure_nr_nfapi_pnf()
## signaling (P5) xnf main loop
These functions initialize the configuration appropriate for the transport mechanism selected ( setting the
pack/unpack function pointers, as well as the appropriate send functions )
nfapi_vnf_start() create the SCTP socket, then do event waiting in a infinite loop while(vnf->terminate == 0). It accepts the pnf connections, then process the messages on reception
After this, a thread is created for the P5 receive loop, which initializes the transport and receive loop
nfapi_pnf_start() initiate connection to vnf until it has a link. Then it enter a similar infinite loop in pnf_message_pump()
This created thread may be only for P5 messages, or P5 and P7, depending on the transport type
After some checks, when a message is obtained, it calls pnf_handle_p5_message() or vnf_handle_p4_p5_message() that have a switch on each p5 message types: the enum nfapi_message_id_e
- When using socket-based communication (which uses nFAPI encoding), the receiving loop for P7 messages is separate from
P5, it starts upon the PNF_START exchange
- In the other transport mechanisms (WLS and nvIPC, which use FAPI encoding), the receiving loop is the same for P5 and
P7 messages, the P7 configuration is done immediately after the P5 configuration.
Since the first P7 messages is only sent/received after the START exchange, we can logically treat the loops as separate
, we won't receive P7 messages before finishing the P5 ones ( except for the STOP exchange )
## P5 interface main loop
After the P5 configuration, both the VNF and PNF have a thread waiting to "consume" (n)FAPI messages exchanged between
them
Upon the reception of a message (whether in its entirety or segmented in the case of nFAPI), the messages are sent to
the appropriate handler:
- pnf_nr_handle_p5_message
- vnf_nr_handle_p4_p5_message
In each of these functions, there's a switch calling the appropriate handler according to the message ID, for example:
Each message type has it's own processing function in the switch, like
```
case NFAPI_START_RESPONSE:
vnf_handle_start_response(pRecvMsg, recvMsgLen, config, p5_idx);
break;
case NFAPI_NR_PHY_MSG_TYPE_START_RESPONSE:
vnf_nr_handle_start_response(pRecvMsg, recvMsgLen, config, p5_idx);
break;
```
These loops are autonomous in their thread waiting incoming message.
## P7 xnf main loop
## P7 interface main loop
When the p5 interface receives appropriate message, it starts the p7 interface by launching a thread (see the calls to pthread_create() in nfapi/oai_integration/nfapi_xnf.c)
- Note: As explained before, the P7 reception loop is the same as the P5 messages when not using socket-based
communication
The p7 main loops starting is a bit simpler, thanks to UDP non connected protocol. The xnf_dispatch_p7_message() do p7 fragments re-assembly, then
calls xnf_dispatch_p7_message() that have the big switch on message type (as in p5 above description)
In this case, when the P5 interface receives appropriate message, it starts the p7 interface by launching a thread
So, we have the logic for UL reception in vnf, and DL reception in pnf
- On the PNF, this is done in the START.request handler ( nr_start_request(...) )
- On the VNF, this is done in ( configure_nr_p7_vnf(...) )
Much in the same way as when processing P5 messages, the following functions are called to unpack and process them:
- pnf_nr_handle_p7_message
- vnf_nr_handle_p7_message
```
case NFAPI_NR_PHY_MSG_TYPE_SLOT_INDICATION:
vnf_handle_nr_slot_indication(pRecvMsg, recvMsgLen, vnf_p7);
break;
```
## P7 UL transmission by PNF
RF samples are received, and decoding is done by the PNF using control data transmitted by the VNF to the PNF through downlink p7 messages (UL_TTI_req and UL_DCI_req).
RF samples are received, and decoding is done by the PNF using control data transmitted by the VNF to the PNF through
downlink p7 messages (UL_TTI.request and UL_DCI.request).
After decoding, results are accumulated into the xNB->UL_INFO structure at the PNF.
After decoding, results are accumulated into the gNB->UL_INFO structure at the PNF.
The data in the UL_INFO struct is transmitted through a socket in the form of 'uplink indication functions' from the PNF to the VNF. Each uplink indication message is transmitted from their respective handle functions in NR_UL_indication(). For example,
The data in the UL_INFO struct is transmitted through the configured send function pointer (send_p7_msg), which packs
the message into a buffer according to the encoding and sends it to the VNF
```
void handle_nr_rach(NR_UL_IND_t *UL_info) {
if(NFAPI_MODE == NFAPI_MODE_PNF) {
if (UL_info->rach_ind.number_of_pdus>0) {
@@ -56,67 +93,186 @@ void handle_nr_rach(NR_UL_IND_t *UL_info) {
}
}
```
....
## P7 UL reception at VNF
int oai_nfapi_nr_rach_indication(nfapi_nr_rach_indication_t *ind) {
ind->header.phy_id = 1; // HACK TODO FIXME - need to pass this around!!!!
ind->header.message_id = NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION;
return nfapi_pnf_p7_nr_rach_ind(p7_config_g, ind);
}
Through the infinite loop [while(vnf_p7->terminate == 0)] running in nfapi_nr_vnf_p7_start(), the VNF receives and unpacks the uplink indication message received on its socket. Based on the unpacked messages, UL_INFO struct on the VNF side gets populated.
.....
```
// have a p7 message
if(FD_ISSET(vnf_p7->socket, &rfds))
{
vnf_nr_p7_read_dispatch_message(vnf_p7);
}
```
vnf_nr_dispatch_p7_message() is the function that contains the switch on various message headers so that the appropriate unpack function is called.
## P7 DL Transmission by VNF
DL messages are scheduled at the VNF, through NR_UL_indication(). NR_UL_indication() is called when the SFN/slot in the UL_info structure changes (this acts as a trigger for next slot processing, instead of running a separate clock at the VNF). The SFN/slot at the VNF in UL_info is updated using the slot_indication uplink p7 message, which is sent at the beginning of every slot by the PNF. The slot_indication message contains SFN/slot of the TX_thread, so that the scheduler operates slot_ahead slots ahead of the RX thread. This ensures that UL_tti_req is received before RX slot processing at the PNF.
The function NR_schedule_response calls oai_nfapi_[DL P7 msg]_req(), which contains the routines for packing + transmission of scheduled messages through the socket to the PNF. For example, to send the 'TX_data_req' p7 message
```
if (Sched_INFO->TX_req->Number_of_PDUs > 0)
int nfapi_pnf_p7_nr_rach_ind(nfapi_pnf_p7_config_t* config, nfapi_nr_rach_indication_t* ind)
{
oai_nfapi_tx_data_req(Sched_INFO->TX_req);
if(config == NULL || ind == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__);
return -1;
}
pnf_p7_t* _this = (pnf_p7_t*)(config);
AssertFatal(_this->_public.send_p7_msg, "Function pointer must be configured|");
return _this->_public.send_p7_msg(_this, (nfapi_nr_p7_message_header_t*)ind, sizeof(nfapi_nr_rach_indication_t));
}
```
## P7 UL reception at VNF
Through the P7 reception loop, the VNF receives a buffer containing the messages, which it handles by the following
process:
- Unpack the header by use of the hdr_unpack_func function pointer
- According to the Message ID in the header, send the buffer to the appropriate handler by use of a switch statement:
```
case NFAPI_NR_PHY_MSG_TYPE_SLOT_INDICATION:
vnf_handle_nr_slot_indication(pRecvMsg, recvMsgLen, vnf_p7);
break;
```
- In the handler function, unpack the entire message, by using the unpack_func function pointer.
- If the unpack procedure is successful, call the previously configure callback for that message type:
```
nfapi_nr_slot_indication_scf_t ind = {0};
const bool result = vnf_p7->_public.unpack_func(pRecvMsg, recvMsgLen, &ind, sizeof(ind), &vnf_p7->_public.codec_config);
if(!result)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Failed to unpack message\n", __FUNCTION__);
}
else
{
NFAPI_TRACE(NFAPI_TRACE_DEBUG, "%s: Handling NR SLOT Indication\n", __FUNCTION__);
if(vnf_p7->_public.nr_slot_indication)
{
(vnf_p7->_public.nr_slot_indication)(&ind);
}
free_slot_indication(&ind);
}
```
vnf_nr_dispatch_p7_message() is the function that contains the switch on various message headers so that the appropriate
unpack function is called.
## P7 DL Transmission by VNF
DL messages are scheduled at the VNF, through gNB_dlsch_ulsch_scheduler(). gNB_dlsch_ulsch_scheduler() is called when
handling a SLOT.indication message in trigger_scheduler().
The function trigger_scheduler(nfapi_nr_slot_indication_scf_t *slot_ind) calls the functions oai_nfapi_[DL P7 msg]_
req(), calling in turn call the send_p7_msg function pointer, which contain the logic to pack the message into a buffer
and send it to the PNF.
Finally, NR_UL_indication is called to process the other P7 messages received from the PNF that were put in theire
respective queues.
For example, the TX_DATA.request message is sent in the following manner:
```
if (g_sched_resp.TX_req.Number_of_PDUs > 0)
oai_nfapi_tx_data_req(&g_sched_resp.TX_req);
...
int oai_nfapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req)
{
LOG_D(NR_PHY, "Entering oai_nfapi_nr_tx_data_req sfn:%d,slot:%d\n", tx_data_req->SFN, tx_data_req->Slot);
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
tx_data_req->header.phy_id = 1; // HACK TODO FIXME - need to pass this around!!!!
tx_data_req->header.message_id = NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST;
//LOG_D(PHY, "[VNF] %s() TX_REQ sfn_sf:%d number_of_pdus:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(tx_req->sfn_sf), tx_req->tx_request_body.number_of_pdus);
bool retval = nfapi_vnf_p7_tx_data_req(p7_config, tx_data_req);
if (!retval) {
LOG_E(PHY, "%s() Problem sending retval:%d\n", __FUNCTION__, retval);
} else {
tx_data_req->Number_of_PDUs = 0;
}
return retval;
}
...
bool nfapi_vnf_p7_tx_data_req(nfapi_vnf_p7_config_t* config, nfapi_nr_tx_data_request_t* req)
{
if(config == 0 || req == 0)
return -1;
vnf_p7_t* vnf_p7 = (vnf_p7_t*)config;
AssertFatal(config->send_p7_msg, "Function pointer must be configured|");
return config->send_p7_msg(vnf_p7, &req->header);
}
```
## VNF functional flowchart
```mermaid
graph TD
pselect[VNF socket pselect] -- timed out : end of slot --> call_sched[Call Scheduler NR_UL_indication] -- oai_nfapi_***_req sends the DL p7 msg--> slot_inc[Increment sfn/slot];
pselect[VNF socket pselect] -- UL p7 xyz msg recvd --> msg_recvd[Read message vnf_nr_p7_read_dispatch_message] --> header_unpack[Unpack Header] -- switch cases on header --> unpack_msg[Handle Message vnf_handle_nr_xyz] --> fill_ul_info[Fill UL info struct with fn pointer vnf_p7->_public.nr_rx_xyz];
fill_ul_info -- update pselect_timeout: next_slot_start - time_xyz_msg_recvd-->pselect;
slot_inc -- next slot --> pselect
softmodem_start[nr-softmodem init] --> P5_configuration[configure_nr_nfapi_vnf] --> transport_init[Transport mechanism init] --> send_first_msg[Send first P5 message to PNF]
transport_init[Transport mechanism init] --> P5_recv_loop[P5 receive loop] -- P5 Message processing --> P5_recv_loop[P5 receive loop]
P5_recv_loop[P5 receive loop] -- Start.response callback called --> P7_config[P7 Configuration] --> P7_loop[P7 Loop] --> P7_msg_recv[P7 message received] --> call_vnf_handle_p7[Call vnf_nr_handle_p7_msg] --> hdr_unpack[Unpack header] --> call_specific_p7_handler[Call specific P7 message handler] --> slot_ind[Is a SLOT.indication?] -- Yes --> trig_scheduler[Call trigger_scheduler] --> gNB_ulsch_dlsch_sched[Call gNB_dlsch_ulsch_scheduler] --> send_p7_dl[Process and send P7 messages to PNF] --> call_ul_ind[Call NR_UL_indication] --> proc_p7[Process P7 messages in queue] --> P7_loop[P7 Loop]
slot_ind[Is a SLOT.indication?] -- No --> put_queue[Put message in queue] --> P7_loop[P7 Loop];
```
Note that since DL P7 message reception and TX/RX processing are done on separate threads, there is the issue of the L1 processing threads trying to do their job before the required P7 message is received. In the case of RX processing, since the scheduler operates slot_ahead slots ahead of the RX thread, the required messages conveniently arrive earlier than they are required. However, in the case of TX processing, this cannot be ensured if the scheduler is exactly in sync with the TX thread.
Therefore, we operate the VNF vnf_slot_ahead (which is currently 2) slots ahead of the PNF. This is to ensure that the DL fapi structures for a particular TX slot are all received before TX processing for that slot.
## P7 DL Reception at PNF
## P7 DL Reception at PNF
Through the infinite loop [while(pnf_p7->terminate == 0)] running in pnf_nr_p7_message_pump(), the PNF receives and
unpacks the downlink P7 message received on its socket. Based on the unpacked message, the appropriate message
structures are filled in the PNF, and these are used further down the pipeline for processing.
Through the P7 reception loop, the PNF receives a buffer containing a P7 message from the VNF, which it processes the
following way:
Through the infinite loop [while(pnf_p7->terminate == 0)] running in pnf_nr_p7_message_pump(), the PNF receives and unpacks the downlink P7 message received on its socket. Based on the unpacked message, the appropriate message structures are filled in the PNF, and these are used further down the pipeline for processing.
- Unpack the header by use of the hdr_unpack_func function pointer
- According to the Message ID in the header, send the buffer to the appropriate handler by use of a switch statement:
While receiving the DL P7 message, we check whether the message was received within a timing window from which it was sent. The duration of the window can be set by the user (set as a parameter for xnf in the p5 messages). Note that the DL information must be received by the PNF within a timing window at least lesser than the duration of slot_ahead variable (timing_window <= slot_ahead * slot_duration).
```
case NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST:
pnf_handle_dl_tti_request(pRecvMsg, recvMsgLen, pnf_p7);
break;
```
- In the handler function, the SFN and Slot are peeked from the message
- The SFN and slot are checked to determine if the message is inside the appropriate timing window
- If so, the message is unpacked into the P7 Slot buffer:
```
pnf_p7->slot_buffer[buffer_index].sfn = frame;
pnf_p7->slot_buffer[buffer_index].slot = slot;
nfapi_nr_dl_tti_request_t *req = &pnf_p7->slot_buffer[buffer_index].dl_tti_req;
pnf_p7->nr_stats.dl_tti.ontime++;
NFAPI_TRACE(NFAPI_TRACE_DEBUG,
"POPULATE DL_TTI_REQ current tx sfn/slot:%d.%d p7 msg sfn/slot: %d.%d buffer_index:%d\n",
pnf_p7->sfn,
pnf_p7->slot,
frame,
slot,
buffer_index);
const bool result = pnf_p7->_public.unpack_func(pRecvMsg, recvMsgLen, req, sizeof(*req), &(pnf_p7->_public.codec_config));
```
- The messages are later processed in the NR_slot_indication function, which is called in the tx_func function (
L1_tx_thread )
## PNF functional flowchart
```mermaid
graph TB
pselect[PNF socket pselect] -- timed out : end of slot --> slot_inc[Increment sfn/slot];
pselect[PNF socket pselect] -- DL p7 xyz msg recvd --> msg_recvd[Read message pnf_nr_nfapi_p7_read_dispatch_message] --> header_unpack[Unpack Header] -- switch cases on header --> unpack_msg[Unpack Message pnf_handle_nr_xyz] --> fill_pnf_p7[Fill pnf_p7 global structure pnf_handle_nr_xyz] --Data from pnf_p7 struct copied to fapi structures using pnf_phy_***_req. Called every slot from handle_nr_slot_ind-->pselect;
slot_inc -- next slot --> pselect
graph TD
softmodem_start[nr-softmodem init] --> init_l1_tx_thread[Init L1 TX Thread] --> tx_func[Call tx_func] --> nr_slot_ind[Call NR_slot_indication] --> pnf_slot_ind[Call handle_nr_slot_ind] --> send_slot_ind[Send SLOT.ind to VNF] --> get_from_slot_buffer[Get P7 messages from slot_buffer] --> proc_p7_dl[Process P7 messages from VNF] --> tx_func
softmodem_start[nr-softmodem init] --> init_l1_rx_thread[Init L1 RX Thread] --> rx_func[Call rx_func] --> nr_ul_ind[Call NR_UL_indication] --> send_p7_vnf[Send P7 messages to VNF] --> rx_func
softmodem_start[nr-softmodem init] --> P5_configuration[configure_nr_nfapi_pnf] --> transport_init[Transport mechanism init] --> p5_loop[P5 Loop] -- Process P5 messages --> p5_loop
p5_loop -- START.request callback called --> p7_config[P7 Configuration] --> l1_north_init_gnb[Call l1_north_init_gNB] --> nr_if_module_init[Call NR_IF_Module_Init] --> install_slot_ind_cb[Install NR_slot_indication callback]
p7_config[P7 Configuration] --> p7_loop[P7 Loop] --> p7_recv[Receive P7 message] --> pnf_handle_p7[Call pnf_nr_handle_p7_message] --> hdr_unpack[Unpack header with hdr_unpack] --> p7_handler[Call pnf_handle_<msg_type>] --> peek_sfn[Peek SFN/Slot and check if in timing window] --> p7_unpack[Unpack message into slot_buffer] --> p7_loop
```
Once the messages are received, they are filled into slot buffers, and are stored until the processing of the slot that they were meant for.

View File

@@ -57,7 +57,7 @@ There is some general information in the [OpenAirInterface Gitlab Wiki](https://
- [How to use the L2 simulator](./L2NFAPI.md)
- [How to use the OAI channel simulator](../openair1/SIMULATION/TOOLS/DOC/channel_simulation.md)
- [How to use multiple BWPs](./RUN_NR_multiple_BWPs.md)
- [How to run OAI-VNF and OAI-PNF](./nfapi.md): how to run the nFAPI split,
- [How to run OAI-VNF and OAI-PNF](./nfapi.md): how to run the FAPI/nFAPI split,
including some general remarks on FAPI/nFAPI.
- [How to use the positioning reference signal (PRS)](./RUN_NR_PRS.md)
- [How to use device-to-device communication (D2D, 4G)](./d2d_emulator_setup.txt)

View File

@@ -291,7 +291,7 @@ Note that while 38.331 requires only one RRC transaction to happen at a time,
the 5G RRC does not actually ensure this; it only tries to prevent it by
chaining of transactions and some checks. For instance, the Security Mode
procedure is followed by a UE capability procedure, and some procedures are not
executed if others are ongoing (ex.: handover if there is reconfiguratio).
executed if others are ongoing (ex.: handover if there is reconfiguration).
However, it might be possible to trigger a procedure while another is ongoing.
As of now, no queueing mechanims exists to ensure only one operation is
@@ -303,7 +303,7 @@ Handover-related data is stored in a per-UE structure of type
`nr_handover_context_t`. It is a pointer and only set during handover
operation. This data structure has in turn two pointers, one to the source CU
(`nr_ho_source_cu_t`), and one to the target CU (`nr_ho_target_cu_t`). In F1,
both are present. In N2 and Xn, only one pointer is supposed to be set a the
both are present. In N2 and Xn, only one pointer is supposed to be set at the
corresponding CU.
`nr_ho_source_cu_t` contains notably a function pointer `ho_cancel` for

View File

@@ -54,7 +54,11 @@ Start DU0:
sudo ./nr-softmodem --rfsim -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb-du.sa.band78.106prb.rfsim.pci0.conf --rfsimulator.serveraddr 127.0.0.1
Start the UE, and let it connect completely:
This will show an error `[HW] connect() to 127.0.0.1:4043 failed,
errno(111)`. _This is expected_, because the RFsim server is at the UE (to be
able to serve two RFsim clients, one DU each; see below for more info). Proceed
by starting the UE, and let it connect completely (this should make the error
go away):
sudo ./nr-uesoftmodem -C 3450720000 -r 106 --numerology 1 --ssb 516 -O <config> --rfsim --rfsimulator.serveraddr server
@@ -119,7 +123,7 @@ You can do handover across DUs with a COTS UE. Note that these DUs should be
separated by at least multiple meters to ensure that the UE will receive
different signal strengths when moving between cells.
We only support intra-frequency handovers yet. We have verified with USRPs
We support both intra-frequency and inter-frequency handovers. We have verified with USRPs
only, although other radios should work as well.
For UEs, we verified Quectel modules and iPhones. Note, though, that not all
@@ -142,7 +146,7 @@ neighbour relation of the DUs at the CU. To do so, proceed as follows:
```
cat nrRRC_stats.log
```
1. Fill in the `neighbour-config.conf` configuration file as shown below, and
1. Fill in the [`neighbour-config.conf`](../ci-scripts/conf_files/neighbour-config.conf) configuration file as shown below, and
`@include` it in the CU file.
1. Start the CU and both DUs.
1. Bring the phone close to one cell, and leave flight mode. It should connect
@@ -157,7 +161,7 @@ triggered:
- Make sure that both DUs use the same hardware.
- Make sure that the UE sees both cells. For instance, you can switch to flight
mode, go closer to the other DU, and switch off flight mode -- the UE should
connect to that second UE.
connect to that second DU.
- We did not manage handover with every phone yet -- make sure you use one of
the list provided above.
@@ -246,6 +250,15 @@ nr_measurement_configuration = {
})
};
```
`@include` this configuration file inside the gNB section of CU file as shown below.
```
plmn_list = ({ mcc = 222; mnc = 01; mnc_length = 2; snssaiList = ({ sst = 1, sd = 0xffffff })});
@include "neighbour-config.conf"
```
# Handovers triggers and NTN

View File

@@ -1,5 +1,6 @@
This document describes the SmallCellForum (SCF) (n)FAPI split in 5G, i.e.,
between the MAC/L2 and PHY/L1.
between the MAC/L2 and PHY/L1. It also describes how to make use of the
multiple transport mechanisms between the 2.
The interested reader is recommended to read a copy of the SCF 222.10
specification ("FAPI"). This includes information on what is P5, P7, and how
@@ -7,6 +8,8 @@ FAPI works. The currently used version is SCF 222.10.02, with some messages
upgraded to SCF 222.10.04 due to bugfixes in the spec. Further information
about nFAPI can be found in SCF 225.2.0.
[[_TOC_]]
# Quickstart
Compile OAI as normal. Start the CN and make sure that the VNF configuration
@@ -108,6 +111,125 @@ can proceed as follows:
Note: all L1-specific options have to be passed to the PNF, and remaining
options to the VNF.
## Transport mechanisms between VNF and PNF
Currently, the VNF/PNF split supports three transport mechanisms between each
other:
1. Socket communication (either regular, or SCTP), this is the default
The socket type may be changed by editing `nfapi_pnf_config_create()` and
`nfapi_vnf_config_create()`, in both of which `_this->sctp = <value, 0 or
1>;` indicate whether SCTP or regular sockets are to be used. Note: The
value of `_this->sctp` **must** be the same on the VNF and PNF.
2. Intel WLS Lib, which uses DPDK to achieve a shared memory communication between components.
3. nvIPC, which is used exclusively for the NVIDIA Aerial L1. Thus, it is only
applicable for the VNF.
The change between transport mechanisms is done at compilation time:
- No changes to the `build_oai` call are required in order to select socket communication, as it is the default.
- In order to select WLS as the transport mechanism between VNF and PNF, first install the WLS library, and afterwards use `-t WLS` as a parameter of `build_oai`:
### How to use nFAPI
nFAPI is used by default. Compile and configure as indicated above.
### How to use Aerial
Refer to [this document](./Aerial_FAPI_Split_Tutorial.md) for more information.
### How to use WLS lib
Before the first compilation with WLS support, the [WLS
library](https://docs.o-ran-sc.org/projects/o-ran-sc-o-du-phy/en/latest/wls-lib.html)
must first be compiled and installed to the system.
The WLS library has a few dependencies:
- [DPDK](https://doc.dpdk.org/guides/prog_guide/build-sdk-meson.html), specifically version [20.11.3](https://fast.dpdk.org/rel/dpdk-20.11.3.tar.xz).
- libelf-dev
- libhugetlbfs-dev
Additionally, a patch needs to be applied to the WLS lib Makefile in order for
the shared library and headers to be installed into the system, the necessary
patch is available [here](../cmake_targets/tools/install_wls_lib.patch)
Clone the code and apply the patch
git clone -b oran_f_release https://gerrit.o-ran-sc.org/r/o-du/phy.git
cd phy/wls_lib/
git apply ~/openairinterface5g/cmake_targets/tools/install_wls_lib.patch
Then compile and install the library
WIRELESS_SDK_TOOLCHAIN=gcc WIRELESS_SDK_TARGET_ISA=avx2 make
sudo WIRELESS_SDK_TOOLCHAIN=gcc WIRELESS_SDK_TARGET_ISA=avx2 make install
After installing WLS, you can run the build command as shown below:
./build_oai -t WLS -w USRP --gNB --nrUE --ninja -C
#### How to run OAI PNF with OAI VNF
Refer to the above steps in [Quickstart](.#quickstart), but run the PNF first as it is the WLS "master".
#### How to run OAI PNF with OSC/Radisys O-DU
Set up the hugepages for DPDK (1GB page size, 6 pages; this only needs to be
done once):
sudo nano /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="${GRUB_CMDLINE_LINUX_DEFAULT} default_hugepagesz=1G hugepagesz=1G hugepages=6"
Then rewrite the bootloader and reboot
sudo update-grub
sudo reboot
Install dependencies:
sudo apt-get install libstdc++-14-dev libnsl-dev libpcap-dev libxml2-dev
Clone the Radisys repository (We're currently using the `oai_integration` branch):
git clone https://gerrit.o-ran-sc.org/r/o-du/l2 -b oai-integration
Build the O-DU
cd ~/l2/build/odu
make clean_all;make odu PHY=INTEL_L1 MACHINE=BIT64 MODE=TDD;make cu_stub NODE=TEST_STUB MACHINE=BIT64 MODE=TDD;make ric_stub NODE=TEST_STUB MACHINE=BIT64 MODE=TDD
Setup local interfaces for the cu_stub, ric_stub and o_du
sudo ifconfig enp7s0:ODU "192.168.130.81" && sudo ifconfig enp7s0:CU_STUB "192.168.130.82" && sudo ifconfig enp7s0:RIC_STUB "192.168.130.80"
Run cu_stu and ric_stub in separate terminals
cd ~/l2/bin/
./cu_stub/cu_stub
clear && ./ric_stub/ric_stub
Run the OAI PNF first, as it is the WLS memory master
sudo NFAPI_TRACE_LEVEL=info ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb-pnf.band78.rfsim.2x2.conf --nfapi PNF --rfsim --rfsimulator.serveraddr server
Run the O-DU over GDB
sudo -E gdb -ex run --readnever --args ./odu/odu
Note: If you see the following prompt in GDB
This GDB supports auto-downloading debuginfo from the following URLs:
<https://debuginfod.ubuntu.com>
Enable debuginfod for this session? (y or [n])
You can run the following command one time before executing gdb to disable it:
export DEBUGINFOD_URLS=
Run the OAI-UE
sudo ./nr-uesoftmodem -r 273 --numerology 1 --band 78 -C 3400140000 --ssb 1518 --uicc0.imsi 001010000000001 --rfsim
# nFAPI logging system
nFAPI has its own logging system, independent of OAI's. It can be activated by

View File

@@ -71,6 +71,7 @@ WORKDIR /opt/oai-gnb/bin
COPY --from=gnb-build \
/oai-ran/cmake_targets/ran_build/build/nr-softmodem ./
COPY ./docker/scripts/gnb_entrypoint.sh ./entrypoint.sh
COPY ./docker/scripts/check-prach-io.sh ./check-prach-io.sh
COPY --from=gnb-build \
/oai-ran/cmake_targets/ran_build/build/librfsimulator.so \

View File

@@ -59,6 +59,7 @@ WORKDIR /opt/oai-gnb/bin
COPY --from=gnb-build \
/oai-ran/cmake_targets/ran_build/build/nr-softmodem ./
COPY ./docker/scripts/gnb_entrypoint.sh ./entrypoint.sh
COPY ./docker/scripts/check-prach-io.sh ./check-prach-io.sh
COPY --from=gnb-build \
/oai-ran/cmake_targets/ran_build/build/librfsimulator.so \

View File

@@ -71,6 +71,7 @@ WORKDIR /opt/oai-gnb/bin
COPY --from=gnb-build \
/oai-ran/cmake_targets/ran_build/build/nr-softmodem ./
COPY ./docker/scripts/gnb_entrypoint.sh ./entrypoint.sh
COPY ./docker/scripts/check-prach-io.sh ./check-prach-io.sh
COPY --from=gnb-build \
/oai-ran/cmake_targets/ran_build/build/librfsimulator.so \

View File

@@ -60,6 +60,7 @@ WORKDIR /opt/oai-gnb/bin
COPY --from=gnb-build \
/oai-ran/cmake_targets/ran_build/build/nr-softmodem ./
COPY ./docker/scripts/gnb_entrypoint.sh ./entrypoint.sh
COPY ./docker/scripts/check-prach-io.sh ./check-prach-io.sh
COPY --from=gnb-build \
/oai-ran/cmake_targets/ran_build/build/liboai_eth_transpro.so \

View File

@@ -57,6 +57,7 @@ WORKDIR /opt/oai-gnb/bin
COPY --from=gnb-build \
/oai-ran/cmake_targets/ran_build/build/nr-softmodem ./
COPY ./docker/scripts/gnb_entrypoint.sh ./entrypoint.sh
COPY ./docker/scripts/check-prach-io.sh ./check-prach-io.sh
COPY --from=gnb-build \
/oai-ran/cmake_targets/ran_build/build/liboai_eth_transpro.so \

View File

@@ -94,6 +94,7 @@ WORKDIR /opt/oai-gnb/bin
COPY --from=gnb-build \
/oai-ran/cmake_targets/ran_build/build/nr-softmodem ./
COPY ./docker/scripts/gnb_entrypoint.sh ./entrypoint.sh
COPY ./docker/scripts/check-prach-io.sh ./check-prach-io.sh
COPY --from=gnb-build \
/oai-ran/cmake_targets/ran_build/build/liboai_eth_transpro.so \

View File

@@ -54,7 +54,7 @@ fi
# the source directory to show correct line numbers
docker run --rm -it \
-v $COREDUMP:/tmp/coredump \
-v $SOURCES:/opt/$TYPEPATH/src \
-v $SOURCES:/oai-ran/ \
--entrypoint bash \
$IMAGE \
-c "gdb --dir=src/cmake_targets/ran_build/build $EXEC /tmp/coredump"

View File

@@ -0,0 +1,5 @@
#!/bin/bash
set -eo pipefail
test -f /opt/oai-gnb/nrL1_stats.log && grep -oP 'PRACH I0 = \K[0-9.]*' /opt/oai-gnb/nrL1_stats.log | awk '{if ($1 > 0.0) exit 0; else exit 1}'

View File

@@ -97,11 +97,19 @@ void exit_function(const char *file, const char *function, const int line, const
oai_exit = 1;
if (ru_m.rfdevice.trx_end_func) {
if (ru_m.rfdevice.trx_get_stats_func) {
ru_m.rfdevice.trx_get_stats_func(&ru_m.rfdevice);
ru_m.rfdevice.trx_get_stats_func = NULL;
}
ru_m.rfdevice.trx_end_func(&ru_m.rfdevice);
ru_m.rfdevice.trx_end_func = NULL;
}
if (ru_m.ifdevice.trx_end_func) {
if (ru_m.ifdevice.trx_get_stats_func) {
ru_m.ifdevice.trx_get_stats_func(&ru_m.ifdevice);
ru_m.ifdevice.trx_get_stats_func = NULL;
}
ru_m.ifdevice.trx_end_func(&ru_m.ifdevice);
ru_m.ifdevice.trx_end_func = NULL;
}
@@ -363,11 +371,19 @@ int main ( int argc, char **argv )
end_configmodule(uniqCfg);
if (ru->rfdevice.trx_end_func) {
if (ru->rfdevice.trx_get_stats_func) {
ru->rfdevice.trx_get_stats_func(&ru->rfdevice);
ru->rfdevice.trx_get_stats_func = NULL;
}
ru->rfdevice.trx_end_func(&ru->rfdevice);
ru->rfdevice.trx_end_func = NULL;
}
if (ru->ifdevice.trx_end_func) {
if (ru->ifdevice.trx_get_stats_func) {
ru->ifdevice.trx_get_stats_func(&ru->ifdevice);
ru->ifdevice.trx_get_stats_func = NULL;
}
ru->ifdevice.trx_end_func(&ru->ifdevice);
ru->ifdevice.trx_end_func = NULL;
}

View File

@@ -114,7 +114,7 @@ static void tx_func(processingData_L1tx_t *info)
pushNotifiedFIFO(&gNB->resp_L1, res);
int tx_slot_type = nr_slot_select(cfg, frame_tx, slot_tx);
if (tx_slot_type == NR_DOWNLINK_SLOT || tx_slot_type == NR_MIXED_SLOT || get_softmodem_params()->continuous_tx) {
if (tx_slot_type == NR_DOWNLINK_SLOT || tx_slot_type == NR_MIXED_SLOT || get_softmodem_params()->continuous_tx || IS_SOFTMODEM_RFSIM) {
start_meas(&info->gNB->phy_proc_tx);
phy_procedures_gNB_TX(info, frame_tx, slot_tx, 1);
@@ -239,14 +239,26 @@ static size_t dump_L1_meas_stats(PHY_VARS_gNB *gNB, RU_t *ru, char *output, size
if (ru->feprx)
output += print_meas_log(&ru->ofdm_demod_stats, "feprx", NULL, NULL, output, end - output);
bool full_slot = ru->half_slot_parallelization == 0;
if (ru->feptx_prec) {
output += print_meas_log(&ru->precoding_stats,"feptx_prec",NULL,NULL, output, end - output);
output += print_meas_log(&ru->precoding_stats,
full_slot ? "feptx_prec (per port)" : "feptx_prec (per port, half_slot)",
NULL,
NULL,
output,
end - output);
}
if (ru->feptx_ofdm) {
output += print_meas_log(&ru->txdataF_copy_stats,"txdataF_copy",NULL,NULL, output, end - output);
output += print_meas_log(&ru->ofdm_mod_stats,"feptx_ofdm",NULL,NULL, output, end - output);
output += print_meas_log(&ru->ofdm_mod_stats,
full_slot ? "feptx_ofdm (per port)" : "feptx_ofdm (per port, half_slot)",
NULL,
NULL,
output,
end - output);
output += print_meas_log(&ru->ofdm_total_stats,"feptx_total",NULL,NULL, output, end - output);
output += print_meas_log(&ru->txdataF_copy_stats, "txdataF_copy", NULL, NULL, output, end - output);
}
if (ru->fh_north_asynch_in)

View File

@@ -759,7 +759,7 @@ void tx_rf(RU_t *ru, int frame,int slot, uint64_t timestamp)
radio_tx_burst_flag_t flags_burst = TX_BURST_INVALID;
radio_tx_gpio_flag_t flags_gpio = 0;
if (cfg->cell_config.frame_duplex_type.value == TDD && !get_softmodem_params()->continuous_tx) {
if (cfg->cell_config.frame_duplex_type.value == TDD && !get_softmodem_params()->continuous_tx && !IS_SOFTMODEM_RFSIM) {
int slot_type = nr_slot_select(cfg,frame,slot%fp->slots_per_frame);
if(slot_type == NR_MIXED_SLOT) {
int txsymb = 0;
@@ -992,36 +992,6 @@ int setup_RU_buffers(RU_t *ru)
return(0);
}
void *ru_stats_thread(void *param) {
RU_t *ru = (RU_t *)param;
wait_sync("ru_stats_thread");
while (!oai_exit) {
sleep(1);
if (cpu_meas_enabled) {
if (ru->feprx) print_meas(&ru->ofdm_demod_stats,"feprx (all ports)",NULL,NULL);
if (ru->feptx_ofdm) {
print_meas(&ru->precoding_stats,(ru->half_slot_parallelization==0)?"feptx_prec (per port)":"feptx_prec (per port, half_slot)",NULL,NULL);
print_meas(&ru->ofdm_mod_stats,(ru->half_slot_parallelization==0)?"feptx_ofdm (per port)":"feptx_ofdm (per port, half_slot)",NULL,NULL);
print_meas(&ru->txdataF_copy_stats,"txdataF_copy",NULL,NULL);
print_meas(&ru->ofdm_total_stats,"feptx_total",NULL,NULL);
}
print_meas(&ru->rx_fhaul,"rx_fhaul",NULL,NULL);
if (ru->if_south == REMOTE_IF5) print_meas(&ru->ifdevice.tx_fhaul,"tx_fhaul (IF5)",NULL,NULL);
else print_meas(&ru->tx_fhaul,"tx_fhaul",NULL,NULL);
if (ru->fh_north_out) {
print_meas(&ru->compression,"compression",NULL,NULL);
print_meas(&ru->transport,"transport",NULL,NULL);
}
}
}
return(NULL);
}
void ru_tx_func(void *param)
{
processingData_RU_t *info = (processingData_RU_t *) param;
@@ -1371,6 +1341,9 @@ int start_rf(RU_t *ru) {
}
int stop_rf(RU_t *ru) {
if (ru->rfdevice.trx_get_stats_func) {
ru->rfdevice.trx_get_stats_func(&ru->rfdevice);
}
ru->rfdevice.trx_end_func(&ru->rfdevice);
return 0;
}
@@ -1399,8 +1372,6 @@ void init_RU_proc(RU_t *ru) {
if(emulate_rf)
threadCreate( &proc->pthread_emulateRF, emulatedRF_thread, (void *)proc, "emulateRF", -1, OAI_PRIORITY_RT );
if (cpu_meas_enabled)
threadCreate(&ru->ru_stats_thread, ru_stats_thread, (void *)ru, "ru_stats", -1, OAI_PRIORITY_RT);
LOG_I(PHY, "Initialized RU proc %d (%s,%s),\n", ru->idx, NB_functions[ru->function], NB_timing[ru->if_timing]);
}
@@ -1430,11 +1401,6 @@ void kill_NR_RU_proc(int inst) {
pthread_mutex_unlock( &proc->mutex_fep[0] );
pthread_join(proc->pthread_FH, NULL);
if (cpu_meas_enabled) {
LOG_D(PHY, "Joining ru_stats_thread\n");
pthread_join(ru->ru_stats_thread, NULL);
}
// everything should be stopped now, we can safely stop the RF device
if (ru->stop_rf == NULL) {
LOG_W(PHY, "No stop_rf() for RU %d defined, cannot stop RF!\n", ru->idx);

View File

@@ -207,11 +207,19 @@ void exit_function(const char *file, const char *function, const int line, const
for (ru_id=0; ru_id<RC.nb_RU; ru_id++) {
if (RC.ru[ru_id] && RC.ru[ru_id]->rfdevice.trx_end_func) {
if (RC.ru[ru_id]->rfdevice.trx_get_stats_func) {
RC.ru[ru_id]->rfdevice.trx_get_stats_func(&RC.ru[ru_id]->rfdevice);
RC.ru[ru_id]->rfdevice.trx_get_stats_func = NULL;
}
RC.ru[ru_id]->rfdevice.trx_end_func(&RC.ru[ru_id]->rfdevice);
RC.ru[ru_id]->rfdevice.trx_end_func = NULL;
}
if (RC.ru[ru_id] && RC.ru[ru_id]->ifdevice.trx_end_func) {
if (RC.ru[ru_id]->ifdevice.trx_get_stats_func) {
RC.ru[ru_id]->ifdevice.trx_get_stats_func(&RC.ru[ru_id]->ifdevice);
RC.ru[ru_id]->ifdevice.trx_get_stats_func = NULL;
}
RC.ru[ru_id]->ifdevice.trx_end_func(&RC.ru[ru_id]->ifdevice);
RC.ru[ru_id]->ifdevice.trx_end_func = NULL;
}
@@ -423,11 +431,17 @@ int stop_L1(module_id_t gnb_id)
stop_RU(RC.nb_RU);
/* stop trx devices, multiple carrier currently not supported by RU */
if (ru->rfdevice.trx_get_stats_func) {
ru->rfdevice.trx_get_stats_func(&ru->rfdevice);
}
if (ru->rfdevice.trx_stop_func) {
ru->rfdevice.trx_stop_func(&ru->rfdevice);
LOG_I(GNB_APP, "turned off RU rfdevice\n");
}
if (ru->ifdevice.trx_get_stats_func) {
ru->ifdevice.trx_get_stats_func(&ru->rfdevice);
}
if (ru->ifdevice.trx_stop_func) {
ru->ifdevice.trx_stop_func(&ru->ifdevice);
LOG_I(GNB_APP, "turned off RU ifdevice\n");

View File

@@ -825,7 +825,8 @@ void dummyWrite(PHY_VARS_NR_UE *UE,openair0_timestamp timestamp, int writeBlockS
AssertFatal(writeBlockSize == tmp, "");
}
void readFrame(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp, bool toTrash) {
void readFrame(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp, int duration_rx_to_tx, bool toTrash)
{
NR_DL_FRAME_PARMS *fp = &UE->frame_parms;
// two frames for initial sync
int num_frames = 2;
@@ -853,7 +854,8 @@ void readFrame(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp, bool toTrash)
AssertFatal(read_block_size == tmp, "");
if (IS_SOFTMODEM_RFSIM) {
const openair0_timestamp writeTimestamp = *timestamp + fp->get_samples_slot_timestamp(slot, fp, NR_UE_CAPABILITY_SLOT_RX_TO_TX) - UE->N_TA_offset;
const openair0_timestamp writeTimestamp =
*timestamp + fp->get_samples_slot_timestamp(slot, fp, duration_rx_to_tx) - UE->N_TA_offset - UE->timing_advance;
dummyWrite(UE, writeTimestamp, fp->get_samples_per_slot(slot, fp));
}
}
@@ -864,7 +866,7 @@ void readFrame(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp, bool toTrash)
free(rxp[i]);
}
static void syncInFrame(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp, openair0_timestamp rx_offset)
static void syncInFrame(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp, int duration_rx_to_tx, openair0_timestamp rx_offset)
{
NR_DL_FRAME_PARMS *fp = &UE->frame_parms;
if (UE->sl_mode == 2)
@@ -879,7 +881,8 @@ static void syncInFrame(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp, opena
const int res = UE->rfdevice.trx_read_func(&UE->rfdevice, timestamp, (void **)UE->common_vars.rxdata, unitTransfer, fp->nb_antennas_rx);
DevAssert(unitTransfer == res);
if (IS_SOFTMODEM_RFSIM) {
const openair0_timestamp writeTimestamp = *timestamp + fp->get_samples_slot_timestamp(slot, fp, NR_UE_CAPABILITY_SLOT_RX_TO_TX) - UE->N_TA_offset;
const openair0_timestamp writeTimestamp =
*timestamp + fp->get_samples_slot_timestamp(slot, fp, duration_rx_to_tx) - UE->N_TA_offset - UE->timing_advance;
dummyWrite(UE, writeTimestamp, unitTransfer);
}
slot = (slot + 1) % fp->slots_per_subframe;
@@ -905,7 +908,8 @@ static inline int get_readBlockSize(uint16_t slot, NR_DL_FRAME_PARMS *fp) {
static inline void apply_ntn_config(PHY_VARS_NR_UE *UE,
NR_DL_FRAME_PARMS *fp,
int slot_nr,
int frame_rx,
int slot_rx,
int *duration_rx_to_tx,
int *timing_advance,
int *ntn_koffset)
@@ -913,22 +917,43 @@ static inline void apply_ntn_config(PHY_VARS_NR_UE *UE,
if (UE->ntn_config_message->update) {
UE->ntn_config_message->update = false;
double total_ta_ms = UE->ntn_config_message->ntn_config_params.ntn_total_time_advance_ms;
UE->timing_advance = fp->samples_per_subframe * total_ta_ms;
const int mu = fp->numerology_index;
const int koffset = UE->ntn_config_message->ntn_config_params.cell_specific_k_offset;
int mu = fp->numerology_index;
int koffset = UE->ntn_config_message->ntn_config_params.cell_specific_k_offset;
if (*ntn_koffset != koffset) {
*duration_rx_to_tx = NR_UE_CAPABILITY_SLOT_RX_TO_TX + (koffset << mu);
*timing_advance += fp->get_samples_slot_timestamp(slot_nr, fp, (koffset - *ntn_koffset) << mu);
*ntn_koffset = koffset;
}
*duration_rx_to_tx = NR_UE_CAPABILITY_SLOT_RX_TO_TX + (koffset << mu);
if (koffset > *ntn_koffset)
*timing_advance += fp->get_samples_slot_timestamp(slot_rx, fp, (koffset - *ntn_koffset) << mu);
else if (koffset < *ntn_koffset)
*timing_advance -= fp->get_samples_slot_timestamp(slot_rx, fp, (*ntn_koffset - koffset) << mu);
*ntn_koffset = koffset;
const int abs_subframe_tx = 10 * frame_rx + ((slot_rx + *duration_rx_to_tx) >> mu);
const int abs_subframe_epoch =
10 * UE->ntn_config_message->ntn_config_params.epoch_sfn + UE->ntn_config_message->ntn_config_params.epoch_subframe;
int ms_since_epoch = abs_subframe_tx - abs_subframe_epoch;
// cope with sfn wrap-around
// this currently limits us to epoch times that are not more than 5.12 seconds in the future (allowed are up to 10.24 seconds)
// and ntn-UlSyncValidityDuration < 5.12 seconds (allowed are up to 900 seconds)
// TODO: fix this limitation by introducing the hyper frame number HFN
if (ms_since_epoch < -5120)
ms_since_epoch += 10240;
else if (ms_since_epoch > 5120)
ms_since_epoch -= 10240;
const double total_ta_ms = UE->ntn_config_message->ntn_config_params.ntn_total_time_advance_ms;
const double total_ta_drift = UE->ntn_config_message->ntn_config_params.ntn_total_time_advance_drift; // µs/s
const double total_ta_drift_variant = UE->ntn_config_message->ntn_config_params.ntn_total_time_advance_drift_variant; // µs/s²
UE->timing_advance = fp->samples_per_subframe * (total_ta_ms + (total_ta_drift / 1000.0) * (ms_since_epoch / 1000.0) + (total_ta_drift_variant / 1000.0) * (ms_since_epoch / 1000.0) * (ms_since_epoch / 1000.0));
LOG_I(PHY,
"k_offset = %d ms (%d slots), ntn_total_time_advance_ms = %f ms (%d samples)\n",
"k_offset = %d ms (%d slots), total_ta_ms = %f ms, total_ta_drift = %f µs/s, total_ta_drift_variant = %f µs/s², ms_since_epoch = %d ms, computed "
"timing_advance = %d samples\n",
*ntn_koffset,
*ntn_koffset << mu,
total_ta_ms,
total_ta_drift,
total_ta_drift_variant,
ms_since_epoch,
UE->timing_advance);
}
}
@@ -965,6 +990,10 @@ void *UE_thread(void *arg)
notifiedFIFO_t freeBlocks;
initNotifiedFIFO_nothreadSafe(&freeBlocks);
double ntn_init_time_drift = get_nrUE_params()->ntn_init_time_drift;
int ntn_koffset = 0;
int duration_rx_to_tx = NR_UE_CAPABILITY_SLOT_RX_TO_TX;
int timing_advance = UE->timing_advance;
UE->N_TA_offset = determine_N_TA_offset(UE);
NR_UE_MAC_INST_t *mac = get_mac_inst(UE->Mod_id);
@@ -988,13 +1017,9 @@ void *UE_thread(void *arg)
//warm up the RF board
int64_t tmp;
for (int i = 0; i < 50; i++)
readFrame(UE, &tmp, true);
readFrame(UE, &tmp, duration_rx_to_tx, true);
}
double ntn_init_time_drift = get_nrUE_params()->ntn_init_time_drift;
int ntn_koffset = 0;
int duration_rx_to_tx = NR_UE_CAPABILITY_SLOT_RX_TO_TX;
while (!oai_exit) {
if (syncRunning) {
notifiedFIFO_elt_t *res = pollNotifiedFIFO(&nf);
@@ -1034,11 +1059,11 @@ void *UE_thread(void *arg)
*/
const unsigned int sync_in_frames = UE->rfdevice.openair0_cfg->recplay_conf->u_f_sync;
while (trashed_frames != sync_in_frames) {
readFrame(UE, &sync_timestamp, true);
readFrame(UE, &sync_timestamp, duration_rx_to_tx, true);
trashed_frames += 2;
}
} else {
readFrame(UE, &sync_timestamp, true);
readFrame(UE, &sync_timestamp, duration_rx_to_tx, true);
trashed_frames += ((UE->sl_mode == 2) ? SL_NR_PSBCH_REPETITION_IN_FRAMES : 2);
}
continue;
@@ -1048,7 +1073,7 @@ void *UE_thread(void *arg)
AssertFatal(!syncRunning, "At this point synchronization can't be running\n");
if (!UE->is_synchronized) {
readFrame(UE, &sync_timestamp, false);
readFrame(UE, &sync_timestamp, duration_rx_to_tx, false);
notifiedFIFO_elt_t *Msg = newNotifiedFIFO_elt(sizeof(syncData_t), 0, &nf, UE_synch);
syncData_t *syncMsg = (syncData_t *)NotifiedFifoData(Msg);
*syncMsg = (syncData_t){0};
@@ -1065,8 +1090,10 @@ void *UE_thread(void *arg)
syncMsg->UE = UE;
memset(&syncMsg->proc, 0, sizeof(syncMsg->proc));
pushNotifiedFIFO(&UE->sync_actor.fifo, Msg);
timing_advance = 0;
UE->timing_advance = 0;
if (ntn_koffset == 0) { // reset timing_advance for TN
timing_advance = 0;
UE->timing_advance = 0;
}
trashed_frames = 0;
syncRunning = true;
continue;
@@ -1074,7 +1101,7 @@ void *UE_thread(void *arg)
if (stream_status == STREAM_STATUS_UNSYNC) {
stream_status = STREAM_STATUS_SYNCING;
syncInFrame(UE, &sync_timestamp, intialSyncOffset);
syncInFrame(UE, &sync_timestamp, duration_rx_to_tx, intialSyncOffset);
openair0_write_reorder_clear_context(&UE->rfdevice);
if (get_nrUE_params()->time_sync_I)
// ntn_init_time_drift is in µs/s, max_pos_acc * time_sync_I is in samples/frame
@@ -1083,9 +1110,6 @@ void *UE_thread(void *arg)
UE->max_pos_acc = 0;
shiftForNextFrame = -(UE->init_sync_frame + trashed_frames + 2) * UE->max_pos_acc * get_nrUE_params()->time_sync_I; // compensate for the time drift that happened during initial sync
LOG_D(PHY, "max_pos_acc = %d, shiftForNextFrame = %d\n", UE->max_pos_acc, shiftForNextFrame);
// TODO: remove this autonomous TA and use up-to-date values of ta-Common, ta-CommonDrift and ta-CommonDriftVariant from received SIB19 instead
if (get_nrUE_params()->autonomous_ta)
UE->timing_advance -= 2 * shiftForNextFrame;
// read in first symbol
AssertFatal(fp->ofdm_symbol_size + fp->nb_prefix_samples0
== UE->rfdevice.trx_read_func(&UE->rfdevice,
@@ -1200,7 +1224,7 @@ void *UE_thread(void *arg)
int writeBlockSize = fp->get_samples_per_slot((slot_nr + duration_rx_to_tx) % nb_slot_frame, fp) - iq_shift_to_apply;
int new_timing_advance = UE->timing_advance;
if (new_timing_advance != timing_advance) {
writeBlockSize -= new_timing_advance- timing_advance;
writeBlockSize -= new_timing_advance - timing_advance;
timing_advance = new_timing_advance;
}
int new_N_TA_offset = determine_N_TA_offset(UE);
@@ -1210,8 +1234,8 @@ void *UE_thread(void *arg)
UE->N_TA_offset = new_N_TA_offset;
}
if (curMsg.proc.nr_slot_tx == 0)
nr_ue_rrc_timer_trigger(UE->Mod_id, curMsg.proc.frame_tx, curMsg.proc.gNB_id);
if (curMsg.proc.nr_slot_rx == 0)
nr_ue_rrc_timer_trigger(UE->Mod_id, curMsg.proc.frame_rx, curMsg.proc.gNB_id);
// RX slot processing. We launch and forget.
notifiedFIFO_elt_t *newRx = newNotifiedFIFO_elt(sizeof(nr_rxtx_thread_data_t), curMsg.proc.nr_slot_tx, NULL, UE_dl_processing);
@@ -1227,7 +1251,7 @@ void *UE_thread(void *arg)
}
// apply new NTN timing information
apply_ntn_config(UE, fp, slot_nr, &duration_rx_to_tx, &timing_advance, &ntn_koffset);
apply_ntn_config(UE, fp, curMsg.proc.frame_rx, curMsg.proc.nr_slot_rx, &duration_rx_to_tx, &timing_advance, &ntn_koffset);
// Start TX slot processing here. It runs in parallel with RX slot processing
// in current code, DURATION_RX_TO_TX constant is the limit to get UL data to encode from a RX slot

View File

@@ -170,8 +170,12 @@ void exit_function(const char *file, const char *function, const int line, const
if (PHY_vars_UE_g && PHY_vars_UE_g[0]) {
for(CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
if (PHY_vars_UE_g[0][CC_id] && PHY_vars_UE_g[0][CC_id]->rfdevice.trx_end_func)
if (PHY_vars_UE_g[0][CC_id] && PHY_vars_UE_g[0][CC_id]->rfdevice.trx_end_func) {
if (PHY_vars_UE_g[0][CC_id]->rfdevice.trx_get_stats_func) {
PHY_vars_UE_g[0][CC_id]->rfdevice.trx_get_stats_func(&PHY_vars_UE_g[0][CC_id]->rfdevice);
}
PHY_vars_UE_g[0][CC_id]->rfdevice.trx_end_func(&PHY_vars_UE_g[0][CC_id]->rfdevice);
}
}
}
@@ -197,11 +201,15 @@ nrUE_params_t *get_nrUE_params(void) {
}
static void get_options(configmodule_interface_t *cfg)
{
paramdef_t cmdline_params[] =CMDLINE_NRUEPARAMS_DESC ;
paramdef_t cmdline_params[] = CMDLINE_NRUEPARAMS_DESC;
int numparams = sizeofArray(cmdline_params);
config_get(cfg, cmdline_params, numparams, NULL);
if (nrUE_params.vcdflag > 0)
ouput_vcd = 1;
AssertFatal(nrUE_params.extra_pdu_id != get_softmodem_params()->default_pdu_session_id,
"Default PDU ID (%d) and Extra PDU ID (%d) must be different!\n",
get_softmodem_params()->default_pdu_session_id,
nrUE_params.extra_pdu_id);
}
// set PHY vars from command line
@@ -591,6 +599,8 @@ int main(int argc, char **argv)
ret = pthread_join(phy_vars->stat_thread, NULL);
AssertFatal(ret == 0, "pthread_join error %d, errno %d (%s)\n", ret, errno, strerror(errno));
}
if (phy_vars->rfdevice.trx_get_stats_func)
phy_vars->rfdevice.trx_get_stats_func(&phy_vars->rfdevice);
if (phy_vars->rfdevice.trx_end_func)
phy_vars->rfdevice.trx_end_func(&phy_vars->rfdevice);
}

View File

@@ -24,6 +24,7 @@ extern uint16_t ue_id_g;
#define CONFIG_HLP_AGC "Rx Gain control used for UE\n"
#define CONFIG_HLP_NUM_UL_ACTORS "Number of UL actors to use. Set to 0 to disable UL actor framework and do processing inline\n"
#define CONFIG_HLP_NUM_DL_ACTORS "Number of DL actors to use. Set to 0 to disable DL actor framework and do processing inline\n"
#define CONFIG_HLP_EXTRA_PDU_ID "ID of an additional PDU session to configure alongside default PDU session\n"
/***************************************************************************************************************************************/
/* command line options definitions, CMDLINE_XXXX_DESC macros are used to initialize paramdef_t arrays which are then used as argument
@@ -81,6 +82,7 @@ extern uint16_t ue_id_g;
{"agc", CONFIG_HLP_AGC, PARAMFLAG_BOOL, .iptr=&(nrUE_params.agc), .defintval=0, TYPE_INT, 0}, \
{"num-ul-actors", CONFIG_HLP_NUM_UL_ACTORS, 0, .iptr=&nrUE_params.num_ul_actors, .defintval=2, TYPE_INT, 0}, \
{"num-dl-actors", CONFIG_HLP_NUM_DL_ACTORS, 0, .iptr=&nrUE_params.num_dl_actors, .defintval=4, TYPE_INT, 0}, \
{"extra-pdu-id", CONFIG_HLP_EXTRA_PDU_ID, 0, .iptr=&nrUE_params.extra_pdu_id, .defintval=-1, TYPE_INT, 0}, \
}
// clang-format on
@@ -122,6 +124,7 @@ typedef struct {
int tx_max_power;
int num_ul_actors;
int num_dl_actors;
int extra_pdu_id;
} nrUE_params_t;
extern uint64_t get_nrUE_optmask(void);
extern uint64_t set_nrUE_optmask(uint64_t bitmask);

View File

@@ -41,16 +41,16 @@
/*----------------------------------------------------------------------------------------------------------------------------------------------------*/
// clang-format off
#define POSITION_CONFIG_PARAMS_DEF { \
{CONFIG_STRING_POSITION_X, HELP_STRING_POSITION, 0, .dblptr=&(position->positionX), .defuintval=0, TYPE_DOUBLE, 0}, \
{CONFIG_STRING_POSITION_Y, HELP_STRING_POSITION, 0, .dblptr=&(position->positionY), .defuintval=0, TYPE_DOUBLE, 0}, \
{CONFIG_STRING_POSITION_Z, HELP_STRING_POSITION, 0, .dblptr=&(position->positionZ), .defuintval=0, TYPE_DOUBLE, 0} \
{CONFIG_STRING_POSITION_X, HELP_STRING_POSITION, 0, .dblptr=&(position->X), .defuintval=0, TYPE_DOUBLE, 0}, \
{CONFIG_STRING_POSITION_Y, HELP_STRING_POSITION, 0, .dblptr=&(position->Y), .defuintval=0, TYPE_DOUBLE, 0}, \
{CONFIG_STRING_POSITION_Z, HELP_STRING_POSITION, 0, .dblptr=&(position->Z), .defuintval=0, TYPE_DOUBLE, 0} \
}
// clang-format on
typedef struct position {
double positionX;
double positionY;
double positionZ;
double X;
double Y;
double Z;
} position_t;
void get_position_coordinates(int Mod_id, position_t *position);

View File

@@ -189,7 +189,7 @@ extern int usrp_tx_thread;
{"E" , CONFIG_HLP_TQFS, PARAMFLAG_BOOL, .iptr=&softmodem_params.threequarter_fs, .defintval=0, TYPE_INT, 0}, \
{"imscope" , CONFIG_HLP_IMSCOPE, PARAMFLAG_BOOL, .uptr=&enable_imscope, .defintval=0, TYPE_UINT, 0}, \
{"imscope-record" , CONFIG_HLP_IMSCOPE_RECORD,PARAMFLAG_BOOL, .uptr=&enable_imscope_record, .defintval=0, TYPE_UINT, 0}, \
{"default_pdu_id", NULL, 0, .iptr=&DEFAULT_PDU_ID, .defintval=10, TYPE_INT, 0}, \
{"default-pdu-id", NULL, 0, .iptr=&DEFAULT_PDU_ID, .defintval=10, TYPE_INT, 0}, \
}
// clang-format on
@@ -347,6 +347,7 @@ typedef struct {
int no_itti;
int threequarter_fs;
int default_pdu_session_id;
int extra_pdu_session_id;
} softmodem_params_t;
#define IS_SA_MODE(sM_params) (!(sM_params)->phy_test && !(sM_params)->do_ra && !(sM_params)->nsa)

View File

@@ -1,3 +1,9 @@
add_subdirectory(oai_integration/aerial)
if (OAI_WLS)
add_subdirectory(oai_integration/wls_integration)
else () # Not WLS, means its SOCKET-based comms, maybe add a flag specific for UDP
message(STATUS "No Support for WLS")
add_subdirectory(oai_integration/socket)
endif ()
add_subdirectory(open-nFAPI)
add_subdirectory(tests)

View File

@@ -3,7 +3,6 @@ if (OAI_AERIAL)
add_library(aerial_lib
fapi_nvIPC.c
fapi_vnf_p7.c
fapi_vnf_p5.c
)
find_library(NVIPC_LIB nvipc REQUIRED)

View File

@@ -48,12 +48,13 @@
#include <sys/queue.h>
#include <sys/epoll.h>
#include "fapi_nvIPC.h"
#include <nfapi_vnf.h>
#include <nr_fapi_p7_utils.h>
#include "nfapi_interface.h"
#include "nfapi.h"
#include "nfapi_nr_interface_scf.h"
#include "nfapi/open-nFAPI/vnf/inc/vnf_p7.h"
#include "fapi_vnf_p5.h"
#include "system.h"
#include "fapi_vnf_p7.h"
#define MAX_EVENTS 10
@@ -93,90 +94,12 @@ static int ipc_handle_rx_msg(nv_ipc_t *ipc, nv_ipc_msg_t *msg)
return -1;
}
vnf_p7_t *vnf_p7_config = (vnf_p7_t *)((vnf_info *)vnf_config->user_data)->p7_vnfs->config;
switch (fapi_msg.message_id) {
case NFAPI_NR_PHY_MSG_TYPE_PARAM_RESPONSE:
if (vnf_config->nr_param_resp) {
nfapi_nr_param_response_scf_t msg_param_resp;
aerial_unpack_nr_param_response(&pReadPackedMessage, end, &msg_param_resp, &vnf_config->codec_config);
(vnf_config->nr_param_resp)(vnf_config, vnf_config->pnf_list->p5_idx, &msg_param_resp);
}
case NFAPI_NR_PHY_MSG_TYPE_PARAM_RESPONSE ... NFAPI_NR_PHY_MSG_TYPE_ERROR_INDICATION:
vnf_nr_handle_p4_p5_message(msg->msg_buf, msg->msg_len, 1, vnf_config);
break;
case NFAPI_NR_PHY_MSG_TYPE_CONFIG_RESPONSE: {
// unpack message
nfapi_nr_config_response_scf_t msg_config_response;
aerial_unpack_nr_config_response(&pReadPackedMessage, end, &msg_config_response, &vnf_config->codec_config);
// Check the error code
if (msg_config_response.error_code == NFAPI_NR_CONFIG_MSG_OK) {
// Invoke the call back
if (vnf_config->nr_config_resp) {
(vnf_config->nr_config_resp)(vnf_config, vnf_config->pnf_list->p5_idx, &msg_config_response);
}
} else {
// Error code not OK (MSG_INVALID_CONFIG)
/* MSG_INVALID_CONFIG.response structure
* Error code uint8_t
* Number of invalid or unsupported TLVs uint8_t
* Number of invalid TLVs that can only be configured in IDLE state uint8_t
* Number of invalid TLVs that can only be configured in RUNNING state uint8_t
* Number of missing TLVs uint8_t
* List of invalid or unsupported TLVs
* List of invalid TLVs that can only be configured in IDLE state
* List of invalid TLVs that can only be configured in RUNNING state
* List of missing TLVs
* */
}
break;
}
case NFAPI_NR_PHY_MSG_TYPE_STOP_INDICATION: {
// TODO : ADD Support for NFAPI_NR_PHY_MSG_TYPE_STOP_INDICATION (0x06)
LOG_D(NFAPI_VNF,"Received NFAPI_NR_PHY_MSG_TYPE_STOP_INDICATION\n");
break;
}
case NFAPI_NR_PHY_MSG_TYPE_ERROR_INDICATION: {
// TODO: Add Support for NFAPI_NR_PHY_MSG_TYPE_ERROR_INDICATION (0x07)
LOG_D(NFAPI_VNF,"Received NFAPI_NR_PHY_MSG_TYPE_ERROR_INDICATION\n");
//for (int i = 0; i < msg->msg_len; i++) {
// printf(" msg->msg_buf[%d] = 0x%02x\n", i, ((uint8_t *) msg->msg_buf)[i]);
//}
LOG_D(NFAPI_VNF,"old sfn %u\n", old_sfn);
LOG_D(NFAPI_VNF,"old slot %u\n", old_slot);
break;
}
// P7 Messages
// P7 Message Handlers -> ((vnf_info *)vnf_config->user_data)->p7_vnfs->config->
case NFAPI_NR_PHY_MSG_TYPE_SLOT_INDICATION: {
nfapi_nr_slot_indication_scf_t ind;
aerial_unpack_nr_slot_indication(&pReadPackedMessage,
end,
&ind,
&((vnf_p7_t *)((vnf_info *)vnf_config->user_data)->p7_vnfs->config)->_public.codec_config);
// check if the sfn/slot unpacked come wrong at any time, should be old + 1 (slot 0 -- 19, sfn 0 -- 1023)
// add 1 to current sfn number
uint16_t old_slot_plus = ((old_slot + 1) % 20);
uint16_t old_sfn_plus = old_slot_plus == 0 ? ((old_sfn + 1) % 1024) : old_sfn;
if (old_slot_plus != ind.slot || old_sfn_plus != ind.sfn) {
LOG_E(NFAPI_VNF,
"\n============================================================================\n"
"sfn slot doesn't match unpacked one! L2->L1 %d.%d vs L1->L2 %d.%d \n"
"============================================================================\n",
old_sfn,
old_slot,
ind.sfn,
ind.slot);
}
old_sfn = ind.sfn;
old_slot = ind.slot;
if (((vnf_info *)vnf_config->user_data)->p7_vnfs->config->nr_slot_indication) {
(((vnf_info *)vnf_config->user_data)->p7_vnfs->config->nr_slot_indication)(&ind);
}
break;
}
case NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION: {
uint8_t *pReadData = msg->data_buf;
int dataBufLen = msg->data_len;
@@ -190,10 +113,10 @@ static int ipc_handle_rx_msg(nv_ipc_t *ipc, nv_ipc_msg_t *msg)
&pReadData,
data_end,
&ind,
&((vnf_p7_t *)((vnf_info *)vnf_config->user_data)->p7_vnfs->config)->_public.codec_config);
&vnf_p7_config->_public.codec_config);
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s: Handling RX Indication\n", __FUNCTION__);
if (((vnf_info *)vnf_config->user_data)->p7_vnfs->config->nr_rx_data_indication) {
(((vnf_info *)vnf_config->user_data)->p7_vnfs->config->nr_rx_data_indication)(&ind);
if (vnf_p7_config->_public.nr_rx_data_indication) {
(vnf_p7_config->_public.nr_rx_data_indication)(&ind);
for (int i = 0; i < ind.number_of_pdus; ++i) {
free(ind.pdu_list[i].pdu);
}
@@ -202,53 +125,6 @@ static int ipc_handle_rx_msg(nv_ipc_t *ipc, nv_ipc_msg_t *msg)
break;
}
case NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION: {
nfapi_nr_crc_indication_t crc_ind;
crc_ind.header.message_id = fapi_msg.message_id;
crc_ind.header.message_length = fapi_msg.message_length;
aerial_unpack_nr_crc_indication(&pReadPackedMessage,
end,
&crc_ind,
&((vnf_p7_t *)((vnf_info *)vnf_config->user_data)->p7_vnfs->config)->_public.codec_config);
if (((vnf_info *)vnf_config->user_data)->p7_vnfs->config->nr_crc_indication) {
(((vnf_info *)vnf_config->user_data)->p7_vnfs->config->nr_crc_indication)(&crc_ind);
free(crc_ind.crc_list);
}
break;
}
case NFAPI_NR_PHY_MSG_TYPE_UCI_INDICATION: {
nfapi_nr_uci_indication_t ind;
aerial_unpack_nr_uci_indication(&pReadPackedMessage,
end,
&ind,
&((vnf_p7_t *)((vnf_info *)vnf_config->user_data)->p7_vnfs->config)->_public.codec_config);
if (((vnf_info *)vnf_config->user_data)->p7_vnfs->config->nr_uci_indication) {
(((vnf_info *)vnf_config->user_data)->p7_vnfs->config->nr_uci_indication)(&ind);
for (int i = 0; i < ind.num_ucis; i++) {
if (ind.uci_list[i].pdu_type == NFAPI_NR_UCI_FORMAT_2_3_4_PDU_TYPE) {
if (ind.uci_list[i].pucch_pdu_format_2_3_4.sr.sr_payload) {
free(ind.uci_list[i].pucch_pdu_format_2_3_4.sr.sr_payload);
}
if(ind.uci_list[i].pucch_pdu_format_2_3_4.harq.harq_payload){
free(ind.uci_list[i].pucch_pdu_format_2_3_4.harq.harq_payload);
}
if(ind.uci_list[i].pucch_pdu_format_2_3_4.csi_part1.csi_part1_payload){
free(ind.uci_list[i].pucch_pdu_format_2_3_4.csi_part1.csi_part1_payload);
}
if(ind.uci_list[i].pucch_pdu_format_2_3_4.csi_part2.csi_part2_payload){
free(ind.uci_list[i].pucch_pdu_format_2_3_4.csi_part2.csi_part2_payload);
}
}
}
free(ind.uci_list);
ind.uci_list = NULL;
}
break;
}
case NFAPI_NR_PHY_MSG_TYPE_SRS_INDICATION: {
uint8_t *pReadData = msg->data_buf;
int dataBufLen = msg->data_len;
@@ -259,26 +135,47 @@ static int ipc_handle_rx_msg(nv_ipc_t *ipc, nv_ipc_msg_t *msg)
&pReadData,
data_end,
&ind,
&((vnf_p7_t *)((vnf_info *)vnf_config->user_data)->p7_vnfs->config)->_public.codec_config);
if (((vnf_info *)vnf_config->user_data)->p7_vnfs->config->nr_srs_indication) {
(((vnf_info *)vnf_config->user_data)->p7_vnfs->config->nr_srs_indication)(&ind);
&vnf_p7_config->_public.codec_config);
if (vnf_p7_config->_public.nr_srs_indication) {
(vnf_p7_config->_public.nr_srs_indication)(&ind);
}
break;
}
case NFAPI_NR_PHY_MSG_TYPE_SLOT_INDICATION: {
nfapi_nr_slot_indication_scf_t ind;
if (!vnf_p7_config->_public.unpack_func(msg->msg_buf, msg->msg_len, &ind, sizeof(ind), &vnf_p7_config->_public.codec_config)) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Failed to unpack message\n", __FUNCTION__);
} else {
NFAPI_TRACE(NFAPI_TRACE_DEBUG, "%s: Handling NR SLOT Indication\n", __FUNCTION__);
// check if the sfn/slot unpacked come wrong at any time, should be old + 1 (slot 0 -- 19, sfn 0 -- 1023)
// add 1 to current sfn number
uint16_t old_slot_plus = ((old_slot + 1) % 20);
uint16_t old_sfn_plus = old_slot_plus == 0 ? ((old_sfn + 1) % 1024) : old_sfn;
if (old_slot_plus != ind.slot || old_sfn_plus != ind.sfn) {
LOG_E(NFAPI_VNF,
"\n============================================================================\n"
"sfn slot doesn't match unpacked one! L2->L1 %d.%d vs L1->L2 %d.%d \n"
"============================================================================\n",
old_sfn,
old_slot,
ind.sfn,
ind.slot);
}
old_sfn = ind.sfn;
old_slot = ind.slot;
if (vnf_p7_config->_public.nr_slot_indication) {
(vnf_p7_config->_public.nr_slot_indication)(&ind);
}
}
break;
}
case NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION:
case NFAPI_NR_PHY_MSG_TYPE_UCI_INDICATION:
case NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION: {
nfapi_nr_rach_indication_t ind;
aerial_unpack_nr_rach_indication(&pReadPackedMessage,
end,
&ind,
&((vnf_p7_t *)((vnf_info *)vnf_config->user_data)->p7_vnfs->config)->_public.codec_config);
if (((vnf_info *)vnf_config->user_data)->p7_vnfs->config->nr_rach_indication) {
(((vnf_info *)vnf_config->user_data)->p7_vnfs->config->nr_rach_indication)(&ind);
free(ind.pdu_list);
}
vnf_nr_handle_p7_message(msg->msg_buf, msg->msg_len, vnf_p7_config);
break;
}
default: {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s P5 Unknown message ID %d\n", __FUNCTION__, fapi_msg.message_id);
@@ -293,10 +190,26 @@ int8_t buf[1024];
nv_ipc_config_t nv_ipc_config;
int aerial_send_P5_msg(void *packedBuf, uint32_t packedMsgLength, nfapi_nr_p4_p5_message_header_t *header)
bool aerial_nr_send_p5_message(vnf_t *vnf, uint16_t p5_idx, nfapi_nr_p4_p5_message_header_t *msg, uint32_t msg_len)
{
nfapi_vnf_pnf_info_t *pnf = nfapi_vnf_pnf_list_find(&(vnf->_public), p5_idx);
if (pnf) {
uint8_t tx_messagebufferFAPI[sizeof(vnf->tx_message_buffer)];
int packedMessageLengthFAPI = -1;
packedMessageLengthFAPI =
vnf->_public.pack_func(msg, msg_len, tx_messagebufferFAPI, sizeof(tx_messagebufferFAPI), &vnf->_public.codec_config);
return aerial_send_P5_msg(tx_messagebufferFAPI, packedMessageLengthFAPI, msg) == 0;
} else {
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() cannot find pnf info for p5_idx:%d\n", __FUNCTION__, p5_idx);
return false;
}
}
bool aerial_send_P5_msg(void *packedBuf, uint32_t packedMsgLength, nfapi_nr_p4_p5_message_header_t *header)
{
if (ipc == NULL) {
return -1;
return false;
}
nv_ipc_msg_t send_msg = {0};
// look for the specific message
@@ -334,7 +247,7 @@ int aerial_send_P5_msg(void *packedBuf, uint32_t packedMsgLength, nfapi_nr_p4_p5
if (alloc_retval != 0) {
LOG_E(NFAPI_VNF, "%s error: allocate TX buffer failed Error: %d\n", __FUNCTION__, alloc_retval);
ipc->tx_release(ipc, &send_msg);
return alloc_retval;
return false;
}
memcpy(send_msg.msg_buf, packedBuf, send_msg.msg_len);
@@ -350,17 +263,17 @@ int aerial_send_P5_msg(void *packedBuf, uint32_t packedMsgLength, nfapi_nr_p4_p5
if (send_retval < 0) {
LOG_E(NFAPI_VNF, "%s error: send TX message failed Error: %d\n", __FUNCTION__, send_retval);
ipc->tx_release(ipc, &send_msg);
return send_retval;
return false;
}
ipc->notify(ipc, 1); // notify that there's 1 message in queue
return 0;
return true;
}
int aerial_send_P7_msg(void *packedBuf, uint32_t packedMsgLength, nfapi_nr_p7_message_header_t *header)
bool aerial_send_P7_msg(void *packedBuf, uint32_t packedMsgLength, nfapi_nr_p7_message_header_t *header)
{
if (ipc == NULL) {
return -1;
return false;
}
nv_ipc_msg_t send_msg;
uint8_t *pPacketBodyField = &((uint8_t *)packedBuf)[8];
@@ -421,7 +334,7 @@ int aerial_send_P7_msg(void *packedBuf, uint32_t packedMsgLength, nfapi_nr_p7_me
if (alloc_retval != 0) {
LOG_E(NFAPI_VNF, "%s error: allocate TX buffer failed Error: %d\n", __FUNCTION__, alloc_retval);
ipc->tx_release(ipc, &send_msg);
return alloc_retval;
return false;
}
memcpy(send_msg.msg_buf, packedBuf, send_msg.msg_len);
@@ -437,21 +350,21 @@ int aerial_send_P7_msg(void *packedBuf, uint32_t packedMsgLength, nfapi_nr_p7_me
if (send_retval < 0) {
LOG_E(NFAPI_VNF, "%s error: send TX message failed Error: %d\n", __FUNCTION__, send_retval);
ipc->tx_release(ipc, &send_msg);
return send_retval;
return false;
}
ipc->notify(ipc, 1); // notify that there's 1 message in queue
return 0;
return true;
}
int aerial_send_P7_msg_with_data(void *packedBuf,
bool aerial_send_P7_msg_with_data(void *packedBuf,
uint32_t packedMsgLength,
void *dataBuf,
uint32_t dataLength,
nfapi_nr_p7_message_header_t *header)
{
if (ipc == NULL) {
return -1;
return false;
}
nv_ipc_msg_t send_msg;
uint8_t *pPacketBodyField = &((uint8_t *)packedBuf)[8];
@@ -510,7 +423,7 @@ int aerial_send_P7_msg_with_data(void *packedBuf,
if (alloc_retval != 0) {
LOG_E(NFAPI_VNF, "%s error: allocate TX buffer failed Error: %d\n", __FUNCTION__, alloc_retval);
ipc->tx_release(ipc, &send_msg);
return alloc_retval;
return false;
}
memcpy(send_msg.msg_buf, packedBuf, send_msg.msg_len);
@@ -527,11 +440,11 @@ int aerial_send_P7_msg_with_data(void *packedBuf,
if (send_retval != 0) {
LOG_E(NFAPI_VNF, "%s error: send TX message failed Error: %d\n", __FUNCTION__, send_retval);
ipc->tx_release(ipc, &send_msg);
return send_retval;
return false;
}
ipc->notify(ipc, 1); // notify that there's 1 message in queue
return 0;
return true;
}
// Always allocate message buffer, but allocate data buffer only when data_len > 0
@@ -656,6 +569,87 @@ int nvIPC_Init(nvipc_params_t nvipc_params_s)
sleep(1);
create_recv_thread(nvipc_params_s.nvipc_poll_core);
while(!recv_task_running){usleep(100000);}
aerial_pnf_nr_connection_indication_cb(vnf_config, 1);
nfapi_nr_param_response_scf_t resp_msg;
vnf_config->nr_param_resp(vnf_config, 1, &resp_msg);
return 0;
}
int oai_fapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req)
{
nfapi_vnf_p7_config_t *p7_config = (((vnf_info *)vnf_config->user_data)->p7_vnfs[0].config);
ul_tti_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
ul_tti_req->header.message_id = NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST;
// int retval = nfapi_vnf_p7_ul_tti_req(p7_config, ul_tti_req);
int retval = p7_config->send_p7_msg((vnf_p7_t *)p7_config, &ul_tti_req->header);
if (retval != 0) {
LOG_E(PHY, "%s() Problem sending retval:%d\n", __FUNCTION__, retval);
} else {
// Reset number of PDUs so that it is not resent
ul_tti_req->n_pdus = 0;
ul_tti_req->n_group = 0;
ul_tti_req->n_ulcch = 0;
ul_tti_req->n_ulsch = 0;
}
return retval;
}
int oai_fapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req)
{
nfapi_vnf_p7_config_t *p7_config = (((vnf_info *)vnf_config->user_data)->p7_vnfs[0].config);
ul_dci_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
ul_dci_req->header.message_id = NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST;
// int retval = nfapi_vnf_p7_ul_dci_req(p7_config, ul_dci_req);
int retval = p7_config->send_p7_msg((vnf_p7_t *)p7_config, &ul_dci_req->header);
if (retval != 0) {
LOG_E(PHY, "%s() Problem sending retval:%d\n", __FUNCTION__, retval);
} else {
ul_dci_req->numPdus = 0;
}
return retval;
}
int oai_fapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req)
{
nfapi_vnf_p7_config_t *p7_config = (((vnf_info *)vnf_config->user_data)->p7_vnfs[0].config);
tx_data_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
tx_data_req->header.message_id = NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST;
// LOG_D(PHY, "[VNF] %s() TX_REQ sfn_sf:%d number_of_pdus:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(tx_data_req->SFN),
// tx_data_req->Number_of_PDUs); int retval = nfapi_vnf_p7_tx_data_req(p7_config, tx_data_req);
int retval = p7_config->send_p7_msg((vnf_p7_t *)p7_config, &tx_data_req->header);
if (retval != 0) {
LOG_E(PHY, "%s() Problem sending retval:%d\n", __FUNCTION__, retval);
} else {
tx_data_req->Number_of_PDUs = 0;
}
return retval;
}
int oai_fapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req)
{
nfapi_vnf_p7_config_t *p7_config = (((vnf_info *)vnf_config->user_data)->p7_vnfs[0].config);
dl_config_req->header.message_id = NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST;
dl_config_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
int retval = p7_config->send_p7_msg((vnf_p7_t *)p7_config, &dl_config_req->header);
dl_config_req->dl_tti_request_body.nPDUs = 0;
dl_config_req->dl_tti_request_body.nGroup = 0;
if (retval != 0) {
LOG_E(PHY, "%s() Problem sending retval:%d\n", __FUNCTION__, retval);
}
return retval;
}
int oai_fapi_send_end_request(int cell, uint32_t frame, uint32_t slot){
nfapi_vnf_p7_config_t *p7_config = (((vnf_info *)vnf_config->user_data)->p7_vnfs[0].config);
nfapi_nr_slot_indication_scf_t nr_slot_resp = {.header.message_id = 0x8F, .sfn = frame, .slot = slot};
int retval = p7_config->send_p7_msg((vnf_p7_t *)p7_config, &nr_slot_resp.header);
if (retval != 0) {
LOG_E(PHY, "%s() Problem sending retval:%d\n", __FUNCTION__, retval);
}
return retval;
}

View File

@@ -36,6 +36,7 @@
#include "nv_ipc_utils.h"
#include "nvlog.h"
#include "nfapi/open-nFAPI/vnf/public_inc/nfapi_vnf_interface.h"
#include "vnf.h"
#include "debug.h"
#include "openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h"
@@ -47,14 +48,19 @@ typedef struct {
uint32_t message_length;
} fapi_phy_api_msg;
int aerial_send_P5_msg(void *packedBuf, uint32_t packedMsgLength, nfapi_nr_p4_p5_message_header_t *header);
int aerial_send_P7_msg(void *packedBuf, uint32_t packedMsgLength, nfapi_nr_p7_message_header_t *header);
int aerial_send_P7_msg_with_data(void *packedBuf,
bool aerial_nr_send_p5_message(vnf_t *vnf, uint16_t p5_idx, nfapi_nr_p4_p5_message_header_t *msg, uint32_t msg_len);
bool aerial_send_P5_msg(void *packedBuf, uint32_t packedMsgLength, nfapi_nr_p4_p5_message_header_t *header);
bool aerial_send_P7_msg(void *packedBuf, uint32_t packedMsgLength, nfapi_nr_p7_message_header_t *header);
bool aerial_send_P7_msg_with_data(void *packedBuf,
uint32_t packedMsgLength,
void *dataBuf,
uint32_t dataLength,
nfapi_nr_p7_message_header_t *header);
void set_config(nfapi_vnf_config_t *conf);
int nvIPC_Init(nvipc_params_t nvipc_params_s);
int oai_fapi_send_end_request(int cell_id, uint32_t frame, uint32_t slot);
int oai_fapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req);
int oai_fapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req);
int oai_fapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req);
int oai_fapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req);
#endif // OPENAIRINTERFACE_FAPI_NVIPC_H

View File

@@ -1,610 +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
*/
/*! \file fapi/oai-integration/fapi_vnf_p5.c
* \brief OAI FAPI VNF P5 message handler procedures
* \author Ruben S. Silva
* \date 2023
* \version 0.1
* \company OpenAirInterface Software Alliance
* \email: contact@openairinterface.org, rsilva@allbesmart.pt
* \note
* \warning
*/
#include "fapi_vnf_p5.h"
#include "fapi_vnf_p7.h"
#include "nfapi/open-nFAPI/vnf/inc/vnf_p7.h"
#include "nr_fapi.h"
#include "nr_fapi_p5.h"
extern RAN_CONTEXT_t RC;
extern UL_RCC_IND_t UL_RCC_INFO;
extern int sf_ahead;
extern int slot_ahead;
void *aerial_vnf_nr_p7_config_init(void *ptr)
{
vnf_p7_info *p7_vnf = (vnf_p7_info *)ptr;
init_queue(&gnb_rach_ind_queue);
init_queue(&gnb_rx_ind_queue);
init_queue(&gnb_crc_ind_queue);
init_queue(&gnb_uci_ind_queue);
p7_vnf->config->port = p7_vnf->local_port;
p7_vnf->config->sync_indication = NULL;
p7_vnf->config->slot_indication = NULL;
p7_vnf->config->harq_indication = NULL;
p7_vnf->config->nr_crc_indication = &aerial_phy_nr_crc_indication;
p7_vnf->config->nr_rx_data_indication = &aerial_phy_nr_rx_data_indication;
p7_vnf->config->nr_rach_indication = &aerial_phy_nr_rach_indication;
p7_vnf->config->nr_uci_indication = &aerial_phy_nr_uci_indication;
p7_vnf->config->srs_indication = NULL;
p7_vnf->config->sr_indication = NULL;
p7_vnf->config->cqi_indication = NULL;
p7_vnf->config->lbt_dl_indication = NULL;
p7_vnf->config->nb_harq_indication = NULL;
p7_vnf->config->nrach_indication = NULL;
p7_vnf->config->nr_slot_indication = &aerial_phy_nr_slot_indication;
p7_vnf->config->nr_srs_indication = &aerial_phy_nr_srs_indication;
p7_vnf->config->malloc = &aerial_vnf_allocate;
p7_vnf->config->free = &aerial_vnf_deallocate;
p7_vnf->config->vendor_ext = &aerial_phy_vendor_ext;
p7_vnf->config->user_data = p7_vnf;
p7_vnf->mac->user_data = p7_vnf;
p7_vnf->config->codec_config.unpack_p7_vendor_extension = &aerial_phy_unpack_p7_vendor_extension;
p7_vnf->config->codec_config.pack_p7_vendor_extension = &aerial_phy_pack_p7_vendor_extension;
p7_vnf->config->codec_config.unpack_vendor_extension_tlv = &aerial_phy_unpack_vendor_extension_tlv;
p7_vnf->config->codec_config.pack_vendor_extension_tlv = &aerial_phy_pack_vendor_extension_tlv;
p7_vnf->config->codec_config.allocate = &aerial_vnf_allocate;
p7_vnf->config->codec_config.deallocate = &aerial_vnf_deallocate;
p7_vnf->config->allocate_p7_vendor_ext = &aerial_phy_allocate_p7_vendor_ext;
p7_vnf->config->deallocate_p7_vendor_ext = &aerial_phy_deallocate_p7_vendor_ext;
return 0;
}
int aerial_pnf_nr_connection_indication_cb(nfapi_vnf_config_t *config, int p5_idx)
{
printf("[VNF] pnf connection indication idx:%d\n", p5_idx);
// in aerial, send first CONFIG.request, not PARAM.request
nfapi_nr_config_request_scf_t conf_req;
memset(&conf_req, 0, sizeof(conf_req));
conf_req.header.message_id = NFAPI_NR_PHY_MSG_TYPE_CONFIG_REQUEST;
printf("Try to send first CONFIG.request\n");
aerial_nr_send_config_request(config, p5_idx);
return 0;
}
int aerial_pnf_disconnection_indication_cb(nfapi_vnf_config_t *config, int p5_idx)
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] pnf disconnection indication idx:%d\n", p5_idx);
vnf_info *vnf = (vnf_info *)(config->user_data);
pnf_info *pnf = vnf->pnfs;
phy_info *phy = pnf->phys;
vnf_p7_info *p7_vnf = vnf->p7_vnfs;
nfapi_vnf_p7_del_pnf((p7_vnf->config), phy->id);
return 0;
}
int aerial_pnf_nr_param_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_nr_pnf_param_response_t *resp)
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] pnf param response idx:%d error:%d\n", p5_idx, resp->error_code);
vnf_info *vnf = (vnf_info *)(config->user_data);
pnf_info *pnf = vnf->pnfs;
for (int i = 0; i < resp->pnf_phy.number_of_phys; ++i) {
phy_info phy;
memset(&phy, 0, sizeof(phy));
phy.index = resp->pnf_phy.phy[i].phy_config_index;
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] (PHY:%d) phy_config_idx:%d\n", i, resp->pnf_phy.phy[i].phy_config_index);
nfapi_vnf_allocate_phy(config, p5_idx, &(phy.id));
for (int j = 0; j < resp->pnf_phy.phy[i].number_of_rfs; ++j) {
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] (PHY:%d) (RF%d) %d\n", i, j, resp->pnf_phy.phy[i].rf_config[j].rf_config_index);
phy.rfs[0] = resp->pnf_phy.phy[i].rf_config[j].rf_config_index;
}
pnf->phys[0] = phy;
}
nfapi_nr_pnf_config_request_t req;
memset(&req, 0, sizeof(req));
req.header.message_id = NFAPI_PNF_CONFIG_REQUEST;
req.pnf_phy_rf_config.tl.tag = NFAPI_PNF_PHY_RF_TAG;
req.pnf_phy_rf_config.number_phy_rf_config_info = 2; // DJP pnf.phys.size();
NFAPI_TRACE(NFAPI_TRACE_INFO, "DJP:Hard coded num phy rf to 2\n");
for (unsigned i = 0; i < 2; ++i) {
req.pnf_phy_rf_config.phy_rf_config[i].phy_id = pnf->phys[i].id;
req.pnf_phy_rf_config.phy_rf_config[i].phy_config_index = pnf->phys[i].index;
req.pnf_phy_rf_config.phy_rf_config[i].rf_config_index = pnf->phys[i].rfs[0];
}
nfapi_nr_vnf_pnf_config_req(config, p5_idx, &req);
return 0;
}
int aerial_pnf_nr_config_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_nr_pnf_config_response_t *resp)
{
NFAPI_TRACE(NFAPI_TRACE_INFO,
"[VNF] pnf config response idx:%d resp[header[phy_id:%u message_id:%02x message_length:%u]]\n",
p5_idx,
resp->header.phy_id,
resp->header.message_id,
resp->header.message_length);
if (1) {
nfapi_nr_pnf_start_request_t req;
memset(&req, 0, sizeof(req));
req.header.phy_id = resp->header.phy_id;
req.header.message_id = NFAPI_PNF_START_REQUEST;
nfapi_nr_vnf_pnf_start_req(config, p5_idx, &req);
} else {
// Rather than send the pnf_start_request we will demonstrate
// sending a vendor extention message. The start request will be
// send when the vendor extension response is received
// vnf_info* vnf = (vnf_info*)(config->user_data);
vendor_ext_p5_req req;
memset(&req, 0, sizeof(req));
req.header.message_id = P5_VENDOR_EXT_REQ;
req.dummy1 = 45;
req.dummy2 = 1977;
nfapi_vnf_vendor_extension(config, p5_idx, &req.header);
}
return 0;
}
int aerial_pnf_nr_start_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_nr_pnf_start_response_t *resp)
{
vnf_info *vnf = (vnf_info *)(config->user_data);
vnf_p7_info *p7_vnf = vnf->p7_vnfs;
pnf_info *pnf = vnf->pnfs;
nfapi_nr_param_request_scf_t req;
NFAPI_TRACE(NFAPI_TRACE_INFO,
"[VNF] pnf start response idx:%d config:%p user_data:%p p7_vnf[config:%p thread_started:%d]\n",
p5_idx,
config,
config->user_data,
vnf->p7_vnfs[0].config,
vnf->p7_vnfs[0].thread_started);
aerial_vnf_nr_p7_config_init(p7_vnf);
// start all the phys in the pnf.
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Sending NFAPI_VNF_PARAM_REQUEST phy_id:%d\n", pnf->phys[0].id);
memset(&req, 0, sizeof(req));
req.header.message_id = NFAPI_NR_PHY_MSG_TYPE_PARAM_REQUEST;
req.header.phy_id = pnf->phys[0].id;
nfapi_nr_vnf_param_req(config, p5_idx, &req);
return 0;
}
int aerial_nr_param_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_nr_param_response_scf_t *resp)
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Received NFAPI_PARAM_RESP idx:%d phy_id:%d\n", p5_idx, resp->header.phy_id);
vnf_info *vnf = (vnf_info *)(config->user_data);
vnf_p7_info *p7_vnf = vnf->p7_vnfs;
pnf_info *pnf = vnf->pnfs;
phy_info *phy = pnf->phys;
struct sockaddr_in pnf_p7_sockaddr;
nfapi_nr_config_request_scf_t *req = &RC.nrmac[0]->config[0]; // check
phy->remote_port = resp->nfapi_config.p7_pnf_port.value;
// phy->remote_port = 32123;//resp->nfapi_config.p7_pnf_port.value;
memcpy(&pnf_p7_sockaddr.sin_addr.s_addr, &(resp->nfapi_config.p7_pnf_address_ipv4.address[0]), 4);
phy->remote_addr = inet_ntoa(pnf_p7_sockaddr.sin_addr);
// for now just 1
NFAPI_TRACE(NFAPI_TRACE_INFO,
"[VNF] %d.%d pnf p7 %s:%d timing %u %u %u %u\n",
p5_idx,
phy->id,
phy->remote_addr,
phy->remote_port,
p7_vnf->timing_window,
p7_vnf->periodic_timing_period,
p7_vnf->aperiodic_timing_enabled,
p7_vnf->periodic_timing_period);
req->header.message_id = NFAPI_NR_PHY_MSG_TYPE_CONFIG_REQUEST;
req->header.phy_id = phy->id;
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Send NFAPI_CONFIG_REQUEST\n");
// NFAPI_TRACE(NFAPI_TRACE_INFO, "\n NR bandP =%d\n",req->nfapi_config.rf_bands.rf_band[0]);
req->nfapi_config.p7_vnf_port.tl.tag = NFAPI_NR_NFAPI_P7_VNF_PORT_TAG;
req->nfapi_config.p7_vnf_port.value = p7_vnf->local_port;
req->num_tlv++;
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] DJP local_port:%d\n", ntohs(p7_vnf->local_port));
req->nfapi_config.p7_vnf_address_ipv4.tl.tag = NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV4_TAG;
struct sockaddr_in vnf_p7_sockaddr;
vnf_p7_sockaddr.sin_addr.s_addr = inet_addr(p7_vnf->local_addr);
memcpy(&(req->nfapi_config.p7_vnf_address_ipv4.address[0]), &vnf_p7_sockaddr.sin_addr.s_addr, 4);
req->num_tlv++;
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] DJP local_addr:%s\n", p7_vnf->local_addr);
req->nfapi_config.timing_window.tl.tag = NFAPI_NR_NFAPI_TIMING_WINDOW_TAG;
req->nfapi_config.timing_window.value = p7_vnf->timing_window;
NFAPI_TRACE(NFAPI_TRACE_INFO,
"\n[VNF]Timing window tag : %d Timing window:%u\n",
NFAPI_NR_NFAPI_TIMING_WINDOW_TAG,
p7_vnf->timing_window);
req->num_tlv++;
if (p7_vnf->periodic_timing_enabled || p7_vnf->aperiodic_timing_enabled) {
req->nfapi_config.timing_info_mode.tl.tag = NFAPI_NR_NFAPI_TIMING_INFO_MODE_TAG;
req->nfapi_config.timing_info_mode.value = (p7_vnf->aperiodic_timing_enabled << 1) | (p7_vnf->periodic_timing_enabled);
req->num_tlv++;
if (p7_vnf->periodic_timing_enabled) {
req->nfapi_config.timing_info_period.tl.tag = NFAPI_NR_NFAPI_TIMING_INFO_PERIOD_TAG;
req->nfapi_config.timing_info_period.value = p7_vnf->periodic_timing_period;
req->num_tlv++;
}
}
// TODO: Assign tag and value for P7 message offsets
req->nfapi_config.dl_tti_timing_offset.tl.tag = NFAPI_NR_NFAPI_DL_TTI_TIMING_OFFSET;
req->nfapi_config.ul_tti_timing_offset.tl.tag = NFAPI_NR_NFAPI_UL_TTI_TIMING_OFFSET;
req->nfapi_config.ul_dci_timing_offset.tl.tag = NFAPI_NR_NFAPI_UL_DCI_TIMING_OFFSET;
req->nfapi_config.tx_data_timing_offset.tl.tag = NFAPI_NR_NFAPI_TX_DATA_TIMING_OFFSET;
vendor_ext_tlv_2 ve2;
memset(&ve2, 0, sizeof(ve2));
ve2.tl.tag = VENDOR_EXT_TLV_2_TAG;
ve2.dummy = 2016;
req->vendor_extension = &ve2.tl;
nfapi_nr_vnf_config_req(config, p5_idx, req);
printf("[VNF] Sent NFAPI_VNF_CONFIG_REQ num_tlv:%u\n", req->num_tlv);
return 0;
}
int aerial_nr_send_config_request(nfapi_vnf_config_t *config, int p5_idx)
{
vnf_info *vnf = (vnf_info *)(config->user_data);
vnf_p7_info *p7_vnf = vnf->p7_vnfs;
pnf_info *pnf = vnf->pnfs;
phy_info *phy = pnf->phys;
nfapi_nr_config_request_scf_t *req = &RC.nrmac[0]->config[0];
NFAPI_TRACE(NFAPI_TRACE_INFO,
"[VNF] %d.%d pnf p7 %s:%d timing %u %u %u %u\n",
p5_idx,
phy->id,
phy->remote_addr,
phy->remote_port,
p7_vnf->timing_window,
p7_vnf->periodic_timing_period,
p7_vnf->aperiodic_timing_enabled,
p7_vnf->periodic_timing_period);
req->header.message_id = NFAPI_NR_PHY_MSG_TYPE_CONFIG_REQUEST;
req->header.phy_id = phy->id;
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Send NFAPI_CONFIG_REQUEST\n");
vnf_t *_this = (vnf_t *)(config);
nfapi_vnf_phy_info_t *vnf_phy = nfapi_vnf_phy_info_list_find(config, req->header.phy_id);
if (vnf_phy == NULL) {
printf("%s failed to find phy information phy_id:%d\n", __FUNCTION__, req->header.phy_id);
return -1;
}
nfapi_nr_p4_p5_message_header_t *msg = &req->header;
uint16_t msg_len = sizeof(nfapi_nr_config_request_scf_t);
uint8_t tx_messagebufferFAPI[sizeof(_this->tx_message_buffer)];
int packedMessageLengthFAPI = -1;
packedMessageLengthFAPI =
fapi_nr_p5_message_pack(msg, msg_len, tx_messagebufferFAPI, sizeof(tx_messagebufferFAPI), &_this->_public.codec_config);
aerial_send_P5_msg(tx_messagebufferFAPI, packedMessageLengthFAPI, msg);
return 0;
}
int aerial_nr_config_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_nr_config_response_scf_t *resp)
{
nfapi_nr_start_request_scf_t req;
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Received NFAPI_CONFIG_RESP idx:%d phy_id:%d\n", p5_idx, resp->header.phy_id);
LOG_I(NFAPI_VNF, "Received CONFIG.response, gNB is ready! \n");
memset(&req, 0, sizeof(req));
req.header.message_id = NFAPI_NR_PHY_MSG_TYPE_START_REQUEST;
req.header.phy_id = resp->header.phy_id;
nfapi_nr_vnf_start_req(config, p5_idx, &req);
return 0;
}
int aerial_nr_start_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_nr_start_response_scf_t *resp)
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Received NFAPI_START_RESP idx:%d phy_id:%d\n", p5_idx, resp->header.phy_id);
return 0;
}
int aerial_vendor_ext_cb(nfapi_vnf_config_t *config, int p5_idx, void *msg)
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] %s\n", __FUNCTION__);
switch (((nfapi_nr_p4_p5_message_header_t *)msg)->message_id) {
case P5_VENDOR_EXT_RSP: {
vendor_ext_p5_rsp *rsp = (vendor_ext_p5_rsp *)msg;
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] P5_VENDOR_EXT_RSP error_code:%d\n", rsp->error_code);
// send the start request
nfapi_nr_pnf_start_request_t req;
memset(&req, 0, sizeof(req));
req.header.message_id = NFAPI_PNF_START_REQUEST;
nfapi_nr_vnf_pnf_start_req(config, p5_idx, &req);
} break;
}
return 0;
}
int aerial_vnf_unpack_vendor_extension_tlv(nfapi_tl_t *tl,
uint8_t **ppReadPackedMessage,
uint8_t *end,
void **ve,
nfapi_p4_p5_codec_config_t *codec)
{
return -1;
}
int aerial_vnf_pack_vendor_extension_tlv(void *vext, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *codec)
{
nfapi_tl_t *tlv = (nfapi_tl_t *)vext;
switch (tlv->tag) {
case VENDOR_EXT_TLV_2_TAG: {
vendor_ext_tlv_2 *ve = (vendor_ext_tlv_2 *)tlv;
if (!push32(ve->dummy, ppWritePackedMsg, end))
return 0;
return 1;
} break;
}
return -1;
}
int aerial_vnf_unpack_p4_p5_vendor_extension(void *header,
uint8_t **ppReadPackedMessage,
uint8_t *end,
nfapi_p4_p5_codec_config_t *codec)
{
if (((nfapi_nr_p4_p5_message_header_t *)header)->message_id == P5_VENDOR_EXT_RSP) {
vendor_ext_p5_rsp *req = (vendor_ext_p5_rsp *)(header);
return (!pull16(ppReadPackedMessage, &req->error_code, end));
}
return 0;
}
int aerial_vnf_pack_p4_p5_vendor_extension(void *header,
uint8_t **ppWritePackedMsg,
uint8_t *end,
nfapi_p4_p5_codec_config_t *codec)
{
if (((nfapi_nr_p4_p5_message_header_t *)header)->message_id == P5_VENDOR_EXT_REQ) {
vendor_ext_p5_req *req = (vendor_ext_p5_req *)(header);
return (!(push16(req->dummy1, ppWritePackedMsg, end) && push16(req->dummy2, ppWritePackedMsg, end)));
}
return 0;
}
void *aerial_vnf_allocate_p4_p5_vendor_ext(uint16_t message_id, uint16_t *msg_size)
{
if (message_id == P5_VENDOR_EXT_RSP) {
*msg_size = sizeof(vendor_ext_p5_rsp);
return malloc(sizeof(vendor_ext_p5_rsp));
}
return 0;
}
void aerial_vnf_deallocate_p4_p5_vendor_ext(void *header)
{
free(header);
}
void *aerial_vnf_p5_allocate(size_t size)
{
// return (void*)memory_pool::allocate(size);
return (void *)malloc(size);
}
void aerial_vnf_p5_deallocate(void *ptr)
{
// memory_pool::deallocate((uint8_t*)ptr);
free(ptr);
}
static vnf_info aerial_vnf;
void aerial_configure_nr_fapi_vnf()
{
// TODO: Implement for FAPI
// nfapi_setmode(NFAPI_MODE_VNF);
memset(&aerial_vnf, 0, sizeof(aerial_vnf));
memset(aerial_vnf.p7_vnfs, 0, sizeof(aerial_vnf.p7_vnfs));
aerial_vnf.p7_vnfs[0].timing_window = 30;
aerial_vnf.p7_vnfs[0].periodic_timing_enabled = 0;
aerial_vnf.p7_vnfs[0].aperiodic_timing_enabled = 0;
aerial_vnf.p7_vnfs[0].periodic_timing_period = 10;
aerial_vnf.p7_vnfs[0].config = nfapi_vnf_p7_config_create();
aerial_vnf.p7_vnfs[0].mac = (mac_t *)malloc(sizeof(mac_t));
nfapi_vnf_config_t *config = nfapi_vnf_config_create();
config->malloc = malloc;
config->free = free;
config->vnf_ipv4 = 1;
config->vnf_ipv6 = 0;
config->pnf_list = 0;
config->phy_list = 0;
config->pnf_nr_connection_indication = &aerial_pnf_nr_connection_indication_cb;
config->pnf_disconnect_indication = &aerial_pnf_disconnection_indication_cb;
config->pnf_nr_param_resp = &aerial_pnf_nr_param_resp_cb;
config->pnf_nr_config_resp = &aerial_pnf_nr_config_resp_cb;
config->pnf_nr_start_resp = &aerial_pnf_nr_start_resp_cb;
config->nr_param_resp = &aerial_nr_param_resp_cb;
config->nr_config_resp = &aerial_nr_config_resp_cb;
config->nr_start_resp = &aerial_nr_start_resp_cb;
config->vendor_ext = &aerial_vendor_ext_cb;
config->user_data = &aerial_vnf;
// To allow custom vendor extentions to be added to nfapi
config->codec_config.unpack_vendor_extension_tlv = &aerial_vnf_unpack_vendor_extension_tlv;
config->codec_config.pack_vendor_extension_tlv = &aerial_vnf_pack_vendor_extension_tlv;
config->codec_config.unpack_p4_p5_vendor_extension = &aerial_vnf_unpack_p4_p5_vendor_extension;
config->codec_config.pack_p4_p5_vendor_extension = &aerial_vnf_pack_p4_p5_vendor_extension;
config->allocate_p4_p5_vendor_ext = &aerial_vnf_allocate_p4_p5_vendor_ext;
config->deallocate_p4_p5_vendor_ext = &aerial_vnf_deallocate_p4_p5_vendor_ext;
config->codec_config.allocate = &aerial_vnf_allocate;
config->codec_config.deallocate = &aerial_vnf_deallocate;
memset(&UL_RCC_INFO, 0, sizeof(UL_RCC_IND_t));
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Creating VNF NFAPI start thread %s\n", __FUNCTION__);
set_config(config);
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Created VNF NFAPI start thread %s\n", __FUNCTION__);
nfapi_vnf_pnf_info_t *pnf = (nfapi_vnf_pnf_info_t *)malloc(sizeof(nfapi_vnf_pnf_info_t));
NFAPI_TRACE(NFAPI_TRACE_INFO, "MALLOC nfapi_vnf_pnf_info_t for pnf_list pnf:%p\n", pnf);
memset(pnf, 0, sizeof(nfapi_vnf_pnf_info_t));
pnf->p5_idx = 1;
pnf->connected = 1;
// Add needed parameters
vnf_info *vnf = (vnf_info *)(config->user_data);
pnf_info *pnf_info = vnf->pnfs;
for (int i = 0; i < 1; ++i) {
phy_info phy;
memset(&phy, 0, sizeof(phy));
phy.index = 0;
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] (PHY:%d) phy_config_idx:%d\n", i, 0);
nfapi_vnf_allocate_phy(config, 1, &(phy.id));
for (int j = 0; j < 1; ++j) {
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] (PHY:%d) (RF%d) %d\n", i, j, 0);
phy.rfs[0] = 0;
}
pnf_info->phys[0] = phy;
}
nfapi_vnf_pnf_list_add(config, pnf);
vnf_p7_info *p7_vnf = vnf->p7_vnfs;
NFAPI_TRACE(NFAPI_TRACE_INFO,
"[VNF] pnf start response idx:%d config:%p user_data:%p p7_vnf[config:%p thread_started:%d]\n",
1,
config,
config->user_data,
vnf->p7_vnfs[0].config,
vnf->p7_vnfs[0].thread_started);
aerial_vnf_nr_p7_config_init(p7_vnf);
}
uint8_t aerial_unpack_nr_param_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config)
{
return unpack_nr_param_response(ppReadPackedMsg, end, msg, config);
}
uint8_t aerial_unpack_nr_config_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config)
{
return unpack_nr_config_response(ppReadPackedMsg, end, msg, config);
}
int oai_fapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req)
{
nfapi_vnf_p7_config_t *p7_config = aerial_vnf.p7_vnfs[0].config;
ul_tti_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
ul_tti_req->header.message_id = NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST;
// int retval = nfapi_vnf_p7_ul_tti_req(p7_config, ul_tti_req);
int retval = fapi_nr_pack_and_send_p7_message((vnf_p7_t *)p7_config, &ul_tti_req->header);
if (retval != 0) {
LOG_E(PHY, "%s() Problem sending retval:%d\n", __FUNCTION__, retval);
} else {
// Reset number of PDUs so that it is not resent
ul_tti_req->n_pdus = 0;
ul_tti_req->n_group = 0;
ul_tti_req->n_ulcch = 0;
ul_tti_req->n_ulsch = 0;
}
return retval;
}
int oai_fapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req)
{
nfapi_vnf_p7_config_t *p7_config = aerial_vnf.p7_vnfs[0].config;
ul_dci_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
ul_dci_req->header.message_id = NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST;
// int retval = nfapi_vnf_p7_ul_dci_req(p7_config, ul_dci_req);
int retval = fapi_nr_pack_and_send_p7_message((vnf_p7_t *)p7_config, &ul_dci_req->header);
if (retval != 0) {
LOG_E(PHY, "%s() Problem sending retval:%d\n", __FUNCTION__, retval);
} else {
ul_dci_req->numPdus = 0;
}
return retval;
}
int oai_fapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req)
{
nfapi_vnf_p7_config_t *p7_config = aerial_vnf.p7_vnfs[0].config;
tx_data_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
tx_data_req->header.message_id = NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST;
// LOG_D(PHY, "[VNF] %s() TX_REQ sfn_sf:%d number_of_pdus:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(tx_data_req->SFN),
// tx_data_req->Number_of_PDUs); int retval = nfapi_vnf_p7_tx_data_req(p7_config, tx_data_req);
int retval = fapi_nr_pack_and_send_p7_message((vnf_p7_t *)p7_config, &tx_data_req->header);
if (retval != 0) {
LOG_E(PHY, "%s() Problem sending retval:%d\n", __FUNCTION__, retval);
} else {
tx_data_req->Number_of_PDUs = 0;
}
return retval;
}
int oai_fapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req)
{
nfapi_vnf_p7_config_t *p7_config = aerial_vnf.p7_vnfs[0].config;
dl_config_req->header.message_id = NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST;
dl_config_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
int retval = fapi_nr_pack_and_send_p7_message((vnf_p7_t *)p7_config, &dl_config_req->header);
dl_config_req->dl_tti_request_body.nPDUs = 0;
dl_config_req->dl_tti_request_body.nGroup = 0;
if (retval != 0) {
LOG_E(PHY, "%s() Problem sending retval:%d\n", __FUNCTION__, retval);
}
return retval;
}
int oai_fapi_send_end_request(int cell, uint32_t frame, uint32_t slot){
nfapi_vnf_p7_config_t *p7_config = aerial_vnf.p7_vnfs[0].config;
nfapi_nr_slot_indication_scf_t nr_slot_resp = {.header.message_id = 0x8F, .sfn = frame, .slot = slot};
int retval = fapi_nr_pack_and_send_p7_message((vnf_p7_t *)p7_config, &nr_slot_resp.header);
if (retval != 0) {
LOG_E(PHY, "%s() Problem sending retval:%d\n", __FUNCTION__, retval);
}
return retval;
}

View File

@@ -1,72 +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
*/
/*! \file fapi/oai-integration/fapi_vnf_p5.h
* \brief Header file for fapi_vnf_p5.c
* \author Ruben S. Silva
* \date 2023
* \version 0.1
* \company OpenAirInterface Software Alliance
* \email: contact@openairinterface.org, rsilva@allbesmart.pt
* \note
* \warning
*/
#ifndef OPENAIRINTERFACE_FAPI_VNF_P5_H
#define OPENAIRINTERFACE_FAPI_VNF_P5_H
#define _GNU_SOURCE
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <pthread.h>
#include <stdlib.h>
#include <stdint.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "nfapi_nr_interface_scf.h"
#include "nfapi_vnf_interface.h"
#include "nfapi_vnf.h"
#include "nfapi.h"
#include "nfapi/oai_integration/vendor_ext.h"
#include "fapi_nvIPC.h"
#include "PHY/defs_eNB.h"
#include "PHY/LTE_TRANSPORT/transport_proto.h"
#include "common/ran_context.h"
#include "openair2/PHY_INTERFACE/queue_t.h"
#include "gnb_ind_vars.h"
#include "nfapi/open-nFAPI/vnf/inc/vnf.h"
void aerial_configure_nr_fapi_vnf();
int aerial_nr_send_config_request(nfapi_vnf_config_t *config, int p5_idx);
int oai_fapi_send_end_request(int cell_id, uint32_t frame, uint32_t slot);
uint8_t aerial_unpack_nr_param_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config);
uint8_t aerial_unpack_nr_config_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config);
int aerial_pnf_nr_connection_indication_cb(nfapi_vnf_config_t *config, int p5_idx);
int oai_fapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req);
int oai_fapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req);
int oai_fapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req);
int oai_fapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req);
#endif //OPENAIRINTERFACE_FAPI_VNF_P5_H

View File

@@ -35,200 +35,6 @@
#include "nr_fapi_p7.h"
#include "nr_fapi_p7_utils.h"
#include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h" // for handle_nr_srs_measurements()
extern pthread_cond_t nfapi_sync_cond;
extern pthread_mutex_t nfapi_sync_mutex;
extern int nfapi_sync_var;
int aerial_phy_nr_crc_indication(nfapi_nr_crc_indication_t *ind)
{
nfapi_nr_crc_indication_t *crc_ind = CALLOC(1, sizeof(*crc_ind));
copy_crc_indication(ind, crc_ind);
if (!put_queue(&gnb_crc_ind_queue, crc_ind)) {
LOG_E(NR_MAC, "Put_queue failed for crc_ind\n");
free_crc_indication(crc_ind);
free(crc_ind);
}
return 1;
}
int aerial_phy_nr_rx_data_indication(nfapi_nr_rx_data_indication_t *ind)
{
nfapi_nr_rx_data_indication_t *rx_ind = CALLOC(1, sizeof(*rx_ind));
copy_rx_data_indication(ind, rx_ind);
if (!put_queue(&gnb_rx_ind_queue, rx_ind)) {
LOG_E(NR_MAC, "Put_queue failed for rx_ind\n");
free_rx_data_indication(rx_ind);
free(rx_ind);
}
return 1;
}
int aerial_phy_nr_rach_indication(nfapi_nr_rach_indication_t *ind)
{
nfapi_nr_rach_indication_t *rach_ind = CALLOC(1, sizeof(*rach_ind));
copy_rach_indication(ind, rach_ind);
if (!put_queue(&gnb_rach_ind_queue, rach_ind)) {
LOG_E(NR_MAC, "Put_queue failed for rach_ind\n");
free_rach_indication(rach_ind);
free(rach_ind);
} else {
LOG_I(NR_MAC, "RACH.indication put_queue successfull\n");
}
return 1;
}
int aerial_phy_nr_uci_indication(nfapi_nr_uci_indication_t *ind)
{
nfapi_nr_uci_indication_t *uci_ind = CALLOC(1, sizeof(*uci_ind));
AssertFatal(uci_ind, "Memory not allocated for uci_ind in phy_nr_uci_indication.");
copy_uci_indication(ind, uci_ind);
if (!put_queue(&gnb_uci_ind_queue, uci_ind)) {
LOG_E(NR_MAC, "Put_queue failed for uci_ind\n");
free_uci_indication(uci_ind);
free(uci_ind);
uci_ind = NULL;
}
return 1;
}
void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frame, slot_t slot, NR_Sched_Rsp_t* sched_info);
int oai_fapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req);
int oai_fapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req);
int oai_fapi_tx_data_req(nfapi_nr_tx_data_request_t* tx_data_req);
int oai_fapi_ul_dci_req(nfapi_nr_ul_dci_request_t* ul_dci_req);
int oai_fapi_send_end_request(int cell, uint32_t frame, uint32_t slot);
extern int trigger_scheduler(nfapi_nr_slot_indication_scf_t *slot_ind);
int aerial_phy_nr_slot_indication(nfapi_nr_slot_indication_scf_t *ind)
{
LOG_D(MAC, "VNF SFN/Slot %d.%d \n", ind->sfn, ind->slot);
trigger_scheduler(ind);
return 1;
}
int aerial_phy_nr_srs_indication(nfapi_nr_srs_indication_t *ind)
{
// or queue to decouple, but I think it should be fast (in all likelihood,
// the VNF has nothing to do)
for (int i = 0; i < ind->number_of_pdus; ++i)
handle_nr_srs_measurements(0, ind->sfn, ind->slot, &ind->pdu_list[i]);
return 1;
}
void *aerial_vnf_allocate(size_t size)
{
// return (void*)memory_pool::allocate(size);
return (void *)malloc(size);
}
void aerial_vnf_deallocate(void *ptr)
{
// memory_pool::deallocate((uint8_t*)ptr);
free(ptr);
}
int aerial_phy_vendor_ext(struct nfapi_vnf_p7_config *config, void *msg)
{
if (((nfapi_nr_p7_message_header_t *)msg)->message_id == P7_VENDOR_EXT_IND) {
// vendor_ext_p7_ind* ind = (vendor_ext_p7_ind*)msg;
// NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] vendor_ext (error_code:%d)\n", ind->error_code);
} else {
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] unknown %02x\n", ((nfapi_nr_p7_message_header_t *)msg)->message_id);
}
return 0;
}
int aerial_phy_unpack_p7_vendor_extension(void *header,
uint8_t **ppReadPackedMessage,
uint8_t *end,
nfapi_p7_codec_config_t *config)
{
// NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
if (((nfapi_nr_p7_message_header_t *)header)->message_id == P7_VENDOR_EXT_IND) {
vendor_ext_p7_ind *req = (vendor_ext_p7_ind *)(header);
if (!pull16(ppReadPackedMessage, &req->error_code, end))
return 0;
}
return 1;
}
int aerial_phy_pack_p7_vendor_extension(void *header, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config)
{
// NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
if (((nfapi_nr_p7_message_header_t *)header)->message_id == P7_VENDOR_EXT_REQ) {
// NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
vendor_ext_p7_req *req = (vendor_ext_p7_req *)(header);
if (!(push16(req->dummy1, ppWritePackedMsg, end) && push16(req->dummy2, ppWritePackedMsg, end)))
return 0;
}
return 1;
}
int aerial_phy_unpack_vendor_extension_tlv(nfapi_tl_t *tl,
uint8_t **ppReadPackedMessage,
uint8_t *end,
void **ve,
nfapi_p7_codec_config_t *codec)
{
(void)tl;
(void)ppReadPackedMessage;
(void)ve;
return -1;
}
int aerial_phy_pack_vendor_extension_tlv(void *ve, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *codec)
{
// NFAPI_TRACE(NFAPI_TRACE_INFO, "phy_pack_vendor_extension_tlv\n");
nfapi_tl_t *tlv = (nfapi_tl_t *)ve;
switch (tlv->tag) {
case VENDOR_EXT_TLV_1_TAG: {
// NFAPI_TRACE(NFAPI_TRACE_INFO, "Packing VENDOR_EXT_TLV_1\n");
vendor_ext_tlv_1 *ve = (vendor_ext_tlv_1 *)tlv;
if (!push32(ve->dummy, ppWritePackedMsg, end))
return 0;
return 1;
} break;
default:
return -1;
break;
}
}
void *aerial_phy_allocate_p7_vendor_ext(uint16_t message_id, uint16_t *msg_size)
{
if (message_id == P7_VENDOR_EXT_IND) {
*msg_size = sizeof(vendor_ext_p7_ind);
return (nfapi_nr_p7_message_header_t *)malloc(sizeof(vendor_ext_p7_ind));
}
return 0;
}
void aerial_phy_deallocate_p7_vendor_ext(void *header)
{
free(header);
}
uint8_t aerial_unpack_nr_slot_indication(uint8_t **ppReadPackedMsg,
uint8_t *end,
nfapi_nr_slot_indication_scf_t *msg,
nfapi_p7_codec_config_t *config)
{
return unpack_nr_slot_indication(ppReadPackedMsg, end, msg, config);
}
static uint8_t aerial_unpack_nr_rx_data_indication_body(nfapi_nr_rx_data_pdu_t *value,
uint8_t **ppReadPackedMsg,
uint8_t *end,
@@ -247,6 +53,7 @@ static uint8_t aerial_unpack_nr_rx_data_indication_body(nfapi_nr_rx_data_pdu_t *
return 1;
}
uint8_t aerial_unpack_nr_rx_data_indication(uint8_t **ppReadPackedMsg,
uint8_t *end,
uint8_t **pDataMsg,
@@ -273,11 +80,11 @@ uint8_t aerial_unpack_nr_rx_data_indication(uint8_t **ppReadPackedMsg,
}
// After unpacking the PDU headers, unpack the PDU data from the separate buffer
for (int i = 0; i < pNfapiMsg->number_of_pdus; i++) {
if(!pullarray8(pDataMsg,
pNfapiMsg->pdu_list[i].pdu,
pNfapiMsg->pdu_list[i].pdu_length,
pNfapiMsg->pdu_list[i].pdu_length,
data_end)){
if (!pullarray8(pDataMsg,
pNfapiMsg->pdu_list[i].pdu,
pNfapiMsg->pdu_list[i].pdu_length,
pNfapiMsg->pdu_list[i].pdu_length,
data_end)) {
return 0;
}
}
@@ -285,19 +92,6 @@ uint8_t aerial_unpack_nr_rx_data_indication(uint8_t **ppReadPackedMsg,
return 1;
}
uint8_t aerial_unpack_nr_crc_indication(uint8_t **ppReadPackedMsg,
uint8_t *end,
nfapi_nr_crc_indication_t *msg,
nfapi_p7_codec_config_t *config)
{
return unpack_nr_crc_indication(ppReadPackedMsg, end, msg, config);
}
uint8_t aerial_unpack_nr_uci_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t *config)
{
return unpack_nr_uci_indication(ppReadPackedMsg, end, msg, config);
}
uint8_t aerial_unpack_nr_srs_indication(uint8_t **ppReadPackedMsg,
uint8_t *end,
uint8_t **pDataMsg,
@@ -316,20 +110,13 @@ uint8_t aerial_unpack_nr_srs_indication(uint8_t **ppReadPackedMsg,
return retval;
}
uint8_t aerial_unpack_nr_rach_indication(uint8_t **ppReadPackedMsg,
uint8_t *end,
nfapi_nr_rach_indication_t *msg,
nfapi_p7_codec_config_t *config)
{
return unpack_nr_rach_indication(ppReadPackedMsg, end, msg, config);
}
static int32_t aerial_pack_tx_data_request(void *pMessageBuf,
void *pPackedBuf,
void *pDataBuf,
uint32_t packedBufLen,
uint32_t dataBufLen,
nfapi_p7_codec_config_t *config,
nfapi_vnf_p7_config_t *p7_config,
uint32_t *data_len)
{
if (pMessageBuf == NULL || pPackedBuf == NULL) {
@@ -386,16 +173,15 @@ static int32_t aerial_pack_tx_data_request(void *pMessageBuf,
uintptr_t dataEnd = (uintptr_t)pPackedDataField;
data_len[0] = dataEnd - dataHead;
if (!fapi_nr_p7_message_pack(pMessageBuf, pPackedBuf, packedBufLen, config)) {
return -1;
}
if (!p7_config->pack_func(pMessageBuf, pPackedBuf, packedBufLen, config)) {
return -1;
}
return (int32_t)(pMessageHeader->message_length);
}
int fapi_nr_pack_and_send_p7_message(vnf_p7_t *vnf_p7, nfapi_nr_p7_message_header_t *header)
bool aerial_nr_send_p7_message(vnf_p7_t *vnf_p7, nfapi_nr_p7_message_header_t *header)
{
uint8_t FAPI_buffer[1024 * 64];
// Check if TX_DATA request, if true, need to pack to data_buf
@@ -414,17 +200,20 @@ int fapi_nr_pack_and_send_p7_message(vnf_p7_t *vnf_p7, nfapi_nr_p7_message_heade
sizeof(FAPI_buffer),
sizeof(FAPI_data_buffer),
&vnf_p7->_public.codec_config,
((nfapi_vnf_p7_config_t *)vnf_p7),
&data_len);
if (len_FAPI <= 0) {
LOG_E(NFAPI_VNF, "Problem packing TX_DATA_request\n");
return len_FAPI;
return false;
} else {
int retval = aerial_send_P7_msg_with_data(FAPI_buffer, len_FAPI, FAPI_data_buffer, data_len, header);
return retval;
return aerial_send_P7_msg_with_data(FAPI_buffer, len_FAPI, FAPI_data_buffer, data_len, header) == 0;
}
} else {
// Create and send FAPI P7 message
int len_FAPI = fapi_nr_p7_message_pack(header, FAPI_buffer, sizeof(FAPI_buffer), &vnf_p7->_public.codec_config);
return aerial_send_P7_msg(FAPI_buffer, len_FAPI, header);
int len_FAPI = ((nfapi_vnf_p7_config_t *)vnf_p7)->pack_func(header,
FAPI_buffer,
sizeof(FAPI_buffer),
&vnf_p7->_public.codec_config);
return aerial_send_P7_msg(FAPI_buffer, len_FAPI, header) == 0;
}
}

View File

@@ -47,187 +47,21 @@
#include "nfapi_interface.h"
#include "nfapi_nr_interface_scf.h"
#include "nfapi_vnf_interface.h"
#include "nfapi_vnf.h"
#include "nfapi.h"
#include "nfapi/oai_integration/vendor_ext.h"
#include "fapi_nvIPC.h"
#include "PHY/defs_eNB.h"
#include "PHY/LTE_TRANSPORT/transport_proto.h"
#include "openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h"
#include "lte-softmodem.h"
#include "common/ran_context.h"
#include "openair2/PHY_INTERFACE/queue_t.h"
#include "gnb_ind_vars.h"
#include "nfapi/open-nFAPI/vnf/inc/vnf.h"
#include "nfapi/open-nFAPI/vnf/inc/vnf_p7.h"
typedef struct {
uint8_t enabled;
uint32_t rx_port;
uint32_t tx_port;
char tx_addr[80];
} udp_data;
typedef struct {
uint16_t index;
uint16_t id;
uint8_t rfs[2];
uint8_t excluded_rfs[2];
udp_data udp;
char local_addr[80];
int local_port;
char *remote_addr;
int remote_port;
uint8_t duplex_mode;
uint16_t dl_channel_bw_support;
uint16_t ul_channel_bw_support;
uint8_t num_dl_layers_supported;
uint8_t num_ul_layers_supported;
uint16_t release_supported;
uint8_t nmm_modes_supported;
uint8_t dl_ues_per_subframe;
uint8_t ul_ues_per_subframe;
uint8_t first_subframe_ind;
// timing information recevied from the vnf
uint8_t timing_window;
uint8_t timing_info_mode;
uint8_t timing_info_period;
} phy_info;
typedef struct {
uint16_t index;
uint16_t band;
int16_t max_transmit_power;
int16_t min_transmit_power;
uint8_t num_antennas_supported;
uint32_t min_downlink_frequency;
uint32_t max_downlink_frequency;
uint32_t max_uplink_frequency;
uint32_t min_uplink_frequency;
} rf_info;
typedef struct {
int release;
phy_info phys[2];
rf_info rfs[2];
uint8_t sync_mode;
uint8_t location_mode;
uint8_t location_coordinates[6];
uint32_t dl_config_timing;
uint32_t ul_config_timing;
uint32_t tx_timing;
uint32_t hi_dci0_timing;
uint16_t max_phys;
uint16_t max_total_bw;
uint16_t max_total_dl_layers;
uint16_t max_total_ul_layers;
uint8_t shared_bands;
uint8_t shared_pa;
int16_t max_total_power;
uint8_t oui;
uint8_t wireshark_test_mode;
} pnf_info;
typedef struct mac mac_t;
typedef struct mac {
void *user_data;
void (*dl_config_req)(mac_t *mac, nfapi_dl_config_request_t *req);
void (*ul_config_req)(mac_t *mac, nfapi_ul_config_request_t *req);
void (*hi_dci0_req)(mac_t *mac, nfapi_hi_dci0_request_t *req);
void (*tx_req)(mac_t *mac, nfapi_tx_request_t *req);
} mac_t;
typedef struct {
int local_port;
char local_addr[80];
unsigned timing_window;
unsigned periodic_timing_enabled;
unsigned aperiodic_timing_enabled;
unsigned periodic_timing_period;
// This is not really the right place if we have multiple PHY,
// should be part of the phy struct
udp_data udp;
uint8_t thread_started;
nfapi_vnf_p7_config_t *config;
mac_t *mac;
} vnf_p7_info;
typedef struct {
uint8_t wireshark_test_mode;
pnf_info pnfs[2];
vnf_p7_info p7_vnfs[2];
} vnf_info;
int aerial_phy_nr_crc_indication(nfapi_nr_crc_indication_t *ind);
int aerial_phy_nr_rx_data_indication(nfapi_nr_rx_data_indication_t *ind);
int aerial_phy_nr_rach_indication(nfapi_nr_rach_indication_t *ind);
int aerial_phy_nr_uci_indication(nfapi_nr_uci_indication_t *ind);
int aerial_phy_nr_slot_indication(nfapi_nr_slot_indication_scf_t *ind);
int aerial_phy_nr_srs_indication(nfapi_nr_srs_indication_t *ind);
void *aerial_vnf_allocate(size_t size);
void aerial_vnf_deallocate(void *ptr);
int aerial_phy_vendor_ext(struct nfapi_vnf_p7_config *config, void *msg);
int aerial_phy_unpack_p7_vendor_extension(void *header,
uint8_t **ppReadPackedMessage,
uint8_t *end,
nfapi_p7_codec_config_t *config);
int aerial_phy_pack_p7_vendor_extension(void *header, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config);
int aerial_phy_unpack_vendor_extension_tlv(nfapi_tl_t *tl,
uint8_t **ppReadPackedMessage,
uint8_t *end,
void **ve,
nfapi_p7_codec_config_t *codec);
int aerial_phy_pack_vendor_extension_tlv(void *ve, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *codec);
void *aerial_phy_allocate_p7_vendor_ext(uint16_t message_id, uint16_t *msg_size);
void aerial_phy_deallocate_p7_vendor_ext(void *header);
uint8_t aerial_unpack_nr_slot_indication(uint8_t **ppReadPackedMsg,
uint8_t *end,
nfapi_nr_slot_indication_scf_t *msg,
nfapi_p7_codec_config_t *config);
uint8_t aerial_unpack_nr_rx_data_indication(uint8_t **ppReadPackedMsg,
uint8_t *end,
uint8_t **pDataMsg,
uint8_t *data_end,
nfapi_nr_rx_data_indication_t *msg,
nfapi_p7_codec_config_t *config);
uint8_t aerial_unpack_nr_crc_indication(uint8_t **ppReadPackedMsg,
uint8_t *end,
nfapi_nr_crc_indication_t *msg,
nfapi_p7_codec_config_t *config);
uint8_t aerial_unpack_nr_uci_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t *config);
uint8_t aerial_unpack_nr_srs_indication(uint8_t **ppReadPackedMsg,
uint8_t *end,
uint8_t **pDataMsg,
uint8_t *data_end,
void *msg,
nfapi_p7_codec_config_t *config);
uint8_t aerial_unpack_nr_rach_indication(uint8_t **ppReadPackedMsg,
uint8_t *end,
nfapi_nr_rach_indication_t *msg,
nfapi_p7_codec_config_t *config);
// int fapi_nr_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBufLen, nfapi_p7_codec_config_t* config);
int fapi_nr_pack_and_send_p7_message(vnf_p7_t *vnf_p7, nfapi_nr_p7_message_header_t *header);
bool aerial_nr_send_p7_message(vnf_p7_t *vnf_p7, nfapi_nr_p7_message_header_t *header);
#endif // OPENAIRINTERFACE_FAPI_VNF_P7_H

View File

@@ -45,6 +45,7 @@
#include <arpa/inet.h>
#include <pthread.h>
#include <errno.h>
#include <pnf.h>
#include <vendor_ext.h>
#include "fapi_stub.h"
@@ -62,6 +63,16 @@
#include "executables/lte-softmodem.h"
#include "nfapi/open-nFAPI/pnf/inc/pnf_p7.h"
#ifdef ENABLE_WLS
#include <nr_fapi_p5.h>
#include <nr_fapi_p7.h>
#include "nfapi/oai_integration/wls_integration/include/wls_pnf.h"
#endif
#ifdef ENABLE_SOCKET
#include <socket/include/socket_pnf.h>
#endif
#define NUM_P5_PHY 2
#define _GNU_SOURCE
@@ -185,7 +196,7 @@ typedef struct {
} pnf_phy_user_data_t;
static pnf_info pnf;
static pthread_t pnf_start_pthread;
static pthread_t pnf_p5_init_and_receive_pthread;
int nfapitooai_level(int nfapi_level) {
switch(nfapi_level) {
@@ -219,12 +230,7 @@ void *pnf_p7_thread_start(void *ptr) {
return 0;
}
void *pnf_nr_p7_thread_start(void *ptr) {
NFAPI_TRACE(NFAPI_TRACE_INFO, "[NR_PNF] NR P7 THREAD %s\n", __FUNCTION__);
nfapi_pnf_p7_config_t *config = (nfapi_pnf_p7_config_t *)ptr;
nfapi_nr_pnf_p7_start(config);
return 0;
}
int pnf_nr_param_request(nfapi_pnf_config_t *config, nfapi_nr_pnf_param_request_t *req)
{
@@ -991,6 +997,10 @@ int nr_config_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, n
phy_info->timing_window,
req->nfapi_config.timing_window.value);
num_tlv++;
}else {
// This is a nFAPI TLV, thus not sent when working with FAPI.
// When not sent, we still need a default value, otherwise every message from the L2 is treated as late and not processed
phy_info->timing_window = 30;
}
if (req->nfapi_config.timing_info_mode.tl.tag == NFAPI_NR_NFAPI_TIMING_INFO_MODE_TAG) {
@@ -1747,9 +1757,26 @@ int nr_start_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nf
p7_config->codec_config.pack_p7_vendor_extension = &pnf_nr_phy_pack_p7_vendor_extension;
p7_config->codec_config.unpack_vendor_extension_tlv = &pnf_nr_phy_unpack_vendor_extension_tlv;
p7_config->codec_config.pack_vendor_extension_tlv = &pnf_nr_phy_pack_vendor_extention_tlv;
#ifdef ENABLE_WLS
p7_config->unpack_func = &fapi_nr_p7_message_unpack;
p7_config->hdr_unpack_func = &fapi_nr_p7_message_header_unpack;
p7_config->pack_func = &fapi_nr_p7_message_pack;
p7_config->send_p7_msg = &wls_pnf_nr_send_p7_message;
// pass p7_config to WLS handler
wls_pnf_set_p7_config(p7_config);
#endif
#ifdef ENABLE_SOCKET
p7_config->unpack_func = &nfapi_nr_p7_message_unpack;
p7_config->hdr_unpack_func = &nfapi_nr_p7_message_header_unpack;
p7_config->pack_func = &nfapi_nr_p7_message_pack;
p7_config->send_p7_msg = &pnf_nr_send_p7_message;
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] Creating P7 thread %s\n", __FUNCTION__);
pthread_t p7_thread;
threadCreate(&p7_thread, &pnf_nr_p7_thread_start, p7_config, "pnf_p7_thread", -1, OAI_PRIORITY_RT);
#endif
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] Calling l1_north_init_eNB() %s\n", __FUNCTION__);
l1_north_init_gNB();
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] HACK - Set p7_config global ready for subframe ind%s\n", __FUNCTION__);
@@ -1794,10 +1821,11 @@ int nr_start_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nf
usleep(50000);
printf("[PNF] waiting for OAI to be started\n");
}
#ifndef ENABLE_WLS
printf("[PNF] Sending PNF_START_RESP\n");
nfapi_nr_send_pnf_start_resp(config, p7_config->phy_id);
printf("[PNF] Sending first P7 slot indication\n");
#endif
#if 1
nfapi_pnf_p7_slot_ind(p7_config, p7_config->phy_id, 0, 0);
printf("[PNF] Sent first P7 slot ind\n");
@@ -2132,15 +2160,6 @@ void *pnf_start_thread(void *ptr) {
return (void *)0;
}
void *pnf_nr_start_thread(void *ptr) {
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] IN PNF NFAPI start thread %s\n", __FUNCTION__);
nfapi_pnf_config_t *config = (nfapi_pnf_config_t *)ptr;
struct sched_param sp;
sp.sched_priority = 20;
pthread_setschedparam(pthread_self(),SCHED_FIFO,&sp);
nfapi_nr_pnf_start(config);
return (void *)0;
}
void configure_nr_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr, int pnf_p7_port, int vnf_p7_port)
{
@@ -2188,9 +2207,29 @@ void configure_nr_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_add
config->deallocate_p4_p5_vendor_ext = &pnf_nr_sim_deallocate_p4_p5_vendor_ext;
config->codec_config.unpack_p4_p5_vendor_extension = &pnf_nr_sim_unpack_p4_p5_vendor_extension;
config->codec_config.pack_p4_p5_vendor_extension = &pnf_nr_sim_pack_p4_p5_vendor_extension;
#ifdef ENABLE_WLS
printf("WLS MODE PNF\n");
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] Creating WLS PNF NFAPI start thread %s\n", __FUNCTION__);
// Assume it's the FAPI handler, change from within the PNF if it's not the case
config->unpack_func = &fapi_nr_p5_message_unpack;
config->hdr_unpack_func = &fapi_nr_message_header_unpack;
config->pack_func = &fapi_nr_p5_message_pack;
config->send_p5_msg = &wls_pnf_nr_send_p5_message;
//wls_fapi_pnf_nr_start_thread(config);
threadCreate(&pnf_p5_init_and_receive_pthread, wls_fapi_pnf_nr_start_thread, config, "NFAPI_WLS_PNF", -1, OAI_PRIORITY_RT_MAX);
#endif
#ifdef ENABLE_SOCKET
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] Creating PNF NFAPI start thread %s\n", __FUNCTION__);
pthread_create(&pnf_start_pthread, NULL, &pnf_nr_start_thread, config);
pthread_setname_np(pnf_start_pthread, "NFAPI_PNF");
config->unpack_func = &nfapi_nr_p5_message_unpack;
config->hdr_unpack_func = &nfapi_nr_p5_message_header_unpack;
config->pack_func = &nfapi_nr_p5_message_pack;
config->send_p5_msg = &pnf_nr_send_p5_message;
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] Creating PNF NFAPI start thread %s\n", __FUNCTION__);
pthread_create(&pnf_p5_init_and_receive_pthread, NULL, &pnf_start_p5_thread, config);
pthread_setname_np(pnf_p5_init_and_receive_pthread, "NFAPI_PNF");
#endif
}
void configure_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr, int pnf_p7_port, int vnf_p7_port) {
@@ -2240,8 +2279,8 @@ void configure_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr,
config->codec_config.unpack_p4_p5_vendor_extension = &pnf_sim_unpack_p4_p5_vendor_extension;
config->codec_config.pack_p4_p5_vendor_extension = &pnf_sim_pack_p4_p5_vendor_extension;
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] Creating PNF NFAPI start thread %s\n", __FUNCTION__);
pthread_create(&pnf_start_pthread, NULL, &pnf_start_thread, config);
pthread_setname_np(pnf_start_pthread, "NFAPI_PNF");
pthread_create(&pnf_p5_init_and_receive_pthread, NULL, &pnf_start_thread, config);
pthread_setname_np(pnf_p5_init_and_receive_pthread, "NFAPI_PNF");
}
void oai_subframe_ind(uint16_t sfn, uint16_t sf) {
@@ -2300,7 +2339,11 @@ void handle_nr_slot_ind(uint16_t sfn, uint16_t slot)
//send VNF slot indication, which is aligned with TX thread, so that it can call the scheduler
//we give four additional slots (2ms) which should be enough time for the VNF to
//answer
#ifndef ENABLE_WLS
int slot_ahead = 2 << mu;
#else
int slot_ahead = 1;
#endif
uint16_t sfn_tx = sfn;
uint16_t slot_tx = slot;
sfnslot_add_slot(mu, &sfn_tx, &slot_tx, slot_ahead); // modify: do in place

View File

@@ -32,8 +32,19 @@
#include <arpa/inet.h>
#include "nfapi_nr_interface_scf.h"
#include "nfapi_vnf_interface.h"
#include "nfapi_vnf.h"
#include <vnf.h>
#include <vnf_p7.h>
#ifdef ENABLE_WLS
#include <wls_integration/include/wls_vnf.h>
#include "nr_fapi_p5.h"
#include "nr_fapi_p7.h"
#endif
#ifdef ENABLE_SOCKET
#include <socket/include/socket_vnf.h>
#endif
#include "nfapi.h"
#include "vendor_ext.h"
@@ -48,10 +59,14 @@
#include "openair2/PHY_INTERFACE/queue_t.h"
#include "gnb_ind_vars.h"
#include "nr_fapi_p7_utils.h"
#include "nr_fapi_p5_utils.h"
#include <NR_MAC_gNB/mac_proto.h>
#ifdef ENABLE_AERIAL
#include "aerial/fapi_vnf_p5.h"
#include "aerial/fapi_nvIPC.h"
#include "aerial/fapi_vnf_p7.h"
#include "nr_fapi_p5.h"
#include "nr_fapi_p7.h"
#endif
#define TEST
@@ -59,128 +74,6 @@
extern RAN_CONTEXT_t RC;
extern UL_RCC_IND_t UL_RCC_INFO;
typedef struct {
uint8_t enabled;
uint32_t rx_port;
uint32_t tx_port;
char tx_addr[80];
} udp_data;
typedef struct {
uint16_t index;
uint16_t id;
uint8_t rfs[2];
uint8_t excluded_rfs[2];
udp_data udp;
char local_addr[80];
int local_port;
char *remote_addr;
int remote_port;
uint8_t duplex_mode;
uint16_t dl_channel_bw_support;
uint16_t ul_channel_bw_support;
uint8_t num_dl_layers_supported;
uint8_t num_ul_layers_supported;
uint16_t release_supported;
uint8_t nmm_modes_supported;
uint8_t dl_ues_per_subframe;
uint8_t ul_ues_per_subframe;
uint8_t first_subframe_ind;
// timing information recevied from the vnf
uint8_t timing_window;
uint8_t timing_info_mode;
uint8_t timing_info_period;
} phy_info;
typedef struct {
uint16_t index;
uint16_t band;
int16_t max_transmit_power;
int16_t min_transmit_power;
uint8_t num_antennas_supported;
uint32_t min_downlink_frequency;
uint32_t max_downlink_frequency;
uint32_t max_uplink_frequency;
uint32_t min_uplink_frequency;
} rf_info;
typedef struct {
int release;
phy_info phys[2];
rf_info rfs[2];
uint8_t sync_mode;
uint8_t location_mode;
uint8_t location_coordinates[6];
uint32_t dl_config_timing;
uint32_t ul_config_timing;
uint32_t tx_timing;
uint32_t hi_dci0_timing;
uint16_t max_phys;
uint16_t max_total_bw;
uint16_t max_total_dl_layers;
uint16_t max_total_ul_layers;
uint8_t shared_bands;
uint8_t shared_pa;
int16_t max_total_power;
uint8_t oui;
uint8_t wireshark_test_mode;
} pnf_info;
typedef struct mac mac_t;
typedef struct mac {
void *user_data;
void (*dl_config_req)(mac_t *mac, nfapi_dl_config_request_t *req);
void (*ul_config_req)(mac_t *mac, nfapi_ul_config_request_t *req);
void (*hi_dci0_req)(mac_t *mac, nfapi_hi_dci0_request_t *req);
void (*tx_req)(mac_t *mac, nfapi_tx_request_t *req);
} mac_t;
typedef struct {
int local_port;
char local_addr[80];
unsigned timing_window;
unsigned periodic_timing_enabled;
unsigned aperiodic_timing_enabled;
unsigned periodic_timing_period;
// This is not really the right place if we have multiple PHY,
// should be part of the phy struct
udp_data udp;
uint8_t thread_started;
nfapi_vnf_p7_config_t *config;
mac_t *mac;
} vnf_p7_info;
typedef struct {
uint8_t wireshark_test_mode;
pnf_info pnfs[2];
vnf_p7_info p7_vnfs[2];
} vnf_info;
int vnf_pack_vendor_extension_tlv(void *ve, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *codec) {
//NFAPI_TRACE(NFAPI_TRACE_INFO, "vnf_pack_vendor_extension_tlv\n");
nfapi_tl_t *tlv = (nfapi_tl_t *)ve;
@@ -707,7 +600,7 @@ int phy_rach_indication(struct nfapi_vnf_p7_config *config, nfapi_rach_indicatio
int phy_nr_rach_indication(nfapi_nr_rach_indication_t *ind)
{
if (NFAPI_MODE == NFAPI_MODE_VNF) {
if (NFAPI_MODE == NFAPI_MODE_VNF || NFAPI_MODE == NFAPI_MODE_AERIAL) {
nfapi_nr_rach_indication_t *rach_ind = CALLOC(1, sizeof(*rach_ind));
copy_rach_indication(ind, rach_ind);
if (!put_queue(&gnb_rach_ind_queue, rach_ind)) {
@@ -724,7 +617,7 @@ int phy_nr_rach_indication(nfapi_nr_rach_indication_t *ind)
int phy_nr_uci_indication(nfapi_nr_uci_indication_t *ind)
{
LOG_D(NR_MAC, "In %s() NFAPI SFN/SF: %d/%d number_of_pdus :%u\n", __FUNCTION__, ind->sfn, ind->slot, ind->num_ucis);
if (NFAPI_MODE == NFAPI_MODE_VNF) {
if (NFAPI_MODE == NFAPI_MODE_VNF || NFAPI_MODE == NFAPI_MODE_AERIAL) {
nfapi_nr_uci_indication_t *uci_ind = CALLOC(1, sizeof(*uci_ind));
AssertFatal(uci_ind, "Memory not allocated for uci_ind in phy_nr_uci_indication.");
copy_uci_indication(ind, uci_ind);
@@ -829,7 +722,7 @@ int phy_nr_crc_indication(nfapi_nr_crc_indication_t *ind)
{
LOG_D(NR_MAC, "In %s() NFAPI SFN/SF: %d/%d number_of_pdus :%u\n", __FUNCTION__, ind->sfn, ind->slot, ind->number_crcs);
if (NFAPI_MODE == NFAPI_MODE_VNF) {
if (NFAPI_MODE == NFAPI_MODE_VNF || NFAPI_MODE == NFAPI_MODE_AERIAL) {
nfapi_nr_crc_indication_t *crc_ind = CALLOC(1, sizeof(*crc_ind));
copy_crc_indication(ind, crc_ind);
if (!put_queue(&gnb_crc_ind_queue, crc_ind)) {
@@ -930,7 +823,7 @@ int phy_nr_rx_data_indication(nfapi_nr_rx_data_indication_t *ind)
ind->number_of_pdus,
ind->pdu_list[0].pdu);
if (NFAPI_MODE == NFAPI_MODE_VNF) {
if (NFAPI_MODE == NFAPI_MODE_VNF || NFAPI_MODE == NFAPI_MODE_AERIAL) {
nfapi_nr_rx_data_indication_t *rx_ind = CALLOC(1, sizeof(*rx_ind));
copy_rx_data_indication(ind, rx_ind);
if (!put_queue(&gnb_rx_ind_queue, rx_ind)) {
@@ -1389,16 +1282,9 @@ int vnf_nr_pack_p4_p5_vendor_extension(void *header, uint8_t **ppWritePackedMsg,
return 0;
}
static pthread_t vnf_start_pthread;
static pthread_t vnf_p5_init_and_receive_pthread;
static pthread_t vnf_p7_start_pthread;
void *vnf_nr_p7_start_thread(void *ptr) {
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s()\n", __FUNCTION__);
pthread_setname_np(pthread_self(), "VNF_P7");
nfapi_vnf_p7_config_t *config = (nfapi_vnf_p7_config_t *)ptr;
nfapi_nr_vnf_p7_start(config);
return config;
}
void *vnf_p7_start_thread(void *ptr) {
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s()\n", __FUNCTION__);
@@ -1408,7 +1294,7 @@ void *vnf_p7_start_thread(void *ptr) {
return config;
}
void *vnf_nr_p7_thread_start(void *ptr)
void *configure_nr_p7_vnf(void *ptr)
{
init_queue(&gnb_rach_ind_queue);
init_queue(&gnb_rx_ind_queue);
@@ -1417,19 +1303,23 @@ void *vnf_nr_p7_thread_start(void *ptr)
vnf_p7_info *p7_vnf = (vnf_p7_info *)ptr;
p7_vnf->config->port = p7_vnf->local_port;
#ifndef ENABLE_AERIAL
p7_vnf->config->sync_indication = &phy_sync_indication;
p7_vnf->config->slot_indication = &phy_slot_indication;
p7_vnf->config->harq_indication = &phy_harq_indication;
#endif
p7_vnf->config->nr_crc_indication = &phy_nr_crc_indication;
p7_vnf->config->nr_rx_data_indication = &phy_nr_rx_data_indication;
p7_vnf->config->nr_rach_indication = &phy_nr_rach_indication;
p7_vnf->config->nr_uci_indication = &phy_nr_uci_indication;
#ifndef ENABLE_AERIAL
p7_vnf->config->srs_indication = &phy_srs_indication;
p7_vnf->config->sr_indication = &phy_sr_indication;
p7_vnf->config->cqi_indication = &phy_cqi_indication;
p7_vnf->config->lbt_dl_indication = &phy_lbt_dl_indication;
p7_vnf->config->nb_harq_indication = &phy_nb_harq_indication;
p7_vnf->config->nrach_indication = &phy_nrach_indication;
#endif
p7_vnf->config->nr_slot_indication = &phy_nr_slot_indication;
p7_vnf->config->nr_srs_indication = &phy_nr_srs_indication;
p7_vnf->config->malloc = &vnf_allocate;
@@ -1445,8 +1335,30 @@ void *vnf_nr_p7_thread_start(void *ptr)
p7_vnf->config->codec_config.deallocate = &vnf_deallocate;
p7_vnf->config->allocate_p7_vendor_ext = &phy_nr_allocate_p7_vendor_ext;
p7_vnf->config->deallocate_p7_vendor_ext = &phy_nr_deallocate_p7_vendor_ext;
#ifdef ENABLE_WLS
p7_vnf->config->unpack_func = &fapi_nr_p7_message_unpack;
p7_vnf->config->hdr_unpack_func = &fapi_nr_p7_message_header_unpack;
p7_vnf->config->pack_func = &fapi_nr_p7_message_pack;
p7_vnf->config->send_p7_msg = &wls_vnf_nr_send_p7_message;
wls_vnf_set_p7_config(p7_vnf->config);
#endif
#ifdef ENABLE_SOCKET
p7_vnf->config->unpack_func = &nfapi_nr_p7_message_unpack;
p7_vnf->config->hdr_unpack_func = &nfapi_nr_p7_message_header_unpack;
p7_vnf->config->pack_func = &nfapi_nr_p7_message_pack;
p7_vnf->config->send_p7_msg = &vnf_nr_send_p7_msg;
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Creating VNF NFAPI P7 start thread %s\n", __FUNCTION__);
pthread_create(&vnf_p7_start_pthread, NULL, &vnf_nr_p7_start_thread, p7_vnf->config);
threadCreate(&vnf_p7_start_pthread, &vnf_nr_start_p7_thread, p7_vnf->config, "vnf_p7_thread", -1, OAI_PRIORITY_RT);
#endif
#ifdef ENABLE_AERIAL
p7_vnf->config->unpack_func = &fapi_nr_p7_message_unpack;
p7_vnf->config->hdr_unpack_func = &fapi_nr_p7_message_header_unpack;
p7_vnf->config->pack_func = &fapi_nr_p7_message_pack;
p7_vnf->config->send_p7_msg = &aerial_nr_send_p7_message;
#endif
return 0;
}
@@ -1494,7 +1406,7 @@ int pnf_nr_start_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_nr_pnf_st
if(p7_vnf->thread_started == 0) {
pthread_t vnf_p7_thread;
threadCreate(&vnf_p7_thread, &vnf_nr_p7_thread_start, p7_vnf, "vnf_p7_thread", -1, OAI_PRIORITY_RT);
threadCreate(&vnf_p7_thread, &configure_nr_p7_vnf, p7_vnf, "vnf_p7_thread", -1, OAI_PRIORITY_RT);
p7_vnf->thread_started = 1;
} else {
// P7 thread already running.
@@ -1504,7 +1416,12 @@ int pnf_nr_start_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_nr_pnf_st
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Sending NFAPI_VNF_PARAM_REQUEST phy_id:%d\n", pnf->phys[0].id);
memset(&req, 0, sizeof(req));
req.header.message_id = NFAPI_NR_PHY_MSG_TYPE_PARAM_REQUEST;
#ifdef ENABLE_WLS
req.header.phy_id = 0;
#endif
#ifdef ENABLE_SOCKET
req.header.phy_id = pnf->phys[0].id;
#endif
nfapi_nr_vnf_param_req(config, p5_idx, &req);
return 0;
}
@@ -1542,8 +1459,9 @@ int nr_param_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_nr_param_resp
vnf_p7_info *p7_vnf = vnf->p7_vnfs;
pnf_info *pnf = vnf->pnfs;
phy_info *phy = pnf->phys;
struct sockaddr_in pnf_p7_sockaddr;
nfapi_nr_config_request_scf_t *req = &RC.nrmac[0]->config[0]; // check
#ifndef ENABLE_AERIAL
struct sockaddr_in pnf_p7_sockaddr;
phy->remote_port = resp->nfapi_config.p7_pnf_port.value;
//phy->remote_port = 32123;//resp->nfapi_config.p7_pnf_port.value;
memcpy(&pnf_p7_sockaddr.sin_addr.s_addr, &(resp->nfapi_config.p7_pnf_address_ipv4.address[0]), 4);
@@ -1551,6 +1469,7 @@ int nr_param_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_nr_param_resp
// for now just 1
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] %d.%d pnf p7 %s:%d timing %u %u %u %u\n", p5_idx, phy->id, phy->remote_addr, phy->remote_port, p7_vnf->timing_window, p7_vnf->periodic_timing_period, p7_vnf->aperiodic_timing_enabled,
p7_vnf->periodic_timing_period);
#endif
// Hack? the VNF might need the subcarrier spacing for some calculations
// (that we actually don't use as of now...). We therefore need to save the
// mu, for the current PNF connection (together with where we have frame/slot
@@ -1566,7 +1485,7 @@ int nr_param_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_nr_param_resp
req->header.phy_id = phy->id;
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Send NFAPI_CONFIG_REQUEST\n");
//NFAPI_TRACE(NFAPI_TRACE_INFO, "\n NR bandP =%d\n",req->nfapi_config.rf_bands.rf_band[0]);
#ifndef ENABLE_AERIAL
req->nfapi_config.p7_vnf_port.tl.tag = NFAPI_NR_NFAPI_P7_VNF_PORT_TAG;
req->nfapi_config.p7_vnf_port.value = p7_vnf->local_port;
req->num_tlv++;
@@ -1604,6 +1523,7 @@ req->nfapi_config.tx_data_timing_offset.tl.tag = NFAPI_NR_NFAPI_TX_DATA_TIMING_O
ve2.tl.tag = VENDOR_EXT_TLV_2_TAG;
ve2.dummy = 2016;
req->vendor_extension = &ve2.tl;
#endif
nfapi_nr_vnf_config_req(config, p5_idx, req);
printf("[VNF] Sent NFAPI_VNF_CONFIG_REQ num_tlv:%u\n",req->num_tlv);
return 0;
@@ -1703,6 +1623,21 @@ int nr_start_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_nr_start_resp
return 0;
}
int nr_error_ind_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_nr_error_indication_scf_t *resp)
{
NFAPI_TRACE(NFAPI_TRACE_WARN,
"[VNF] Received NFAPI_NR_PHY_MSG_TYPE_ERROR_INDICATION idx:%d phy_id:%d\n",
p5_idx,
resp->header.phy_id);
NFAPI_TRACE(NFAPI_TRACE_WARN, "[VNF] Previous message 0x%02x resulted in an error on the PNF \n", resp->message_id);
NFAPI_TRACE(NFAPI_TRACE_WARN,
"[VNF] Received error code 0x%02x (%s)\n",
resp->error_code,
error_ind_code_to_str(resp->error_code));
// TODO: add error handling to the VNF instead of only reporting the received error
return 0;
}
int vendor_ext_cb(nfapi_vnf_config_t *config, int p5_idx, void *msg)
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] %s\n", __FUNCTION__);
@@ -1794,28 +1729,19 @@ void vnf_nr_deallocate_p4_p5_vendor_ext(void *header) {
free(header);
}
nfapi_vnf_config_t *config = 0;
void vnf_nr_start_thread(void *ptr) {
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] VNF NFAPI thread - nfapi_vnf_start()%s\n", __FUNCTION__);
pthread_setname_np(pthread_self(), "VNF");
config = (nfapi_vnf_config_t *)ptr;
nfapi_nr_vnf_start(config);
}
void vnf_start_thread(void *ptr) {
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] VNF NFAPI thread - nfapi_vnf_start()%s\n", __FUNCTION__);
pthread_setname_np(pthread_self(), "VNF");
config = (nfapi_vnf_config_t *)ptr;
nfapi_vnf_start(config);
nfapi_vnf_start((nfapi_vnf_config_t *)ptr);
}
static vnf_info vnf;
void configure_nr_nfapi_vnf(char *vnf_addr, int vnf_p5_port, char *pnf_ip_addr, int pnf_p7_port, int vnf_p7_port)
void configure_nr_nfapi_vnf(eth_params_t params)
{
#ifndef ENABLE_AERIAL
nfapi_setmode(NFAPI_MODE_VNF);
#endif
memset(&vnf, 0, sizeof(vnf));
memset(vnf.p7_vnfs, 0, sizeof(vnf.p7_vnfs));
vnf.p7_vnfs[0].timing_window = 30;
@@ -1823,19 +1749,21 @@ void configure_nr_nfapi_vnf(char *vnf_addr, int vnf_p5_port, char *pnf_ip_addr,
vnf.p7_vnfs[0].aperiodic_timing_enabled = 0;
vnf.p7_vnfs[0].periodic_timing_period = 1;
vnf.p7_vnfs[0].config = nfapi_vnf_p7_config_create();
#ifndef ENABLE_AERIAL
NFAPI_TRACE(NFAPI_TRACE_INFO,
"[VNF] %s() vnf.p7_vnfs[0].config:%p VNF ADDRESS:%s:%d\n",
__FUNCTION__,
vnf.p7_vnfs[0].config,
vnf_addr,
vnf_p5_port);
strcpy(vnf.p7_vnfs[0].local_addr, vnf_addr);
vnf.p7_vnfs[0].local_port = vnf_p7_port;
params.my_addr,
params.my_portc);
strcpy(vnf.p7_vnfs[0].local_addr, params.my_addr);
vnf.p7_vnfs[0].local_port = params.my_portd;
#endif
vnf.p7_vnfs[0].mac = (mac_t *)malloc(sizeof(mac_t));
nfapi_vnf_config_t *config = nfapi_vnf_config_create();
config->malloc = malloc;
config->free = free;
config->vnf_p5_port = vnf_p5_port;
config->vnf_p5_port = params.my_portc;
config->vnf_ipv4 = 1;
config->vnf_ipv6 = 0;
config->pnf_list = 0;
@@ -1850,6 +1778,7 @@ void configure_nr_nfapi_vnf(char *vnf_addr, int vnf_p5_port, char *pnf_ip_addr,
config->nr_param_resp = &nr_param_resp_cb;
config->nr_config_resp = &nr_config_resp_cb;
config->nr_start_resp = &nr_start_resp_cb;
config->nr_error_ind = &nr_error_ind_cb;
config->vendor_ext = &vendor_nr_ext_cb;
config->user_data = &vnf;
// To allow custom vendor extentions to be added to nfapi
@@ -1862,9 +1791,73 @@ void configure_nr_nfapi_vnf(char *vnf_addr, int vnf_p5_port, char *pnf_ip_addr,
config->codec_config.allocate = &vnf_nr_allocate;
config->codec_config.deallocate = &vnf_nr_deallocate;
memset(&UL_RCC_INFO, 0, sizeof(UL_RCC_IND_t));
#ifdef ENABLE_WLS
config->unpack_func = &fapi_nr_p5_message_unpack;
config->hdr_unpack_func = &fapi_nr_message_header_unpack;
config->pack_func = &fapi_nr_p5_message_pack;
config->send_p5_msg = &wls_vnf_nr_send_p5_message;
printf("WLS MODE PNF\n");
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] Creating WLS VNF NFAPI start thread %s\n", __FUNCTION__);
//wls_fapi_pnf_nr_start_thread(config);
threadCreate(&vnf_p5_init_and_receive_pthread, wls_fapi_vnf_nr_start_thread, config, "NFAPI_WLS_VNF", -1, OAI_PRIORITY_RT_MAX);
#endif
#ifdef ENABLE_SOCKET
config->unpack_func = &nfapi_nr_p5_message_unpack;
config->hdr_unpack_func = &nfapi_nr_p5_message_header_unpack;
config->pack_func = &nfapi_nr_p5_message_pack;
config->send_p5_msg = &vnf_nr_send_p5_msg;
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Creating VNF NFAPI start thread %s\n", __FUNCTION__);
pthread_create(&vnf_start_pthread, NULL, (void *)&vnf_nr_start_thread, config);
pthread_create(&vnf_p5_init_and_receive_pthread, NULL, (void *)&vnf_start_p5_thread, config);
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Created VNF NFAPI start thread %s\n", __FUNCTION__);
#endif
#ifdef ENABLE_AERIAL
config->unpack_func = &fapi_nr_p5_message_unpack;
config->hdr_unpack_func = &fapi_nr_message_header_unpack;
config->pack_func = &fapi_nr_p5_message_pack;
config->send_p5_msg = &aerial_nr_send_p5_message;
set_config(config);
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Created VNF NFAPI start thread %s\n", __FUNCTION__);
nfapi_vnf_pnf_info_t *pnf = (nfapi_vnf_pnf_info_t *)malloc(sizeof(nfapi_vnf_pnf_info_t));
NFAPI_TRACE(NFAPI_TRACE_INFO, "MALLOC nfapi_vnf_pnf_info_t for pnf_list pnf:%p\n", pnf);
memset(pnf, 0, sizeof(nfapi_vnf_pnf_info_t));
pnf->p5_idx = 1;
pnf->connected = 1;
// Add needed parameters
vnf_info *vnf = (vnf_info *)(config->user_data);
pnf_info *pnf_info = vnf->pnfs;
for (int i = 0; i < 1; ++i) {
phy_info phy;
memset(&phy, 0, sizeof(phy));
phy.index = 0;
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] (PHY:%d) phy_config_idx:%d\n", i, 0);
nfapi_vnf_allocate_phy(config, 1, &(phy.id));
for (int j = 0; j < 1; ++j) {
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] (PHY:%d) (RF%d) %d\n", i, j, 0);
phy.rfs[0] = 0;
}
pnf_info->phys[0] = phy;
}
nfapi_vnf_pnf_list_add(config, pnf);
vnf_p7_info *p7_vnf = vnf->p7_vnfs;
NFAPI_TRACE(NFAPI_TRACE_INFO,
"[VNF] pnf start response idx:%d config:%p user_data:%p p7_vnf[config:%p thread_started:%d]\n",
1,
config,
config->user_data,
vnf->p7_vnfs[0].config,
vnf->p7_vnfs[0].thread_started);
configure_nr_p7_vnf(p7_vnf);
#endif
}
@@ -1912,7 +1905,7 @@ void configure_nfapi_vnf(char *vnf_addr, int vnf_p5_port, char *pnf_ip_addr, int
config->codec_config.deallocate = &vnf_deallocate;
memset(&UL_RCC_INFO,0,sizeof(UL_RCC_IND_t));
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Creating VNF NFAPI start thread %s\n", __FUNCTION__);
pthread_create(&vnf_start_pthread, NULL, (void *)&vnf_start_thread, config);
pthread_create(&vnf_p5_init_and_receive_pthread, NULL, (void *)&vnf_start_thread, config);
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Created VNF NFAPI start thread %s\n", __FUNCTION__);
}
@@ -1957,13 +1950,13 @@ int oai_nfapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req)
dl_config_req->header.message_id= NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST;
dl_config_req->header.phy_id = 1; // HACK TODO FIXME - need to pass this around!!!!
int retval = nfapi_vnf_p7_nr_dl_config_req(p7_config, dl_config_req);
bool retval = nfapi_vnf_p7_nr_dl_config_req(p7_config, dl_config_req);
dl_config_req->dl_tti_request_body.nPDUs = 0;
dl_config_req->dl_tti_request_body.nGroup = 0;
if (retval!=0) {
if (!retval) {
LOG_E(PHY, "%s() Problem sending retval:%d\n", __FUNCTION__, retval);
}
return retval;
@@ -1976,9 +1969,9 @@ int oai_nfapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req)
tx_data_req->header.phy_id = 1; // HACK TODO FIXME - need to pass this around!!!!
tx_data_req->header.message_id = NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST;
//LOG_D(PHY, "[VNF] %s() TX_REQ sfn_sf:%d number_of_pdus:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(tx_req->sfn_sf), tx_req->tx_request_body.number_of_pdus);
int retval = nfapi_vnf_p7_tx_data_req(p7_config, tx_data_req);
bool retval = nfapi_vnf_p7_tx_data_req(p7_config, tx_data_req);
if (retval!=0) {
if (!retval) {
LOG_E(PHY, "%s() Problem sending retval:%d\n", __FUNCTION__, retval);
} else {
tx_data_req->Number_of_PDUs = 0;
@@ -2009,9 +2002,9 @@ int oai_nfapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req) {
ul_dci_req->header.phy_id = 1; // HACK TODO FIXME - need to pass this around!!!!
ul_dci_req->header.message_id = NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST;
//LOG_D(PHY, "[VNF] %s() HI_DCI0_REQ sfn_sf:%d dci:%d hi:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(hi_dci0_req->sfn_sf), hi_dci0_req->hi_dci0_request_body.number_of_dci, hi_dci0_req->hi_dci0_request_body.number_of_hi);
int retval = nfapi_vnf_p7_ul_dci_req(p7_config, ul_dci_req);
bool retval = nfapi_vnf_p7_ul_dci_req(p7_config, ul_dci_req);
if (retval!=0) {
if (!retval) {
LOG_E(PHY, "%s() Problem sending retval:%d\n", __FUNCTION__, retval);
} else {
ul_dci_req->numPdus = 0;
@@ -2062,9 +2055,9 @@ int oai_nfapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req) {
ul_tti_req->header.phy_id = 1; // HACK TODO FIXME - need to pass this around!!!!
ul_tti_req->header.message_id = NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST;
int retval = nfapi_vnf_p7_ul_tti_req(p7_config, ul_tti_req);
bool retval = nfapi_vnf_p7_ul_tti_req(p7_config, ul_tti_req);
if (retval!=0) {
if (!retval) {
LOG_E(PHY, "%s() Problem sending retval:%d\n", __FUNCTION__, retval);
} else {
// Reset number of PDUs so that it is not resent

View File

@@ -21,8 +21,132 @@
#ifndef NFAPI_VNF_H_
#define NFAPI_VNF_H_
#include <common_lib.h>
#include "nfapi_vnf_interface.h"
typedef struct {
uint8_t enabled;
uint32_t rx_port;
uint32_t tx_port;
char tx_addr[80];
} udp_data;
typedef struct {
uint16_t index;
uint16_t id;
uint8_t rfs[2];
uint8_t excluded_rfs[2];
udp_data udp;
char local_addr[80];
int local_port;
char *remote_addr;
int remote_port;
uint8_t duplex_mode;
uint16_t dl_channel_bw_support;
uint16_t ul_channel_bw_support;
uint8_t num_dl_layers_supported;
uint8_t num_ul_layers_supported;
uint16_t release_supported;
uint8_t nmm_modes_supported;
uint8_t dl_ues_per_subframe;
uint8_t ul_ues_per_subframe;
uint8_t first_subframe_ind;
// timing information recevied from the vnf
uint8_t timing_window;
uint8_t timing_info_mode;
uint8_t timing_info_period;
} phy_info;
typedef struct {
uint16_t index;
uint16_t band;
int16_t max_transmit_power;
int16_t min_transmit_power;
uint8_t num_antennas_supported;
uint32_t min_downlink_frequency;
uint32_t max_downlink_frequency;
uint32_t max_uplink_frequency;
uint32_t min_uplink_frequency;
} rf_info;
typedef struct {
int release;
phy_info phys[2];
rf_info rfs[2];
uint8_t sync_mode;
uint8_t location_mode;
uint8_t location_coordinates[6];
uint32_t dl_config_timing;
uint32_t ul_config_timing;
uint32_t tx_timing;
uint32_t hi_dci0_timing;
uint16_t max_phys;
uint16_t max_total_bw;
uint16_t max_total_dl_layers;
uint16_t max_total_ul_layers;
uint8_t shared_bands;
uint8_t shared_pa;
int16_t max_total_power;
uint8_t oui;
uint8_t wireshark_test_mode;
} pnf_info;
typedef struct mac mac_t;
typedef struct mac {
void *user_data;
void (*dl_config_req)(mac_t *mac, nfapi_dl_config_request_t *req);
void (*ul_config_req)(mac_t *mac, nfapi_ul_config_request_t *req);
void (*hi_dci0_req)(mac_t *mac, nfapi_hi_dci0_request_t *req);
void (*tx_req)(mac_t *mac, nfapi_tx_request_t *req);
} mac_t;
typedef struct {
int local_port;
char local_addr[80];
unsigned timing_window;
unsigned periodic_timing_enabled;
unsigned aperiodic_timing_enabled;
unsigned periodic_timing_period;
// This is not really the right place if we have multiple PHY,
// should be part of the phy struct
udp_data udp;
uint8_t thread_started;
nfapi_vnf_p7_config_t *config;
mac_t *mac;
} vnf_p7_info;
typedef struct {
uint8_t wireshark_test_mode;
pnf_info pnfs[2];
vnf_p7_info p7_vnfs[2];
} vnf_info;
void configure_nfapi_vnf(char *vnf_addr, int vnf_p5_port, char *pnf_ip_addr, int pnf_p7_port, int vnf_p7_port);
void configure_nr_nfapi_vnf(char *vnf_addr, int vnf_p5_port, char *pnf_ip_addr, int pnf_p7_port, int vnf_p7_port);
void configure_nr_nfapi_vnf(eth_params_t params);
#endif /* NFAPI_VNF_H_ */

View File

@@ -0,0 +1,14 @@
add_library(nfapi_socket_lib
socket_pnf.c
socket_vnf.c
socket_common.c
)
target_include_directories(nfapi_socket_lib PRIVATE include/)
target_compile_definitions(nfapi_socket_lib PUBLIC ENABLE_SOCKET)
target_link_libraries(nfapi_socket_lib PRIVATE NFAPI_LIB NFAPI_USER_LIB)
target_link_libraries(nfapi_socket_lib PRIVATE LOG)
add_dependencies(nfapi_socket_lib generate_T)
target_link_libraries(nfapi_socket_lib PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs)
target_link_libraries(nfapi_socket_lib PRIVATE nr_fapi_p5 nr_fapi_p7)

View File

@@ -0,0 +1,45 @@
/*
* 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 SOCKET_COMMON_H
#define SOCKET_COMMON_H
#define _GNU_SOURCE /* required for pthread_getname_np */
#include <errno.h>
#include <stdbool.h>
#include <stdio.h>
#include <netinet/in.h>
#include <netinet/sctp.h>
#include <assertions.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <sys/socket.h>
#include <pthread.h>
#include <netdb.h>
int socket_send_p5_msg(const int sctp,
const int socket,
const void* remote_addr,
const void* msg,
const uint32_t len,
const uint16_t stream);
int socket_send_p7_msg(const int socket, const void* remote_addr, const void* msg, const uint32_t len);
#endif // SOCKET_COMMON_H

View File

@@ -0,0 +1,39 @@
/*
* 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 SOCKET_PNF_H
#define SOCKET_PNF_H
#include "socket_common.h"
#include <sys/time.h>
#include <arpa/inet.h>
#include <netdb.h>
#include "pnf.h"
#include "pnf_p7.h"
#include "nr_fapi_p5.h"
#include "nr_nfapi_p7.h"
int pnf_connect_socket(pnf_t *pnf);
int pnf_nr_message_pump(pnf_t *pnf);
bool pnf_nr_send_p5_message(pnf_t *pnf, nfapi_nr_p4_p5_message_header_t *msg, uint32_t msg_len);
bool pnf_nr_send_p7_message(pnf_p7_t* pnf_p7, nfapi_nr_p7_message_header_t* header, uint32_t msg_len);
void *pnf_start_p5_thread(void *ptr);
void *pnf_nr_p7_thread_start(void *ptr);
#endif // SOCKET_PNF_H

View File

@@ -19,9 +19,16 @@
* contact@openairinterface.org
*/
#ifndef F1AP_LIB_EXTERN_H_
#define F1AP_LIB_EXTERN_H_
#include "f1ap_rrc_message_transfer.h"
#endif /* F1AP_LIB_EXTERN_H_ */
#ifndef SOCKET_VNF_H
#define SOCKET_VNF_H
#include "socket_common.h"
#include "vnf.h"
#include "vnf_p7.h"
#include "nr_fapi_p5.h"
#include "nr_nfapi_p7.h"
#include "nr_fapi_p7.h"
bool vnf_nr_send_p5_msg(vnf_t *vnf, uint16_t p5_idx, nfapi_nr_p4_p5_message_header_t* msg, uint32_t msg_len);
bool vnf_nr_send_p7_msg(vnf_p7_t *vnf_p7, nfapi_nr_p7_message_header_t* header);
void vnf_start_p5_thread(void* ptr);
void* vnf_nr_start_p7_thread(void* ptr);
#endif // SOCKET_VNF_H

View File

@@ -0,0 +1,58 @@
/*
* 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 "socket_common.h"
#include "LOG/log.h"
int socket_send_p5_msg(const int sctp,
const int socket,
const void* remote_addr,
const void* msg,
const uint32_t len,
const uint16_t stream)
{
if (sctp == 1) {
struct sockaddr* to = (struct sockaddr*)remote_addr;
const int retval = sctp_sendmsg(socket, msg, len, to, 0, 42, 0, stream, 0, 0);
if (retval < 0) {
LOG_E(NR_PHY, "sctp_sendmsg failed errno: %d\n", errno);
return -1;
}
} else {
if (send(socket, msg, len, 0) != len) {
LOG_E(NR_PHY, "write failed errno: %d\n", errno);
return -1;
}
}
return len;
}
int socket_send_p7_msg(const int socket, const void* remote_addr, const void* msg, const uint32_t len)
{
const struct sockaddr* to = (struct sockaddr*)remote_addr;
const long sendto_result = sendto(socket, msg, len, 0, to, sizeof(struct sockaddr_in));
if (sendto_result != len) {
LOG_E(NR_PHY, "%s() sendto_result %ld %d\n", __FUNCTION__, sendto_result, errno);
return -1;
}
return 0;
}

View File

@@ -0,0 +1,867 @@
/*
* 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 "socket_pnf.h"
#include "nfapi.h"
bool pnf_nr_send_p5_message(pnf_t *pnf, nfapi_nr_p4_p5_message_header_t *msg, uint32_t msg_len)
{
int packed_len =
pnf->_public.pack_func(msg, msg_len, pnf->tx_message_buffer, sizeof(pnf->tx_message_buffer), &pnf->_public.codec_config);
if (packed_len < 0) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "p5_message_pack failed (%d)\n", packed_len);
return false;
}
return socket_send_p5_msg(pnf->sctp, pnf->p5_sock, NULL, pnf->tx_message_buffer, packed_len, 0) == packed_len;
}
static int send_p7_msg(pnf_p7_t *pnf_p7, uint8_t *msg, uint32_t len)
{
// todo : consider how to do this only once
struct sockaddr_in remote_addr = {.sin_family = AF_INET, .sin_port = htons(pnf_p7->_public.remote_p7_port)};
if (inet_aton(pnf_p7->_public.remote_p7_addr, &remote_addr.sin_addr) == -1) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "inet_aton failed %d\n", errno);
return -1;
}
socklen_t remote_addr_len = sizeof(struct sockaddr_in);
int sendto_result = socket_send_p7_msg((int)pnf_p7->p7_sock, &remote_addr, msg, len);
if (sendto_result < 0) {
NFAPI_TRACE(NFAPI_TRACE_ERROR,
"%s %s:%d sendto(%d, %p, %d) %d failed errno: %d\n",
__FUNCTION__,
pnf_p7->_public.remote_p7_addr,
pnf_p7->_public.remote_p7_port,
(int)pnf_p7->p7_sock,
(const char *)msg,
len,
remote_addr_len,
errno);
return -1;
}
if (sendto_result != 0) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s sendto failed to send the entire message %d %d\n", __FUNCTION__, sendto_result, len);
}
return 0;
}
bool pnf_nr_send_p7_message(pnf_p7_t *pnf_p7, nfapi_nr_p7_message_header_t *header, uint32_t msg_len)
{
header->m_segment_sequence = NFAPI_NR_P7_SET_MSS(0, 0, pnf_p7->sequence_number);
// Need to guard against different threads calling the encode function at the same time
if (pthread_mutex_lock(&(pnf_p7->pack_mutex)) != 0) {
NFAPI_TRACE(NFAPI_TRACE_INFO, "failed to lock mutex\n");
return false;
}
uint8_t tx_buf[131072]; // four times NFAPI_MAX_PACKED_MESSAGE_SIZE as of this commit
int len = pnf_p7->_public.pack_func(header, tx_buf, sizeof(tx_buf), &pnf_p7->_public.codec_config);
if (len < 0) {
if (pthread_mutex_unlock(&(pnf_p7->pack_mutex)) != 0) {
NFAPI_TRACE(NFAPI_TRACE_INFO, "failed to unlock mutex\n");
return false;
}
NFAPI_TRACE(NFAPI_TRACE_ERROR, "nfapi_p7_message_pack failed with return %d\n", len);
return false;
}
if (len > pnf_p7->_public.segment_size) {
int msg_body_len = len - NFAPI_NR_P7_HEADER_LENGTH;
int seg_body_len = pnf_p7->_public.segment_size - NFAPI_NR_P7_HEADER_LENGTH;
int segment_count = (msg_body_len / (seg_body_len)) + ((msg_body_len % seg_body_len) ? 1 : 0);
int segment = 0;
int offset = NFAPI_NR_P7_HEADER_LENGTH;
uint8_t buffer[pnf_p7->_public.segment_size];
for (segment = 0; segment < segment_count; ++segment) {
uint8_t last = 0;
uint32_t size = pnf_p7->_public.segment_size - NFAPI_NR_P7_HEADER_LENGTH;
if (segment + 1 == segment_count) {
last = 1;
size = (msg_body_len) - (seg_body_len * segment);
}
uint32_t segment_size = size + NFAPI_NR_P7_HEADER_LENGTH;
// Update the header with the m and segement
memcpy(&buffer[0], tx_buf, NFAPI_NR_P7_HEADER_LENGTH);
// set the segment length , update and push m_segment_sequence
uint8_t *buf_ptr = &buffer[4];
uint8_t *buf_ptr_end = &buffer[10];
push32(segment_size, (&buf_ptr), buf_ptr_end);
header->m_segment_sequence = NFAPI_NR_P7_SET_MSS((!last), segment, pnf_p7->sequence_number);
push16(header->m_segment_sequence, (&buf_ptr), buf_ptr_end);
memcpy(&buffer[NFAPI_NR_P7_HEADER_LENGTH], tx_buf + offset, size);
offset += size;
if (pnf_p7->_public.checksum_enabled) {
nfapi_nr_p7_update_checksum(buffer, segment_size);
}
send_p7_msg(pnf_p7, &buffer[0], segment_size);
}
} else {
if (pnf_p7->_public.checksum_enabled) {
nfapi_nr_p7_update_checksum(tx_buf, len);
}
// simple case that the message fits in a single segment
send_p7_msg(pnf_p7, tx_buf, len);
}
pnf_p7->sequence_number++;
if (pthread_mutex_unlock(&(pnf_p7->pack_mutex)) != 0) {
NFAPI_TRACE(NFAPI_TRACE_INFO, "failed to unlock mutex\n");
return false;
}
return true;
}
void *pnf_start_p5_thread(void *ptr)
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] IN PNF NFAPI start thread %s\n", __FUNCTION__);
nfapi_pnf_config_t *config = (nfapi_pnf_config_t *)ptr;
struct sched_param sp;
sp.sched_priority = 20;
pthread_setschedparam(pthread_self(), SCHED_FIFO, &sp);
// Verify that config is not null
if (config == 0)
return (void *)-1;
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
pnf_t *_this = (pnf_t *)(config);
while (_this->terminate == 0) {
int connect_result = pnf_connect_socket(_this);
if (connect_result > 0) {
pnf_nr_message_pump(_this);
} else if (connect_result < 0) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() Error connecting to P5 socket\n", __FUNCTION__);
return 0;
}
sleep(1);
}
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() terminate=1 - EXITTING............\n", __FUNCTION__);
return 0;
}
int pnf_connect_socket(pnf_t *pnf)
{
uint8_t socketConnected = 0;
if (pnf->_public.vnf_ip_addr == 0) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "vnfIpAddress is null\n");
return -1;
}
NFAPI_TRACE(NFAPI_TRACE_INFO, "Starting P5 PNF connection to VNF at %s:%u\n", pnf->_public.vnf_ip_addr, pnf->_public.vnf_p5_port);
// todo split the vnf address list. currently only supporting 1
struct addrinfo hints = {0}, *servinfo;
hints.ai_socktype = SOCK_STREAM; // For SCTP we are only interested in SOCK_STREAM
// todo : allow the client to restrict IPV4 or IPV6
// todo : randomize which address to connect to?
char port_str[8];
snprintf(port_str, sizeof(port_str), "%d", pnf->_public.vnf_p5_port);
if (getaddrinfo(pnf->_public.vnf_ip_addr, port_str, &hints, &servinfo) != 0) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "Failed to get host (%s) addr info h_errno:%d \n", pnf->_public.vnf_ip_addr, h_errno);
return -1;
}
struct addrinfo *p = servinfo;
int connected = 0;
while (p != NULL && connected == 0) {
#ifdef NFAPI_TRACE_ENABLED
char *family = "Unknown";
char *address = "Unknown";
char _addr[128];
if (p->ai_family == AF_INET6) {
family = "IPV6";
struct sockaddr_in6 *addr = (struct sockaddr_in6 *)p->ai_addr;
inet_ntop(AF_INET6, &addr->sin6_addr, _addr, sizeof(_addr));
address = &_addr[0];
} else if (p->ai_family == AF_INET) {
family = "IPV4";
struct sockaddr_in *addr = (struct sockaddr_in *)p->ai_addr;
address = inet_ntoa(addr->sin_addr);
}
NFAPI_TRACE(NFAPI_TRACE_NOTE, "Host address info %d Family:%s Address:%s\n", i++, family, address);
#endif
if (pnf->sctp) {
// open the SCTP socket
if ((pnf->p5_sock = socket(p->ai_family, SOCK_STREAM, IPPROTO_SCTP)) < 0) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After P5 socket errno: %d\n", errno);
freeaddrinfo(servinfo);
return -1;
}
int noDelay;
struct sctp_initmsg initMsg = {0};
// configure the socket options
NFAPI_TRACE(NFAPI_TRACE_NOTE, "PNF Setting the SCTP_INITMSG\n");
initMsg.sinit_num_ostreams = 5; // MAX_SCTP_STREAMS; // number of output streams can be greater
initMsg.sinit_max_instreams = 5; // MAX_SCTP_STREAMS; // number of output streams can be greater
if (setsockopt(pnf->p5_sock, IPPROTO_SCTP, SCTP_INITMSG, &initMsg, sizeof(initMsg)) < 0) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After setsockopt errno: %d\n", errno);
freeaddrinfo(servinfo);
return -1;
}
noDelay = 1;
if (setsockopt(pnf->p5_sock, IPPROTO_SCTP, SCTP_NODELAY, &noDelay, sizeof(noDelay)) < 0) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After setsockopt errno: %d\n", errno);
freeaddrinfo(servinfo);
return -1;
}
struct sctp_event_subscribe events = {0};
events.sctp_data_io_event = 1;
if (setsockopt(pnf->p5_sock, SOL_SCTP, SCTP_EVENTS, (const void *)&events, sizeof(events)) < 0) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After setsockopt errno: %d\n", errno);
freeaddrinfo(servinfo);
return -1;
}
} else {
// Create an IP socket point
if ((pnf->p5_sock = socket(p->ai_family, SOCK_STREAM, IPPROTO_IP)) < 0) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After P5 socket errno: %d\n", errno);
freeaddrinfo(servinfo);
return -1;
}
}
NFAPI_TRACE(NFAPI_TRACE_INFO, "P5 socket created...\n");
if (connect(pnf->p5_sock, p->ai_addr, p->ai_addrlen) < 0) {
NFAPI_TRACE(NFAPI_TRACE_ERROR,
"After connect (address:%s port:%d) errno: %d\n",
pnf->_public.vnf_ip_addr,
pnf->_public.vnf_p5_port,
errno);
if (errno == EINVAL) {
freeaddrinfo(servinfo);
return -1;
}
if (pnf->terminate != 0) {
freeaddrinfo(servinfo);
return 0;
}
close(pnf->p5_sock);
sleep(1);
} else {
NFAPI_TRACE(NFAPI_TRACE_INFO, "connect succeeded...\n");
connected = 1;
}
p = p->ai_next;
}
freeaddrinfo(servinfo);
// If we have failed to connect return 0 and it is retry
if (connected == 0)
return 0;
NFAPI_TRACE(NFAPI_TRACE_NOTE, "After connect loop\n");
if (pnf->sctp) {
socklen_t optLen;
struct sctp_status status = {0};
// check the connection status
optLen = (socklen_t)sizeof(struct sctp_status);
if (getsockopt(pnf->p5_sock, IPPROTO_SCTP, SCTP_STATUS, &status, &optLen) < 0) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After getsockopt errno: %d\n", errno);
return -1;
} else {
NFAPI_TRACE(NFAPI_TRACE_INFO, "Association ID = %d\n", status.sstat_assoc_id);
NFAPI_TRACE(NFAPI_TRACE_INFO, "Receiver window size = %d\n", status.sstat_rwnd);
NFAPI_TRACE(NFAPI_TRACE_INFO, "In Streams = %d\n", status.sstat_instrms);
NFAPI_TRACE(NFAPI_TRACE_INFO, "Out Streams = %d\n", status.sstat_outstrms);
socketConnected = 1;
}
} else {
int error;
socklen_t len = sizeof(error);
if (getsockopt(pnf->p5_sock, SOL_SOCKET, SO_ERROR, &error, &len) < 0) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After getsockopt errno: %d\n", errno);
return -1;
} else {
// If error is zero, the socket is connected
if (error == 0) {
socketConnected = 1;
}
}
}
NFAPI_TRACE(NFAPI_TRACE_NOTE, "Socket %s\n", socketConnected ? "CONNECTED" : "NOT_CONNECTED");
return socketConnected;
}
static int pnf_nr_read_dispatch_message(pnf_t *pnf)
{
int socket_connected = 1;
// 1. Peek the message header
// 2. If the message is larger than the stack buffer, then create a dynamic buffer
// 3. Read the buffer
// 4. Handle the p5 message
uint32_t header_buffer_size = NFAPI_NR_P5_HEADER_LENGTH;
uint8_t header_buffer[header_buffer_size];
uint32_t stack_buffer_size = 32; // should it be the size of then sctp_notificatoin structure
uint8_t stack_buffer[stack_buffer_size];
uint8_t *dynamic_buffer = 0;
uint8_t *read_buffer = &stack_buffer[0];
uint32_t message_size = 0;
struct sockaddr_in addr;
socklen_t addr_len = sizeof(addr);
struct sctp_sndrcvinfo sndrcvinfo = {0};
{
int flags = MSG_PEEK;
if (pnf->sctp) {
message_size = sctp_recvmsg(pnf->p5_sock,
header_buffer,
header_buffer_size,
/*(struct sockaddr*)&addr, &addr_len*/
0,
0,
&sndrcvinfo,
&flags);
} else {
message_size = recv(pnf->p5_sock, header_buffer, header_buffer_size, flags);
}
if (message_size < NFAPI_NR_P5_HEADER_LENGTH) {
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF Failed to peek sctp message size errno:%d\n", errno);
return 0;
}
nfapi_nr_p4_p5_message_header_t header;
const bool result = pnf->_public.hdr_unpack_func(header_buffer, header_buffer_size, &header, sizeof(header), 0);
if (!result) {
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF Failed to unpack p5 message header\n");
return 0;
}
message_size = header.message_length + header_buffer_size;
// now have the size of the mesage
}
if (message_size > stack_buffer_size) {
dynamic_buffer = (uint8_t *)malloc(message_size);
if (dynamic_buffer == NULL) {
// todo : add error mesage
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF Failed to allocate dynamic buffer for sctp_recvmsg size:%d\n", message_size);
return -1;
}
read_buffer = dynamic_buffer;
}
{
int flags = 0;
ssize_t recvmsg_result = 0;
if (pnf->sctp) {
recvmsg_result =
sctp_recvmsg(pnf->p5_sock, read_buffer, message_size, (struct sockaddr *)&addr, &addr_len, &sndrcvinfo, &flags);
} else {
if ((recvmsg_result = recv(pnf->p5_sock, read_buffer, message_size, flags)) <= 0) {
recvmsg_result = -1;
}
}
if (recvmsg_result == -1) {
int tmp = errno;
NFAPI_TRACE(NFAPI_TRACE_INFO, "Failed to read sctp message size error %s errno:%d\n", strerror(tmp), tmp);
} else {
#if 0
// print the received message
printf("\n MESSAGE RECEIVED: \n");
for(int i=0; i<message_size; i++){
printf("read_buffer[%d] = 0x%02x\n",i, read_buffer[i]);
}
printf("\n");
#endif
if (flags & MSG_NOTIFICATION) {
NFAPI_TRACE(NFAPI_TRACE_INFO, "Notification received from %s:%u\n", inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
// todo - handle the events
} else {
/*
NFAPI_TRACE(NFAPI_TRACE_INFO, "Received message fd:%d from %s:%u assoc:%d on stream %d, PPID %d, length %d, flags 0x%x\n",
pnf->p5_sock,
inet_ntoa(addr.sin_addr),
ntohs(addr.sin_port),
sndrcvinfo.sinfo_assoc_id,
sndrcvinfo.sinfo_stream,
ntohl(sndrcvinfo.sinfo_ppid),
message_size,
flags);
*/
// handle now if complete message in one or more segments
if ((flags & 0x80) == 0x80 || !pnf->sctp) {
pnf_nr_handle_p5_message(pnf, read_buffer, message_size);
} else {
int tmp = errno;
NFAPI_TRACE(NFAPI_TRACE_WARN,
"sctp_recvmsg: unhandled mode with flags 0x%x and error %s errno:%d\n",
flags,
strerror(tmp),
tmp);
// assume socket disconnected
NFAPI_TRACE(NFAPI_TRACE_WARN, "Disconnected socket\n");
socket_connected = 0;
}
}
}
}
if (dynamic_buffer) {
free(dynamic_buffer);
}
return socket_connected;
}
int pnf_nr_message_pump(pnf_t *pnf)
{
uint8_t socketConnected = 1;
while (socketConnected && pnf->terminate == 0) {
fd_set rfds;
int selectRetval = 0;
// select on a timeout and then get the message
FD_ZERO(&rfds);
FD_SET(pnf->p5_sock, &rfds);
struct timeval timeout;
timeout.tv_sec = 1;
timeout.tv_usec = 0;
selectRetval = select(pnf->p5_sock + 1, &rfds, NULL, NULL, &timeout);
if (selectRetval == 0) {
// timeout
continue;
} else if (selectRetval == -1 && (errno == EINTR)) {
// interrupted by signal
NFAPI_TRACE(NFAPI_TRACE_WARN, "P5 Signal Interrupt %d\n", errno);
continue;
} else if (selectRetval == -1) {
NFAPI_TRACE(NFAPI_TRACE_WARN, "P5 select() failed\n");
sleep(1);
continue;
}
if (FD_ISSET(pnf->p5_sock, &rfds)) {
socketConnected = pnf_nr_read_dispatch_message(pnf);
} else {
NFAPI_TRACE(NFAPI_TRACE_WARN, "Why are we here\n");
}
}
// Drop back to idle if we have lost connection
pnf->_public.state = NFAPI_PNF_IDLE;
// close the connection and socket
if (close(pnf->p5_sock) < 0) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "close(sctpSock) failed errno: %d\n", errno);
}
return 0;
}
static void pnf_nr_reassemble_nfapi_p7_message(void *pRecvMsg, int recvMsgLen, pnf_p7_t *pnf_p7, uint32_t rx_hr_time)
{
nfapi_nr_p7_message_header_t messageHeader;
// validate the input params
if (pRecvMsg == NULL || recvMsgLen < 4 || pnf_p7 == NULL) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "pnf_handle_p7_message: invalid input params (%p %d %p)\n", pRecvMsg, recvMsgLen, pnf_p7);
return;
}
// unpack the message header
const bool result =
pnf_p7->_public.hdr_unpack_func(pRecvMsg, recvMsgLen, &messageHeader, sizeof(messageHeader), &pnf_p7->_public.codec_config);
if (!result) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "Unpack message header failed, ignoring\n");
return;
}
uint8_t m = NFAPI_P7_GET_MORE(messageHeader.m_segment_sequence);
uint8_t sequence_num = NFAPI_P7_GET_SEQUENCE(messageHeader.m_segment_sequence);
uint8_t segment_num = NFAPI_P7_GET_SEGMENT(messageHeader.m_segment_sequence);
if (pnf_p7->_public.checksum_enabled) {
uint32_t checksum = nfapi_nr_p7_calculate_checksum(pRecvMsg, recvMsgLen);
if (checksum != messageHeader.checksum) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "Checksum verification failed %d %d\n", checksum, messageHeader.checksum);
return;
}
}
if (m == 0 && segment_num == 0) {
// we have a complete message
// ensure the message is sensible
if (recvMsgLen < 8 || pRecvMsg == NULL) {
NFAPI_TRACE(NFAPI_TRACE_WARN, "Invalid message size: %d, ignoring\n", recvMsgLen);
return;
}
pnf_nr_handle_p7_message(pRecvMsg, recvMsgLen, pnf_p7, rx_hr_time);
} else {
pnf_p7_rx_message_t *rx_msg = pnf_p7_rx_reassembly_queue_add_segment(pnf_p7,
&(pnf_p7->reassembly_queue),
rx_hr_time,
sequence_num,
segment_num,
m,
pRecvMsg,
recvMsgLen);
if (rx_msg->num_segments_received == rx_msg->num_segments_expected) {
// send the buffer on
uint16_t i = 0;
uint32_t length = 0;
for (i = 0; i < rx_msg->num_segments_expected; ++i) {
length += rx_msg->segments[i].length - (i > 0 ? NFAPI_NR_P7_HEADER_LENGTH : 0);
}
if (pnf_p7->reassemby_buffer_size < length) {
pnf_p7_free(pnf_p7, pnf_p7->reassemby_buffer);
pnf_p7->reassemby_buffer = 0;
}
if (pnf_p7->reassemby_buffer == 0) {
NFAPI_TRACE(NFAPI_TRACE_NOTE, "Resizing PNF_P7 Reassembly buffer %d->%d\n", pnf_p7->reassemby_buffer_size, length);
pnf_p7->reassemby_buffer = (uint8_t *)pnf_p7_malloc(pnf_p7, length);
if (pnf_p7->reassemby_buffer == 0) {
NFAPI_TRACE(NFAPI_TRACE_NOTE, "Failed to allocate PNF_P7 reassemby buffer len:%d\n", length);
return;
}
memset(pnf_p7->reassemby_buffer, 0, length);
pnf_p7->reassemby_buffer_size = length;
}
uint32_t offset = 0;
for (i = 0; i < rx_msg->num_segments_expected; ++i) {
if (i == 0) {
memcpy(pnf_p7->reassemby_buffer, rx_msg->segments[i].buffer, rx_msg->segments[i].length);
offset += rx_msg->segments[i].length;
} else {
memcpy(pnf_p7->reassemby_buffer + offset,
rx_msg->segments[i].buffer + NFAPI_NR_P7_HEADER_LENGTH,
rx_msg->segments[i].length - NFAPI_NR_P7_HEADER_LENGTH);
offset += rx_msg->segments[i].length - NFAPI_NR_P7_HEADER_LENGTH;
}
}
pnf_nr_handle_p7_message(pnf_p7->reassemby_buffer, length, pnf_p7, rx_msg->rx_hr_time);
// delete the structure
pnf_p7_rx_reassembly_queue_remove_msg(pnf_p7, &(pnf_p7->reassembly_queue), rx_msg);
}
}
// The timeout used to be 1000, i.e., 1ms, which is too short. The below 10ms
// is selected to be able to encompass any "reasonable" slot ahead time for the VNF.
// Ideally, we would remove old msg (segments) if we detect packet loss
// (e.g., if the sequence numbers advances sufficiently); in the branch of
// this commit, our goal is to make the PNF work, so we content ourselves to
// just remove very old messages.
pnf_p7_rx_reassembly_queue_remove_old_msgs(pnf_p7, &(pnf_p7->reassembly_queue), rx_hr_time, 10000);
}
static void pnf_nr_nfapi_p7_read_dispatch_message(pnf_p7_t *pnf_p7, uint32_t now_hr_time)
{
int recvfrom_result = 0;
struct sockaddr_in remote_addr;
socklen_t remote_addr_size = sizeof(remote_addr);
remote_addr.sin_family = 2; // hardcoded
do {
// peek the header
uint8_t header_buffer[NFAPI_NR_P7_HEADER_LENGTH];
recvfrom_result = recvfrom(pnf_p7->p7_sock,
header_buffer,
NFAPI_NR_P7_HEADER_LENGTH,
MSG_DONTWAIT | MSG_PEEK,
(struct sockaddr *)&remote_addr,
&remote_addr_size);
if (recvfrom_result > 0) {
// get the segment size
nfapi_nr_p7_message_header_t header;
pnf_p7->_public.hdr_unpack_func(header_buffer, NFAPI_NR_P7_HEADER_LENGTH, &header, 34, 0);
// resize the buffer if we have a large segment
if (header.message_length > pnf_p7->rx_message_buffer_size) {
NFAPI_TRACE(NFAPI_TRACE_NOTE, "reallocing rx buffer %d\n", header.message_length);
pnf_p7->rx_message_buffer = realloc(pnf_p7->rx_message_buffer, header.message_length);
pnf_p7->rx_message_buffer_size = header.message_length;
}
// read the segment
recvfrom_result = recvfrom(pnf_p7->p7_sock,
pnf_p7->rx_message_buffer,
header.message_length,
MSG_DONTWAIT,
(struct sockaddr *)&remote_addr,
&remote_addr_size);
now_hr_time = pnf_get_current_time_hr(); // moved to here - get closer timestamp???
if (recvfrom_result > 0) {
pnf_nr_reassemble_nfapi_p7_message(pnf_p7->rx_message_buffer, recvfrom_result, pnf_p7, now_hr_time);
// printf("\npnf_handle_p7_message sfn=%d,slot=%d\n",pnf_p7->sfn,pnf_p7->slot);
}
} else if (recvfrom_result == 0) {
// recv zero length message
recvfrom_result =
recvfrom(pnf_p7->p7_sock, header_buffer, 0, MSG_DONTWAIT, (struct sockaddr *)&remote_addr, &remote_addr_size);
}
if (recvfrom_result == -1) {
if (errno == EAGAIN || errno == EWOULDBLOCK) {
// return to the select
// NFAPI_TRACE(NFAPI_TRACE_WARN, "%s recvfrom would block :%d\n", __FUNCTION__, errno);
} else {
NFAPI_TRACE(NFAPI_TRACE_WARN, "%s recvfrom failed errno:%d\n", __FUNCTION__, errno);
}
}
// need to update the time as we would only use the value from the
// select
} while (recvfrom_result > 0);
}
int pnf_nr_p7_message_pump(pnf_p7_t *pnf_p7)
{
// initialize the mutex lock
if (pthread_mutex_init(&(pnf_p7->mutex), NULL) != 0) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After P7 mutex init: %d\n", errno);
return -1;
}
if (pthread_mutex_init(&(pnf_p7->pack_mutex), NULL) != 0) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After P7 mutex init: %d\n", errno);
return -1;
}
// create the pnf p7 socket
if ((pnf_p7->p7_sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After P7 socket errno: %d\n", errno);
return -1;
}
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF P7 socket created (%d)...\n", pnf_p7->p7_sock);
// configure the UDP socket options
int reuseaddr_enable = 1;
if (setsockopt(pnf_p7->p7_sock, SOL_SOCKET, SO_REUSEADDR, &reuseaddr_enable, sizeof(int)) < 0) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "PNF P7 setsockopt (SOL_SOCKET, SO_REUSEADDR) failed errno: %d\n", errno);
return -1;
}
/*
int reuseport_enable = 1;
if (setsockopt(pnf_p7->p7_sock, SOL_SOCKET, SO_REUSEPORT, &reuseport_enable, sizeof(int)) < 0)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "PNF P7 setsockopt (SOL_SOCKET, SO_REUSEPORT) failed errno: %d\n", errno);
return -1;
}
*/
int iptos_value = 0;
if (setsockopt(pnf_p7->p7_sock, IPPROTO_IP, IP_TOS, &iptos_value, sizeof(iptos_value)) < 0) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "PNF P7 setsockopt (IPPROTO_IP, IP_TOS) failed errno: %d\n", errno);
return -1;
}
struct sockaddr_in addr = {0};
addr.sin_family = AF_INET;
addr.sin_port = htons(pnf_p7->_public.local_p7_port);
if (pnf_p7->_public.local_p7_addr == 0) {
addr.sin_addr.s_addr = INADDR_ANY;
} else {
// addr.sin_addr.s_addr = inet_addr(pnf_p7->_public.local_p7_addr);
if (inet_aton(pnf_p7->_public.local_p7_addr, &addr.sin_addr) == -1) {
NFAPI_TRACE(NFAPI_TRACE_INFO, "inet_aton failed\n");
}
}
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF P7 binding %d too %s:%d\n", pnf_p7->p7_sock, inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
if (bind(pnf_p7->p7_sock, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "PNF_P7 bind error fd:%d errno: %d\n", pnf_p7->p7_sock, errno);
return -1;
}
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF P7 bind succeeded...\n");
// Initializaing timing structures needed for slot ticking
struct timespec slot_start;
clock_gettime(CLOCK_MONOTONIC, &slot_start);
struct timespec pselect_start;
struct timespec slot_duration;
slot_duration.tv_sec = 0;
slot_duration.tv_nsec = 0.5e6;
// Infinite loop
while (pnf_p7->terminate == 0) {
fd_set rfds;
int selectRetval = 0;
// select on a timeout and then get the message
FD_ZERO(&rfds);
FD_SET(pnf_p7->p7_sock, &rfds);
struct timespec timeout;
timeout.tv_sec = 100;
timeout.tv_nsec = 0;
clock_gettime(CLOCK_MONOTONIC, &pselect_start);
// setting the timeout
if ((pselect_start.tv_sec > slot_start.tv_sec)
|| ((pselect_start.tv_sec == slot_start.tv_sec) && (pselect_start.tv_nsec > slot_start.tv_nsec))) {
// overran the end of the subframe we do not want to wait
timeout.tv_sec = 0;
timeout.tv_nsec = 0;
// struct timespec overrun = pnf_timespec_sub(pselect_start, sf_start);
// NFAPI_TRACE(NFAPI_TRACE_INFO, "Subframe overrun detected of %d.%d running to catchup\n", overrun.tv_sec, overrun.tv_nsec);
} else {
// still time before the end of the subframe wait
timeout = pnf_timespec_sub(slot_start, pselect_start);
}
selectRetval = pselect(pnf_p7->p7_sock + 1, &rfds, NULL, NULL, &timeout, NULL);
uint32_t now_hr_time = pnf_get_current_time_hr();
if (selectRetval == 0) {
// timeout
// update slot start timing
slot_start = pnf_timespec_add(slot_start, slot_duration);
// increment sfn/slot
if (++pnf_p7->slot == 20) {
pnf_p7->slot = 0;
pnf_p7->sfn = (pnf_p7->sfn + 1) % 1024;
}
continue;
} else if (selectRetval == -1 && (errno == EINTR)) {
// interrupted by signal
NFAPI_TRACE(NFAPI_TRACE_WARN, "PNF P7 Signal Interrupt %d\n", errno);
continue;
} else if (selectRetval == -1) {
NFAPI_TRACE(NFAPI_TRACE_WARN, "PNF P7 select() failed\n");
sleep(1);
continue;
}
if (FD_ISSET(pnf_p7->p7_sock, &rfds))
{
pnf_nr_nfapi_p7_read_dispatch_message(pnf_p7, now_hr_time);
}
}
NFAPI_TRACE(NFAPI_TRACE_ERROR, "PNF_P7 Terminating..\n");
// close the connection and socket
if (close(pnf_p7->p7_sock) < 0) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "close failed errno: %d\n", errno);
}
if (pthread_mutex_destroy(&(pnf_p7->pack_mutex)) != 0) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "mutex destroy failed errno: %d\n", errno);
}
if (pthread_mutex_destroy(&(pnf_p7->mutex)) != 0) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "mutex destroy failed errno: %d\n", errno);
}
return 0;
}
static int nfapi_nr_pnf_p7_start(nfapi_pnf_p7_config_t *config)
{
// Verify that config is not null
if (config == 0)
return -1;
pnf_p7_t *_this = (pnf_p7_t *)(config);
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
pnf_nr_p7_message_pump(_this);
return 0;
}
void *pnf_nr_p7_thread_start(void *ptr)
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "[NR_PNF] NR P7 THREAD %s\n", __FUNCTION__);
nfapi_pnf_p7_config_t *config = (nfapi_pnf_p7_config_t *)ptr;
nfapi_nr_pnf_p7_start(config);
return 0;
}

View File

@@ -0,0 +1,847 @@
/*
* 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 "socket_vnf.h"
#include "nfapi.h"
#include "nfapi/oai_integration/vendor_ext.h" //TODO: Remove this include when removing the Aerial transport stuff
static bool send_p5_msg(vnf_t *vnf, nfapi_vnf_pnf_info_t *pnf, const void *msg, int len, uint8_t stream)
{
int result = socket_send_p5_msg(vnf->sctp, pnf->p5_sock, &pnf->p5_pnf_sockaddr, msg, len, stream);
if (result != len) {
if (result < 0) {
// error
NFAPI_TRACE(NFAPI_TRACE_ERROR, "sctp sendto failed errno: %d\n", errno);
} else {
// did not send the entire message
}
}
return result == len;
}
bool vnf_nr_send_p5_msg(vnf_t *vnf, uint16_t p5_idx, nfapi_nr_p4_p5_message_header_t *msg, uint32_t msg_len)
{
nfapi_vnf_pnf_info_t *pnf = nfapi_vnf_pnf_list_find(&(vnf->_public), p5_idx);
if (pnf) {
// pack the message for transmission
int packedMessageLength = 0;
packedMessageLength =
vnf->_public.pack_func(msg, msg_len, vnf->tx_message_buffer, sizeof(vnf->tx_message_buffer), &vnf->_public.codec_config);
if (packedMessageLength < 0) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "nfapi_nr_p5_message_pack failed with return %d\n", packedMessageLength);
return false;
}
return send_p5_msg(vnf, pnf, vnf->tx_message_buffer, packedMessageLength, 0);
} else {
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() cannot find pnf info for p5_idx:%d\n", __FUNCTION__, p5_idx);
return false;
}
}
bool vnf_nr_send_p7_msg(vnf_p7_t *vnf_p7, nfapi_nr_p7_message_header_t *header)
{
nfapi_vnf_p7_connection_info_t *p7_connection = vnf_p7_connection_info_list_find(vnf_p7, header->phy_id);
if (p7_connection) {
int send_result = 0;
uint8_t buffer[1024 * 1024 * 3];
header->m_segment_sequence = NFAPI_NR_P7_SET_MSS(0, 0, p7_connection->sequence_number);
int len = vnf_p7->_public.pack_func(header, buffer, sizeof(buffer), &vnf_p7->_public.codec_config);
if (len < 0) {
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() failed to pack p7 message phy_id:%d\n", __FUNCTION__, header->phy_id);
return false;
}
if (len > vnf_p7->_public.segment_size) {
// todo : consider replacing with the sendmmsg call
// todo : worry about blocking writes?
// segmenting the transmit
int msg_body_len = len - NFAPI_NR_P7_HEADER_LENGTH;
int seg_body_len = vnf_p7->_public.segment_size - NFAPI_NR_P7_HEADER_LENGTH;
int segment_count = (msg_body_len / (seg_body_len)) + ((msg_body_len % seg_body_len) ? 1 : 0);
int segment = 0;
int offset = NFAPI_NR_P7_HEADER_LENGTH;
uint8_t tx_buffer[vnf_p7->_public.segment_size];
NFAPI_TRACE(NFAPI_TRACE_DEBUG,
"%s() MORE THAN ONE SEGMENT phy_id:%d nfapi_p7_message_pack()=len=%d vnf_p7->_public.segment_size:%u\n",
__FUNCTION__,
header->phy_id,
len,
vnf_p7->_public.segment_size);
for (segment = 0; segment < segment_count; ++segment) {
uint8_t last = 0;
uint16_t size = vnf_p7->_public.segment_size - NFAPI_NR_P7_HEADER_LENGTH;
if (segment + 1 == segment_count) {
last = 1;
size = (msg_body_len) - (seg_body_len * segment);
}
uint32_t segment_size = size + NFAPI_NR_P7_HEADER_LENGTH;
// Update the header with the m and segement
memcpy(&tx_buffer[0], buffer, NFAPI_NR_P7_HEADER_LENGTH);
// set the segment length, update and push m_segment_sequence
uint8_t *buf_ptr = &tx_buffer[4];
uint8_t *buf_ptr_end = &tx_buffer[10];
push32(segment_size, (&buf_ptr), buf_ptr_end);
header->m_segment_sequence = NFAPI_NR_P7_SET_MSS((!last), segment, p7_connection->sequence_number);
push16(header->m_segment_sequence, (&buf_ptr), buf_ptr_end);
memcpy(&tx_buffer[NFAPI_NR_P7_HEADER_LENGTH], &buffer[0] + offset, size);
offset += size;
if (vnf_p7->_public.checksum_enabled) {
nfapi_nr_p7_update_checksum(tx_buffer, segment_size);
}
const uint32_t time =
calculate_transmit_timestamp(p7_connection->mu, p7_connection->sfn, p7_connection->slot, vnf_p7->slot_start_time_hr);
nfapi_nr_p7_update_transmit_timestamp(tx_buffer, time);
send_result = socket_send_p7_msg(vnf_p7->socket, &(p7_connection->remote_addr), &tx_buffer[0], segment_size);
}
} else {
if (vnf_p7->_public.checksum_enabled) {
nfapi_nr_p7_update_checksum(buffer, len);
}
const uint32_t time =
calculate_transmit_timestamp(p7_connection->mu, p7_connection->sfn, p7_connection->slot, vnf_p7->slot_start_time_hr);
nfapi_nr_p7_update_transmit_timestamp(buffer, time);
send_result = socket_send_p7_msg(vnf_p7->socket, &(p7_connection->remote_addr), &buffer[0], len);
}
p7_connection->sequence_number++;
return send_result == 0;
} else {
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() cannot find p7 connection info for phy_id:%d\n", __FUNCTION__, header->phy_id);
return false;
}
}
static int vnf_nr_read_dispatch_message(nfapi_vnf_config_t *config, nfapi_vnf_pnf_info_t *pnf)
{
if (1) {
int socket_connected = 1;
vnf_t *vnf = (vnf_t *)(config);
// 1. Peek the message header
// 2. If the message is larger than the stack buffer then create a dynamic buffer
// 3. Read the buffer
// 4. Handle the p5 message
uint32_t header_buffer_size = NFAPI_NR_P5_HEADER_LENGTH;
uint8_t header_buffer[header_buffer_size];
uint32_t stack_buffer_size = 32; // should it be the size of then sctp_notificatoin structure
uint8_t stack_buffer[stack_buffer_size];
uint8_t *dynamic_buffer = 0;
uint8_t *read_buffer = &stack_buffer[0];
uint32_t message_size = 0;
struct sockaddr_in addr;
socklen_t addr_len = sizeof(addr);
struct sctp_sndrcvinfo sndrcvinfo;
(void)memset(&sndrcvinfo, 0, sizeof(struct sctp_sndrcvinfo));
{
int flags = MSG_PEEK;
if (vnf->sctp) {
message_size =
sctp_recvmsg(pnf->p5_sock, header_buffer, header_buffer_size, (struct sockaddr *)&addr, &addr_len, &sndrcvinfo, &flags);
} else {
message_size = recv(pnf->p5_sock, header_buffer, header_buffer_size, flags);
}
if (message_size == -1) {
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF Failed to peek sctp message size errno:%d\n", errno);
return 0;
}
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF Peeked message with length :0x%02x\n", message_size);
for (int i = 0; i < message_size; i++) {
printf("%02x ", header_buffer[i]);
}
printf("\n");
nfapi_nr_p4_p5_message_header_t header;
const bool result = config->hdr_unpack_func(header_buffer, header_buffer_size, &header, sizeof(header), 0);
if (!result) {
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF Failed to decode message header\n");
return 0;
}
message_size = header.message_length + header_buffer_size;
// now have the size of the mesage
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF After header unpacking msg size is :0x%02x\n", message_size);
}
if (message_size > stack_buffer_size) {
dynamic_buffer = (uint8_t *)malloc(message_size);
if (dynamic_buffer == NULL) {
// todo : add error mesage
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF Failed to allocate dynamic buffer for sctp_recvmsg size:%d\n", message_size);
return -1;
}
read_buffer = dynamic_buffer;
}
{
int flags = 0;
(void)memset(&sndrcvinfo, 0, sizeof(struct sctp_sndrcvinfo));
ssize_t recvmsg_result = 0;
if (vnf->sctp) {
recvmsg_result =
sctp_recvmsg(pnf->p5_sock, read_buffer, message_size, (struct sockaddr *)&addr, &addr_len, &sndrcvinfo, &flags);
} else {
recvmsg_result = recv(pnf->p5_sock, read_buffer, message_size, 0);
}
if (recvmsg_result == -1) {
int tmp = errno;
NFAPI_TRACE(NFAPI_TRACE_INFO, "Failed to read sctp message size error %s errno:%d\n", strerror(tmp), tmp);
} else {
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF after recv flags are :0x%02x\n", flags);
if (flags & MSG_NOTIFICATION) {
NFAPI_TRACE(NFAPI_TRACE_INFO, "Notification received from %s:%u\n", inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
// todo - handle the events
} else {
NFAPI_TRACE(NFAPI_TRACE_INFO,
"Received message fd:%d from %s:%u assoc:%d on stream %d, PPID %d, length %d, flags 0x%x\n",
pnf->p5_sock,
inet_ntoa(addr.sin_addr),
ntohs(addr.sin_port),
sndrcvinfo.sinfo_assoc_id,
sndrcvinfo.sinfo_stream,
ntohl(sndrcvinfo.sinfo_ppid),
message_size,
flags);
// handle now if complete message in one or more segments
if ((flags & 0x80) == 0x80 || !vnf->sctp) {
vnf_nr_handle_p4_p5_message(read_buffer, message_size, pnf->p5_idx, config);
} else {
int tmp = errno;
NFAPI_TRACE(NFAPI_TRACE_WARN,
"sctp_recvmsg: unhandled mode with flags 0x%x and error %s errno:%d\n",
flags,
strerror(tmp),
tmp);
// assume socket disconnected
NFAPI_TRACE(NFAPI_TRACE_WARN, "Disconnected socket\n");
socket_connected = 0;
}
}
}
}
if (dynamic_buffer) {
free(dynamic_buffer);
}
return socket_connected;
}
}
static int nfapi_nr_vnf_p5_start(nfapi_vnf_config_t *config)
{
// Verify that config is not null
if (config == 0)
return -1;
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s()\n", __FUNCTION__);
int p5ListenSock, p5Sock;
struct sockaddr_in addr = {0};
socklen_t addrSize;
struct sockaddr_in6 addr6 = {0};
struct sctp_event_subscribe events = {0};
struct sctp_initmsg initMsg = {0};
int noDelay;
vnf_t *vnf = (vnf_t *)(config);
NFAPI_TRACE(NFAPI_TRACE_INFO, "Starting P5 VNF connection on port %u\n", config->vnf_p5_port);
{
int protocol;
int domain;
if (vnf->sctp)
protocol = IPPROTO_SCTP;
else
protocol = IPPROTO_IP;
if (config->vnf_ipv6) {
domain = PF_INET6;
} else {
domain = AF_INET;
}
// open the SCTP socket
if ((p5ListenSock = socket(domain, SOCK_STREAM, protocol)) < 0) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After P5 socket errno: %d\n", errno);
return 0;
}
NFAPI_TRACE(NFAPI_TRACE_INFO, "P5 socket created... %d\n", p5ListenSock);
}
if (vnf->sctp) {
// configure for MSG_NOTIFICATION
if (setsockopt(p5ListenSock, IPPROTO_SCTP, SCTP_EVENTS, &events, sizeof(struct sctp_event_subscribe)) < 0) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After setsockopt (SCTP_EVENTS) errno: %d\n", errno);
close(p5ListenSock);
return 0;
}
NFAPI_TRACE(NFAPI_TRACE_NOTE, "VNF Setting the SCTP_INITMSG\n");
// configure the SCTP socket options
initMsg.sinit_num_ostreams = 5; // MAX_SCTP_STREAMS; // number of output streams can be greater
initMsg.sinit_max_instreams = 5; // MAX_SCTP_STREAMS; // number of output streams can be greater
if (setsockopt(p5ListenSock, IPPROTO_SCTP, SCTP_INITMSG, &initMsg, sizeof(initMsg)) < 0) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After setsockopt (SCTP_INITMSG) errno: %d\n", errno);
close(p5ListenSock);
return 0;
}
noDelay = 1;
if (setsockopt(p5ListenSock, IPPROTO_SCTP, SCTP_NODELAY, &noDelay, sizeof(noDelay)) < 0) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After setsockopt (STCP_NODELAY) errno: %d\n", errno);
close(p5ListenSock);
return 0;
}
struct sctp_event_subscribe events;
memset((void *)&events, 0, sizeof(events));
events.sctp_data_io_event = 1;
if (setsockopt(p5ListenSock, SOL_SCTP, SCTP_EVENTS, (const void *)&events, sizeof(events)) < 0) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After setsockopt errno: %d\n", errno);
close(p5ListenSock);
return -1;
}
} else {
int error;
socklen_t len = sizeof(error);
if (getsockopt(p5ListenSock, SOL_SOCKET, SO_ERROR, &error, &len) < 0) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After getsockopt errno: %d\n", errno);
close(p5ListenSock);
return -1;
}
}
if (config->vnf_ipv6) {
NFAPI_TRACE(NFAPI_TRACE_INFO, "IPV6 binding to port %d %d\n", config->vnf_p5_port, p5ListenSock);
addr6.sin6_family = AF_INET6;
addr6.sin6_port = htons(config->vnf_p5_port);
addr6.sin6_addr = in6addr_any;
// bind to the configured address and port
if (bind(p5ListenSock, (struct sockaddr *)&addr6, sizeof(struct sockaddr_in6)) < 0) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After bind errno: %d\n", errno);
close(p5ListenSock);
return 0;
}
} else if (config->vnf_ipv4) {
NFAPI_TRACE(NFAPI_TRACE_INFO, "IPV4 binding to port %d\n", config->vnf_p5_port);
addr.sin_family = AF_INET;
addr.sin_port = htons(config->vnf_p5_port);
addr.sin_addr.s_addr = INADDR_ANY;
// bind to the configured address and port
if (bind(p5ListenSock, (struct sockaddr *)&addr, sizeof(struct sockaddr_in)) < 0) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After bind errno: %d\n", errno);
close(p5ListenSock);
AssertFatal(1 == 0, "Failed to bind socket with errno: %d\n", errno);
return 0;
}
}
NFAPI_TRACE(NFAPI_TRACE_INFO, "bind succeeded..%d.\n", p5ListenSock);
// put the socket into listen mode
if (listen(p5ListenSock, 2) < 0) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After listen errno: %d\n", errno);
close(p5ListenSock);
return 0;
}
NFAPI_TRACE(NFAPI_TRACE_INFO, "listen succeeded...\n");
struct timeval tv;
fd_set read_fd_set;
int p5_idx = 0;
while (vnf->terminate == 0) {
FD_ZERO(&read_fd_set);
FD_SET(p5ListenSock, &read_fd_set);
int max_fd = p5ListenSock;
tv.tv_sec = 5;
tv.tv_usec = 0;
nfapi_vnf_pnf_info_t *pnf = config->pnf_list;
while (pnf != 0) {
if (pnf->connected) {
FD_SET(pnf->p5_sock, &read_fd_set);
if (pnf->p5_sock > max_fd) {
max_fd = pnf->p5_sock;
}
}
pnf = pnf->next;
}
int select_result = select(max_fd + 1, &read_fd_set, 0, 0, &tv);
if (select_result == -1) {
NFAPI_TRACE(NFAPI_TRACE_INFO, "select result %d errno %d\n", select_result, errno);
close(p5ListenSock);
return 0;
} else if (select_result) {
if (FD_ISSET(p5ListenSock, &read_fd_set)) {
addrSize = sizeof(struct sockaddr_in);
NFAPI_TRACE(NFAPI_TRACE_INFO, "Accepting connection from PNF...\n");
p5Sock = accept(p5ListenSock, (struct sockaddr *)&addr, &addrSize);
if (p5Sock < 0) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "Failed to accept PNF connection reason:%d\n", errno);
} else {
NFAPI_TRACE(NFAPI_TRACE_INFO,
"PNF connection (fd:%d) accepted from %s:%d \n",
p5Sock,
inet_ntoa(addr.sin_addr),
ntohs(addr.sin_port));
nfapi_vnf_pnf_info_t *pnf = (nfapi_vnf_pnf_info_t *)malloc(sizeof(nfapi_vnf_pnf_info_t));
NFAPI_TRACE(NFAPI_TRACE_INFO, "MALLOC nfapi_vnf_pnf_info_t for pnf_list pnf:%p\n", pnf);
memset(pnf, 0, sizeof(nfapi_vnf_pnf_info_t));
pnf->p5_sock = p5Sock;
pnf->p5_idx = p5_idx++;
pnf->p5_pnf_sockaddr = addr;
pnf->connected = 1;
nfapi_vnf_pnf_list_add(config, pnf);
// Inform mac that a pnf connection has been established
// todo : allow mac to 'accept' the connection. i.e. to
// reject it.
if (config->pnf_nr_connection_indication != 0) {
(config->pnf_nr_connection_indication)(config, pnf->p5_idx);
}
// check the connection status
if (vnf->sctp) {
struct sctp_status status;
(void)memset(&status, 0, sizeof(struct sctp_status));
socklen_t optLen = (socklen_t)sizeof(struct sctp_status);
if (getsockopt(p5Sock, IPPROTO_SCTP, SCTP_STATUS, &status, &optLen) < 0) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After getsockopt errno: %d\n", errno);
return -1;
} else {
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF Association ID = %d\n", status.sstat_assoc_id);
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF Receiver window size = %d\n", status.sstat_rwnd);
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF In Streams = %d\n", status.sstat_instrms);
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF Out Streams = %d\n", status.sstat_outstrms);
}
}
}
} else {
uint8_t delete_pnfs = 0;
nfapi_vnf_pnf_info_t *pnf = config->pnf_list;
while (pnf != 0) {
if (FD_ISSET(pnf->p5_sock, &read_fd_set)) {
if (vnf_nr_read_dispatch_message(config, pnf) == 0) {
if (config->pnf_disconnect_indication != 0) {
(config->pnf_disconnect_indication)(config, pnf->p5_idx);
}
close(pnf->p5_sock);
pnf->to_delete = 1;
delete_pnfs = 1;
}
}
pnf = pnf->next;
}
if (delete_pnfs) {
nfapi_vnf_pnf_info_t *pnf = config->pnf_list;
nfapi_vnf_pnf_info_t *prev = 0;
while (pnf != 0) {
nfapi_vnf_pnf_info_t *curr = pnf;
if (pnf->to_delete == 1) {
if (prev == 0) {
config->pnf_list = pnf->next;
} else {
prev->next = pnf->next;
}
pnf = pnf->next;
free(curr);
} else {
prev = pnf;
pnf = pnf->next;
}
}
}
}
continue;
} else {
// timeout
// Should we test for socket closure here every second?
continue;
}
}
NFAPI_TRACE(NFAPI_TRACE_INFO, "Closing p5Sock socket's\n");
{
nfapi_vnf_pnf_info_t *curr = config->pnf_list;
while (curr != NULL) {
if (config->pnf_disconnect_indication) {
(config->pnf_disconnect_indication)(config, curr->p5_idx);
}
close(curr->p5_sock);
curr = curr->next;
}
}
NFAPI_TRACE(NFAPI_TRACE_INFO, "Closing p5Listen socket\n");
close(p5ListenSock);
return 0;
}
void vnf_start_p5_thread(void *ptr)
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] VNF NFAPI thread - nfapi_vnf_start()%s\n", __FUNCTION__);
pthread_setname_np(pthread_self(), "VNF");
nfapi_nr_vnf_p5_start((nfapi_vnf_config_t *)ptr);
}
void vnf_nr_reassemble_p7_message(void *pRecvMsg, int recvMsgLen, vnf_p7_t *vnf_p7)
{
nfapi_nr_p7_message_header_t messageHeader;
// validate the input params
if (pRecvMsg == NULL || recvMsgLen < 4 || vnf_p7 == NULL) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "vnf_handle_p7_message: invalid input params (%p %d %p)\n", pRecvMsg, recvMsgLen, vnf_p7);
return;
}
// unpack the message header
const bool result =
vnf_p7->_public.hdr_unpack_func(pRecvMsg, recvMsgLen, &messageHeader, sizeof(messageHeader), &vnf_p7->_public.codec_config);
if (!result) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "Unpack message header failed, ignoring\n");
return;
}
if (vnf_p7->_public.checksum_enabled) {
uint32_t checksum = nfapi_nr_p7_calculate_checksum(pRecvMsg, recvMsgLen);
if (checksum != messageHeader.checksum) {
NFAPI_TRACE(NFAPI_TRACE_ERROR,
"Checksum verification failed %d %d msg:%d len:%d\n",
checksum,
messageHeader.checksum,
messageHeader.message_id,
recvMsgLen);
return;
}
}
uint8_t m = NFAPI_P7_GET_MORE(messageHeader.m_segment_sequence);
uint8_t segment_num = NFAPI_P7_GET_SEGMENT(messageHeader.m_segment_sequence);
uint8_t sequence_num = NFAPI_P7_GET_SEQUENCE(messageHeader.m_segment_sequence);
if (m == 0 && segment_num == 0) {
// we have a complete message
// ensure the message is sensible
if (recvMsgLen < 8 || pRecvMsg == NULL) {
NFAPI_TRACE(NFAPI_TRACE_WARN, "Invalid message size: %d, ignoring\n", recvMsgLen);
return;
}
// vnf_dispatch_p7_message(&messageHeader, pRecvMsg, recvMsgLen, vnf_p7);
vnf_nr_handle_p7_message(pRecvMsg, recvMsgLen, vnf_p7);
} else {
nfapi_vnf_p7_connection_info_t *phy = vnf_p7_connection_info_list_find(vnf_p7, messageHeader.phy_id);
if (phy) {
vnf_p7_rx_message_t *rx_msg = vnf_p7_rx_reassembly_queue_add_segment(vnf_p7,
&(phy->reassembly_queue),
sequence_num,
segment_num,
m,
pRecvMsg,
recvMsgLen);
if (rx_msg->num_segments_received == rx_msg->num_segments_expected) {
// send the buffer on
uint16_t i = 0;
uint16_t length = 0;
for (i = 0; i < rx_msg->num_segments_expected; ++i) {
length += rx_msg->segments[i].length - (i > 0 ? NFAPI_NR_P7_HEADER_LENGTH : 0);
}
if (phy->reassembly_buffer_size < length) {
vnf_p7_free(vnf_p7, phy->reassembly_buffer);
phy->reassembly_buffer = 0;
}
if (phy->reassembly_buffer == 0) {
NFAPI_TRACE(NFAPI_TRACE_NOTE, "Resizing VNF_P7 Reassembly buffer %d->%d\n", phy->reassembly_buffer_size, length);
phy->reassembly_buffer = (uint8_t *)vnf_p7_malloc(vnf_p7, length);
if (phy->reassembly_buffer == 0) {
NFAPI_TRACE(NFAPI_TRACE_NOTE, "Failed to allocate VNF_P7 reassemby buffer len:%d\n", length);
return;
}
memset(phy->reassembly_buffer, 0, length);
phy->reassembly_buffer_size = length;
}
uint16_t offset = 0;
for (i = 0; i < rx_msg->num_segments_expected; ++i) {
if (i == 0) {
memcpy(phy->reassembly_buffer, rx_msg->segments[i].buffer, rx_msg->segments[i].length);
offset += rx_msg->segments[i].length;
} else {
memcpy(phy->reassembly_buffer + offset,
rx_msg->segments[i].buffer + NFAPI_NR_P7_HEADER_LENGTH,
rx_msg->segments[i].length - NFAPI_NR_P7_HEADER_LENGTH);
offset += rx_msg->segments[i].length - NFAPI_NR_P7_HEADER_LENGTH;
}
}
vnf_nr_handle_p7_message(phy->reassembly_buffer, length, vnf_p7);
// delete the structure
vnf_p7_rx_reassembly_queue_remove_msg(vnf_p7, &(phy->reassembly_queue), rx_msg);
}
// see corresponding comment in pnf_nr_handle_p7_message() [same commit]
vnf_p7_rx_reassembly_queue_remove_old_msgs(vnf_p7, &(phy->reassembly_queue), 10000);
} else {
NFAPI_TRACE(NFAPI_TRACE_INFO, "Unknown phy id %d\n", messageHeader.phy_id);
}
}
}
int vnf_nr_p7_read_dispatch_message(vnf_p7_t *vnf_p7)
{
int recvfrom_result = 0;
struct sockaddr_in remote_addr;
socklen_t remote_addr_size = sizeof(remote_addr);
do {
// peek the header
uint8_t header_buffer[NFAPI_NR_P7_HEADER_LENGTH];
recvfrom_result = recvfrom(vnf_p7->socket,
header_buffer,
NFAPI_NR_P7_HEADER_LENGTH,
MSG_DONTWAIT | MSG_PEEK,
(struct sockaddr *)&remote_addr,
&remote_addr_size);
if (recvfrom_result > 0) {
// get the segment size
nfapi_nr_p7_message_header_t header;
const bool result = vnf_p7->_public.hdr_unpack_func(header_buffer, NFAPI_NR_P7_HEADER_LENGTH, &header, sizeof(header), 0);
if (!result) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "Unpack message header failed, ignoring\n");
return -1;
}
// resize the buffer if we have a large segment
if (header.message_length > vnf_p7->rx_message_buffer_size) {
NFAPI_TRACE(NFAPI_TRACE_NOTE, "reallocing rx buffer %d\n", header.message_length);
vnf_p7->rx_message_buffer = realloc(vnf_p7->rx_message_buffer, header.message_length);
vnf_p7->rx_message_buffer_size = header.message_length;
}
// read the segment
recvfrom_result = recvfrom(vnf_p7->socket,
vnf_p7->rx_message_buffer,
header.message_length,
MSG_WAITALL | MSG_TRUNC,
(struct sockaddr *)&remote_addr,
&remote_addr_size);
NFAPI_TRACE(NFAPI_TRACE_DEBUG, "recvfrom_result = %d from %s():%d\n", recvfrom_result, __FUNCTION__, __LINE__);
// todo : how to handle incomplete readfroms, need some sort of buffer/select
if (recvfrom_result > 0) {
if (recvfrom_result != header.message_length) {
NFAPI_TRACE(NFAPI_TRACE_ERROR,
"(%d) Received unexpected number of bytes. %d != %d",
__LINE__,
recvfrom_result,
header.message_length);
break;
}
NFAPI_TRACE(NFAPI_TRACE_DEBUG, "Calling vnf_nr_reassemble_p7_message from %d\n", __LINE__);
vnf_nr_reassemble_p7_message(vnf_p7->rx_message_buffer, recvfrom_result, vnf_p7);
return 0;
} else {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "recvfrom failed %d %d\n", recvfrom_result, errno);
}
}
if (recvfrom_result == -1) {
if (errno == EAGAIN || errno == EWOULDBLOCK) {
// return to the select
} else {
NFAPI_TRACE(NFAPI_TRACE_WARN, "%s recvfrom failed errno:%d\n", __FUNCTION__, errno);
}
}
} while (recvfrom_result > 0);
return 0;
}
static int nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t *config)
{
if (config == 0)
return -1;
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s()\n", __FUNCTION__);
vnf_p7_t *vnf_p7 = (vnf_p7_t *)config;
// Create p7 receive udp port
// todo : this needs updating for Ipv6
NFAPI_TRACE(NFAPI_TRACE_INFO, "Initialising VNF P7 port:%u\n", config->port);
// open the UDP socket
if ((vnf_p7->socket = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After P7 socket errno: %d\n", errno);
return -1;
}
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF P7 socket created...\n");
// configure the UDP socket options
int iptos_value = 0;
if (setsockopt(vnf_p7->socket, IPPROTO_IP, IP_TOS, &iptos_value, sizeof(iptos_value)) < 0) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After setsockopt (IP_TOS) errno: %d\n", errno);
return -1;
}
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF P7 setsockopt succeeded...\n");
// Create the address structure
struct sockaddr_in addr;
memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET;
addr.sin_port = htons(config->port);
addr.sin_addr.s_addr = INADDR_ANY;
// bind to the configured port
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF P7 binding too %s:%d\n", inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
if (bind(vnf_p7->socket, (struct sockaddr *)&addr, sizeof(struct sockaddr_in)) < 0)
// if (sctp_bindx(config->socket, (struct sockaddr *)&addr, sizeof(struct sockaddr_in), 0) < 0)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After bind errno: %d\n", errno);
return -1;
}
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF P7 bind succeeded...\n");
// struct timespec original_pselect_timeout;
struct timespec pselect_timeout;
pselect_timeout.tv_sec = 100;
pselect_timeout.tv_nsec = 0;
struct timespec ref_time;
clock_gettime(CLOCK_MONOTONIC, &ref_time);
while (vnf_p7->terminate == 0) {
fd_set rfds;
int maxSock = 0;
FD_ZERO(&rfds);
int selectRetval = 0;
// Add the p7 socket
FD_SET(vnf_p7->socket, &rfds);
maxSock = vnf_p7->socket;
selectRetval = pselect(maxSock + 1, &rfds, NULL, NULL, &pselect_timeout, NULL);
if (selectRetval == 0) {
// pselect timed out, continue
} else if (selectRetval > 0) {
// have a p7 message
if (FD_ISSET(vnf_p7->socket, &rfds)) {
vnf_nr_p7_read_dispatch_message(vnf_p7);
}
} else {
// pselect error
if (selectRetval == -1 && errno == EINTR) {
// a sigal was received.
} else {
// should we exit now?
if (selectRetval == -1 && errno == 22) // invalid argument??? not sure about timeout duration
{
usleep(100000);
}
}
}
}
NFAPI_TRACE(NFAPI_TRACE_INFO, "Closing p7 socket\n");
close(vnf_p7->socket);
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() returning\n", __FUNCTION__);
return 0;
}
void *vnf_nr_start_p7_thread(void *ptr)
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s()\n", __FUNCTION__);
pthread_setname_np(pthread_self(), "VNF_P7");
nfapi_vnf_p7_config_t *config = (nfapi_vnf_p7_config_t *)ptr;
nfapi_nr_vnf_p7_start(config);
return config;
}

View File

@@ -0,0 +1,22 @@
message(STATUS "Building with support for WLS")
add_library(wls_integration_lib
wls_pnf.c
wls_vnf.c
wls_common.c
)
find_library(WLS_LIB wls REQUIRED)
message(STATUS " wls library found in ${WLS_LIB}")
find_library(hugetlbfs_LIB hugetlbfs REQUIRED)
message(STATUS " hugetlbfs library found in ${hugetlbfs_LIB}")
pkg_check_modules(dpdk REQUIRED libdpdk=20.11.3)
target_link_libraries(wls_integration_lib PRIVATE ${dpdk_LINK_LIBRARIES})
target_include_directories(wls_integration_lib PRIVATE ${dpdk_INCLUDE_DIRS})
target_include_directories(wls_integration_lib PRIVATE include/)
target_compile_definitions(wls_integration_lib PUBLIC ENABLE_WLS)
target_link_libraries(wls_integration_lib PRIVATE NFAPI_LIB NFAPI_USER_LIB)
target_link_libraries(wls_integration_lib PRIVATE nr_fapi_p5 nr_fapi_p7)
target_link_libraries(wls_integration_lib PRIVATE "${WLS_LIB}" "${hugetlbfs_LIB}")

View File

@@ -0,0 +1,108 @@
/*
* 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 OPENAIRINTERFACE_WLS_COMMON_H
#define OPENAIRINTERFACE_WLS_COMMON_H
#include <stdint.h>
#include <stdio.h>
#include <stdbool.h>
#include "wls_lib.h"
#include "nfapi/open-nFAPI/fapi/inc/nr_fapi_p5_utils.h"
#include "nfapi/open-nFAPI/fapi/inc/nr_fapi_p7_utils.h"
#define WLS_DEV_NAME "wls"
#define WLS_MAC_MEMORY_SIZE 0x7F000000
#define WLS_PHY_MEMORY_SIZE 0x7F000000
#define MAX_NUM_LOCATIONS (508)
#define MIN_DL_BUF_LOCATIONS (0) /* Used for stats collection 0-49 */
#define MIN_UL_BUF_LOCATIONS (MIN_DL_BUF_LOCATIONS + MAX_NUM_LOCATIONS) /* Used for stats collection 50-99 */
#define MAX_DL_BUF_LOCATIONS (MIN_DL_BUF_LOCATIONS + MAX_NUM_LOCATIONS) /* Used for stats collection 0-49 */
#define MAX_UL_BUF_LOCATIONS (MIN_UL_BUF_LOCATIONS + MAX_NUM_LOCATIONS) /* Used for stats collection 50-99 */
#define ALLOC_TRACK_SIZE ( 16384 )
typedef struct {
uint64_t *values;
uint16_t values_size;
uint16_t values_count;
}pa_store_t;
/* ----- WLS Operation --- */
#define FAPI_VENDOR_MSG_HEADER_IND 0x1A
// Linked list header present at the top of all messages
typedef struct _fapi_api_queue_elem {
struct _fapi_api_queue_elem *p_next;
// p_tx_data_elm_list used for TX_DATA.request processing
struct _fapi_api_queue_elem *p_tx_data_elm_list;
uint8_t msg_type;
uint8_t num_message_in_block;
uint32_t msg_len;
uint32_t align_offset;
uint64_t time_stamp;
} fapi_api_queue_elem_t,
*p_fapi_api_queue_elem_t;
typedef struct wls_mac_mem_array
{
void **ppFreeBlock;
void *pStorage;
void *pEndOfStorage;
uint32_t nBlockSize;
uint32_t nBlockCount;
} WLS_MAC_MEM_SRUCT, *PWLS_MAC_MEM_SRUCT;
typedef struct wls_mac_ctx
{
void *hWls;
void *pWlsMemBase;
void *pWlsMemBaseUsable;
WLS_MAC_MEM_SRUCT sWlsStruct;
uint64_t nTotalMemorySize;
uint64_t nTotalMemorySizeUsable;
uint32_t nBlockSize;
uint32_t nTotalBlocks;
uint32_t nAllocBlocks;
uint32_t nTotalAllocCnt;
uint32_t nTotalFreeCnt;
uint32_t nTotalUlBufAllocCnt;
uint32_t nTotalUlBufFreeCnt;
uint32_t nTotalDlBufAllocCnt;
uint32_t nTotalDlBufFreeCnt;
// Support for FAPI Translator
uint32_t nPartitionMemSize;
void *pPartitionMemBase;
volatile pthread_mutex_t lock;
volatile pthread_mutex_t lock_alloc;
} WLS_MAC_CTX, *PWLS_MAC_CTX;
void fill_fapi_list_elem(p_fapi_api_queue_elem_t currElem, p_fapi_api_queue_elem_t nextElem, const uint8_t msgType, const uint8_t numMsgInBlock, const uint32_t alignOffset);
uint64_t dequeueBlock(PWLS_MAC_CTX pWls);
void wls_return_msg_to_master(PWLS_MAC_CTX pWls, const uint64_t msg_PA);
uint8_t wls_send_fapi_msg(PWLS_MAC_CTX pWls, const uint16_t message_id, const int packed_len, const uint8_t *message );
uint8_t wls_msg_send(PWLS_MAC_CTX pWls, p_fapi_api_queue_elem_t currMsg);
#endif //OPENAIRINTERFACE_WLS_COMMON_H

View File

@@ -0,0 +1,33 @@
/*
* 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 OPENAIRINTERFACE_WLS_PNF_H
#define OPENAIRINTERFACE_WLS_PNF_H
#include "nfapi_pnf_interface.h"
#include "pnf.h"
#include "wls_common.h"
bool wls_pnf_nr_send_p5_message(pnf_t *pnf, nfapi_nr_p4_p5_message_header_t* msg, uint32_t msg_len);
bool wls_pnf_nr_send_p7_message(pnf_p7_t* pnf_p7,nfapi_nr_p7_message_header_t *msg, uint32_t msg_len);
void *wls_fapi_pnf_nr_start_thread(void *ptr);
int wls_fapi_nr_pnf_start();
void wls_pnf_set_p7_config(void *p7_config);
#endif // OPENAIRINTERFACE_WLS_PNF_H

View File

@@ -0,0 +1,33 @@
/*
* 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 OPENAIRINTERFACE_WLS_VNF_H
#define OPENAIRINTERFACE_WLS_VNF_H
#include "nfapi_vnf_interface.h"
#include "vnf.h"
#include "wls_common.h"
void *wls_fapi_vnf_nr_start_thread(void *ptr);
int wls_fapi_nr_vnf_start();
void wls_vnf_set_p7_config(void *p7_config);
bool wls_vnf_nr_send_p5_message(vnf_t *vnf,uint16_t p5_idx, nfapi_nr_p4_p5_message_header_t* msg, uint32_t msg_len);
bool wls_vnf_nr_send_p7_message(vnf_p7_t* vnf_p7,nfapi_nr_p7_message_header_t* msg);
#endif //OPENAIRINTERFACE_WLS_VNF_H

Some files were not shown because too many files have changed in this diff Show More