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
49 changes: 35 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ jobs:
# DKMS build + smoke tests (every PR and workflow_dispatch)
# ------------------------------------------------------------------
dkms-test:
runs-on: ubuntu-22.04
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, ubuntu-24.04]
steps:
- name: Runner info
run: |
Expand Down Expand Up @@ -121,7 +125,8 @@ jobs:
- name: Summary
if: always()
run: |
echo "## DKMS Smoke Tests" >> "$GITHUB_STEP_SUMMARY"
echo "## DKMS Smoke Tests (${{ matrix.os }})" >> "$GITHUB_STEP_SUMMARY"
echo "- OS: ${{ matrix.os }}" >> "$GITHUB_STEP_SUMMARY"
echo "- Kernel: $(uname -r)" >> "$GITHUB_STEP_SUMMARY"
echo "- Build: ${{ steps.build.outputs.status || 'unknown' }}" >> "$GITHUB_STEP_SUMMARY"
echo "- Load: ${{ steps.load.outputs.load_ok || 'false' }}" >> "$GITHUB_STEP_SUMMARY"
Expand Down Expand Up @@ -189,14 +194,15 @@ jobs:
ptp-test:
if: github.event_name == 'workflow_dispatch'
needs: ptp-images
runs-on: ubuntu-22.04
runs-on: ${{ matrix.os }}
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, ubuntu-24.04]
mode: [oc, bc, dualnicbc, dualnicbcha, dualfollower]
steps:
- name: "Runner info (${{ matrix.mode }})"
- name: "Runner info (${{ matrix.os }} / ${{ matrix.mode }})"
run: |
echo "CPUs: $(nproc)"
echo "RAM: $(free -h | awk '/Mem:/{print $2}')"
Expand All @@ -207,16 +213,30 @@ jobs:
- name: Install latest podman
run: |
. /etc/os-release
sudo mkdir -p /etc/apt/keyrings
curl -fsSL "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_${VERSION_ID}/Release.key" \
| sudo gpg --dearmor --yes -o /etc/apt/keyrings/devel_kubic_libcontainers_unstable.gpg
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
if [[ "${VERSION_ID}" == "22.04" ]]; then
sudo mkdir -p /etc/apt/keyrings
curl -fsSL "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_${VERSION_ID}/Release.key" \
| sudo gpg --dearmor --yes -o /etc/apt/keyrings/devel_kubic_libcontainers_unstable.gpg
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
podman --version

- name: Install OpenShift CLI (oc)
run: |
if ! command -v oc &>/dev/null; then
curl -sLO https://mirror.openshift.com/pub/openshift-v4/clients/ocp/stable/openshift-client-linux.tar.gz
sudo tar xzf openshift-client-linux.tar.gz -C /usr/local/bin oc kubectl
rm -f openshift-client-linux.tar.gz
fi
oc version --client

- name: Install DKMS dependencies
run: |
sudo apt-get install -y dkms gcc make ethtool linuxptp \
Expand Down Expand Up @@ -276,7 +296,7 @@ jobs:
if: always()
uses: actions/upload-artifact@v4
with:
name: ptp-artifacts-${{ matrix.mode }}
name: ptp-artifacts-${{ matrix.os }}-${{ matrix.mode }}
path: /tmp/artifacts/
if-no-files-found: ignore

Expand All @@ -292,5 +312,6 @@ jobs:
- name: Summary
if: always()
run: |
echo "## ptp-operator: ${{ matrix.mode }}" >> "$GITHUB_STEP_SUMMARY"
echo "## ptp-operator: ${{ matrix.os }} / ${{ matrix.mode }}" >> "$GITHUB_STEP_SUMMARY"
echo "- OS: ${{ matrix.os }}" >> "$GITHUB_STEP_SUMMARY"
echo "- Kernel: $(uname -r)" >> "$GITHUB_STEP_SUMMARY"
106 changes: 99 additions & 7 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 6.8.x kernels
* (ubuntu-22.04 runners).
* shims so the same source tree compiles against both 6.8.x (Ubuntu
* 22.04) and 6.17.x (Ubuntu 24.04 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 @@ -44,9 +44,12 @@
/*
* ---- PTP_EXTTS_EVENT_VALID / PTP_EXT_OFFSET flags -------------------------
*
* These flags on struct ptp_extts_event were added together with EXTOFF.
* These flags on struct ptp_extts_event were added together with EXTOFF
* in v6.9. On 6.8.x they don't exist in the kernel headers so we
* define them to 0 (no-ops). On 6.9+ (including 6.17) the kernel's
* uapi/linux/ptp_clock.h already defines them, so we must not redefine.
*/
#ifndef PTP_EXTTS_EVENT_VALID
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 9, 0)
#define PTP_EXTTS_EVENT_VALID 0
#define PTP_EXT_OFFSET 0
#endif
Expand Down Expand Up @@ -85,14 +88,21 @@
/*
* ---- genlmsg_multicast_allns compat ---------------------------------------
*
* On 6.8 the signature is (family, skb, portid, flags) — no group param.
* On 6.9+ it is (family, skb, portid, group, flags).
* Provide a wrapper that drops the group arg on 6.8.
* The signature has changed across kernel versions:
* < 6.9: (family, skb, portid, flags) — no group
* 6.9-6.11: (family, skb, portid, group, flags) — our 6.9.5 source
* >= 6.12: (family, skb, portid, group) — flags removed
*
* Our source uses the 5-arg form. Map it to the right kernel signature.
*/
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 9, 0)
#include <net/genetlink.h>
#define genlmsg_multicast_allns(family, skb, portid, group, flags) \
(genlmsg_multicast_allns)(family, skb, portid, flags)
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(6, 12, 0)
#include <net/genetlink.h>
#define genlmsg_multicast_allns(family, skb, portid, group, flags) \
(genlmsg_multicast_allns)(family, skb, portid, group)
#endif

