From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mta.qwilt.com (mta.qwilt.com [52.9.191.255]) by dpdk.org (Postfix) with ESMTP id 787016CD1 for ; Thu, 19 Apr 2018 08:01:35 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mta.qwilt.com (Postfix) with ESMTP id E7C2F8070AF; Thu, 19 Apr 2018 06:01:34 +0000 (UTC) X-Virus-Scanned: amavisd-new at qwilt.com Received: from mta.qwilt.com ([127.0.0.1]) by localhost (mta.qwilt.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mhU3uEHAfph1; Thu, 19 Apr 2018 06:01:34 +0000 (UTC) Received: from rd01.it.qwilt.com.qwilt.com (80.179.204.39.cable.012.net.il [80.179.204.39]) by mta.qwilt.com (Postfix) with ESMTPSA id 3696D8070AE; Thu, 19 Apr 2018 06:01:32 +0000 (UTC) From: Arnon Warshavsky To: thomas@monjalon.net, anatoly.burakov@intel.com, wenzhuo.lu@intel.com, declan.doherty@intel.com, jerin.jacob@caviumnetworks.com, bruce.richardson@intel.com, ferruh.yigit@intel.com Cc: dev@dpdk.org, arnon@qwilt.com Date: Thu, 19 Apr 2018 09:01:04 +0300 Message-Id: <1524117669-25729-7-git-send-email-arnon@qwilt.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1524117669-25729-1-git-send-email-arnon@qwilt.com> References: <1524117669-25729-1-git-send-email-arnon@qwilt.com> Subject: [dpdk-dev] [PATCH v4 06/11] kni: replace rte_panic instances in kni X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Apr 2018 06:01:35 -0000 replace panic calls with log and retrun value. Local function to this file, changing from void to int is non-abi-breaking Signed-off-by: Arnon Warshavsky --- lib/librte_kni/rte_kni.c | 18 ++++++++++++------ lib/librte_kni/rte_kni_fifo.h | 11 ++++++++--- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/lib/librte_kni/rte_kni.c b/lib/librte_kni/rte_kni.c index 8a8f6c1..4dac407 100644 --- a/lib/librte_kni/rte_kni.c +++ b/lib/librte_kni/rte_kni.c @@ -353,37 +353,43 @@ struct rte_kni * /* TX RING */ mz = slot->m_tx_q; ctx->tx_q = mz->addr; - kni_fifo_init(ctx->tx_q, KNI_FIFO_COUNT_MAX); + if (kni_fifo_init(ctx->tx_q, KNI_FIFO_COUNT_MAX)) + return NULL; dev_info.tx_phys = mz->phys_addr; /* RX RING */ mz = slot->m_rx_q; ctx->rx_q = mz->addr; - kni_fifo_init(ctx->rx_q, KNI_FIFO_COUNT_MAX); + if (kni_fifo_init(ctx->rx_q, KNI_FIFO_COUNT_MAX)) + return NULL; dev_info.rx_phys = mz->phys_addr; /* ALLOC RING */ mz = slot->m_alloc_q; ctx->alloc_q = mz->addr; - kni_fifo_init(ctx->alloc_q, KNI_FIFO_COUNT_MAX); + if (kni_fifo_init(ctx->alloc_q, KNI_FIFO_COUNT_MAX)) + return NULL; dev_info.alloc_phys = mz->phys_addr; /* FREE RING */ mz = slot->m_free_q; ctx->free_q = mz->addr; - kni_fifo_init(ctx->free_q, KNI_FIFO_COUNT_MAX); + if (kni_fifo_init(ctx->free_q, KNI_FIFO_COUNT_MAX)) + return NULL; dev_info.free_phys = mz->phys_addr; /* Request RING */ mz = slot->m_req_q; ctx->req_q = mz->addr; - kni_fifo_init(ctx->req_q, KNI_FIFO_COUNT_MAX); + if (kni_fifo_init(ctx->req_q, KNI_FIFO_COUNT_MAX)) + return NULL; dev_info.req_phys = mz->phys_addr; /* Response RING */ mz = slot->m_resp_q; ctx->resp_q = mz->addr; - kni_fifo_init(ctx->resp_q, KNI_FIFO_COUNT_MAX); + if (kni_fifo_init(ctx->resp_q, KNI_FIFO_COUNT_MAX)) + return NULL; dev_info.resp_phys = mz->phys_addr; /* Req/Resp sync mem area */ diff --git a/lib/librte_kni/rte_kni_fifo.h b/lib/librte_kni/rte_kni_fifo.h index ac26a8c..5052015 100644 --- a/lib/librte_kni/rte_kni_fifo.h +++ b/lib/librte_kni/rte_kni_fifo.h @@ -7,17 +7,22 @@ /** * Initializes the kni fifo structure */ -static void +static int kni_fifo_init(struct rte_kni_fifo *fifo, unsigned size) { /* Ensure size is power of 2 */ - if (size & (size - 1)) - rte_panic("KNI fifo size must be power of 2\n"); + if (size & (size - 1)) { + RTE_LOG(CRIT, EAL, "%s(): KNI fifo size must be power of 2\n", + __func__); + return -1; + } fifo->write = 0; fifo->read = 0; fifo->len = size; fifo->elem_size = sizeof(void *); + + return 0; } /** -- 1.8.3.1