Successfully build based on ASK and run k8s, cdx pending

This commit is contained in:
2026-05-10 04:35:55 +08:00
parent 9c6fb5194e
commit 9fd18cfe6f
11 changed files with 403 additions and 271 deletions

View File

@@ -0,0 +1,62 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: builder <builder@localhost>
Date: Sun, 10 May 2026 00:00:00 +0000
Subject: [PATCH] auto_bridge: adapt timer API names for Linux 6.18
Linux 6.18 uses the renamed timer helpers. Update the vendor
module to use timer_delete() and timer_container_of().
---
auto_bridge/auto_bridge.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
--- a/auto_bridge/auto_bridge.c
+++ b/auto_bridge/auto_bridge.c
@@ -243,7 +243,7 @@
list_add(&table_entry->list_msg_to_send, &l2flow_list_msg_to_send);
work_to_do = 1;
}
- if (del_timer(&table_entry->timeout) || no_timer)
+ if (timer_delete(&table_entry->timeout) || no_timer)
__abm_go_dying(table_entry);
}
}
@@ -604,7 +604,7 @@
****************************************************************************/
static void abm_death_by_timeout(struct timer_list *t)
{
- struct l2flowTable *table_entry = from_timer(table_entry, t, timeout);
+ struct l2flowTable *table_entry = timer_container_of(table_entry, t, timeout);
spin_lock_bh(&abm_lock);
__abm_go_dying(table_entry);
@@ -671,7 +671,7 @@
/* Flow is programmed in FPP */
table_entry->state = L2FLOW_STATE_FF;
/* If timer already expired we'll die, it's ok though... */
- del_timer(&table_entry->timeout);
+ timer_delete(&table_entry->timeout);
}
else if(flags & L2FLOW_DENIED){
/* Flow is not programmed in FPP */
@@ -735,7 +735,7 @@
}
/* Die soon or now */
- if(del_timer(&table_entry->timeout) || (table_entry->state == L2FLOW_STATE_FF))
+ if(timer_delete(&table_entry->timeout) || (table_entry->state == L2FLOW_STATE_FF))
__abm_go_dying(table_entry);
}
else{
@@ -1093,7 +1093,7 @@
list_for_each_safe(entry, tmp, &l2flow_table[i]){
table_entry = container_of(entry, struct l2flowTable, list);
table_entry->flags |= L2FLOW_FL_DEAD;
- if(del_timer(&table_entry->timeout) || table_entry->state == L2FLOW_STATE_FF)
+ if(timer_delete(&table_entry->timeout) || table_entry->state == L2FLOW_STATE_FF)
__abm_go_dying(table_entry);
}
}
--
2.43.0

View File

@@ -0,0 +1,24 @@
From c772418b42580bcf9d9b863e742df7ae3f921176 Mon Sep 17 00:00:00 2001
From: test <test@example.com>
Date: Sat, 9 May 2026 16:59:25 +0000
Subject: [PATCH 1/2] cdx: do not start dpa_app from kernel module
diff --git a/cdx/cdx_main.c b/cdx/cdx_main.c
index 2d7b72b..ec763cb 100644
--- a/cdx/cdx_main.c
+++ b/cdx/cdx_main.c
@@ -8,8 +8,8 @@
*
*/
-//uncomment to start dpa_app from cdx module
-#define START_DPA_APP 1
+// Start dpa_app from userspace service ordering instead of kernel module init.
+// #define START_DPA_APP 1
#define DEFINE_GLOBALS
#include "portdefs.h"
--
2.47.3

View File

