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 <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
This commit is contained in:
Andrew Rybchenko 2020-09-24 13:12:04 +01:00 committed by Ferruh Yigit
parent 4664935a73
commit 7d382a059b
2 changed files with 5 additions and 8 deletions

View File

@ -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);
}

View File

@ -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);