From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nbfkord-smmo02.seg.att.com (nbfkord-smmo02.seg.att.com [209.65.160.78]) by dpdk.org (Postfix) with ESMTP id 1B06BFA4E for ; Fri, 2 Dec 2016 08:45:21 +0100 (CET) Received: from unknown [12.187.104.26] (EHLO nbfkord-smmo02.seg.att.com) by nbfkord-smmo02.seg.att.com(mxl_mta-7.2.4-7) with ESMTP id 19621485.2b07d6c03940.106165.00-2458.246001.nbfkord-smmo02.seg.att.com (envelope-from ); Fri, 02 Dec 2016 07:45:21 +0000 (UTC) X-MXL-Hash: 584126915bfe3551-14f630359d6317149baa7b4566ab33a9770f23f2 Received: from unknown [12.187.104.26] by nbfkord-smmo02.seg.att.com(mxl_mta-7.2.4-7) with SMTP id e8621485.0.106140.00-2393.245986.nbfkord-smmo02.seg.att.com (envelope-from ); Fri, 02 Dec 2016 07:45:20 +0000 (UTC) X-MXL-Hash: 5841269053ee9b17-45e963acdfee6098d56c8e76984c7edcba84e12a 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, 1 Dec 2016 23:45:02 -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, 1 Dec 2016 23:45:02 -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 uB27j1pq005915; Fri, 2 Dec 2016 07:45:01 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 uB27ixx0026628; Fri, 2 Dec 2016 07:45:01 GMT From: Andrew Rybchenko To: CC: Ivan Malov Date: Fri, 2 Dec 2016 07:44:43 +0000 Message-ID: <1480664691-26561-24-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1480664691-26561-1-git-send-email-arybchenko@solarflare.com> References: <1480664691-26561-1-git-send-email-arybchenko@solarflare.com> MIME-Version: 1.0 Content-Type: text/plain X-AnalysisOut: [v=2.1 cv=NIXTjhOg c=1 sm=1 tr=0 a=8BlWFWvVlq5taO8ncb8nKg==] X-AnalysisOut: [:17 a=n5n_aSjo0skA:10 a=pK7X0mNQAAAA:8 a=zRKbQ67AAAAA:8 a=] X-AnalysisOut: [LvpjEVOCtHb1B7et8JgA:9 a=5HA-qpC1VU4iIGLgRoNS:22 a=PA03WX8] X-AnalysisOut: [tBzeizutn5_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 23/31] net/sfc: support deferred start of transmit queues 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, 02 Dec 2016 07:45:21 -0000 From: Ivan Malov Reviewed-by: Andrew Lee Reviewed-by: Robert Stonehouse Signed-off-by: Ivan Malov Signed-off-by: Andrew Rybchenko --- doc/guides/nics/features/sfc_efx.ini | 2 +- doc/guides/nics/sfc_efx.rst | 2 +- drivers/net/sfc/sfc_ethdev.c | 51 ++++++++++++++++++++++++++++++++++++ drivers/net/sfc/sfc_tx.c | 18 +++++++------ drivers/net/sfc/sfc_tx.h | 2 ++ 5 files changed, 65 insertions(+), 10 deletions(-) diff --git a/doc/guides/nics/features/sfc_efx.ini b/doc/guides/nics/features/sfc_efx.ini index 4a887f0..38bf9d2 100644 --- a/doc/guides/nics/features/sfc_efx.ini +++ b/doc/guides/nics/features/sfc_efx.ini @@ -7,7 +7,7 @@ Speed capabilities = Y Link status = Y Link status event = Y -Queue start/stop = P +Queue start/stop = Y MTU update = Y Jumbo frame = Y Scattered Rx = Y diff --git a/doc/guides/nics/sfc_efx.rst b/doc/guides/nics/sfc_efx.rst index 3d705bc..c2e7149 100644 --- a/doc/guides/nics/sfc_efx.rst +++ b/doc/guides/nics/sfc_efx.rst @@ -68,7 +68,7 @@ SFC EFX PMD has support for: - Scattered Rx DMA for packet that are larger that a single Rx descriptor -- Deferred receive queue start +- Deferred receive and transmit queue start Non-supported Features diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index 5d0d774..ba3c838 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -865,6 +865,7 @@ sfc_tx_queue_info_get(struct rte_eth_dev *dev, uint16_t tx_queue_id, qinfo->conf.txq_flags = txq_info->txq->flags; qinfo->conf.tx_free_thresh = txq_info->txq->free_thresh; + qinfo->conf.tx_deferred_start = txq_info->deferred_start; qinfo->nb_desc = txq_info->entries; sfc_adapter_unlock(sa); @@ -936,6 +937,54 @@ sfc_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id) return 0; } +static int +sfc_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id) +{ + struct sfc_adapter *sa = dev->data->dev_private; + int rc; + + sfc_log_init(sa, "TxQ = %u", tx_queue_id); + + sfc_adapter_lock(sa); + + rc = EINVAL; + if (sa->state != SFC_ADAPTER_STARTED) + goto fail_not_started; + + rc = sfc_tx_qstart(sa, tx_queue_id); + if (rc != 0) + goto fail_tx_qstart; + + sa->txq_info[tx_queue_id].deferred_started = B_TRUE; + + sfc_adapter_unlock(sa); + return 0; + +fail_tx_qstart: + +fail_not_started: + sfc_adapter_unlock(sa); + SFC_ASSERT(rc > 0); + return -rc; +} + +static int +sfc_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id) +{ + struct sfc_adapter *sa = dev->data->dev_private; + + sfc_log_init(sa, "TxQ = %u", tx_queue_id); + + sfc_adapter_lock(sa); + + sfc_tx_qstop(sa, tx_queue_id); + + sa->txq_info[tx_queue_id].deferred_started = B_FALSE; + + sfc_adapter_unlock(sa); + return 0; +} + static const struct eth_dev_ops sfc_eth_dev_ops = { .dev_configure = sfc_dev_configure, .dev_start = sfc_dev_start, @@ -956,6 +1005,8 @@ static const struct eth_dev_ops sfc_eth_dev_ops = { .mtu_set = sfc_dev_set_mtu, .rx_queue_start = sfc_rx_queue_start, .rx_queue_stop = sfc_rx_queue_stop, + .tx_queue_start = sfc_tx_queue_start, + .tx_queue_stop = sfc_tx_queue_stop, .rx_queue_setup = sfc_rx_queue_setup, .rx_queue_release = sfc_rx_queue_release, .rx_queue_count = sfc_rx_queue_count, diff --git a/drivers/net/sfc/sfc_tx.c b/drivers/net/sfc/sfc_tx.c index 13b24f7..15a6f9f 100644 --- a/drivers/net/sfc/sfc_tx.c +++ b/drivers/net/sfc/sfc_tx.c @@ -72,11 +72,6 @@ sfc_tx_qcheck_conf(struct sfc_adapter *sa, uint16_t nb_tx_desc, rc = EINVAL; } - if (tx_conf->tx_deferred_start != 0) { - sfc_err(sa, "TX queue deferred start is not supported (yet)"); - rc = EINVAL; - } - if (tx_conf->tx_thresh.pthresh != 0 || tx_conf->tx_thresh.hthresh != 0 || tx_conf->tx_thresh.wthresh != 0) { @@ -198,6 +193,7 @@ sfc_tx_qinit(struct sfc_adapter *sa, unsigned int sw_index, evq->txq = txq; txq_info->txq = txq; + txq_info->deferred_start = (tx_conf->tx_deferred_start != 0); return 0; @@ -425,6 +421,9 @@ sfc_tx_qstop(struct sfc_adapter *sa, unsigned int sw_index) txq = txq_info->txq; + if (txq->state == SFC_TXQ_INITIALIZED) + return; + SFC_ASSERT(txq->state & SFC_TXQ_STARTED); txq->state &= ~SFC_TXQ_RUNNING; @@ -497,9 +496,12 @@ sfc_tx_start(struct sfc_adapter *sa) goto fail_efx_tx_init; for (sw_index = 0; sw_index < sa->txq_count; ++sw_index) { - rc = sfc_tx_qstart(sa, sw_index); - if (rc != 0) - goto fail_tx_qstart; + if (!(sa->txq_info[sw_index].deferred_start) || + sa->txq_info[sw_index].deferred_started) { + rc = sfc_tx_qstart(sa, sw_index); + if (rc != 0) + goto fail_tx_qstart; + } } return 0; diff --git a/drivers/net/sfc/sfc_tx.h b/drivers/net/sfc/sfc_tx.h index f9eecc0..632e3be 100644 --- a/drivers/net/sfc/sfc_tx.h +++ b/drivers/net/sfc/sfc_tx.h @@ -91,6 +91,8 @@ sfc_txq_sw_index(const struct sfc_txq *txq) struct sfc_txq_info { unsigned int entries; struct sfc_txq *txq; + boolean_t deferred_start; + boolean_t deferred_started; }; int sfc_tx_init(struct sfc_adapter *sa); -- 2.5.5