/*
Expand All @@ -112,6 +122,30 @@ static inline int nla_put_sint(struct sk_buff *msg, int attrtype, s64 value)
}
#endif

/*
* ---- hrtimer_init removal -------------------------------------------------
*
* hrtimer_init() was removed in v6.15 in favour of hrtimer_setup()
* which combines initialisation and callback assignment. Our 6.9.5
* source still uses the old two-step pattern:
* hrtimer_init(&t, clock, mode);
* t.function = callback;
*
* On >= 6.15, provide an inline shim that maps hrtimer_init() to
* hrtimer_setup() with a dummy callback; the real callback assignment
* on the next line will overwrite it.
*/
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 15, 0)
#include <linux/hrtimer.h>
static enum hrtimer_restart __maybe_unused
__dkms_hrtimer_dummy(struct hrtimer *t)
{
return HRTIMER_NORESTART;
}
#define hrtimer_init(timer, which_clock, mode) \
hrtimer_setup(timer, __dkms_hrtimer_dummy, which_clock, mode)
#endif

/*
* ---- cyclecounter const qualifier -----------------------------------------
*
Expand All @@ -126,6 +160,64 @@ static inline int nla_put_sint(struct sk_buff *msg, int attrtype, s64 value)
#define CYCLECOUNTER_READ_CONST const
#endif

/*
* ---- no_llseek removal ----------------------------------------------------
*
* no_llseek was removed from <linux/fs.h> in v6.12. Our fib.c still
* references it. Map to noop_llseek which is equivalent and still exists.
*/
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 12, 0)
#define no_llseek noop_llseek
#endif

/*
* ---- debugfs_real_fops removal / debugfs_get_aux --------------------------
*
* debugfs_real_fops() was removed in v6.16 as part of the debugfs proxy
* refactor. The replacement pattern uses debugfs_get_aux() with
* debugfs_create_file_aux() and struct debugfs_short_fops (added in v6.13).
*
* hwstats.c uses #ifdef HAVE_DEBUGFS_GET_AUX to select the right API.
*/
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 16, 0)
#define HAVE_DEBUGFS_GET_AUX 1
#endif

/*
* ---- xfrmdev_ops signature change -----------------------------------------
*
* The xdo_dev_state_add/delete/free callbacks gained an explicit
* struct net_device * first parameter in v6.16.
*/
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 16, 0)
#define HAVE_XFRMDEV_OPS_DEV_PARAM 1
#endif

/*
* ---- UDP_TUNNEL_NIC_INFO_MAY_SLEEP removal --------------------------------
*
* The flag was removed in v6.17 when the UDP tunnel NIC infrastructure
* switched from rtnl_lock to a dedicated mutex. Define it as 0 so
* existing code that sets the flag becomes a harmless no-op.
*/
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 17, 0)
#define UDP_TUNNEL_NIC_INFO_MAY_SLEEP 0
#endif

/*
* ---- kernel_ethtool_ts_info -----------------------------------------------
*
* struct kernel_ethtool_ts_info was introduced in v6.11 as a kernel-only
* replacement for struct ethtool_ts_info in the get_ts_info() callback.
* Our 6.9.5 source uses the old struct name. Provide a typedef so the
* function signature matches whichever kernel we build against.
*/
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 11, 0)
#define NSIM_ETHTOOL_TS_INFO struct kernel_ethtool_ts_info
#else
#define NSIM_ETHTOOL_TS_INFO struct ethtool_ts_info
#endif

