From 7d382a059b749a5754bdf41538c3ea1b1e4cd35e Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Thu, 24 Sep 2020 13:12:04 +0100 Subject: [PATCH] common/sfc_efx/base: maintain RxQ counter in generic code The counter is incremented in generic efx_rx_qcreate(), but was asserted and decremented in NIC family specific queue create and destroy callbacks. Move assert and decrement to generic functions as well to make NIC family specific callbacks shorter. Signed-off-by: Andrew Rybchenko Reviewed-by: Andy Moreton --- drivers/common/sfc_efx/base/ef10_rx.c | 4 ---- drivers/common/sfc_efx/base/efx_rx.c | 9 +++++---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/common/sfc_efx/base/ef10_rx.c b/drivers/common/sfc_efx/base/ef10_rx.c index f27058963f..7004ab2aca 100644 --- a/drivers/common/sfc_efx/base/ef10_rx.c +++ b/drivers/common/sfc_efx/base/ef10_rx.c @@ -844,7 +844,6 @@ ef10_rx_qcreate( EFX_STATIC_ASSERT(EFX_EV_RX_NLABELS == (1 << ESF_DZ_RX_QLABEL_WIDTH)); EFSYS_ASSERT3U(label, <, EFX_EV_RX_NLABELS); - EFSYS_ASSERT3U(enp->en_rx_qcount + 1, <, encp->enc_rxq_limit); if (index >= encp->enc_rxq_limit) { rc = EINVAL; @@ -1022,9 +1021,6 @@ ef10_rx_qdestroy( ef10_ev_rxlabel_fini(eep, label); - EFSYS_ASSERT(enp->en_rx_qcount != 0); - --enp->en_rx_qcount; - EFSYS_KMEM_FREE(enp->en_esip, sizeof (efx_rxq_t), erp); } diff --git a/drivers/common/sfc_efx/base/efx_rx.c b/drivers/common/sfc_efx/base/efx_rx.c index cce34cfce9..a361112849 100644 --- a/drivers/common/sfc_efx/base/efx_rx.c +++ b/drivers/common/sfc_efx/base/efx_rx.c @@ -819,6 +819,8 @@ efx_rx_qcreate_internal( EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_RX); + EFSYS_ASSERT3U(enp->en_rx_qcount + 1, <, encp->enc_rxq_limit); + EFSYS_ASSERT(ISP2(encp->enc_rxq_max_ndescs)); EFSYS_ASSERT(ISP2(encp->enc_rxq_min_ndescs)); @@ -975,6 +977,9 @@ efx_rx_qdestroy( EFSYS_ASSERT3U(erp->er_magic, ==, EFX_RXQ_MAGIC); + EFSYS_ASSERT(enp->en_rx_qcount != 0); + --enp->en_rx_qcount; + erxop->erxo_qdestroy(erp); } @@ -1626,7 +1631,6 @@ siena_rx_qcreate( EFX_STATIC_ASSERT(EFX_EV_RX_NLABELS == (1 << FRF_AZ_RX_DESCQ_LABEL_WIDTH)); EFSYS_ASSERT3U(label, <, EFX_EV_RX_NLABELS); - EFSYS_ASSERT3U(enp->en_rx_qcount + 1, <, encp->enc_rxq_limit); if (index >= encp->enc_rxq_limit) { rc = EINVAL; @@ -1697,9 +1701,6 @@ siena_rx_qdestroy( efx_nic_t *enp = erp->er_enp; efx_oword_t oword; - EFSYS_ASSERT(enp->en_rx_qcount != 0); - --enp->en_rx_qcount; - /* Purge descriptor queue */ EFX_ZERO_OWORD(oword); -- 2.20.1