Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 61 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
# ------------------------------------------------------------------
dkms-test:
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
Expand All @@ -37,14 +38,18 @@ jobs:
- uses: actions/checkout@v4

- name: Install DKMS dependencies
timeout-minutes: 12
run: |
sudo apt-get update
sudo apt-get install -y dkms gcc make ethtool linuxptp \
linux-headers-$(uname -r) \
linux-modules-extra-$(uname -r) || {
echo "::error::Could not install kernel headers/modules for $(uname -r)"
exit 1
}
sudo bash "$GITHUB_WORKSPACE/scripts/ci-apt.sh" update
sudo bash "$GITHUB_WORKSPACE/scripts/ci-apt.sh" install \
dkms gcc make ethtool linuxptp \
linux-headers-$(uname -r)

- name: Install extra kernel modules
timeout-minutes: 12
run: |
# gnss.ko is in extra-modules on Azure kernels; netdevsim needs it.
sudo bash "$GITHUB_WORKSPACE/scripts/ci-install-extra-modules.sh"

- name: Install DKMS source tree
run: |
Expand Down Expand Up @@ -73,11 +78,19 @@ jobs:
id: load
run: |
set -e
sudo modprobe gnss && echo "gnss loaded" || echo "gnss skipped"
sudo modprobe nsim_ptp && echo "nsim_ptp loaded"
sudo modprobe nsim_ptp_mock && echo "nsim_ptp_mock loaded"
sudo modprobe nsim_dpll && echo "nsim_dpll loaded"
sudo modprobe netdevsim pci_bus_nr=0x1f && echo "netdevsim loaded"
sudo modprobe gnss && echo "gnss loaded" || echo "gnss skipped"
sudo modprobe nsim_ptp
echo "nsim_ptp loaded"
sudo modprobe nsim_ptp_mock
echo "nsim_ptp_mock loaded"
sudo modprobe nsim_dpll
echo "nsim_dpll loaded"
if ! sudo modprobe netdevsim pci_bus_nr=0x1f; then
echo "::error::netdevsim failed to load (needs gnss from linux-modules-extra)"
sudo dmesg | tail -n 40 || true
exit 1
fi
echo "netdevsim loaded"
lsmod | grep -E 'nsim_ptp|nsim_dpll|netdevsim|gnss' || true
sudo chmod 666 /dev/nsim_ptp* 2>/dev/null || true
echo "load_ok=true" >> "$GITHUB_OUTPUT"
Expand Down Expand Up @@ -159,6 +172,7 @@ jobs:
- uses: actions/checkout@v4

- name: Install latest podman
timeout-minutes: 10
run: |
. /etc/os-release
sudo mkdir -p /etc/apt/keyrings
Expand All @@ -167,9 +181,11 @@ jobs:
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/devel_kubic_libcontainers_unstable.gpg] \
https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_${VERSION_ID}/ /" \
| sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:unstable.list >/dev/null
sudo apt-get update
sudo apt-get install -y podman
sudo bash "$GITHUB_WORKSPACE/scripts/ci-apt.sh" update
sudo bash "$GITHUB_WORKSPACE/scripts/ci-apt.sh" install podman
podman --version
# Serialize podman CLI via one API server (avoids Kind exec SQLite deadlock).
sudo bash "$GITHUB_WORKSPACE/scripts/start-podman-api-service.sh"

- name: Clone ptp-operator
run: |
Expand All @@ -181,7 +197,7 @@ jobs:
sudo bash -l <<'BUILD'
set -euo pipefail
set -x
export PATH=/usr/local/go/bin:/root/go/bin:$PATH
export PATH=/usr/local/ptp-podman-wrap:/usr/local/bin:/usr/local/go/bin:/root/go/bin:$PATH
export KIND_EXPERIMENTAL_PROVIDER=podman
export BUILDAH_LAYERS=true
export BUILDAH_HISTORY=true
Expand All @@ -190,6 +206,8 @@ jobs:
VM_IP=$(hostname -I | awk '{print $1}')
cd /root/ptp-operator/scripts
./run-on-vm.sh --dkms --images "${VM_IP}"

rm -rf /tmp/go-build* /root/.cache/go-build
BUILD

- name: Upload image tarball
Expand Down Expand Up @@ -221,6 +239,7 @@ jobs:
- uses: actions/checkout@v4

