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 9BDC9A04E1; Tue, 22 Sep 2020 10:54:17 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D5B661DB1D; Tue, 22 Sep 2020 10:50:55 +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 174F61D720 for ; Tue, 22 Sep 2020 10:50:20 +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 9D93120058 for ; Tue, 22 Sep 2020 08:50:19 +0000 (UTC) Received: from us4-mdac16-33.at1.mdlocal (unknown [10.110.49.217]) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id 9CAF36009B for ; Tue, 22 Sep 2020 08:50:19 +0000 (UTC) X-Virus-Scanned: Proofpoint Essentials engine Received: from mx1-us1.ppe-hosted.com (unknown [10.110.50.7]) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id 3499A220054 for ; Tue, 22 Sep 2020 08:50:19 +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 F18CA4C005C for ; Tue, 22 Sep 2020 08:50:18 +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 08M8oAoA004679; 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 479731613BE; Tue, 22 Sep 2020 09:50:10 +0100 (BST) From: Andrew Rybchenko To: CC: Ivan Malov Date: Tue, 22 Sep 2020 09:49:18 +0100 Message-ID: <1600764594-14752-25-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-12.166200-8.000000-10 X-TMASE-MatchedRID: d1H6qgit8iW3CKSZlTKFTzIjK23O9D33ecm5MLY/475KDy5+nmfdPubL nggvqoV3odulkTJrLACIY8ivHy/5E0VmSHq9Uv731T7WuTapx0oZSo6PM4Lsis1YMD+2TGH/MWM 94lj32bR/MmgtAHVjaBlmULbAHsuHahH+l6+69lgtuNep3N20JYVQ55H8w+7mQbcly18O6sNPio 8ccJLAYU9X7I2Zhfqs5vUv9HiEFG8MhpM+zlgvP5xVZzZr7+O769xONVZSrH2+GYmD5FwZEkJmf ftVAWC9VKof8nN+v9+wV0nFZaiBYuKjFlxcu5AGQuFiD+xrWCwCPiT971fk7Jl8NETW6pKCypp7 h0UrnMpgBq+T1SGAT/1+tT1rdLd8VKGvQ8smqCVlpwNsTvdlKZTXNrcm6D3CabJxhiIFjJkxQJ2 2xpM8eYutokGdHfkcfNoHi9eWoqxeFCVeyol8efCW/PNRRp/ZoiKTb964zHXZys5NkrEkyaip18 v0DWYVODq14EZkGmO+/EZB0N4pAsomsOO5srHBtKR5FXfbysytggmrIZxcdWhLNmF22y36o8WMk QWv6iUKb4Bq/kRu2lcppCzPq+1UOwBXM346/+yJ2TcaHlojx7n8cqtech8VTOzHLN9p1ubFlbrF BKNQmU/CA7m7393r X-TM-AS-User-Approved-Sender: Yes X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--12.166200-8.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.6.1012-25674.003 X-MDID: 1600764619-PB73aRuPSlyl Subject: [dpdk-dev] [PATCH 24/60] common/sfc_efx/base: complete EvQ creation on Riverhead 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" From: Ivan Malov Client drivers relying on interrupts will fail to complete event queue creation on Riverhead boards as the latter have no support for INIT_DONE events which means that it's useless to wait until initialisation callback is triggered by interrupt-driven polling. Client drivers which avoid interrupt-driven polling still handle INIT_DONE events by direct polling and will fail to do so. Solve this problem by adding an extra poll-once method which will be called by client drivers after queue creation (probably, with driver-specific lock being held). The method will invoke initialisation callback on Riverhead and do nothing on the other boards. Then the drivers will proceed with normal waiting which will complete immediately in the case of Riverhead. Signed-off-by: Ivan Malov Signed-off-by: Andrew Rybchenko Reviewed-by: Andy Moreton --- drivers/common/sfc_efx/base/efx.h | 8 +++++ drivers/common/sfc_efx/base/efx_ev.c | 30 +++++++++++++++++++ drivers/common/sfc_efx/base/hunt_nic.c | 6 ++++ drivers/common/sfc_efx/base/medford2_nic.c | 6 ++++ drivers/common/sfc_efx/base/medford_nic.c | 6 ++++ drivers/common/sfc_efx/base/rhead_nic.c | 6 ++++ drivers/common/sfc_efx/base/siena_nic.c | 6 ++++ .../sfc_efx/rte_common_sfc_efx_version.map | 1 + drivers/net/sfc/sfc_ev.c | 12 ++++++-- 9 files changed, 79 insertions(+), 2 deletions(-) diff --git a/drivers/common/sfc_efx/base/efx.h b/drivers/common/sfc_efx/base/efx.h index c7fe814ca0..2c49280a43 100644 --- a/drivers/common/sfc_efx/base/efx.h +++ b/drivers/common/sfc_efx/base/efx.h @@ -1443,6 +1443,7 @@ typedef struct efx_nic_cfg_s { uint32_t enc_vf; uint32_t enc_privilege_mask; #endif /* EFSYS_OPT_RIVERHEAD || EFX_OPTS_EF10() */ + boolean_t enc_evq_init_done_ev_supported; boolean_t enc_bug26807_workaround; boolean_t enc_bug35388_workaround; boolean_t enc_bug41750_workaround; @@ -2430,6 +2431,13 @@ efx_ev_qprefetch( #endif /* EFSYS_OPT_EV_PREFETCH */ +LIBEFX_API +extern void +efx_ev_qcreate_check_init_done( + __in efx_evq_t *eep, + __in const efx_ev_callbacks_t *eecp, + __in_opt void *arg); + LIBEFX_API extern void efx_ev_qpoll( diff --git a/drivers/common/sfc_efx/base/efx_ev.c b/drivers/common/sfc_efx/base/efx_ev.c index edc1b182c9..99a7743edb 100644 --- a/drivers/common/sfc_efx/base/efx_ev.c +++ b/drivers/common/sfc_efx/base/efx_ev.c @@ -423,6 +423,36 @@ efx_ev_qprefetch( #endif /* EFSYS_OPT_EV_PREFETCH */ +/* + * This method is needed to ensure that eec_initialized callback + * is invoked after queue creation. The callback will be invoked + * on Riverhead boards which have no support for INIT_DONE events + * and will do nothing on other boards. + * + * The client drivers must call this method after calling efx_ev_create(). + * The call must be done with the same locks being held (if any) which are + * normally acquired around efx_ev_qpoll() calls to ensure that + * eec_initialized callback is invoked within the same locking context. + */ + void +efx_ev_qcreate_check_init_done( + __in efx_evq_t *eep, + __in const efx_ev_callbacks_t *eecp, + __in_opt void *arg) +{ + const efx_nic_cfg_t *encp; + + EFSYS_ASSERT(eep != NULL); + EFSYS_ASSERT3U(eep->ee_magic, ==, EFX_EVQ_MAGIC); + EFSYS_ASSERT(eecp != NULL); + EFSYS_ASSERT(eecp->eec_initialized != NULL); + + encp = efx_nic_cfg_get(eep->ee_enp); + + if (encp->enc_evq_init_done_ev_supported == B_FALSE) + (void) eecp->eec_initialized(arg); +} + void efx_ev_qpoll( __in efx_evq_t *eep, diff --git a/drivers/common/sfc_efx/base/hunt_nic.c b/drivers/common/sfc_efx/base/hunt_nic.c index 75c9050070..489c2d35d3 100644 --- a/drivers/common/sfc_efx/base/hunt_nic.c +++ b/drivers/common/sfc_efx/base/hunt_nic.c @@ -76,6 +76,12 @@ hunt_board_cfg( uint32_t bandwidth; efx_rc_t rc; + /* + * Event queue creation is complete when an + * EVQ_INIT_DONE_EV event is received. + */ + encp->enc_evq_init_done_ev_supported = B_TRUE; + /* * Enable firmware workarounds for hardware errata. * Expected responses are: diff --git a/drivers/common/sfc_efx/base/medford2_nic.c b/drivers/common/sfc_efx/base/medford2_nic.c index 1a454fc34b..f19435a202 100644 --- a/drivers/common/sfc_efx/base/medford2_nic.c +++ b/drivers/common/sfc_efx/base/medford2_nic.c @@ -44,6 +44,12 @@ medford2_board_cfg( uint32_t bandwidth; efx_rc_t rc; + /* + * Event queue creation is complete when an + * EVQ_INIT_DONE_EV event is received. + */ + encp->enc_evq_init_done_ev_supported = B_TRUE; + /* * Enable firmware workarounds for hardware errata. * Expected responses are: diff --git a/drivers/common/sfc_efx/base/medford_nic.c b/drivers/common/sfc_efx/base/medford_nic.c index 6c85b0c841..6ad9af9403 100644 --- a/drivers/common/sfc_efx/base/medford_nic.c +++ b/drivers/common/sfc_efx/base/medford_nic.c @@ -42,6 +42,12 @@ medford_board_cfg( uint32_t bandwidth; efx_rc_t rc; + /* + * Event queue creation is complete when an + * EVQ_INIT_DONE_EV event is received. + */ + encp->enc_evq_init_done_ev_supported = B_TRUE; + /* * Enable firmware workarounds for hardware errata. * Expected responses are: diff --git a/drivers/common/sfc_efx/base/rhead_nic.c b/drivers/common/sfc_efx/base/rhead_nic.c index c83d18e6ab..b779b4f8e1 100644 --- a/drivers/common/sfc_efx/base/rhead_nic.c +++ b/drivers/common/sfc_efx/base/rhead_nic.c @@ -51,6 +51,12 @@ rhead_board_cfg( encp->enc_buftbl_limit = UINT32_MAX; + /* + * Riverhead event queue creation completes + * immediately (no initial event). + */ + encp->enc_evq_init_done_ev_supported = B_FALSE; + /* * Enable firmware workarounds for hardware errata. * Expected responses are: diff --git a/drivers/common/sfc_efx/base/siena_nic.c b/drivers/common/sfc_efx/base/siena_nic.c index b9b6d1951c..beabac0d38 100644 --- a/drivers/common/sfc_efx/base/siena_nic.c +++ b/drivers/common/sfc_efx/base/siena_nic.c @@ -135,6 +135,12 @@ siena_board_cfg( encp->enc_rx_scale_additional_modes_supported = B_FALSE; #endif /* EFSYS_OPT_RX_SCALE */ + /* + * Event queue creation is complete when an + * EVQ_INIT_DONE_EV event is received. + */ + encp->enc_evq_init_done_ev_supported = B_TRUE; + encp->enc_tx_dma_desc_size_max = EFX_MASK32(FSF_AZ_TX_KER_BYTE_COUNT); /* Fragments must not span 4k boundaries. */ encp->enc_tx_dma_desc_boundary = 4096; diff --git a/drivers/common/sfc_efx/rte_common_sfc_efx_version.map b/drivers/common/sfc_efx/rte_common_sfc_efx_version.map index 5e2a7ad919..9b1715bfee 100644 --- a/drivers/common/sfc_efx/rte_common_sfc_efx_version.map +++ b/drivers/common/sfc_efx/rte_common_sfc_efx_version.map @@ -6,6 +6,7 @@ INTERNAL { efx_ev_fini; efx_ev_init; efx_ev_qcreate; + efx_ev_qcreate_check_init_done; efx_ev_qdestroy; efx_ev_qmoderate; efx_ev_qpending; diff --git a/drivers/net/sfc/sfc_ev.c b/drivers/net/sfc/sfc_ev.c index 83115e8775..7e5676fa45 100644 --- a/drivers/net/sfc/sfc_ev.c +++ b/drivers/net/sfc/sfc_ev.c @@ -608,6 +608,8 @@ sfc_ev_qstart(struct sfc_evq *evq, unsigned int hw_index) else evq_flags |= EFX_EVQ_FLAGS_NOTIFY_DISABLED; + evq->init_state = SFC_EVQ_STARTING; + /* Create the common code event queue */ rc = efx_ev_qcreate(sa->nic, hw_index, esmp, evq->entries, 0 /* unused on EF10 */, 0, evq_flags, @@ -632,7 +634,13 @@ sfc_ev_qstart(struct sfc_evq *evq, unsigned int hw_index) evq->callbacks = &sfc_ev_callbacks; } - evq->init_state = SFC_EVQ_STARTING; + /* + * Poll once to ensure that eec_initialized callback is invoked in + * case if the hardware does not support INIT_DONE events. If the + * hardware supports INIT_DONE events, this will do nothing, and the + * corresponding event will be processed by sfc_ev_qpoll() below. + */ + efx_ev_qcreate_check_init_done(evq->common, evq->callbacks, evq); /* Wait for the initialization event */ total_delay_us = 0; @@ -665,10 +673,10 @@ sfc_ev_qstart(struct sfc_evq *evq, unsigned int hw_index) return 0; fail_timedout: - evq->init_state = SFC_EVQ_INITIALIZED; efx_ev_qdestroy(evq->common); fail_ev_qcreate: + evq->init_state = SFC_EVQ_INITIALIZED; sfc_log_init(sa, "failed %d", rc); return rc; } -- 2.17.1