@@ -0,0 +1,39 @@
From 919ea304abf495a7142639e51555508fa1b23a30 Mon Sep 17 00:00:00 2001
From: test <test@example.com>
Date: Sat, 9 May 2026 16:59:28 +0000
Subject: [PATCH 2/2] cdx: do not fail module init for absent optional offloads
diff --git a/cdx/cdx_main.c b/cdx/cdx_main.c
index ec763cb..641121b 100644
--- a/cdx/cdx_main.c
+++ b/cdx/cdx_main.c
@@ -195,16 +195,17 @@ static int __init cdx_module_init(void)
#ifdef CFG_WIFI_OFFLOAD
rc = dpaa_vwd_init();
if (rc != 0) {
- printk("%s::vwd_driver_init failed\n", __func__);
- goto exit;
+ printk(KERN_WARNING "%s::vwd_driver_init failed rc %d; continuing without wifi offload\n",
+ __func__, rc);
+ rc = 0;
}
#endif
- // initialize global fragmentation params
- if (cdx_init_frag_module()) {
- printk("%s::cdx_init_frag_module failed\n", __func__);
- rc = -EIO;
- goto exit;
- }
+ /*
+ * The vendor fragmentation path assumes its BMan pool/config exists and
+ * can crash in bman_free_pool() when this board profile does not provide
+ * it. Keep CDX usable without the optional fragmentation offload path.
+ */
+ printk(KERN_WARNING "%s::skipping cdx_init_frag_module on this platform\n", __func__);
#ifdef DPA_IPSEC_OFFLOAD
if (cdx_dpa_ipsec_init()) {
--
2.47.3

View File

@@ -0,0 +1,52 @@
--- a/cdx/devoh.c
+++ b/cdx/devoh.c
@@ -313,6 +313,7 @@
uint32_t port_idx;
uint8_t oh_iface_name[8]="";
+ printk(KERN_INFO "%s::adding OH iface name=%s\n", __func__, name);
if (sscanf(name, "dpa-fman%d-oh@%d", &fman_idx,
&port_idx) != 2) {
@@ -331,6 +332,8 @@
DPA_ERROR("%s::oh_port_driver_get_port_info failed\n", __func__);
return FAILURE;
}
+ printk(KERN_INFO "%s::OH port info name=%s channel=%u default_fqid=0x%x err_fqid=0x%x\n",
+ __func__, name, info.channel_id, info.default_fqid, info.err_fqid);
//ethernet/physical iface type
iface_info = (struct dpa_iface_info *)
kzalloc(sizeof(struct dpa_iface_info), GFP_KERNEL);
@@ -358,6 +361,10 @@
__func__, name);
goto err_ret;
}
+ printk(KERN_INFO "%s::CDX OH iface config found name=%s fman=%u port_idx=%u portid=%u max_dist=%u\n",
+ __func__, name,
+ iface_info->oh_info.fman_idx, iface_info->oh_info.port_idx,
+ iface_info->oh_info.portid, iface_info->oh_info.max_dist);
if (cdx_create_dir_in_procfs(&iface_info->pcd_proc_entry, oh_iface_name, PCD_DIR)) {
DPA_ERROR("%s:: create pcd proc entry failed %s\n",
__func__, name);
@@ -581,6 +588,10 @@
#endif
}
//add fqid information into of port list
+ printk(KERN_INFO "%s::created OH FQs name=%s fman=%u port_idx=%u rx_default_fqid=0x%x rx_err_fqid=0x%x channel=0x%x\n",
+ __func__, dpa_oh_iface_info->name, iface_info->fman_idx,
+ iface_info->port_idx, iface_info->fqinfo[RX_DEFA_FQ].fq_base,
+ iface_info->fqinfo[RX_ERR_FQ].fq_base, iface_info->channel_id);
port_info->fm_idx = iface_info->fman_idx;
port_info->ohinfo = iface_info;
port_info->channel = iface_info->channel_id;
@@ -600,6 +611,10 @@
}
offline_port_info[iface_info->fman_idx][iface_info->port_idx].flags |=
(OF_FQID_VALID | PORT_VALID);
+ printk(KERN_INFO "%s::OH port registered name=%s fman=%u port_idx=%u flags=0x%x\n",
+ __func__, port_info->name, iface_info->fman_idx,
+ iface_info->port_idx,
+ offline_port_info[iface_info->fman_idx][iface_info->port_idx].flags);
return 0;
}

View File

