From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Rybchenko Subject: [PATCH 21/38] net/sfc/base: round number of queue buffers up Date: Thu, 7 Feb 2019 16:29:26 +0000 Message-ID: <1549556983-10896-22-git-send-email-arybchenko@solarflare.com> References: <1549556983-10896-1-git-send-email-arybchenko@solarflare.com> Mime-Version: 1.0 Content-Type: text/plain Cc: Igor Romanov To: Return-path: Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [67.231.154.164]) by dpdk.org (Postfix) with ESMTP id 4DFDA1B58A for ; Thu, 7 Feb 2019 17:30:37 +0100 (CET) In-Reply-To: <1549556983-10896-1-git-send-email-arybchenko@solarflare.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Igor Romanov Functions efx_*q_nbufs return the number of a queue buffers by dividing the queue size by page size. If minimum size of a queue is smaller than one page, we still need the page and number of buffers should not be 0. Signed-off-by: Igor Romanov Signed-off-by: Andrew Rybchenko --- drivers/net/sfc/base/efx_ev.c | 2 +- drivers/net/sfc/base/efx_rx.c | 2 +- drivers/net/sfc/base/efx_tx.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/sfc/base/efx_ev.c b/drivers/net/sfc/base/efx_ev.c index 21f4c226c..b98623995 100644 --- a/drivers/net/sfc/base/efx_ev.c +++ b/drivers/net/sfc/base/efx_ev.c @@ -188,7 +188,7 @@ efx_evq_nbufs( __in const efx_nic_t *enp, __in unsigned int ndescs) { - return (efx_evq_size(enp, ndescs) / EFX_BUF_SIZE); + return (EFX_DIV_ROUND_UP(efx_evq_size(enp, ndescs), EFX_BUF_SIZE)); } void diff --git a/drivers/net/sfc/base/efx_rx.c b/drivers/net/sfc/base/efx_rx.c index c0d738128..8a12ef705 100644 --- a/drivers/net/sfc/base/efx_rx.c +++ b/drivers/net/sfc/base/efx_rx.c @@ -781,7 +781,7 @@ efx_rxq_nbufs( __in const efx_nic_t *enp, __in unsigned int ndescs) { - return (efx_rxq_size(enp, ndescs) / EFX_BUF_SIZE); + return (EFX_DIV_ROUND_UP(efx_rxq_size(enp, ndescs), EFX_BUF_SIZE)); } void diff --git a/drivers/net/sfc/base/efx_tx.c b/drivers/net/sfc/base/efx_tx.c index bbe2bd1b7..5cf3dcd3a 100644 --- a/drivers/net/sfc/base/efx_tx.c +++ b/drivers/net/sfc/base/efx_tx.c @@ -312,7 +312,7 @@ efx_txq_nbufs( __in const efx_nic_t *enp, __in unsigned int ndescs) { - return (efx_txq_size(enp, ndescs) / EFX_BUF_SIZE); + return (EFX_DIV_ROUND_UP(efx_txq_size(enp, ndescs), EFX_BUF_SIZE)); } __checkReturn efx_rc_t -- 2.17.1