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 58C811C73B for ; Fri, 13 Apr 2018 20:31:07 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mta.qwilt.com (Postfix) with ESMTP id B66F980B51C; Fri, 13 Apr 2018 18:31:06 +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 ppi3CNtNhAMv; Fri, 13 Apr 2018 18:31:06 +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 1BB0280B51A; Fri, 13 Apr 2018 18:31:03 +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: Fri, 13 Apr 2018 21:30:37 +0300 Message-Id: <1523644244-17511-7-git-send-email-arnon@qwilt.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1523644244-17511-1-git-send-email-arnon@qwilt.com> References: <1523644244-17511-1-git-send-email-arnon@qwilt.com> Subject: [dpdk-dev] [PATCH v3 06/13] 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: Fri, 13 Apr 2018 18:31:08 -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 2867411..54050c8 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