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 4FB09A04E1; Tue, 22 Sep 2020 10:56:28 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 52CB21DB75; Tue, 22 Sep 2020 10:51:10 +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 81B7E1D725 for ; Tue, 22 Sep 2020 10:50:21 +0200 (CEST) Received: from mx1-us1.ppe-hosted.com (unknown [10.110.50.143]) by dispatch1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id 5DC642006D for ; Tue, 22 Sep 2020 08:50:21 +0000 (UTC) Received: from us4-mdac16-12.at1.mdlocal (unknown [10.110.49.194]) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id 5D7C58009B for ; Tue, 22 Sep 2020 08:50:21 +0000 (UTC) X-Virus-Scanned: Proofpoint Essentials engine Received: from mx1-us1.ppe-hosted.com (unknown [10.110.50.12]) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id 0C7E94006E for ; Tue, 22 Sep 2020 08:50:21 +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 CA1F940051 for ; Tue, 22 Sep 2020 08:50:20 +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:11 +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:11 +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 08M8oB2Z004746 for ; Tue, 22 Sep 2020 09:50:11 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id F2F3C1613AB for ; Tue, 22 Sep 2020 09:50:10 +0100 (BST) From: Andrew Rybchenko To: Date: Tue, 22 Sep 2020 09:49:30 +0100 Message-ID: <1600764594-14752-37-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-4.178900-8.000000-10 X-TMASE-MatchedRID: UKVvtpGOi8W3CKSZlTKFT2I5Hlv2xZ2jH6pHzc00RUrwJYZa/L83HX7L cZObGgN9rW702S6GBavZJDu+P9KrgkWSfdP0PEqZIf0TE1VduNsxXH/dlhvLv3CR0itW3xfVsoG mWO8qx8739CfzL6vbjTtuVglUWXzvLgycURHhkaJH+PTjR9EWkrp0somlfE2zSg8ufp5n3T6Gon GL0jN7MlfdYI1jtiJOBukl+sGSmY0aeqxnyxGvYiDSF4zvwLoK3YSaHlnZL83g9GtYPBPdS34Ed iDLAdil2TtEMkKrch6udxrwMMiYnjhWRwsgQQIYDDlsUbcsIPqX3dHCCeCwWqT6hbegvOYeF5ZR TdcETVTi8zVgXoAltsIJ+4gwXrEtWBd6ltyXuvu/UKGDnvcK/oPr2VzhM7VzWTkGlwyTI1D1SJp i6psc5+xFWKGrjM0HKvE4Qky0m+mk1AZBJXKEh3fIcQpYNQ6Ha0lrJLFs9jCqFrt9xUgp+uq+T0 IcdvQ1BtPt5WQTZkLauEQaIW46Kz1vpbjBE8IeftwZ3X11IV0= X-TM-AS-User-Approved-Sender: Yes X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--4.178900-8.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.6.1012-25674.003 X-MDID: 1600764621-5JC3il5kjkcb Subject: [dpdk-dev] [PATCH 36/60] common/sfc_efx/base: handle Tx complete 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" Introduce a new event callback which has the same prototype, but provides number of completed descriptors instead of the last completed descriptor index. When all libefx-based drivers implement the new callback, libefx may be updated to use it for Siena and EF10 family NICs and the old one may be removed. Signed-off-by: Andrew Rybchenko Reviewed-by: Andy Moreton --- drivers/common/sfc_efx/base/efx.h | 7 ++++ drivers/common/sfc_efx/base/rhead_ev.c | 51 +++++++++++++++++++++++++- 2 files changed, 57 insertions(+), 1 deletion(-) diff --git a/drivers/common/sfc_efx/base/efx.h b/drivers/common/sfc_efx/base/efx.h index 983b723145..2437980c9e 100644 --- a/drivers/common/sfc_efx/base/efx.h +++ b/drivers/common/sfc_efx/base/efx.h @@ -2319,6 +2319,12 @@ typedef __checkReturn boolean_t __in uint32_t label, __in uint32_t id); +typedef __checkReturn boolean_t +(*efx_tx_ndescs_ev_t)( + __in_opt void *arg, + __in uint32_t label, + __in unsigned int ndescs); + #define EFX_EXCEPTION_RX_RECOVERY 0x00000001 #define EFX_EXCEPTION_RX_DSC_ERROR 0x00000002 #define EFX_EXCEPTION_TX_DSC_ERROR 0x00000003 @@ -2406,6 +2412,7 @@ typedef struct efx_ev_callbacks_s { efx_rx_ps_ev_t eec_rx_ps; #endif efx_tx_ev_t eec_tx; + efx_tx_ndescs_ev_t eec_tx_ndescs; efx_exception_ev_t eec_exception; efx_rxq_flush_done_ev_t eec_rxq_flush_done; efx_rxq_flush_failed_ev_t eec_rxq_flush_failed; diff --git a/drivers/common/sfc_efx/base/rhead_ev.c b/drivers/common/sfc_efx/base/rhead_ev.c index a624b1dd94..48998ccf65 100644 --- a/drivers/common/sfc_efx/base/rhead_ev.c +++ b/drivers/common/sfc_efx/base/rhead_ev.c @@ -23,6 +23,13 @@ rhead_ev_rx_packets( __in const efx_ev_callbacks_t *eecp, __in_opt void *arg); +static __checkReturn boolean_t +rhead_ev_tx_completion( + __in efx_evq_t *eep, + __in efx_qword_t *eqp, + __in const efx_ev_callbacks_t *eecp, + __in_opt void *arg); + static __checkReturn boolean_t rhead_ev_mcdi( @@ -66,7 +73,7 @@ rhead_ev_qcreate( /* Set up the handler table */ eep->ee_rx = rhead_ev_rx_packets; - eep->ee_tx = NULL; /* FIXME */ + eep->ee_tx = rhead_ev_tx_completion; eep->ee_driver = NULL; /* FIXME */ eep->ee_drv_gen = NULL; /* FIXME */ eep->ee_mcdi = rhead_ev_mcdi; @@ -212,6 +219,10 @@ rhead_ev_qpoll( should_abort = eep->ee_rx(eep, &(ev[index]), eecp, arg); break; + case ESE_GZ_EF100_EV_TX_COMPLETION: + should_abort = eep->ee_tx(eep, + &(ev[index]), eecp, arg); + break; case ESE_GZ_EF100_EV_MCDI: should_abort = eep->ee_mcdi(eep, &(ev[index]), eecp, arg); @@ -328,6 +339,44 @@ rhead_ev_rx_packets( return (should_abort); } +static __checkReturn boolean_t +rhead_ev_tx_completion( + __in efx_evq_t *eep, + __in efx_qword_t *eqp, + __in const efx_ev_callbacks_t *eecp, + __in_opt void *arg) +{ + efx_nic_t *enp = eep->ee_enp; + uint32_t num_descs; + uint32_t label; + boolean_t should_abort; + + EFX_EV_QSTAT_INCR(eep, EV_TX); + + /* Discard events after RXQ/TXQ errors, or hardware not available */ + if (enp->en_reset_flags & + (EFX_RESET_RXQ_ERR | EFX_RESET_TXQ_ERR | EFX_RESET_HW_UNAVAIL)) + return (B_FALSE); + + label = EFX_QWORD_FIELD(*eqp, ESF_GZ_EV_TXCMPL_Q_LABEL); + + /* + * On EF100 the EV_TX event reports the number of completed Tx + * descriptors (on EF10, the event reports the low bits of the + * index of the last completed descriptor). + * The client driver completion callback will compute the + * descriptor index, so that is not needed here. + */ + num_descs = EFX_QWORD_FIELD(*eqp, ESF_GZ_EV_TXCMPL_NUM_DESC); + + EFSYS_PROBE2(tx_ndescs, uint32_t, label, unsigned int, num_descs); + + EFSYS_ASSERT(eecp->eec_tx_ndescs != NULL); + should_abort = eecp->eec_tx_ndescs(arg, label, num_descs); + + return (should_abort); +} + static __checkReturn boolean_t rhead_ev_mcdi( __in efx_evq_t *eep, -- 2.17.1