DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] kni: remove rte_panic exits from library
@ 2016-09-02  9:51 Ferruh Yigit
  2016-09-21 16:21 ` Thomas Monjalon
  0 siblings, 1 reply; 2+ messages in thread
From: Ferruh Yigit @ 2016-09-02  9:51 UTC (permalink / raw)
  To: dev

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-dev] [PATCH] kni: remove rte_panic exits from library
  2016-09-02  9:51 [dpdk-dev] [PATCH] kni: remove rte_panic exits from library Ferruh Yigit
@ 2016-09-21 16:21 ` Thomas Monjalon
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Monjalon @ 2016-09-21 16:21 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: dev

2016-09-02 10:51, Ferruh Yigit:
> This also helps to remove stack backtrace when kernel module is not
> inserted.
> 
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>

Applied, thanks

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-09-21 16:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-02  9:51 [dpdk-dev] [PATCH] kni: remove rte_panic exits from library Ferruh Yigit
2016-09-21 16:21 ` Thomas Monjalon

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).