DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: liujie5@linkdatatechnology.com
To: stephen@networkplumber.org
Cc: dev@dpdk.org, Jie Liu <liujie5@linkdatatechnology.com>
Subject: [PATCH v1 10/13] common/sxe2: allow munmap during kernel reset
Date: Fri, 14 Aug 2026 20:22:01 +0800	[thread overview]
Message-ID: <20260814122204.2666045-11-liujie5@linkdatatechnology.com> (raw)
In-Reply-To: <20260814122204.2666045-1-liujie5@linkdatatechnology.com>

From: Jie Liu <liujie5@linkdatatechnology.com>

This patch improves error handling and resource management:

- Add NULL pointer protection in driver remove path:
  * Check cdrv and cdrv->remove before calling remove function
  * Prevent NULL pointer dereference in sxe2_classes_driver_remove
  * Return SXE2_SUCCESS if no driver or remove handler exists

- Allow memory unmap during kernel reset:
  * Remove kernel_reset restriction in sxe2_drv_dev_munmap
  * Enable cleanup operations even when kernel has been reset

Signed-off-by: Jie Liu <liujie5@linkdatatechnology.com>
---
 drivers/common/sxe2/sxe2_common.c     | 5 ++++-
 drivers/common/sxe2/sxe2_ioctl_chnl.c | 8 +-------
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/common/sxe2/sxe2_common.c b/drivers/common/sxe2/sxe2_common.c
index 5c5db85f29..3f60b2be11 100644
--- a/drivers/common/sxe2/sxe2_common.c
+++ b/drivers/common/sxe2/sxe2_common.c
@@ -465,8 +465,11 @@ static int32_t sxe2_classes_driver_probe(struct sxe2_common_device *cdev,
 static int32_t sxe2_classes_driver_remove(struct sxe2_common_device *cdev)
 {
 	struct sxe2_class_driver *cdrv = cdev->cdrv;
+	int32_t ret = 0;
 
-	return cdrv->remove(cdev);
+	if (cdrv != NULL && cdrv->remove != NULL)
+		ret = cdrv->remove(cdev);
+	return ret;
 }
 
 static int32_t sxe2_kvargs_validate(struct sxe2_dev_kvargs_info *kv_info)
diff --git a/drivers/common/sxe2/sxe2_ioctl_chnl.c b/drivers/common/sxe2/sxe2_ioctl_chnl.c
index a233a78136..3e2fbf572f 100644
--- a/drivers/common/sxe2/sxe2_ioctl_chnl.c
+++ b/drivers/common/sxe2/sxe2_ioctl_chnl.c
@@ -367,16 +367,10 @@ void
 
 RTE_EXPORT_INTERNAL_SYMBOL(sxe2_drv_dev_munmap)
 int32_t
-sxe2_drv_dev_munmap(struct sxe2_common_device *cdev, void *virt, uint64_t len)
+sxe2_drv_dev_munmap(struct sxe2_common_device *cdev __rte_unused, void *virt, uint64_t len)
 {
 	int32_t ret = 0;
 
-	if (cdev->config.kernel_reset) {
-		ret = -EPERM;
-		PMD_LOG_WARN(COM, "kernel reset, need restart app.");
-		goto l_end;
-	}
-
 	PMD_LOG_DEBUG(COM, "Munmap virt=%p, len=0x%"PRIx64"",
 		virt, len);
 
-- 
2.52.0


  parent reply	other threads:[~2026-08-14 12:23 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-14 12:21 [PATCH v1 00/13] net/sxe2: fix bugs liujie5
2026-08-14 12:21 ` [PATCH v1 01/13] net/sxe2: add Rx queue buffer split fill support liujie5
2026-08-14 12:21 ` [PATCH v1 02/13] net/sxe2: update switchdev repr VSI ID display format liujie5
2026-08-14 12:21 ` [PATCH v1 03/13] net/sxe2: add ACL engine event statistics support liujie5
2026-08-14 12:21 ` [PATCH v1 04/13] net/sxe2: enhance device cap and res management liujie5
2026-08-14 12:21 ` [PATCH v1 05/13] net/sxe2: improve representor device initialization liujie5
2026-08-14 12:21 ` [PATCH v1 06/13] net/sxe2: refactor flow tunnel port handling liujie5
2026-08-14 12:21 ` [PATCH v1 07/13] net/sxe2: validate IPsec key length against maximum limit liujie5
2026-08-14 12:21 ` [PATCH v1 08/13] net/sxe2: enhance repre event handling and MP code liujie5
2026-08-14 12:22 ` [PATCH v1 09/13] net/sxe2: optimize vectorized Tx/Rx path liujie5
2026-08-14 12:22 ` liujie5 [this message]
2026-08-14 12:22 ` [PATCH v1 11/13] net/sxe2: clean up duplicate function declarations liujie5
2026-08-14 12:22 ` [PATCH v1 12/13] net/sxe2: clean up structure definitions liujie5
2026-08-14 12:22 ` [PATCH v1 13/13] doc/sxe2: add acl-stat-type parameter documentation liujie5
2026-08-14 18:44 ` [PATCH v1 00/13] net/sxe2: fix bugs Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260814122204.2666045-11-liujie5@linkdatatechnology.com \
    --to=liujie5@linkdatatechnology.com \
    --cc=dev@dpdk.org \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox