# tc956x/tc9564_host_driver architecture

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

- Interactive diagram: https://gitdiagram.com/tc956x/tc9564_host_driver
- Repository: https://github.com/tc956x/tc9564_host_driver

## Overview

This is a Linux PCIe Ethernet host driver for Toshiba’s TC956X, exposing a network interface and driver controls to the kernel and administrator. The main workflow is PCI device discovery and setup, MAC/DMA initialization, then packet transmission and reception through the kernel network stack; link management and optional offload, timestamping, and diagnostics are supporting capabilities. The sampled excerpts are partial, so some subsystem connections are omitted or marked unverified rather than inferred as definite calls.

Main entry points: [`tc956xmac_main.c`](https://github.com/tc956x/tc9564_host_driver/blob/master/tc956xmac_main.c) (MAC driver), [`hwif.c`](https://github.com/tc956x/tc9564_host_driver/blob/master/hwif.c) (Hardware dispatch), [`tc956x_pci.c`](https://github.com/tc956x/tc9564_host_driver/blob/master/tc956x_pci.c) (PCI setup), [`dwxgmac2_core.c`](https://github.com/tc956x/tc9564_host_driver/blob/master/dwxgmac2_core.c) (MAC register operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Device entry"]
  node_pci_setup["PCI setup<br/>[tc956x_pci.c]"]
  node_mac_core["MAC driver<br/>[tc956xmac_main.c]"]
end

subgraph group_datapath["Ethernet datapath"]
  node_mac_registers["MAC register operations<br/>[dwxgmac2_core.c]"]
  node_descriptor_ops["Descriptor handling<br/>[dwxgmac2_descs.c]"]
  node_dma_ops["DMA operations<br/>[dwxgmac2_dma.c]"]
  node_hardware_dispatch["Hardware dispatch<br/>[hwif.c]"]
  node_statistics["Hardware statistics<br/>[mmc_core.c]"]
end

subgraph group_link["Link and timing"]
  node_mdio["MDIO management<br/>[tc956xmac_mdio.c]"]
  node_xpcs["PCS link<br/>[tc956x_xpcs.c]"]
  node_pma["PMA access<br/>[tc956x_pma.c]"]
  node_timestamp["PTP timestamping<br/>[tc956xmac_ptp.c]"]
  node_timestamp_config["Timestamp configuration"]
end

subgraph group_management["Controls and diagnostics"]
  node_ethtool["Ettool controls"]
  node_traffic_control["Traffic control<br/>[tc956xmac_tc.c]"]
  node_ioctl["Driver controls<br/>[tc956x_ipa_intf.c]"]
  node_pcie_diagnostics["PCIe diagnostics"]
end

node_admin(("Driver administrator"))
node_kernel(("Linux network stack"))
node_pcie{{"PCIe device"}}

node_admin -->|"loads driver"| node_pci_setup
node_pcie -.->|"probes"| node_pci_setup
node_pci_setup -.->|"initializes"| node_mac_core
node_kernel -.->|"sends packets"| node_mac_core
node_mac_core -.->|"uses callbacks"| node_hardware_dispatch
node_hardware_dispatch -.->|"dispatches"| node_mac_registers
node_hardware_dispatch -.->|"dispatches"| node_descriptor_ops
node_hardware_dispatch -.->|"dispatches"| node_dma_ops
node_mac_core -.->|"reads counters"| node_statistics
node_kernel -.->|"requests settings"| node_ethtool
node_kernel -.->|"configures traffic"| node_traffic_control
node_admin -.->|"sets controls"| node_ioctl
node_mac_core -.->|"manages PHY"| node_mdio
node_mac_core -->|"reads link state"| node_xpcs
node_mac_core -.->|"accesses PMA"| node_pma
node_mac_core -->|"uses PTP"| node_timestamp
node_mac_core -.->|"configures timestamps"| node_timestamp_config
node_admin -.->|"reads diagnostics"| node_pcie_diagnostics

click node_pci_setup "https://github.com/tc956x/tc9564_host_driver/blob/master/tc956x_pci.c"
click node_mac_core "https://github.com/tc956x/tc9564_host_driver/blob/master/tc956xmac_main.c"
click node_mac_registers "https://github.com/tc956x/tc9564_host_driver/blob/master/dwxgmac2_core.c"
click node_descriptor_ops "https://github.com/tc956x/tc9564_host_driver/blob/master/dwxgmac2_descs.c"
click node_dma_ops "https://github.com/tc956x/tc9564_host_driver/blob/master/dwxgmac2_dma.c"
click node_hardware_dispatch "https://github.com/tc956x/tc9564_host_driver/blob/master/hwif.c"
click node_statistics "https://github.com/tc956x/tc9564_host_driver/blob/master/mmc_core.c"
click node_ethtool "https://github.com/tc956x/tc9564_host_driver/blob/master/tc956xmac_ethtool.c"
click node_traffic_control "https://github.com/tc956x/tc9564_host_driver/blob/master/tc956xmac_tc.c"
click node_ioctl "https://github.com/tc956x/tc9564_host_driver/blob/master/tc956x_ipa_intf.c"
click node_mdio "https://github.com/tc956x/tc9564_host_driver/blob/master/tc956xmac_mdio.c"
click node_xpcs "https://github.com/tc956x/tc9564_host_driver/blob/master/tc956x_xpcs.c"
click node_pma "https://github.com/tc956x/tc9564_host_driver/blob/master/tc956x_pma.c"
click node_timestamp "https://github.com/tc956x/tc9564_host_driver/blob/master/tc956xmac_ptp.c"
click node_timestamp_config "https://github.com/tc956x/tc9564_host_driver/blob/master/tc956xmac_hwtstamp.c"
click node_pcie_diagnostics "https://github.com/tc956x/tc9564_host_driver/blob/master/tc956x_pcie_logstat.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_pci_setup,node_mac_core toneBlue
class node_mac_registers,node_descriptor_ops,node_dma_ops,node_hardware_dispatch,node_statistics toneAmber
class node_mdio,node_xpcs,node_pma,node_timestamp,node_timestamp_config toneMint
class node_ethtool,node_traffic_control,node_ioctl,node_pcie_diagnostics toneRose
class node_admin,node_kernel,node_pcie toneIndigo
```

## Components

### Device entry

- [PCI setup](https://github.com/tc956x/tc9564_host_driver/blob/master/tc956x_pci.c): `tc956x_pci.c`
- [MAC driver](https://github.com/tc956x/tc9564_host_driver/blob/master/tc956xmac_main.c): `tc956xmac_main.c`

### Ethernet datapath

- [MAC register operations](https://github.com/tc956x/tc9564_host_driver/blob/master/dwxgmac2_core.c): `dwxgmac2_core.c`
- [Descriptor handling](https://github.com/tc956x/tc9564_host_driver/blob/master/dwxgmac2_descs.c): `dwxgmac2_descs.c`
- [DMA operations](https://github.com/tc956x/tc9564_host_driver/blob/master/dwxgmac2_dma.c): `dwxgmac2_dma.c`
- [Hardware dispatch](https://github.com/tc956x/tc9564_host_driver/blob/master/hwif.c): `hwif.c`
- [Hardware statistics](https://github.com/tc956x/tc9564_host_driver/blob/master/mmc_core.c): `mmc_core.c`

### Link and timing

- [MDIO management](https://github.com/tc956x/tc9564_host_driver/blob/master/tc956xmac_mdio.c): `tc956xmac_mdio.c`
- [PCS link](https://github.com/tc956x/tc9564_host_driver/blob/master/tc956x_xpcs.c): `tc956x_xpcs.c`
- [PMA access](https://github.com/tc956x/tc9564_host_driver/blob/master/tc956x_pma.c): `tc956x_pma.c`
- [PTP timestamping](https://github.com/tc956x/tc9564_host_driver/blob/master/tc956xmac_ptp.c): `tc956xmac_ptp.c`
- [Timestamp configuration](https://github.com/tc956x/tc9564_host_driver/blob/master/tc956xmac_hwtstamp.c): `tc956xmac_hwtstamp.c`

### Controls and diagnostics

- [Ettool controls](https://github.com/tc956x/tc9564_host_driver/blob/master/tc956xmac_ethtool.c): `tc956xmac_ethtool.c`
- [Traffic control](https://github.com/tc956x/tc9564_host_driver/blob/master/tc956xmac_tc.c): `tc956xmac_tc.c`
- [Driver controls](https://github.com/tc956x/tc9564_host_driver/blob/master/tc956x_ipa_intf.c): `tc956x_ipa_intf.c`
- [PCIe diagnostics](https://github.com/tc956x/tc9564_host_driver/blob/master/tc956x_pcie_logstat.c): `tc956x_pcie_logstat.c`

### Other components

- **Driver administrator**
- **Linux network stack**
- **PCIe device**

## Connections

- Driver administrator → PCI setup: loads driver (evidence: `Readme.md`)
- PCIe device → PCI setup: probes
- PCI setup → MAC driver: initializes
- Linux network stack → MAC driver: sends packets
- MAC driver → Hardware dispatch: uses callbacks
- Hardware dispatch → MAC register operations: dispatches
- Hardware dispatch → Descriptor handling: dispatches
- Hardware dispatch → DMA operations: dispatches
- MAC driver → Hardware statistics: reads counters
- Linux network stack → Ettool controls: requests settings
- Linux network stack → Traffic control: configures traffic
- Driver administrator → Driver controls: sets controls
- MAC driver → MDIO management: manages PHY
- MAC driver → PCS link: reads link state (evidence: `tc956xmac_main.c`)
- MAC driver → PMA access: accesses PMA
- MAC driver → PTP timestamping: uses PTP (evidence: `tc956xmac_main.c`)
- MAC driver → Timestamp configuration: configures timestamps
- Driver administrator → PCIe diagnostics: reads diagnostics
