DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] kni: remove rte_panic exits from library
Date: Fri,  2 Sep 2016 10:51:49 +0100	[thread overview]
Message-ID: <1472809909-10962-1-git-send-email-ferruh.yigit@intel.com> (raw)

This also helps to remove stack backtrace when kernel module is not
inserted.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 lib/librte_kni/rte_kni.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/lib/librte_kni/rte_kni.c b/lib/librte_kni/rte_kni.c
index f48b72b..d88a70d 100644
--- a/lib/librte_kni/rte_kni.c
+++ b/lib/librte_kni/rte_kni.c
@@ -210,14 +210,18 @@ rte_kni_init(unsigned int max_kni_ifaces)
 	if (max_kni_ifaces == 0) {
 		RTE_LOG(ERR, KNI, "Invalid number of max_kni_ifaces %d\n",
 							max_kni_ifaces);
-		rte_panic("Unable to initialize KNI\n");
+		RTE_LOG(ERR, KNI, "Unable to initialize KNI\n");
+		return;
 	}
 
 	/* Check FD and open */
 	if (kni_fd < 0) {
 		kni_fd = open("/dev/" KNI_DEVICE, O_RDWR);
-		if (kni_fd < 0)
-			rte_panic("Can not open /dev/%s\n", KNI_DEVICE);
+		if (kni_fd < 0) {
+			RTE_LOG(ERR, KNI,
+				"Can not open /dev/%s\n", KNI_DEVICE);
+			return;
+		}
 	}
 
 	/* Allocate slot objects */
@@ -307,8 +311,8 @@ rte_kni_init(unsigned int max_kni_ifaces)
 	return;
 
 kni_fail:
-	rte_panic("Unable to allocate memory for max_kni_ifaces:%d. Increase the amount of hugepages memory\n",
-			 max_kni_ifaces);
+	RTE_LOG(ERR, KNI, "Unable to allocate memory for max_kni_ifaces:%d."
+		"Increase the amount of hugepages memory\n", max_kni_ifaces);
 }
 
 
@@ -483,8 +487,9 @@ rte_kni_release(struct rte_kni *kni)
 
 	/* Release memzone */
 	if (slot_id > kni_memzone_pool.max_ifaces) {
-		rte_panic("KNI pool: corrupted slot ID: %d, max: %d\n",
+		RTE_LOG(ERR, KNI, "KNI pool: corrupted slot ID: %d, max: %d\n",
 			slot_id, kni_memzone_pool.max_ifaces);
+		return -1;
 	}
 	kni_memzone_pool_release(&kni_memzone_pool.slots[slot_id]);
 
@@ -506,7 +511,8 @@ rte_kni_handle_request(struct rte_kni *kni)
 		return 0; /* It is OK of can not getting the request mbuf */
 
 	if (req != kni->sync_addr) {
-		rte_panic("Wrong req pointer %p\n", req);
+		RTE_LOG(ERR, KNI, "Wrong req pointer %p\n", req);
+		return -1;
 	}
 
 	/* Analyze the request and call the relevant actions for it */
-- 
2.7.4

             reply	other threads:[~2016-09-02  9:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-02  9:51 Ferruh Yigit [this message]
2016-09-21 16:21 ` Thomas Monjalon

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=1472809909-10962-1-git-send-email-ferruh.yigit@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=dev@dpdk.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;
as well as URLs for NNTP newsgroup(s).