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 8B742A04E1; Tue, 22 Sep 2020 10:56:06 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 24AF01DB6C; Tue, 22 Sep 2020 10:51:08 +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 2514A1D736 for ; Tue, 22 Sep 2020 10:50:21 +0200 (CEST) Received: from mx1-us1.ppe-hosted.com (unknown [10.110.50.150]) by dispatch1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id C126620050 for ; Tue, 22 Sep 2020 08:50:20 +0000 (UTC) Received: from us4-mdac16-6.at1.mdlocal (unknown [10.110.49.173]) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id C06DE800A3 for ; Tue, 22 Sep 2020 08:50:20 +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 39C07100061 for ; Tue, 22 Sep 2020 08:50:20 +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 032A740051 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 08M8oAba004741 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 E429A1613A9 for ; Tue, 22 Sep 2020 09:50:10 +0100 (BST) From: Andrew Rybchenko To: Date: Tue, 22 Sep 2020 09:49:29 +0100 Message-ID: <1600764594-14752-36-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-6.819800-8.000000-10 X-TMASE-MatchedRID: SKbLpZM5T542jeY+Udg/Ij42t8NRMRfEH6pHzc00RUrwJYZa/L83HX8Q cMWiCE6P2ax6tv+nTknJtGCjz42SzYv86dLVvWqPqJSK+HSPY+/uo8ooMQqOsleIuu+Gkot88g3 /FrlIBYoqjtfrxHD0XtL8EByfWwBiLGmmJTL2jhwD2WXLXdz+AfngX/aL8PCN90btya4ycSgGXY vX9dFbnDePvvYKqjb95gwMghrrzQlCXIPbCpslEFCCVuPjoP0CovA/6ONsv0oda1Vk3RqxOIO5T fSzrxQ77tfc12PNMitUEHGr7esKgSctS4FwlL6VIwk7p1qp3JYwjY20D2quYuy9vsxhLmzepBjV yjacfaxEpHaTXB/p5WjxB4+cTFbXvfadVsSXb6csisyWO3dp26crPbNuRpm6yaz/THj7NZyjxYy RBa/qJcFwgTvxipFajoczmuoPCq3rAumP/cOT6YPUepLeN+d5xvqhKk+auUjlawy734N43qqRR+ 8fQZKSQwymtxuJ6y0= X-TM-AS-User-Approved-Sender: Yes X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--6.819800-8.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.6.1012-25674.003 X-MDID: 1600764620-Z2dtpTfFoCTj Subject: [dpdk-dev] [PATCH 35/60] common/sfc_efx/base: handle Rx events for 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" Rx event on Riverhead provides a number of received packets and no classification/offloads information is available Rx event. Introduce a new event callback to be implemented by drivers. The callback provides information about the number of completed packets. libefx-based drivers should implement the new callback for Riverhead and keep the old one for Siena and EF10 NICs. The new callback may be used for Medford2 NO_CONT_EV Rx mode support. Signed-off-by: Andrew Rybchenko Reviewed-by: Andy Moreton --- drivers/common/sfc_efx/base/efx.h | 8 ++++ drivers/common/sfc_efx/base/rhead_ev.c | 56 +++++++++++++++++++++++++- 2 files changed, 63 insertions(+), 1 deletion(-) diff --git a/drivers/common/sfc_efx/base/efx.h b/drivers/common/sfc_efx/base/efx.h index 2c49280a43..983b723145 100644 --- a/drivers/common/sfc_efx/base/efx.h +++ b/drivers/common/sfc_efx/base/efx.h @@ -2277,6 +2277,13 @@ typedef __checkReturn boolean_t __in uint32_t size, __in uint16_t flags); +typedef __checkReturn boolean_t +(*efx_rx_packets_ev_t)( + __in_opt void *arg, + __in uint32_t label, + __in unsigned int num_packets, + __in uint32_t flags); + #if EFSYS_OPT_RX_PACKED_STREAM || EFSYS_OPT_RX_ES_SUPER_BUFFER /* @@ -2394,6 +2401,7 @@ typedef __checkReturn boolean_t typedef struct efx_ev_callbacks_s { efx_initialized_ev_t eec_initialized; efx_rx_ev_t eec_rx; + efx_rx_packets_ev_t eec_rx_packets; #if EFSYS_OPT_RX_PACKED_STREAM || EFSYS_OPT_RX_ES_SUPER_BUFFER efx_rx_ps_ev_t eec_rx_ps; #endif diff --git a/drivers/common/sfc_efx/base/rhead_ev.c b/drivers/common/sfc_efx/base/rhead_ev.c index 0205769e70..a624b1dd94 100644 --- a/drivers/common/sfc_efx/base/rhead_ev.c +++ b/drivers/common/sfc_efx/base/rhead_ev.c @@ -16,6 +16,13 @@ */ #define EFX_RHEAD_ALWAYS_INTERRUPTING_EVQ_INDEX (0) +static __checkReturn boolean_t +rhead_ev_rx_packets( + __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( @@ -58,7 +65,7 @@ rhead_ev_qcreate( _NOTE(ARGUNUSED(id)) /* buftbl id managed by MC */ /* Set up the handler table */ - eep->ee_rx = NULL; /* FIXME */ + eep->ee_rx = rhead_ev_rx_packets; eep->ee_tx = NULL; /* FIXME */ eep->ee_driver = NULL; /* FIXME */ eep->ee_drv_gen = NULL; /* FIXME */ @@ -201,6 +208,10 @@ rhead_ev_qpoll( code = EFX_QWORD_FIELD(ev[index], ESF_GZ_E_TYPE); switch (code) { + case ESE_GZ_EF100_EV_RX_PKTS: + should_abort = eep->ee_rx(eep, + &(ev[index]), eecp, arg); + break; case ESE_GZ_EF100_EV_MCDI: should_abort = eep->ee_mcdi(eep, &(ev[index]), eecp, arg); @@ -274,6 +285,49 @@ rhead_ev_qstats_update( } #endif /* EFSYS_OPT_QSTATS */ +static __checkReturn boolean_t +rhead_ev_rx_packets( + __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 label; + uint32_t num_packets; + boolean_t should_abort; + + EFX_EV_QSTAT_INCR(eep, EV_RX); + + /* 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_RXPKTS_Q_LABEL); + + /* + * On EF100 the EV_RX event reports the number of received + * packets (unlike EF10 which reports a descriptor index). + * The client driver is responsible for maintaining the Rx + * descriptor index, and computing how many descriptors are + * occupied by each received packet (based on the Rx buffer size + * and the packet length from the Rx prefix). + */ + num_packets = EFX_QWORD_FIELD(*eqp, ESF_GZ_EV_RXPKTS_NUM_PKT); + + /* + * The receive event may indicate more than one packet, and so + * does not contain the packet length. Read the packet length + * from the prefix when handling each packet. + */ + EFSYS_ASSERT(eecp->eec_rx_packets != NULL); + should_abort = eecp->eec_rx_packets(arg, label, num_packets, + EFX_PKT_PREFIX_LEN); + + return (should_abort); +} + static __checkReturn boolean_t rhead_ev_mcdi( __in efx_evq_t *eep, -- 2.17.1