- name: Install latest podman
timeout-minutes: 10
run: |
. /etc/os-release
if [[ "${VERSION_ID}" == "22.04" ]]; then
Expand All @@ -230,13 +249,12 @@ jobs:
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/devel_kubic_libcontainers_unstable.gpg] \
https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_${VERSION_ID}/ /" \
| sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:unstable.list >/dev/null
sudo apt-get update
sudo apt-get install -y podman
else
sudo apt-get update
sudo apt-get install -y podman
fi
sudo bash "$GITHUB_WORKSPACE/scripts/ci-apt.sh" update
sudo bash "$GITHUB_WORKSPACE/scripts/ci-apt.sh" install podman
podman --version
# Serialize podman CLI via one API server (avoids Kind exec SQLite deadlock).
sudo bash "$GITHUB_WORKSPACE/scripts/start-podman-api-service.sh"

- name: Install OpenShift CLI (oc)
run: |
Expand All @@ -248,10 +266,16 @@ jobs:
oc version --client

- name: Install DKMS dependencies
timeout-minutes: 12
run: |
sudo bash "$GITHUB_WORKSPACE/scripts/ci-apt.sh" install \
dkms gcc make ethtool linuxptp \
linux-headers-$(uname -r)

- name: Install extra kernel modules
timeout-minutes: 12
run: |
sudo apt-get install -y dkms gcc make ethtool linuxptp \
linux-headers-$(uname -r) \
linux-modules-extra-$(uname -r)
sudo bash "$GITHUB_WORKSPACE/scripts/ci-install-extra-modules.sh"

- name: Build and install DKMS modules
run: |
Expand Down Expand Up @@ -281,20 +305,32 @@ jobs:
sudo bash -l <<'LOAD'
set -euo pipefail
set -x
export PATH=/usr/local/go/bin:/root/go/bin:$PATH
export PATH=/usr/local/ptp-podman-wrap:/usr/local/bin:/usr/local/go/bin:/root/go/bin:$PATH
export KIND_EXPERIMENTAL_PROVIDER=podman

VM_IP=$(hostname -I | awk '{print $1}')
cd /root/ptp-operator/scripts
./run-on-vm.sh --dkms --load /tmp/ptp-images.tar "${VM_IP}"
LOAD

- name: "Free disk space before tests"
run: |
sudo bash -l <<'CLEANUP'
set -euo pipefail
rm -rf /tmp/ptp-images.tar /tmp/ptp-images-load
rm -rf /tmp/go-build* /var/cache/apt /root/.cache
sync
echo 3 > /proc/sys/vm/drop_caches || true
df -h
free -h
CLEANUP

- name: "Run scenario: ${{ matrix.mode }}"
run: |
sudo bash -l <<'DEPLOY'
set -euo pipefail
set -x
export PATH=/usr/local/go/bin:/root/go/bin:$PATH
export PATH=/usr/local/ptp-podman-wrap:/usr/local/bin:/usr/local/go/bin:/root/go/bin:$PATH
export KIND_EXPERIMENTAL_PROVIDER=podman

VM_IP=$(hostname -I | awk '{print $1}')
Expand Down
10 changes: 7 additions & 3 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ renaming happens at the preprocessor level.
## Kernel Version Compatibility Layer

`include/dkms_compat.h` provides shims so the 6.9.5 source compiles on
kernels from **6.8** (Ubuntu 22.04) through **6.17** (Ubuntu 24.04 HWE):
kernels from **6.8** (Ubuntu 22.04) through **7.0** (Ubuntu 24.04.5 HWE):

| Shim | Kernel boundary | What changed |
|------|----------------|--------------|
Expand All @@ -154,7 +154,9 @@ kernels from **6.8** (Ubuntu 22.04) through **6.17** (Ubuntu 24.04 HWE):
| `HAVE_DEBUGFS_GET_AUX` | >= 6.16 | `debugfs_real_fops` removed, new aux API |
| `HAVE_XFRMDEV_OPS_DEV_PARAM` | >= 6.16 | xfrm callbacks gained `net_device *` param |
| `UDP_TUNNEL_NIC_INFO_MAY_SLEEP` | >= 6.17 → stub 0 | Flag removed from tunnel infrastructure |
| `HAVE_DEVLINK_HEALTH_REPORTER_OPS_PERIOD` | >= 6.18 | `devl_health_reporter_create` dropped graceful_period |
| `NSIM_ETHTOOL_TS_INFO` | >= 6.11 | `ethtool_ts_info` → `kernel_ethtool_ts_info` |
| vendored `include/linux/dpll.h` | >= 7.0 | Host DPLL kAPI added `dpll_tracker *`; keep 6.9.5 get/put |

