# intel/flexran architecture

> Architecture diagram of the GitHub repository intel/flexran, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/intel/flexran
- Repository: https://github.com/intel/flexran

## Overview

##### Project type and purpose
- This is Intel’s FlexRAN 5GNR Reference PHY project, providing a real‐time Layer-1 (L1) implementation (l1app) and a Test MAC application (testmac) for functional and performance validation of 5GNR PHY features on Intel® Xeon® platforms.
- It also includes a FAPI interface container (oran-fapi) for O-RAN integration.

##### File structure
- Top-level directories:
- docker/ → Dockerfile, build scripts, Kubernetes pod manifest (multi-container Pod: l1app, oran-fapi, testmac)
- l1/ →
– bin/nr5g/gnb/l1/ → L1 binaries, XML configs, lookup tables
– bin/nr5g/gnb/testmac/ → testmac binaries and configs
– source/ → C/C++ headers and code implementing PHY and API layers
- libs/cpa/ → DPDK BBDev drivers (cpa_drv.ko, mmwcpa_drv.ko) for SW/FPGA FEC offload
- sdk/ → prebuilt phy algorithm libraries with lookup-table binaries (e.g., ce_type1_w_sinc.bin)
- testcase/ → reference IQ samples and XML config files for DL, UL, FD test cases
- Key patterns:
- Layered modular code (hardware interface → PHY algorithms → API → test orchestration)
- Containerized deployment with shared volumes (HugePages, DPDK socket)
- Kubernetes resource isolation for real-time tasks

##### README for insights
- L1 application supports private and FAPI interfaces (FAPI v222.10.02).
- Testmac application orchestrates DL/UL/FD tests: feeds UL IQ to PHY, receives DL IQ, compares results.
- Deployment modes: bare-metal (real-time tuned CentOS 7 + hugepages + DPDK) or containerized (Docker + Kubernetes).
- Resource requirements: l1app (16 GiB + 2 GiB 1GiB hugepages), oran-fapi (4 GiB + 4 GiB hugepages), testmac (4 GiB).

##### Detail
- Entrypoint scripts (l1.sh, oran_5g_fapi.sh, l2.sh)
- Lookup-table directories under sdk/ and l1/bin
- Resource limits (Memory, HugePages)
- SW vs FPGA FEC offload path via DPDK BBDev driver

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Pod with containers
    subgraph "Kubernetes Pod: FlexRAN DU"
        direction TB
        TESTMAC["testmac\n(l2.sh)"]:::app
        ORAN["oran-fapi\n(oran_5g_fapi.sh)"]:::app
        L1APP["l1app\n(l1.sh)"]:::app
    end

    %% Shared Volumes
    HP["HugePages\n(medium: HugePages)"]:::vol
    DPDK["DPDK Socket\n/var/run/dpdk"]:::vol
    HOSTPATH["HostPath Volume\n/opt/intel/system_studio_2019"]:::vol

    %% SDK Libraries
    SDK["SDK Libraries &\nLookup Tables"]:::lib

    %% Kernel Modules / Drivers
    DRV["Kernel Modules\n(cpa_drv.ko,\nmmwcpa_drv.ko)"]:::drv

    %% Hardware Layer
    HW["Intel Xeon CPU\n(real-time tuned)\nNIC/FPGA/BBDev"]:::hw

    %% Connections between containers
    TESTMAC -->|"FAPI requests & configs"| ORAN
    ORAN -->|"FAPI ↔ Private API\nIQ Stream"| L1APP
    L1APP -->|"Load algorithm libs & lookup tables"| SDK

    %% Containers to volumes
    TESTMAC --- HP
    ORAN --- HP
    L1APP --- HP
    TESTMAC --- DPDK
    ORAN --- DPDK
    L1APP --- DPDK
    L1APP --- HOSTPATH
    ORAN --- HOSTPATH
    TESTMAC --- HOSTPATH

    %% Hardware and drivers
    HW --> DRV
    DRV --> L1APP
    DRV --> ORAN
    DRV --> TESTMAC

    %% Click Events for component mappings
    click L1APP "https://github.com/intel/flexran/blob/master/l1/bin/nr5g/gnb/l1/l1.sh"
    click TESTMAC "https://github.com/intel/flexran/blob/master/l1/bin/nr5g/gnb/testmac/l2.sh"
    click ORAN "https://github.com/intel/flexran/blob/master/docker/oran-release-du.yaml"
    click SDK "https://github.com/intel/flexran/blob/master/sdk/build-avx512-icc/source/phy/lib_cestimate_5gnr/*.bin"
    click DRV "https://github.com/intel/flexran/blob/master/libs/cpa/bin/cpa_drv.ko"

    %% Styles
    classDef app fill:#DDEBF7,stroke:#1155CC,stroke-width:2px
    classDef vol fill:#FFF2CC,stroke:#F1C232,stroke-width:2px
    classDef lib fill:#EAD1DC,stroke:#C27BA0,stroke-width:2px
    classDef drv fill:#D9EAD3,stroke:#6AA84F,stroke-width:2px
    classDef hw fill:#F4CCCC,stroke:#CC0000,stroke-width:2px
```