@@ -1,87 +0,0 @@
# mono-ask.mk
# Custom wrapper to build the NXP ASK for the monok8s Alpine/musl ecosystem
# Define default paths and cross-compilers
KDIR?= /src/linux
ASK_DIR?= $(CURDIR)
ARCH?= arm64
GNU_CROSS?= aarch64-linux-gnu-
MUSL_HOST?= aarch64-linux-musl
STAMPS_DIR := $(ASK_DIR)/sources/.stamps
FMLIB_DIR := $(ASK_DIR)/sources/fmlib
FMC_BASE := $(ASK_DIR)/sources/fmc
FMC_DIR := $(FMC_BASE)/source
SYSROOT_PATH := /opt/aarch64-linux-musl-cross/aarch64-linux-musl
.PHONY: prepare-kernel build-kernel modules userspace dist
prepare-preloaded-sources:
@echo "--> Initializing dummy git repos and building preloaded fmlib/fmc..."
mkdir -p $(STAMPS_DIR)
git config --global user.email "monok8s@localhost"
git config --global user.name "monok8s authors"
git config --global --add safe.directory '*'
# Inject libmnl.pc into the vendor's isolated sysroot to satisfy pkg-config
mkdir -p $(ASK_DIR)/sources/sysroot/lib/pkgconfig
cp -a $(SYSROOT_PATH)/lib/pkgconfig/libmnl.pc $(ASK_DIR)/sources/sysroot/lib/pkgconfig/
# Handle fmlib: Initialize dummy repo, patch, and build
cd $(FMLIB_DIR) && git init -q && git add -A && git commit -q -m "base"
cd $(FMLIB_DIR) && git apply $(ASK_DIR)/patches/fmlib/01-mono-ask-extensions.patch
$(MAKE) -C $(FMLIB_DIR) CROSS_COMPILE=$(MUSL_HOST)- KERNEL_SRC=$(KDIR) libfm-arm.a
ln -sf libfm-arm.a $(FMLIB_DIR)/libfm.a
touch $(STAMPS_DIR)/fmlib
# Handle fmc: Initialize dummy repo, patch, and build
cd $(FMC_BASE) && git init -q && git add -A && git commit -q -m "base"
cd $(FMC_BASE) && git apply $(ASK_DIR)/patches/fmc/01-mono-ask-extensions.patch
$(MAKE) -C $(FMC_DIR) CC="$(MUSL_HOST)-gcc -static" CXX="$(MUSL_HOST)-g++ -static" AR=$(MUSL_HOST)-ar \
MACHINE=ls1046 \
FMD_USPACE_HEADER_PATH=$(FMLIB_DIR)/include/fmd \
FMD_USPACE_LIB_PATH=$(FMLIB_DIR) \
LIBXML2_HEADER_PATH=$(SYSROOT_PATH)/include/libxml2 \
TCLAP_HEADER_PATH=$(SYSROOT_PATH)/include
touch $(STAMPS_DIR)/fmc
# 1. Patch the kernel and merge our custom Kubernetes configuration
prepare-kernel:
@echo "--> Patching the Linux kernel with NXP DPAA extensions..."
cd $(KDIR) && patch -p1 < $(ASK_DIR)/patches/kernel/002-mono-gateway-ask-kernel_linux_6_12.patch
@echo "--> Merging NXP defconfig with Kubernetes extra config..."
cp $(ASK_DIR)/config/kernel/defconfig $(KDIR)/.config
cd $(KDIR) && ./scripts/kconfig/merge_config.sh -m .config /src/kernel-extra.config
$(MAKE) -C $(KDIR) ARCH=$(ARCH) CROSS_COMPILE=$(GNU_CROSS) olddefconfig
/src/ensure-kconfig.sh $(KDIR)/.config /src/kernel-extra.config
# 2. Build the kernel tree (mandatory before out-of-tree modules can be built)
build-kernel: prepare-kernel
@echo "--> Building the Linux kernel natively..."
# Replace "dtbs" with the exact path to your target dtb
$(MAKE) -C $(KDIR) ARCH=$(ARCH) CROSS_COMPILE=$(GNU_CROSS) -j$$(nproc) \
Image modules freescale/mono-gateway-dk-sdk.dtb
# 3. Build the ASK out-of-tree modules using the vendor Makefile
modules: build-kernel
@echo "--> Building ASK out-of-tree modules..."
$(MAKE) -f Makefile modules KDIR=$(KDIR) CROSS_COMPILE=$(GNU_CROSS) ARCH=$(ARCH)
# 4. Build the ASK userspace daemons using the musl cross-compiler
userspace: prepare-preloaded-sources
@echo "--> Building ASK sources and libraries..."
$(MAKE) -f Makefile sources KDIR=$(KDIR) CROSS_COMPILE=$(MUSL_HOST)- ARCH=$(ARCH) HOST=$(MUSL_HOST)
@echo "--> Stripping -Werror from vendor Makefiles for modern GCC compatibility..."
sed -i 's/-Werror//g' $(ASK_DIR)/cmm/Makefile
sed -i 's/-Werror//g' $(ASK_DIR)/dpa_app/Makefile
@echo "--> Building ASK userspace executables statically..."
$(MAKE) -f Makefile userspace KDIR=$(KDIR) CROSS_COMPILE=$(MUSL_HOST)- ARCH=$(ARCH) HOST=$(MUSL_HOST) CC='"$(MUSL_HOST)-gcc -static"' CXX='"$(MUSL_HOST)-g++ -static"'
# 5. Extract artifacts
dist:
@echo "--> Staging artifacts..."
$(MAKE) -f Makefile dist KDIR=$(KDIR) CROSS_COMPILE=$(GNU_CROSS) ARCH=$(ARCH)