Each block is guarded by `LINUX_VERSION_CODE` so the code compiles
cleanly on the native 6.9.x tree as well (no shims active).
Expand Down Expand Up @@ -221,9 +223,10 @@ Format: `<id> <pci_addr> <logical_clk_id> [num_ports]`
netdevsim-dkms/
├── .github/workflows/ci.yml # GitHub Actions CI
├── include/
│ ├── dkms_compat.h # Kernel version shims (6.8 → 6.17)
│ ├── dkms_compat.h # Kernel version shims (6.8 → 7.0)
│ ├── nsim_rename.h # nsim_ symbol prefix macros
│ └── linux/
│ ├── dpll.h # 6.9.5 DPLL kAPI on >= 7.0; include_next otherwise
│ ├── ptp_clock_kernel.h # PTP kernel API header
│ └── ptp_mock.h # Mock PHC API header
├── ptp/ # nsim_ptp.ko + nsim_ptp_mock.ko
Expand Down Expand Up @@ -337,5 +340,6 @@ cloud credentials needed).
| Ubuntu | Kernel | Status |
|--------|--------|--------|
| 22.04 (HWE) | 6.8.x | Tested in CI |
| 24.04 (HWE) | 6.17.x | Tested in CI |
| 24.04.4 (HWE) | 6.17.x | Dual-compat layer |
| 24.04.5 (HWE) | 7.0.x | Tested in CI (ubuntu-24.04) |
| 6.9.x (native) | 6.9.x | Source origin — no shims needed |
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,16 @@ Based on Linux 6.9.5 kernel sources.

## Kernel Compatibility

This package targets **Linux 6.9.x** kernels. Internal kernel APIs (devlink,
dpll, netdevice, PTP) may differ in other kernel versions. Building against a
substantially different kernel version will likely require source modifications.
This package is based on **Linux 6.9.5** sources. `include/dkms_compat.h`
shims the same tree onto nearby kernels:

| Ubuntu | Kernel |
|--------|--------|
| 22.04 HWE | 6.8.x |
| 24.04.4 HWE | 6.17.x |
| 24.04.5 HWE | 7.0.x |

Building against a kernel outside this range will likely need more shims.

## Prerequisites

Expand Down Expand Up @@ -273,7 +280,7 @@ you to remove it or pick a different `--vm-name`.
# Ubuntu 22.04 (kernel 6.8 HWE) — smoke tests only
./scripts/test-utm-ubuntu.sh --release 22.04 --skip-ptp-operator --shell

# Ubuntu 24.04 (kernel 6.17 HWE) — smoke tests only
# Ubuntu 24.04 (kernel 7.0 HWE) — smoke tests only
./scripts/test-utm-ubuntu.sh --release 24.04 --skip-ptp-operator --shell
```

Expand Down
15 changes: 13 additions & 2 deletions include/dkms_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* Kernel version compatibility layer for netdevsim DKMS package.
*
* The DKMS sources originate from Linux 6.9.5. This header provides
* shims so the same source tree compiles against both 6.8.x (Ubuntu
* 22.04) and 6.17.x (Ubuntu 24.04 HWE) kernels.
* shims so the same source tree compiles against 6.8.x (Ubuntu 22.04),
* 6.17.x (Ubuntu 24.04.4 HWE), and 7.0.x (Ubuntu 24.04.5 HWE) kernels.
*
* Each compat block is guarded by LINUX_VERSION_CODE so the module
* builds cleanly on the native 6.9.x tree as well.
Expand Down Expand Up @@ -204,6 +204,17 @@ __dkms_hrtimer_dummy(struct hrtimer *t)
#define UDP_TUNNEL_NIC_INFO_MAY_SLEEP 0
#endif

/*
* ---- devl_health_reporter_create signature --------------------------------
*
* Commit d2b007374551 ("devlink: Move graceful period parameter to
* reporter ops"), merged in v6.18, dropped the graceful_period argument.
* The period now lives in ops->default_graceful_period (0 when unset).
*/
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 18, 0)
#define HAVE_DEVLINK_HEALTH_REPORTER_OPS_PERIOD 1
#endif

/*
* ---- kernel_ethtool_ts_info -----------------------------------------------
*
Expand Down
Loading
Loading