/*
* ---- ptp_clock_freerun ----------------------------------------------------
*
Expand Down
2 changes: 1 addition & 1 deletion netdevsim/ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ nsim_set_fecparam(struct net_device *dev, struct ethtool_fecparam *fecparam)
}

static int nsim_get_ts_info(struct net_device *dev,
struct ethtool_ts_info *info)
NSIM_ETHTOOL_TS_INFO *info)
{
struct netdevsim *ns = netdev_priv(dev);

Expand Down
30 changes: 29 additions & 1 deletion netdevsim/hwstats.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,9 @@ enum nsim_dev_hwstats_do {
};

struct nsim_dev_hwstats_fops {
#ifndef HAVE_DEBUGFS_GET_AUX
const struct file_operations fops;
#endif
enum nsim_dev_hwstats_do action;
enum netdev_offload_xstats_type type;
};
Expand All @@ -342,13 +344,17 @@ nsim_dev_hwstats_do_write(struct file *file,
size_t count, loff_t *ppos)
{
struct nsim_dev_hwstats *hwstats = file->private_data;
struct nsim_dev_hwstats_fops *hwsfops;
const struct nsim_dev_hwstats_fops *hwsfops;
struct list_head *hwsdev_list;
int ifindex;
int err;

#ifdef HAVE_DEBUGFS_GET_AUX
hwsfops = debugfs_get_aux(file);
#else
hwsfops = container_of(debugfs_real_fops(file),
struct nsim_dev_hwstats_fops, fops);
#endif

err = kstrtoint_from_user(data, count, 0, &ifindex);
if (err)
Expand Down Expand Up @@ -381,6 +387,18 @@ nsim_dev_hwstats_do_write(struct file *file,
return count;
}

#ifdef HAVE_DEBUGFS_GET_AUX
static struct debugfs_short_fops nsim_hwstats_short_fops = {
.write = nsim_dev_hwstats_do_write,
.llseek = generic_file_llseek,
};

#define NSIM_DEV_HWSTATS_FOPS(ACTION, TYPE) \
{ \
.action = ACTION, \
.type = TYPE, \
}
#else
#define NSIM_DEV_HWSTATS_FOPS(ACTION, TYPE) \
{ \
.fops = { \
Expand All @@ -392,6 +410,7 @@ nsim_dev_hwstats_do_write(struct file *file,
.action = ACTION, \
.type = TYPE, \
}
#endif

static const struct nsim_dev_hwstats_fops nsim_dev_hwstats_l3_disable_fops =
NSIM_DEV_HWSTATS_FOPS(NSIM_DEV_HWSTATS_DO_DISABLE,
Expand Down Expand Up @@ -433,12 +452,21 @@ int nsim_dev_hwstats_init(struct nsim_dev *nsim_dev)
goto err_remove_hwstats_recursive;
}

#ifdef HAVE_DEBUGFS_GET_AUX
debugfs_create_file_aux("enable_ifindex", 0200, hwstats->l3_ddir, hwstats,
&nsim_dev_hwstats_l3_enable_fops, &nsim_hwstats_short_fops);
debugfs_create_file_aux("disable_ifindex", 0200, hwstats->l3_ddir, hwstats,
&nsim_dev_hwstats_l3_disable_fops, &nsim_hwstats_short_fops);
debugfs_create_file_aux("fail_next_enable", 0200, hwstats->l3_ddir, hwstats,
&nsim_dev_hwstats_l3_fail_fops, &nsim_hwstats_short_fops);
#else
debugfs_create_file("enable_ifindex", 0200, hwstats->l3_ddir, hwstats,
&nsim_dev_hwstats_l3_enable_fops.fops);
debugfs_create_file("disable_ifindex", 0200, hwstats->l3_ddir, hwstats,
&nsim_dev_hwstats_l3_disable_fops.fops);
debugfs_create_file("fail_next_enable", 0200, hwstats->l3_ddir, hwstats,
&nsim_dev_hwstats_l3_fail_fops.fops);
#endif

INIT_DELAYED_WORK(&hwstats->traffic_dw,
&nsim_dev_hwstats_traffic_work);
Expand Down
17 changes: 14 additions & 3 deletions netdevsim/ipsec.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,17 +125,22 @@ static int nsim_ipsec_parse_proto_keys(struct xfrm_state *xs,
return 0;
}

#ifdef HAVE_XFRMDEV_OPS_DEV_PARAM
static int nsim_ipsec_add_sa(struct net_device *dev,
struct xfrm_state *xs,
struct netlink_ext_ack *extack)
{
#else
static int nsim_ipsec_add_sa(struct xfrm_state *xs,
struct netlink_ext_ack *extack)
{
struct net_device *dev = xs->xso.real_dev;
#endif
struct nsim_ipsec *ipsec;
struct net_device *dev;
struct netdevsim *ns;
struct nsim_sa sa;
u16 sa_idx;
int ret;

dev = xs->xso.real_dev;
ns = netdev_priv(dev);
ipsec = &ns->ipsec;

Expand Down Expand Up @@ -197,9 +202,15 @@ static int nsim_ipsec_add_sa(struct xfrm_state *xs,
return 0;
}

#ifdef HAVE_XFRMDEV_OPS_DEV_PARAM
static void nsim_ipsec_del_sa(struct net_device *dev, struct xfrm_state *xs)
{
struct netdevsim *ns = netdev_priv(dev);
#else
static void nsim_ipsec_del_sa(struct xfrm_state *xs)
{
struct netdevsim *ns = netdev_priv(xs->xso.real_dev);
#endif
struct nsim_ipsec *ipsec = &ns->ipsec;
u16 sa_idx;

Expand Down
Loading
Loading