# emmericp/ixy architecture

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

- Interactive diagram: https://gitdiagram.com/emmericp/ixy
- Repository: https://github.com/emmericp/ixy

## Overview

- Application Layer:
- “app” directory as the high-level entry point with the applications (ixy-fwd, ixy-pcap, ixy-pktgen). These examples demonstrate different packet processing use cases (forwarding, packet generation, etc.).
- Driver Layer:
- Support/Utility Components:
- Shared modules such as “interrupts”, “memory”, “pci”, “stats”, and the VFIO library (libixy-vfio). These provide foundational services like memory management (including hugepages support), interrupt handling, and PCI device enumeration/control.

##### Relationships and Interactions
- Start from an Application example (e.g., ixy-fwd) invoking library calls that manage packet reception and forwarding.
- Calls interacting with both the driver-specific modules (ixgbe or virtio) and the lower-level hardware abstraction layers.
- Link the low-level modules (memory, PCI, and interrupts) with the driver layer — since they set up buffers, configure NIC registers, handle DMA descriptors, and manage interrupt requests.

##### Architectural Patterns and Design Principles
- Modular and Layered Architecture:
- The separation into application, driver, and utilities clearly follows modular design principles; each component is responsible for a distinct part of the overall system.
- Low-Level Direct Hardware Access:
- That there is no kernel-space dependency for networking – the driver runs entirely in user space. Thus, illustrate how “ixy” bypasses the kernel’s typical network stack.
- Simplicity for Educational Purpose:

##### Incorporate Specific Technologies and “IOMMU/VFIO” Path
- For systems that use VFIO (and IOMMU), include an alternate path:

##### Capturing Essential Details
- Every module from the file tree that contributes to system functionality is represented.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Application Layer
    subgraph "Application Layer"
        A1["ixy-fwd App"]:::app
        A2["ixy-pcap App"]:::app
        A3["ixy-pktgen App"]:::app
    end

    %% Driver Layer
    subgraph "Driver Layer"
        D1["Intel ixgbe Driver"]:::driver
        D2["Virtio Driver"]:::driver
    end

    %% System Utilities
    subgraph "System Utilities"
        U1["Memory Management"]:::utility
        U2["PCI Access"]:::utility
        U3["Interrupt Handling"]:::utility
        U4["Statistics & Monitoring"]:::utility
        U5["VFIO Integration"]:::utility
    end

    %% External Hardware
    N["Network Adapter"]:::external

    %% Connections: Application to Drivers
    A1 -->|"invoke"| D1
    A3 -->|"invoke"| D1
    A2 -->|"invoke"| D2

    %% Connections: Application also initializes PCI & Interrupt modules
    A1 -->|"init"| U2
    A1 -->|"init"| U3
    A2 -->|"init"| U2
    A2 -->|"init"| U3
    A3 -->|"init"| U2
    A3 -->|"init"| U3

    %% Connections: Drivers use System Utilities
    D1 -->|"uses"| U1
    D1 -->|"uses"| U2
    D1 -->|"uses"| U3
    D1 -->|"monitors"| U4
    D2 -->|"uses"| U1
    D2 -->|"uses"| U2
    D2 -->|"uses"| U3
    D2 -->|"monitors"| U4

    %% Drivers directly interact with Network Adapter
    D1 -->|"DMA/control"| N
    D2 -->|"DMA/control"| N

    %% Utilities prepare the hardware
    U1 -->|"setup_DMA"| N
    U2 -->|"configure"| N
    U3 -->|"handle_IRQ"| N

    %% VFIO branch enables advanced interrupt support
    U5 -->|"enables"| U3

    %% Click Events
    click A1 "https://github.com/emmericp/ixy/blob/master/src/app/ixy-fwd.c"
    click A2 "https://github.com/emmericp/ixy/blob/master/src/app/ixy-pcap.c"
    click A3 "https://github.com/emmericp/ixy/blob/master/src/app/ixy-pktgen.c"

    click D1 "https://github.com/emmericp/ixy/blob/master/src/driver/ixgbe.c"
    click D2 "https://github.com/emmericp/ixy/blob/master/src/driver/virtio.c"

    click U1 "https://github.com/emmericp/ixy/blob/master/src/memory.c"
    click U2 "https://github.com/emmericp/ixy/blob/master/src/pci.c"
    click U3 "https://github.com/emmericp/ixy/blob/master/src/interrupts.c"
    click U4 "https://github.com/emmericp/ixy/blob/master/src/stats.c"
    click U5 "https://github.com/emmericp/ixy/blob/master/src/libixy-vfio.c"

    %% Styles
    classDef app fill:#b3cde0,stroke:#000,stroke-width:1px;
    classDef driver fill:#ccebc5,stroke:#000,stroke-width:1px;
    classDef utility fill:#fddb92,stroke:#000,stroke-width:1px;
    classDef external fill:#ffcccb,stroke:#000,stroke-width:1px;
```
