From 50448dd3ab21c864960eeaf44a2a4ad45017551f Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Tue, 2 Nov 2021 16:13:40 +0300 Subject: [PATCH] net/sfc: merge Rx and Tx doorbell counters into one Datapath queue is either Rx or Tx, so just one counter is sufficient for doorbells. It can count Tx doorbells in the case of Tx queue and Rx doorbells in the case of Rx queue. Signed-off-by: Andrew Rybchenko --- drivers/net/sfc/sfc_dp.h | 3 +-- drivers/net/sfc/sfc_ef100_rx.c | 2 +- drivers/net/sfc/sfc_ef100_tx.c | 2 +- drivers/net/sfc/sfc_ef10_essb_rx.c | 2 +- drivers/net/sfc/sfc_ef10_rx.c | 3 +-- drivers/net/sfc/sfc_ef10_tx.c | 2 +- drivers/net/sfc/sfc_rx.c | 2 +- drivers/net/sfc/sfc_sw_stats.c | 4 ++-- drivers/net/sfc/sfc_tx.c | 2 +- 9 files changed, 10 insertions(+), 12 deletions(-) diff --git a/drivers/net/sfc/sfc_dp.h b/drivers/net/sfc/sfc_dp.h index 994116e480..c302a5cc13 100644 --- a/drivers/net/sfc/sfc_dp.h +++ b/drivers/net/sfc/sfc_dp.h @@ -51,8 +51,7 @@ struct sfc_dp_queue { * used on datapath or reap to have more chances to be cache-hot. */ union sfc_pkts_bytes stats; - uint32_t rx_dbells; - uint32_t tx_dbells; + uint32_t dbells; uint16_t port_id; uint16_t queue_id; diff --git a/drivers/net/sfc/sfc_ef100_rx.c b/drivers/net/sfc/sfc_ef100_rx.c index 83f5c1ec70..259290f14a 100644 --- a/drivers/net/sfc/sfc_ef100_rx.c +++ b/drivers/net/sfc/sfc_ef100_rx.c @@ -124,7 +124,7 @@ sfc_ef100_rx_qpush(struct sfc_ef100_rxq *rxq, unsigned int added) * operations that follow it (i.e. doorbell write). */ rte_write32(dword.ed_u32[0], rxq->doorbell); - rxq->dp.dpq.rx_dbells++; + rxq->dp.dpq.dbells++; sfc_ef100_rx_debug(rxq, "RxQ pushed doorbell at pidx %u (added=%u)", EFX_DWORD_FIELD(dword, ERF_GZ_RX_RING_PIDX), diff --git a/drivers/net/sfc/sfc_ef100_tx.c b/drivers/net/sfc/sfc_ef100_tx.c index c0944df166..b41eddbcca 100644 --- a/drivers/net/sfc/sfc_ef100_tx.c +++ b/drivers/net/sfc/sfc_ef100_tx.c @@ -503,7 +503,7 @@ sfc_ef100_tx_qpush(struct sfc_ef100_txq *txq, unsigned int added) * operations that follow it (i.e. doorbell write). */ rte_write32(dword.ed_u32[0], txq->doorbell); - txq->dp.dpq.tx_dbells++; + txq->dp.dpq.dbells++; sfc_ef100_tx_debug(txq, "TxQ pushed doorbell at pidx %u (added=%u)", EFX_DWORD_FIELD(dword, ERF_GZ_TX_RING_PIDX), diff --git a/drivers/net/sfc/sfc_ef10_essb_rx.c b/drivers/net/sfc/sfc_ef10_essb_rx.c index 67db837afd..4f7d712297 100644 --- a/drivers/net/sfc/sfc_ef10_essb_rx.c +++ b/drivers/net/sfc/sfc_ef10_essb_rx.c @@ -221,7 +221,7 @@ sfc_ef10_essb_rx_qrefill(struct sfc_ef10_essb_rxq *rxq) SFC_ASSERT(rxq->added != added); rxq->added = added; sfc_ef10_rx_qpush(rxq->doorbell, added, rxq_ptr_mask, - &rxq->dp.dpq.rx_dbells); + &rxq->dp.dpq.dbells); } static bool diff --git a/drivers/net/sfc/sfc_ef10_rx.c b/drivers/net/sfc/sfc_ef10_rx.c index 245f616bc2..8503c3c15f 100644 --- a/drivers/net/sfc/sfc_ef10_rx.c +++ b/drivers/net/sfc/sfc_ef10_rx.c @@ -171,8 +171,7 @@ sfc_ef10_rx_qrefill(struct sfc_ef10_rxq *rxq) SFC_ASSERT(rxq->added != added); rxq->added = added; - sfc_ef10_rx_qpush(rxq->doorbell, added, ptr_mask, - &rxq->dp.dpq.rx_dbells); + sfc_ef10_rx_qpush(rxq->doorbell, added, ptr_mask, &rxq->dp.dpq.dbells); } static void diff --git a/drivers/net/sfc/sfc_ef10_tx.c b/drivers/net/sfc/sfc_ef10_tx.c index fc829a6f31..2463c1423a 100644 --- a/drivers/net/sfc/sfc_ef10_tx.c +++ b/drivers/net/sfc/sfc_ef10_tx.c @@ -248,7 +248,7 @@ sfc_ef10_tx_qpush(struct sfc_ef10_txq *txq, unsigned int added, rte_io_wmb(); *(volatile efsys_uint128_t *)txq->doorbell = oword.eo_u128[0]; - txq->dp.dpq.tx_dbells++; + txq->dp.dpq.dbells++; } static unsigned int diff --git a/drivers/net/sfc/sfc_rx.c b/drivers/net/sfc/sfc_rx.c index e2be84b275..17ff2aa67a 100644 --- a/drivers/net/sfc/sfc_rx.c +++ b/drivers/net/sfc/sfc_rx.c @@ -139,7 +139,7 @@ sfc_efx_rx_qrefill(struct sfc_efx_rxq *rxq) SFC_ASSERT(added != rxq->added); rxq->added = added; efx_rx_qpush(rxq->common, added, &rxq->pushed); - rxq->dp.dpq.rx_dbells++; + rxq->dp.dpq.dbells++; } static uint64_t diff --git a/drivers/net/sfc/sfc_sw_stats.c b/drivers/net/sfc/sfc_sw_stats.c index 6b3a01b3c6..70259660c0 100644 --- a/drivers/net/sfc/sfc_sw_stats.c +++ b/drivers/net/sfc/sfc_sw_stats.c @@ -95,7 +95,7 @@ sfc_get_sw_stat_val_rx_dbells(struct sfc_adapter *sa, uint16_t qid, SFC_ASSERT(values_count == 1); rxq_info = sfc_rxq_info_by_ethdev_qid(sas, qid); values[0] = rxq_info->state & SFC_RXQ_INITIALIZED ? - rxq_info->dp->dpq.rx_dbells : 0; + rxq_info->dp->dpq.dbells : 0; } static sfc_get_sw_stat_val_t sfc_get_sw_stat_val_tx_dbells; @@ -110,7 +110,7 @@ sfc_get_sw_stat_val_tx_dbells(struct sfc_adapter *sa, uint16_t qid, SFC_ASSERT(values_count == 1); txq_info = sfc_txq_info_by_ethdev_qid(sas, qid); values[0] = txq_info->state & SFC_TXQ_INITIALIZED ? - txq_info->dp->dpq.tx_dbells : 0; + txq_info->dp->dpq.dbells : 0; } /* diff --git a/drivers/net/sfc/sfc_tx.c b/drivers/net/sfc/sfc_tx.c index bee0beb947..d59a1af3af 100644 --- a/drivers/net/sfc/sfc_tx.c +++ b/drivers/net/sfc/sfc_tx.c @@ -996,7 +996,7 @@ sfc_efx_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) if (likely(pushed != txq->added)) { efx_tx_qpush(txq->common, txq->added, pushed); - txq->dp.dpq.tx_dbells++; + txq->dp.dpq.dbells++; } } -- 2.39.5