From mboxrd@z Thu Jan 1 00:00:00 1970 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 C44CB1B357 for ; Tue, 26 Dec 2017 08:28:02 +0100 (CET) X-Virus-Scanned: Proofpoint Essentials engine Received: from webmail.solarflare.com (webmail.solarflare.com [12.187.104.26]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1-us4.ppe-hosted.com (Proofpoint Essentials ESMTP Server) with ESMTPS id C5764B4005A for ; Tue, 26 Dec 2017 07:28:01 +0000 (UTC) Received: from ocex03.SolarFlarecom.com (10.20.40.36) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1044.25; Mon, 25 Dec 2017 23:27:58 -0800 Received: from opal.uk.solarflarecom.com (10.17.10.1) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1044.25 via Frontend Transport; Mon, 25 Dec 2017 23:27:58 -0800 Received: from uklogin.uk.solarflarecom.com (uklogin.uk.solarflarecom.com [10.17.10.10]) by opal.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id vBQ7RvSF015577 for ; Tue, 26 Dec 2017 07:27:57 GMT Received: from uklogin.uk.solarflarecom.com (localhost.localdomain [127.0.0.1]) by uklogin.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id vBQ7RuGN019696 for ; Tue, 26 Dec 2017 07:27:57 GMT From: Andrew Rybchenko To: Date: Tue, 26 Dec 2017 07:27:48 +0000 Message-ID: <1514273271-19604-4-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1514273271-19604-1-git-send-email-arybchenko@solarflare.com> References: <1514273271-19604-1-git-send-email-arybchenko@solarflare.com> MIME-Version: 1.0 Content-Type: text/plain X-MDID: 1514273282-SeYmT2hzEBkr Subject: [dpdk-dev] [PATCH 3/6] net/sfc: use Rx queue max fill level calculated on init 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: Tue, 26 Dec 2017 07:28:03 -0000 Prepare to support more options for number of Rx descriptors. libefx-based datapath is updated just for completeness to make code more readable and less error-prone. Signed-off-by: Andrew Rybchenko Reviewed-by: Andy Moreton --- drivers/net/sfc/sfc_dp_rx.h | 2 ++ drivers/net/sfc/sfc_ef10_rx.c | 5 +++-- drivers/net/sfc/sfc_rx.c | 5 +++-- drivers/net/sfc/sfc_rx.h | 1 + 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/net/sfc/sfc_dp_rx.h b/drivers/net/sfc/sfc_dp_rx.h index 3c29089..f62d79a 100644 --- a/drivers/net/sfc/sfc_dp_rx.h +++ b/drivers/net/sfc/sfc_dp_rx.h @@ -60,6 +60,8 @@ struct sfc_dp_rxq { struct sfc_dp_rx_qcreate_info { /** Memory pool to allocate Rx buffer from */ struct rte_mempool *refill_mb_pool; + /** Maximum number of pushed Rx descriptors in the queue */ + unsigned int max_fill_level; /** Minimum number of unused Rx descriptors to do refill */ unsigned int refill_threshold; /** diff --git a/drivers/net/sfc/sfc_ef10_rx.c b/drivers/net/sfc/sfc_ef10_rx.c index 29524ce..fc89078 100644 --- a/drivers/net/sfc/sfc_ef10_rx.c +++ b/drivers/net/sfc/sfc_ef10_rx.c @@ -93,6 +93,7 @@ struct sfc_ef10_rxq { /* Used on refill */ uint16_t buf_size; unsigned int added; + unsigned int max_fill_level; unsigned int refill_threshold; struct rte_mempool *refill_mb_pool; efx_qword_t *rxq_hw_ring; @@ -141,8 +142,7 @@ sfc_ef10_rx_qrefill(struct sfc_ef10_rxq *rxq) void *objs[SFC_RX_REFILL_BULK]; unsigned int added = rxq->added; - free_space = SFC_EF10_RXQ_LIMIT(ptr_mask + 1) - - (added - rxq->completed); + free_space = rxq->max_fill_level - (added - rxq->completed); if (free_space < rxq->refill_threshold) return; @@ -620,6 +620,7 @@ sfc_ef10_rx_qcreate(uint16_t port_id, uint16_t queue_id, rxq->flags |= SFC_EF10_RXQ_RSS_HASH; rxq->ptr_mask = info->rxq_entries - 1; rxq->evq_hw_ring = info->evq_hw_ring; + rxq->max_fill_level = info->max_fill_level; rxq->refill_threshold = info->refill_threshold; rxq->rearm_data = sfc_ef10_mk_mbuf_rearm_data(port_id, info->prefix_size); diff --git a/drivers/net/sfc/sfc_rx.c b/drivers/net/sfc/sfc_rx.c index 43d51c4..ecf8e99 100644 --- a/drivers/net/sfc/sfc_rx.c +++ b/drivers/net/sfc/sfc_rx.c @@ -88,8 +88,7 @@ sfc_efx_rx_qrefill(struct sfc_efx_rxq *rxq) struct rte_mbuf *m; uint16_t port_id = rxq->dp.dpq.port_id; - free_space = EFX_RXQ_LIMIT(rxq->ptr_mask + 1) - - (added - rxq->completed); + free_space = rxq->max_fill_level - (added - rxq->completed); if (free_space < rxq->refill_threshold) return; @@ -459,6 +458,7 @@ sfc_efx_rx_qcreate(uint16_t port_id, uint16_t queue_id, rxq->ptr_mask = info->rxq_entries - 1; rxq->batch_max = info->batch_max; rxq->prefix_size = info->prefix_size; + rxq->max_fill_level = info->max_fill_level; rxq->refill_threshold = info->refill_threshold; rxq->buf_size = info->buf_size; rxq->refill_mb_pool = info->refill_mb_pool; @@ -993,6 +993,7 @@ sfc_rx_qinit(struct sfc_adapter *sa, unsigned int sw_index, memset(&info, 0, sizeof(info)); info.refill_mb_pool = rxq->refill_mb_pool; + info.max_fill_level = rxq_max_fill_level; info.refill_threshold = rxq->refill_threshold; info.buf_size = buf_size; info.batch_max = encp->enc_rx_batch_max; diff --git a/drivers/net/sfc/sfc_rx.h b/drivers/net/sfc/sfc_rx.h index 9e6282e..d2f4471 100644 --- a/drivers/net/sfc/sfc_rx.h +++ b/drivers/net/sfc/sfc_rx.h @@ -121,6 +121,7 @@ struct sfc_efx_rxq { /* Used on refill */ unsigned int added; unsigned int pushed; + unsigned int max_fill_level; unsigned int refill_threshold; uint16_t buf_size; struct rte_mempool *refill_mb_pool; -- 2.7.4