From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nbfkord-smmo01.seg.att.com (nbfkord-smmo01.seg.att.com [209.65.160.76]) by dpdk.org (Postfix) with ESMTP id 189C63989 for ; Thu, 15 Dec 2016 13:52:21 +0100 (CET) Received: from unknown [12.187.104.26] (EHLO nbfkord-smmo01.seg.att.com) by nbfkord-smmo01.seg.att.com(mxl_mta-7.2.4-7) with ESMTP id 50292585.2b9fbd62e940.721177.00-2476.1504351.nbfkord-smmo01.seg.att.com (envelope-from ); Thu, 15 Dec 2016 12:52:21 +0000 (UTC) X-MXL-Hash: 5852920512978a1c-1df5fcd1e4d742b70cb8292e1b93a47d2ee34e47 Received: from unknown [12.187.104.26] by nbfkord-smmo01.seg.att.com(mxl_mta-7.2.4-7) with SMTP id 20292585.0.721151.00-2349.1504322.nbfkord-smmo01.seg.att.com (envelope-from ); Thu, 15 Dec 2016 12:52:19 +0000 (UTC) X-MXL-Hash: 585292037ed862d7-31bd44230193f73eff0e0cc52a9a428c2a48c661 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; Thu, 15 Dec 2016 04:52:05 -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; Thu, 15 Dec 2016 04:52:05 -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 uBFCq44P006401; Thu, 15 Dec 2016 12:52:04 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 uBFCpcep010431; Thu, 15 Dec 2016 12:52:04 GMT From: Andrew Rybchenko To: CC: Date: Thu, 15 Dec 2016 12:51:07 +0000 Message-ID: <1481806283-10387-17-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1481806283-10387-1-git-send-email-arybchenko@solarflare.com> References: <1480664691-26561-1-git-send-email-arybchenko@solarflare.com> <1481806283-10387-1-git-send-email-arybchenko@solarflare.com> MIME-Version: 1.0 Content-Type: text/plain X-AnalysisOut: [v=2.1 cv=I8xjMYUg c=1 sm=1 tr=0 a=8BlWFWvVlq5taO8ncb8nKg==] X-AnalysisOut: [:17 a=n5n_aSjo0skA:10 a=zRKbQ67AAAAA:8 a=VVP6y7Rf34IKicDjX] X-AnalysisOut: [S8A:9 a=PA03WX8tBzeizutn5_OT:22] X-Spam: [F=0.2000000000; CM=0.500; S=0.200(2015072901)] X-MAIL-FROM: X-SOURCE-IP: [12.187.104.26] Subject: [dpdk-dev] [PATCH v2 16/32] net/sfc: support Rx free threshold 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, 15 Dec 2016 12:52:21 -0000 Rx free threshold defines minimum number of free Rx descriptors when Rx ring refill should be done. Signed-off-by: Andrew Rybchenko Reviewed-by: Andrew Lee Reviewed-by: Robert Stonehouse --- drivers/net/sfc/sfc_ethdev.c | 1 + drivers/net/sfc/sfc_rx.c | 16 ++++++++++++---- drivers/net/sfc/sfc_rx.h | 1 + 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index e67ca61..1d7993f 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -838,6 +838,7 @@ sfc_rx_queue_info_get(struct rte_eth_dev *dev, uint16_t rx_queue_id, SFC_ASSERT(rxq != NULL); qinfo->mp = rxq->refill_mb_pool; + qinfo->conf.rx_free_thresh = rxq->refill_threshold; qinfo->conf.rx_drop_en = 1; qinfo->nb_desc = rxq_info->entries; diff --git a/drivers/net/sfc/sfc_rx.c b/drivers/net/sfc/sfc_rx.c index be8fa23..278d583 100644 --- a/drivers/net/sfc/sfc_rx.c +++ b/drivers/net/sfc/sfc_rx.c @@ -87,6 +87,10 @@ sfc_rx_qrefill(struct sfc_rxq *rxq) free_space = EFX_RXQ_LIMIT(rxq->ptr_mask + 1) - (added - rxq->completed); + + if (free_space < rxq->refill_threshold) + return; + bulks = free_space / RTE_DIM(objs); id = added & rxq->ptr_mask; @@ -410,9 +414,10 @@ sfc_rx_qstop(struct sfc_adapter *sa, unsigned int sw_index) } static int -sfc_rx_qcheck_conf(struct sfc_adapter *sa, +sfc_rx_qcheck_conf(struct sfc_adapter *sa, uint16_t nb_rx_desc, const struct rte_eth_rxconf *rx_conf) { + const uint16_t rx_free_thresh_max = EFX_RXQ_LIMIT(nb_rx_desc); int rc = 0; if (rx_conf->rx_thresh.pthresh != 0 || @@ -423,8 +428,10 @@ sfc_rx_qcheck_conf(struct sfc_adapter *sa, rc = EINVAL; } - if (rx_conf->rx_free_thresh != 0) { - sfc_err(sa, "RxQ free threshold is not supported"); + if (rx_conf->rx_free_thresh > rx_free_thresh_max) { + sfc_err(sa, + "RxQ free threshold too large: %u vs maximum %u", + rx_conf->rx_free_thresh, rx_free_thresh_max); rc = EINVAL; } @@ -555,7 +562,7 @@ sfc_rx_qinit(struct sfc_adapter *sa, unsigned int sw_index, struct sfc_evq *evq; struct sfc_rxq *rxq; - rc = sfc_rx_qcheck_conf(sa, rx_conf); + rc = sfc_rx_qcheck_conf(sa, nb_rx_desc, rx_conf); if (rc != 0) goto fail_bad_conf; @@ -615,6 +622,7 @@ sfc_rx_qinit(struct sfc_adapter *sa, unsigned int sw_index, evq->rxq = rxq; rxq->evq = evq; rxq->ptr_mask = rxq_info->entries - 1; + rxq->refill_threshold = rx_conf->rx_free_thresh; rxq->refill_mb_pool = mb_pool; rxq->buf_size = buf_size; rxq->hw_index = sw_index; diff --git a/drivers/net/sfc/sfc_rx.h b/drivers/net/sfc/sfc_rx.h index e4385b9..69318ab 100644 --- a/drivers/net/sfc/sfc_rx.h +++ b/drivers/net/sfc/sfc_rx.h @@ -87,6 +87,7 @@ struct sfc_rxq { /* Used on refill */ unsigned int added; unsigned int pushed; + unsigned int refill_threshold; uint8_t port_id; uint16_t buf_size; struct rte_mempool *refill_mb_pool; -- 2.5.5