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

@@ -0,0 +1,249 @@
#!/usr/bin/env bash
set -euo pipefail
# split-kernel-patch.sh
# Split one big git-style patch into one patch file per touched file, then
# optionally apply them one by one and stop at the first failure.
#
# Defaults match your ASK kernel patch workflow.
#
# Usage:
# ./split-kernel-patch.sh split
# ./split-kernel-patch.sh apply
# ./split-kernel-patch.sh check
# ./split-kernel-patch.sh reset-output
#
# Env overrides:
# PATCH_FILE=/src/ASK/patches/kernel/002-mono-gateway-ask-kernel_linux_6_12.patch
# LINUX_DIR=/src/linux
# OUT_DIR=/src/ASK/patches/kernel/split-002
# FUZZ=0
# USE_PATCH=0 # 0 = git apply, 1 = patch utility
# THREEWAY=0 # git apply --3way when USE_PATCH=0
# UPDATED_PATCH_DIR=/src/ASK/patches/kernel/updated-patch
# # If a file with the same basename exists here, use it
# # instead of the generated split fragment.
PATCH_FILE="${PATCH_FILE:-/src/ASK/patches/kernel/002-mono-gateway-ask-kernel_linux_6_12.patch}"
LINUX_DIR="${LINUX_DIR:-/src/linux}"
OUT_DIR="${OUT_DIR:-/src/ASK/patches/kernel/split-002}"
FUZZ="${FUZZ:-0}"
USE_PATCH="${USE_PATCH:-0}"
THREEWAY="${THREEWAY:-0}"
UPDATED_PATCH_DIR="${UPDATED_PATCH_DIR:-$(dirname "$OUT_DIR")/updated-patch}"
SERIES_FILE="${OUT_DIR}/series"
LOG_FILE="${OUT_DIR}/apply.log"
usage() {
sed -n '1,35p' "$0" >&2
}
need_file() {
[ -f "$1" ] || { echo "ERROR: missing file: $1" >&2; exit 1; }
}
need_dir() {
[ -d "$1" ] || { echo "ERROR: missing directory: $1" >&2; exit 1; }
}
resolve_patch_file() {
# Generated split fragments are immutable-ish. During porting, put a
# corrected replacement patch in UPDATED_PATCH_DIR with the exact same
# basename, e.g.:
# updated-patch/0005-drivers__net__ethernet__freescale__sdk_dpaa__dpaa_eth.h.patch
# The apply/check loop will use that replacement instead.
local generated="$1"
local replacement="${UPDATED_PATCH_DIR}/$(basename "$generated")"
if [ -f "$replacement" ]; then
printf '%s\n' "$replacement"
else
printf '%s\n' "$generated"
fi
}
patch_target_file() {
# Best-effort target display for one split fragment. Prefer the b/ path
# from the diff header, fall back to +++ if needed.
awk '
/^diff --git / {
p = $4
sub(/^b\//, "", p)
print p
exit
}
/^\+\+\+ / && $2 != "/dev/null" {
p = $2
sub(/^b\//, "", p)
print p
exit
}
' "$1"
}
reset_output() {
rm -rf "$OUT_DIR"
mkdir -p "$OUT_DIR"
}
split_patch() {
need_file "$PATCH_FILE"
reset_output
# Lossless split: do NOT trim trailing whitespace and do NOT rewrite content.
# Each output starts at a 'diff --git ...' boundary.
awk -v outdir="$OUT_DIR" -v series="$SERIES_FILE" '
function sanitize(s) {
sub(/^b\//, "", s)
gsub(/^\"|\"$/, "", s)
gsub(/\//, "__", s)
gsub(/[^A-Za-z0-9._+-]/, "_", s)
if (length(s) > 160) s = substr(s, 1, 160)
return s
}
BEGIN {
n = 0
out = ""
}
/^diff --git / {
if (out != "") close(out)
n++
path = $4
safe = sanitize(path)
out = sprintf("%s/%04d-%s.patch", outdir, n, safe)
print out >> series
}
{
if (out != "") print $0 > out
}
END {
if (out != "") close(out)
if (n == 0) {
print "ERROR: no diff --git sections found" > "/dev/stderr"
exit 2
}
print n > outdir "/count"
}
' "$PATCH_FILE"
echo "Split $(cat "$OUT_DIR/count") patch fragments into: $OUT_DIR"
echo "Series file: $SERIES_FILE"
}
ensure_split_exists() {
if [ ! -s "$SERIES_FILE" ]; then
echo "=> No split series found, splitting first..."
split_patch
fi
}
apply_one_git() {
patch_file="$1"
args=(--verbose)
if [ "$THREEWAY" = "1" ]; then
args+=(--3way)
fi
git apply "${args[@]}" --check "$patch_file"
git apply "${args[@]}" "$patch_file"
}
apply_one_patch_utility() {
patch_file="$1"
# --forward avoids reapplying already-applied hunks.
# --reject leaves .rej files for manual whack-a-mole.
patch -p1 --forward --batch --fuzz="$FUZZ" --dry-run < "$patch_file"
patch -p1 --forward --batch --fuzz="$FUZZ" --reject < "$patch_file"
}
check_or_apply() {
mode="$1"
ensure_split_exists
need_dir "$LINUX_DIR"
: > "$LOG_FILE"
cd "$LINUX_DIR"
i=0
total=$(wc -l < "$SERIES_FILE" | tr -d ' ')
while IFS= read -r patch_file; do
i=$((i + 1))
generated_patch_file="$patch_file"
patch_file=$(resolve_patch_file "$generated_patch_file")
base=$(basename "$generated_patch_file")
patching_target=$(patch_target_file "$patch_file")
if [ -z "$patching_target" ]; then
patching_target="unknown"
fi
if [ "$patch_file" != "$generated_patch_file" ]; then
echo "=> [$i/$total] $base (using updated-patch override)" | tee -a "$LOG_FILE"
echo " override: $patch_file" >>"$LOG_FILE"
else
echo "=> [$i/$total] $base" | tee -a "$LOG_FILE"
fi
if [ "$mode" = "check" ]; then
if git apply --check "$patch_file" >>"$LOG_FILE" 2>&1; then
echo " OK" | tee -a "$LOG_FILE"
continue
fi
echo " FAIL: $patch_file" | tee -a "$LOG_FILE"
echo "Stopped at: $patch_file"
echo "Inspect log: $LOG_FILE"
echo "Target file: $patching_target"
echo ""
exit 1
fi
if [ "$USE_PATCH" = "1" ]; then
if apply_one_patch_utility "$patch_file" >>"$LOG_FILE" 2>&1; then
echo " applied" | tee -a "$LOG_FILE"
continue
fi
else
if apply_one_git "$patch_file" >>"$LOG_FILE" 2>&1; then
echo " applied" | tee -a "$LOG_FILE"
continue
fi
fi
echo " FAILED: $patch_file" | tee -a "$LOG_FILE"
echo ""
echo "Stopped at: $patch_file"
echo "Inspect log: $LOG_FILE"
echo "Target file: $patching_target"
echo ""
echo "Useful next commands:"
echo " cd $LINUX_DIR"
echo " git diff"
echo " git status --short"
echo " ${USE_PATCH:+find . -name '*.rej' -o -name '*.orig'}"
exit 1
done < "$SERIES_FILE"
echo "All $total patch fragments ${mode}ed successfully."
}
cmd="${1:-split}"
case "$cmd" in
split)
split_patch
;;
check)
check_or_apply check
;;
apply)
check_or_apply apply
;;
reset-output)
reset_output
;;
*)
usage
exit 2
;;
esac