From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.52]) by dpdk.org (Postfix) with ESMTP id DD3C41B4B6 for ; Thu, 7 Feb 2019 13:18:15 +0100 (CET) X-Virus-Scanned: Proofpoint Essentials engine Received: from webmail.solarflare.com (webmail.solarflare.com [12.187.104.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1-us3.ppe-hosted.com (Proofpoint Essentials ESMTP Server) with ESMTPS id 8B3B1600057 for ; Thu, 7 Feb 2019 12:18:14 +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.1395.4; Thu, 7 Feb 2019 04:18:10 -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.1395.4 via Frontend Transport; Thu, 7 Feb 2019 04:18:10 -0800 Received: from ukv-loginhost.uk.solarflarecom.com (ukv-loginhost.uk.solarflarecom.com [10.17.10.39]) by opal.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id x17CI8AW013250 for ; Thu, 7 Feb 2019 12:18:08 GMT Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id B2BB51613E4 for ; Thu, 7 Feb 2019 12:18:08 +0000 (GMT) From: Andrew Rybchenko To: Date: Thu, 7 Feb 2019 12:17:36 +0000 Message-ID: <1549541873-17403-14-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1549541873-17403-1-git-send-email-arybchenko@solarflare.com> References: <1549541873-17403-1-git-send-email-arybchenko@solarflare.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.5.1010-24412.006 X-TM-AS-Result: No-7.086200-4.000000-10 X-TMASE-MatchedRID: 2xd9EQ8Wt06oI13vZ2XFyx+WEMjoO9WWTJDl9FKHbrlX14Hy+eYp78P/ La5NP1JvS2Wd7rYJi8EGCakwPNLse2nLMsFvdAw4Cz1WR8KHe4BYMtqMzbYRNup7wgGRqw6kfMr dD3NIUvsMB2Nzy1L1+253ydx9lOkWGXJM4GwoDq+e7UdJp0QINZqCl1R34jDPCqIJhrrDy29hcJ qAtNJYSH9dRB2q7pOorQK+QUFQiw8YB2fOueQzjxRFJJyf5BJe3QfwsVk0UbuGrPnef/I+eqJuU QbS4Jfh36Cyl6U5Hv51IrtLjdG6u/gkRT4XtS1dN+XOQZygrvY= X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--7.086200-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24412.006 X-MDID: 1549541894-gncsREl6MLfb Subject: [dpdk-dev] [PATCH 13/30] net/sfc: move TxQ state to multi-process shared location 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, 07 Feb 2019 12:18:16 -0000 Secondary process needs to know TxQ state. TxQ control structure will become primary process private. Signed-off-by: Andrew Rybchenko --- drivers/net/sfc/sfc_ev.c | 4 +++- drivers/net/sfc/sfc_tx.c | 51 +++++++++++++++++++++++----------------- drivers/net/sfc/sfc_tx.h | 6 +++-- 3 files changed, 36 insertions(+), 25 deletions(-) diff --git a/drivers/net/sfc/sfc_ev.c b/drivers/net/sfc/sfc_ev.c index 5965e2350..0ca502ea2 100644 --- a/drivers/net/sfc/sfc_ev.c +++ b/drivers/net/sfc/sfc_ev.c @@ -355,7 +355,9 @@ sfc_ev_txq_flush_done(void *arg, __rte_unused uint32_t txq_hw_index) SFC_ASSERT(txq != NULL); SFC_ASSERT(txq->hw_index == txq_hw_index); SFC_ASSERT(txq->evq == evq); - sfc_tx_qflush_done(txq); + RTE_SET_USED(txq); + + sfc_tx_qflush_done(sfc_txq_info_by_dp_txq(dp_txq)); return B_FALSE; } diff --git a/drivers/net/sfc/sfc_tx.c b/drivers/net/sfc/sfc_tx.c index 5d31fedbb..f4fbffe0a 100644 --- a/drivers/net/sfc/sfc_tx.c +++ b/drivers/net/sfc/sfc_tx.c @@ -110,10 +110,10 @@ sfc_tx_qcheck_conf(struct sfc_adapter *sa, unsigned int txq_max_fill_level, } void -sfc_tx_qflush_done(struct sfc_txq *txq) +sfc_tx_qflush_done(struct sfc_txq_info *txq_info) { - txq->state |= SFC_TXQ_FLUSHED; - txq->state &= ~SFC_TXQ_FLUSHING; + txq_info->state |= SFC_TXQ_FLUSHED; + txq_info->state &= ~SFC_TXQ_FLUSHING; } int @@ -201,7 +201,7 @@ sfc_tx_qinit(struct sfc_adapter *sa, unsigned int sw_index, evq->dp_txq = txq->dp; - txq->state = SFC_TXQ_INITIALIZED; + txq_info->state = SFC_TXQ_INITIALIZED; txq_info->deferred_start = (tx_conf->tx_deferred_start != 0); @@ -241,7 +241,7 @@ sfc_tx_qfini(struct sfc_adapter *sa, unsigned int sw_index) txq = txq_info->txq; SFC_ASSERT(txq != NULL); - SFC_ASSERT(txq->state == SFC_TXQ_INITIALIZED); + SFC_ASSERT(txq_info->state == SFC_TXQ_INITIALIZED); sa->priv.dp_tx->qdestroy(txq->dp); txq->dp = NULL; @@ -426,7 +426,7 @@ sfc_tx_qstart(struct sfc_adapter *sa, unsigned int sw_index) txq = txq_info->txq; SFC_ASSERT(txq != NULL); - SFC_ASSERT(txq->state == SFC_TXQ_INITIALIZED); + SFC_ASSERT(txq_info->state == SFC_TXQ_INITIALIZED); evq = txq->evq; @@ -464,7 +464,7 @@ sfc_tx_qstart(struct sfc_adapter *sa, unsigned int sw_index) efx_tx_qenable(txq->common); - txq->state |= SFC_TXQ_STARTED; + txq_info->state |= SFC_TXQ_STARTED; rc = sa->priv.dp_tx->qstart(txq->dp, evq->read_ptr, desc_index); if (rc != 0) @@ -479,7 +479,7 @@ sfc_tx_qstart(struct sfc_adapter *sa, unsigned int sw_index) return 0; fail_dp_qstart: - txq->state = SFC_TXQ_INITIALIZED; + txq_info->state = SFC_TXQ_INITIALIZED; efx_tx_qdestroy(txq->common); fail_tx_qcreate: @@ -506,10 +506,10 @@ sfc_tx_qstop(struct sfc_adapter *sa, unsigned int sw_index) txq = txq_info->txq; - if (txq == NULL || txq->state == SFC_TXQ_INITIALIZED) + if (txq == NULL || txq_info->state == SFC_TXQ_INITIALIZED) return; - SFC_ASSERT(txq->state & SFC_TXQ_STARTED); + SFC_ASSERT(txq_info->state & SFC_TXQ_STARTED); sa->priv.dp_tx->qstop(txq->dp, &txq->evq->read_ptr); @@ -518,12 +518,12 @@ sfc_tx_qstop(struct sfc_adapter *sa, unsigned int sw_index) * timeout; in the worst case it can delay for 6 seconds */ for (retry_count = 0; - ((txq->state & SFC_TXQ_FLUSHED) == 0) && + ((txq_info->state & SFC_TXQ_FLUSHED) == 0) && (retry_count < SFC_TX_QFLUSH_ATTEMPTS); ++retry_count) { rc = efx_tx_qflush(txq->common); if (rc != 0) { - txq->state |= (rc == EALREADY) ? + txq_info->state |= (rc == EALREADY) ? SFC_TXQ_FLUSHED : SFC_TXQ_FLUSH_FAILED; break; } @@ -538,19 +538,19 @@ sfc_tx_qstop(struct sfc_adapter *sa, unsigned int sw_index) do { rte_delay_ms(SFC_TX_QFLUSH_POLL_WAIT_MS); sfc_ev_qpoll(txq->evq); - } while ((txq->state & SFC_TXQ_FLUSHING) && + } while ((txq_info->state & SFC_TXQ_FLUSHING) && wait_count++ < SFC_TX_QFLUSH_POLL_ATTEMPTS); - if (txq->state & SFC_TXQ_FLUSHING) + if (txq_info->state & SFC_TXQ_FLUSHING) sfc_err(sa, "TxQ %u flush timed out", sw_index); - if (txq->state & SFC_TXQ_FLUSHED) + if (txq_info->state & SFC_TXQ_FLUSHED) sfc_notice(sa, "TxQ %u flushed", sw_index); } sa->priv.dp_tx->qreap(txq->dp); - txq->state = SFC_TXQ_INITIALIZED; + txq_info->state = SFC_TXQ_INITIALIZED; efx_tx_qdestroy(txq->common); @@ -854,13 +854,12 @@ sfc_efx_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) return pkts_sent; } -struct sfc_txq * -sfc_txq_by_dp_txq(const struct sfc_dp_txq *dp_txq) +struct sfc_txq_info * +sfc_txq_info_by_dp_txq(const struct sfc_dp_txq *dp_txq) { const struct sfc_dp_queue *dpq = &dp_txq->dpq; struct rte_eth_dev *eth_dev; struct sfc_adapter *sa; - struct sfc_txq *txq; SFC_ASSERT(rte_eth_dev_is_valid_port(dpq->port_id)); eth_dev = &rte_eth_devices[dpq->port_id]; @@ -868,10 +867,18 @@ sfc_txq_by_dp_txq(const struct sfc_dp_txq *dp_txq) sa = eth_dev->data->dev_private; SFC_ASSERT(dpq->queue_id < sa->txq_count); - txq = sa->txq_info[dpq->queue_id].txq; + return &sa->txq_info[dpq->queue_id]; +} - SFC_ASSERT(txq != NULL); - return txq; +struct sfc_txq * +sfc_txq_by_dp_txq(const struct sfc_dp_txq *dp_txq) +{ + struct sfc_txq_info *txq_info; + + txq_info = sfc_txq_info_by_dp_txq(dp_txq); + + SFC_ASSERT(txq_info->txq != NULL); + return txq_info->txq; } static sfc_dp_tx_qsize_up_rings_t sfc_efx_tx_qsize_up_rings; diff --git a/drivers/net/sfc/sfc_tx.h b/drivers/net/sfc/sfc_tx.h index efb486d32..c3edd3a58 100644 --- a/drivers/net/sfc/sfc_tx.h +++ b/drivers/net/sfc/sfc_tx.h @@ -51,7 +51,6 @@ enum sfc_txq_state_bit { * Allocated on the socket specified on the queue setup. */ struct sfc_txq { - unsigned int state; unsigned int hw_index; struct sfc_evq *evq; efsys_mem_t mem; @@ -107,6 +106,7 @@ sfc_efx_txq_by_dp_txq(struct sfc_dp_txq *dp_txq) } struct sfc_txq_info { + unsigned int state; unsigned int entries; struct sfc_txq *txq; boolean_t deferred_start; @@ -115,6 +115,8 @@ struct sfc_txq_info { uint64_t offloads; }; +struct sfc_txq_info *sfc_txq_info_by_dp_txq(const struct sfc_dp_txq *dp_txq); + int sfc_tx_configure(struct sfc_adapter *sa); void sfc_tx_close(struct sfc_adapter *sa); @@ -123,7 +125,7 @@ int sfc_tx_qinit(struct sfc_adapter *sa, unsigned int sw_index, const struct rte_eth_txconf *tx_conf); void sfc_tx_qfini(struct sfc_adapter *sa, unsigned int sw_index); -void sfc_tx_qflush_done(struct sfc_txq *txq); +void sfc_tx_qflush_done(struct sfc_txq_info *txq_info); int sfc_tx_qstart(struct sfc_adapter *sa, unsigned int sw_index); void sfc_tx_qstop(struct sfc_adapter *sa, unsigned int sw_index); int sfc_tx_start(struct sfc_adapter *sa); -- 2.17.1