Files
monok8s/patches/ask/cdx/0002-cdx-do-not-fail-module-init-for-absent-optional-offl.patch
2026-05-10 04:36:51 +08:00

87 lines
2.7 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: builder <builder@localhost>
Date: Sun, 10 May 2026 00:00:00 +0000
Subject: [PATCH] cdx: keep optional offload init failures non-fatal
The CDX module currently treats several board-specific acceleration paths as
mandatory. On boards without VWD/WiFi OH ports, fragmentation BMan pools, or
DPA IPsec OH ports, module init either fails or can crash before returning an
error.
Keep the CDX core loadable when those optional resources are absent:
- warn and continue when VWD/WiFi init fails;
- skip the vendor fragmentation module on this platform, because it can
dereference a missing BMan pool;
- warn and continue when DPA IPsec init fails;
- only initialize DPA IPsec follow-up buffer pools when IPsec init succeeds.
---
cdx/cdx_main.c | 47 +++++++++++++++++++++--------------------------
1 file changed, 21 insertions(+), 26 deletions(-)
diff --git a/cdx/cdx_main.c b/cdx/cdx_main.c
--- a/cdx/cdx_main.c
+++ b/cdx/cdx_main.c
@@ -178,31 +178,36 @@ 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 is optional for this platform and can
+ * dereference a missing BMan pool before returning an error. Do not let a
+ * missing fragmentation pool prevent the CDX core from loading.
+ */
+ printk(KERN_WARNING "%s::skipping cdx_init_frag_module on this platform\n",
+ __func__);
#ifdef DPA_IPSEC_OFFLOAD
- if (cdx_dpa_ipsec_init()) {
- printk("%s::dpa_ipsec start failed\n", __func__);
- goto exit;
- }
-
- if (cdx_init_scatter_gather_bpool()) {
- printk("%s::cdx_init_scatter_gather_bpool failed\n",__func__);
- rc = -ENOMEM;
- goto exit;
- }
- if (cdx_init_skb_2bfreed_bpool()) {
- printk("%s(%d) : cdx_init_skb_2bfreed_bpool failed\n", __func__,__LINE__);
- rc = -ENOMEM;
- goto exit;
+ rc = cdx_dpa_ipsec_init();
+ if (rc) {
+ printk(KERN_WARNING "%s::dpa_ipsec start failed rc %d; continuing without DPA IPsec offload\n",
+ __func__, rc);
+ rc = 0;
+ } else {
+ if (cdx_init_scatter_gather_bpool()) {
+ printk("%s::cdx_init_scatter_gather_bpool failed\n", __func__);
+ rc = -ENOMEM;
+ goto exit;
+ }
+ if (cdx_init_skb_2bfreed_bpool()) {
+ printk("%s(%d) : cdx_init_skb_2bfreed_bpool failed\n", __func__, __LINE__);
+ rc = -ENOMEM;
+ goto exit;
+ }
}
#endif
--
2.45.0