From patchwork Fri Dec 2 07:41:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Rybchenko X-Patchwork-Id: 17386 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 0D1136932; Fri, 2 Dec 2016 08:42:19 +0100 (CET) Received: from nbfkord-smmo03.seg.att.com (nbfkord-smmo03.seg.att.com [209.65.160.84]) by dpdk.org (Postfix) with ESMTP id 32D4E689B for ; Fri, 2 Dec 2016 08:42:02 +0100 (CET) Received: from unknown [12.187.104.26] (EHLO webmail.solarflare.com) by nbfkord-smmo03.seg.att.com(mxl_mta-7.2.4-7) over TLS secured channel with ESMTP id 9c521485.0.394291.00-2338.805107.nbfkord-smmo03.seg.att.com (envelope-from ); Fri, 02 Dec 2016 07:42:02 +0000 (UTC) X-MXL-Hash: 584125ca3c140a6e-019ee9041a5828f66d49cbfe729deb1f1eb4994f Received: from ocex03.SolarFlarecom.com (10.20.40.36) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1044.25; Thu, 1 Dec 2016 23:41:58 -0800 Received: from opal.uk.solarflarecom.com (10.17.10.1) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1044.25 via Frontend Transport; Thu, 1 Dec 2016 23:41:58 -0800 Received: from uklogin.uk.solarflarecom.com (uklogin.uk.solarflarecom.com [10.17.10.10]) by opal.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id uB27fvWC005697 for ; Fri, 2 Dec 2016 07:41:57 GMT Received: from uklogin.uk.solarflarecom.com (localhost.localdomain [127.0.0.1]) by uklogin.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id uB27fZXt026464 for ; Fri, 2 Dec 2016 07:41:57 GMT From: Andrew Rybchenko To: Date: Fri, 2 Dec 2016 07:41:20 +0000 Message-ID: <1480664481-26427-2-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1480664481-26427-1-git-send-email-arybchenko@solarflare.com> References: <1480664481-26427-1-git-send-email-arybchenko@solarflare.com> MIME-Version: 1.0 X-AnalysisOut: [v=2.1 cv=HuVwbhnS c=1 sm=1 tr=0 a=8BlWFWvVlq5taO8ncb8nKg==] X-AnalysisOut: [:17 a=n5n_aSjo0skA:10 a=zRKbQ67AAAAA:8 a=GXR-bymMMbl77G2L-] X-AnalysisOut: [qYA:9 a=PA03WX8tBzeizutn5_OT:22] X-Spam: [F=0.2000000000; CM=0.500; S=0.200(2015072901)] X-MAIL-FROM: X-SOURCE-IP: [12.187.104.26] Subject: [dpdk-dev] [PATCH 1/2] net/sfc: restart RxQ in case of exception on its event queue 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" Examples of recoverable exceptions are: - unexpected Rx event (Rx scatter abort with non-zero size, too big Rx descriptors batch completed) - Rx error due to invalid Rx descriptors push - Rx error due to Rx descriptor read error (e.g. unmapped Rx ring and denied by IOMMU) Reviewed-by: Andrew Lee Reviewed-by: Robert Stonehouse Signed-off-by: Andrew Rybchenko --- drivers/net/sfc/sfc.h | 6 ++++++ drivers/net/sfc/sfc_ev.c | 26 ++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/drivers/net/sfc/sfc.h b/drivers/net/sfc/sfc.h index 29d3a6b..995dfe6 100644 --- a/drivers/net/sfc/sfc.h +++ b/drivers/net/sfc/sfc.h @@ -187,6 +187,12 @@ sfc_adapter_lock(struct sfc_adapter *sa) rte_spinlock_lock(&sa->lock); } +static inline int +sfc_adapter_trylock(struct sfc_adapter *sa) +{ + return rte_spinlock_trylock(&sa->lock); +} + static inline void sfc_adapter_unlock(struct sfc_adapter *sa) { diff --git a/drivers/net/sfc/sfc_ev.c b/drivers/net/sfc/sfc_ev.c index 96b95cc..36aede8 100644 --- a/drivers/net/sfc/sfc_ev.c +++ b/drivers/net/sfc/sfc_ev.c @@ -30,6 +30,7 @@ #include #include #include +#include #include "efx.h" @@ -320,6 +321,31 @@ sfc_ev_qpoll(struct sfc_evq *evq) efx_ev_qpoll(evq->common, &evq->read_ptr, &sfc_ev_callbacks, evq); + if (unlikely(evq->exception) && sfc_adapter_trylock(evq->sa)) { + struct sfc_adapter *sa = evq->sa; + int rc; + + if ((evq->rxq != NULL) && (evq->rxq->state & SFC_RXQ_RUNNING)) { + unsigned int rxq_sw_index = sfc_rxq_sw_index(evq->rxq); + + sfc_warn(sa, + "restart RxQ %u because of exception on its EvQ %u", + rxq_sw_index, evq->evq_index); + + sfc_rx_qstop(sa, rxq_sw_index); + rc = sfc_rx_qstart(sa, rxq_sw_index); + if (rc != 0) + sfc_err(sa, "cannot restart RxQ %u", + rxq_sw_index); + } + + if (evq->exception) + sfc_panic(sa, "unrecoverable exception on EvQ %u", + evq->evq_index); + + sfc_adapter_unlock(sa); + } + /* Poll-mode driver does not re-prime the event queue for interrupts */ }