From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id AF381A04E1; Tue, 22 Sep 2020 10:52:19 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CDDDB1DAC1; Tue, 22 Sep 2020 10:50:41 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [67.231.154.164]) by dpdk.org (Postfix) with ESMTP id 38E4D1D70C for ; Tue, 22 Sep 2020 10:50:17 +0200 (CEST) Received: from mx1-us1.ppe-hosted.com (unknown [10.110.50.137]) by dispatch1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id DAAFA20062 for ; Tue, 22 Sep 2020 08:50:16 +0000 (UTC) Received: from us4-mdac16-56.at1.mdlocal (unknown [10.110.48.199]) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id DAA2F6009B for ; Tue, 22 Sep 2020 08:50:16 +0000 (UTC) X-Virus-Scanned: Proofpoint Essentials engine Received: from mx1-us1.ppe-hosted.com (unknown [10.110.50.8]) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id 6760E22004D for ; Tue, 22 Sep 2020 08:50:16 +0000 (UTC) Received: from webmail.solarflare.com (uk.solarflare.com [193.34.186.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id 2E6424C0059 for ; Tue, 22 Sep 2020 08:50:16 +0000 (UTC) Received: from ukex01.SolarFlarecom.com (10.17.10.4) by ukex01.SolarFlarecom.com (10.17.10.4) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 22 Sep 2020 09:50:10 +0100 Received: from opal.uk.solarflarecom.com (10.17.10.1) by ukex01.SolarFlarecom.com (10.17.10.4) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 22 Sep 2020 09:50:10 +0100 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 08M8oA95004666 for ; Tue, 22 Sep 2020 09:50:10 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id 0A6FC1613A9 for ; Tue, 22 Sep 2020 09:50:10 +0100 (BST) From: Andrew Rybchenko To: Date: Tue, 22 Sep 2020 09:49:14 +0100 Message-ID: <1600764594-14752-21-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1600764594-14752-1-git-send-email-arybchenko@solarflare.com> References: <1600764594-14752-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.6.1012-25674.003 X-TM-AS-Result: No-8.075200-8.000000-10 X-TMASE-MatchedRID: S+rRSYBLXJsfLZjRGBdfQbzgL/eLACDEAZn/4A9db2RKddiF2Wo8eZv8 OBKGKGJrLWabnXd3sbEUUZUcIrQXSSaHInC0kEnSLbjXqdzdtCV6i696PjRPiI5JUK9UdYkncij MZrr2iZ2t2gtuWr1LmoUeih7oVVPgBynbVEv5faHbbgI4AuYpVwZyESFXAljfc3igmsO92YHGmG lCTaxrRF890HgjV6tnQL+jDTIbnJ/jadsomdxplO9YaEWtcpo2XGjQf7uckKvbspKx4YOD3ZcFn +/+Esg7FOGBZ0GoT8/QSeCRl5BMID4Mxg/VjhfPQ24lJ40XApi6hgVvSdGKo12sM+iSqvF9qKnX y/QNZhWv46y+TjZtax8Pxha3QGpW63uSu/qSbCaeAiCmPx4NwBnUJ0Ek6yhjxEHRux+uk8irEHf aj14ZyV697GpNV0wtJ0LJUKeBWRDaw+JinpVUaoNymLjGRnc4MA+10QetsLZWXGvUUmKP2w== X-TM-AS-User-Approved-Sender: Yes X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--8.075200-8.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.6.1012-25674.003 X-MDID: 1600764616-PARjdovbkyMz Subject: [dpdk-dev] [PATCH 20/60] common/sfc_efx/base: move EvQ create generic checks 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" There is no point to duplicate these generic checks in NIC family specific handlers. As the side effect it fixes bug with incorrect interrupt moderation settings silently ignored on event queue create on Siena. Signed-off-by: Andrew Rybchenko Reviewed-by: Andy Moreton Reviewed-by: Vijay Kumar Srivastava --- drivers/common/sfc_efx/base/ef10_ev.c | 20 ++----------- drivers/common/sfc_efx/base/efx_ev.c | 42 ++++++++++++++++----------- 2 files changed, 28 insertions(+), 34 deletions(-) diff --git a/drivers/common/sfc_efx/base/ef10_ev.c b/drivers/common/sfc_efx/base/ef10_ev.c index 08729cf71e..18f19e816d 100644 --- a/drivers/common/sfc_efx/base/ef10_ev.c +++ b/drivers/common/sfc_efx/base/ef10_ev.c @@ -133,16 +133,6 @@ ef10_ev_qcreate( _NOTE(ARGUNUSED(id)) /* buftbl id managed by MC */ - if (index >= encp->enc_evq_limit) { - rc = EINVAL; - goto fail1; - } - - if (us > encp->enc_evq_timer_max_us) { - rc = EINVAL; - goto fail2; - } - /* * NO_CONT_EV mode is only requested from the firmware when creating * receive queues, but here it needs to be specified at event queue @@ -156,7 +146,7 @@ ef10_ev_qcreate( if (flags & EFX_EVQ_FLAGS_NO_CONT_EV) { if (enp->en_nic_cfg.enc_no_cont_ev_mode_supported == B_FALSE) { rc = EINVAL; - goto fail3; + goto fail1; } } @@ -197,7 +187,7 @@ ef10_ev_qcreate( rc = efx_mcdi_init_evq_v2(enp, index, esmp, ndescs, irq, us, flags); if (rc != 0) - goto fail4; + goto fail2; } else { /* * On Huntington we need to specify the settings to use. @@ -214,15 +204,11 @@ ef10_ev_qcreate( rc = efx_mcdi_init_evq(enp, index, esmp, ndescs, irq, us, flags, low_latency); if (rc != 0) - goto fail5; + goto fail3; } return (0); -fail5: - EFSYS_PROBE(fail5); -fail4: - EFSYS_PROBE(fail4); fail3: EFSYS_PROBE(fail3); fail2: diff --git a/drivers/common/sfc_efx/base/efx_ev.c b/drivers/common/sfc_efx/base/efx_ev.c index 21fddfb64d..4d11c531ce 100644 --- a/drivers/common/sfc_efx/base/efx_ev.c +++ b/drivers/common/sfc_efx/base/efx_ev.c @@ -236,18 +236,28 @@ efx_ev_qcreate( EFSYS_ASSERT3U(enp->en_ev_qcount + 1, <, enp->en_nic_cfg.enc_evq_limit); + if (index >= encp->enc_evq_limit) { + rc = EINVAL; + goto fail1; + } + + if (us > encp->enc_evq_timer_max_us) { + rc = EINVAL; + goto fail2; + } + switch (flags & EFX_EVQ_FLAGS_NOTIFY_MASK) { case EFX_EVQ_FLAGS_NOTIFY_INTERRUPT: break; case EFX_EVQ_FLAGS_NOTIFY_DISABLED: if (us != 0) { rc = EINVAL; - goto fail1; + goto fail3; } break; default: rc = EINVAL; - goto fail2; + goto fail4; } EFSYS_ASSERT(ISP2(encp->enc_evq_max_nevs)); @@ -257,14 +267,14 @@ efx_ev_qcreate( ndescs < encp->enc_evq_min_nevs || ndescs > encp->enc_evq_max_nevs) { rc = EINVAL; - goto fail3; + goto fail5; } /* Allocate an EVQ object */ EFSYS_KMEM_ALLOC(enp->en_esip, sizeof (efx_evq_t), eep); if (eep == NULL) { rc = ENOMEM; - goto fail4; + goto fail6; } eep->ee_magic = EFX_EVQ_MAGIC; @@ -287,16 +297,20 @@ efx_ev_qcreate( if ((rc = eevop->eevo_qcreate(enp, index, esmp, ndescs, id, us, flags, eep)) != 0) - goto fail5; + goto fail7; return (0); -fail5: - EFSYS_PROBE(fail5); +fail7: + EFSYS_PROBE(fail7); *eepp = NULL; enp->en_ev_qcount--; EFSYS_KMEM_FREE(enp->en_esip, sizeof (efx_evq_t), eep); +fail6: + EFSYS_PROBE(fail6); +fail5: + EFSYS_PROBE(fail5); fail4: EFSYS_PROBE(fail4); fail3: @@ -1189,15 +1203,11 @@ siena_ev_qcreate( _NOTE(ARGUNUSED(esmp)) - if (index >= encp->enc_evq_limit) { - rc = EINVAL; - goto fail1; - } #if EFSYS_OPT_RX_SCALE if (enp->en_intr.ei_type == EFX_INTR_LINE && index >= EFX_MAXRSS_LEGACY) { rc = EINVAL; - goto fail2; + goto fail1; } #endif for (size = 0; @@ -1207,7 +1217,7 @@ siena_ev_qcreate( break; if (id + (1 << size) >= encp->enc_buftbl_limit) { rc = EINVAL; - goto fail3; + goto fail2; } /* Set up the handler table */ @@ -1239,13 +1249,11 @@ siena_ev_qcreate( return (0); -fail3: - EFSYS_PROBE(fail3); -#if EFSYS_OPT_RX_SCALE fail2: EFSYS_PROBE(fail2); -#endif +#if EFSYS_OPT_RX_SCALE fail1: +#endif EFSYS_PROBE1(fail1, efx_rc_t, rc); return (rc); -- 2.17.1