From patchwork Tue Nov 29 16:19:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Rybchenko X-Patchwork-Id: 17312 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 61594FA98; Tue, 29 Nov 2016 17:22:31 +0100 (CET) Received: from nbfkord-smmo01.seg.att.com (nbfkord-smmo01.seg.att.com [209.65.160.76]) by dpdk.org (Postfix) with ESMTP id 50C79475D for ; Tue, 29 Nov 2016 17:20:53 +0100 (CET) Received: from unknown [12.187.104.26] (EHLO nbfkord-smmo01.seg.att.com) by nbfkord-smmo01.seg.att.com(mxl_mta-7.2.4-7) with ESMTP id 5eaad385.2b3e98666940.83585.00-2495.173910.nbfkord-smmo01.seg.att.com (envelope-from ); Tue, 29 Nov 2016 16:20:53 +0000 (UTC) X-MXL-Hash: 583daae54516bbed-fdc243b745cdda082412f2ce9b7e66393b2fb91e Received: from unknown [12.187.104.26] by nbfkord-smmo01.seg.att.com(mxl_mta-7.2.4-7) with SMTP id 2eaad385.0.83424.00-2358.173855.nbfkord-smmo01.seg.att.com (envelope-from ); Tue, 29 Nov 2016 16:20:51 +0000 (UTC) X-MXL-Hash: 583daae3367de582-cbc3431ac1181417a8739330d5065e56c3179998 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; Tue, 29 Nov 2016 08:20:26 -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; Tue, 29 Nov 2016 08:20:25 -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 uATGKOWE030020; Tue, 29 Nov 2016 16:20:24 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 uATGKM1m021233; Tue, 29 Nov 2016 16:20:24 GMT From: Andrew Rybchenko To: CC: Date: Tue, 29 Nov 2016 16:19:12 +0000 Message-ID: <1480436367-20749-41-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1480436367-20749-1-git-send-email-arybchenko@solarflare.com> References: <1479740470-6723-1-git-send-email-arybchenko@solarflare.com> <1480436367-20749-1-git-send-email-arybchenko@solarflare.com> MIME-Version: 1.0 X-AnalysisOut: [v=2.1 cv=UoJlQrEB c=1 sm=1 tr=0 a=8BlWFWvVlq5taO8ncb8nKg==] X-AnalysisOut: [:17 a=L24OOQBejmoA:10 a=zRKbQ67AAAAA:8 a=9Zmx-CB1EvL28Kt1B] X-AnalysisOut: [EsA: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 v2 40/55] net/sfc: periodic management EVQ polling using alarm X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Timers cannot be used to implement periodic polling, since it implies requirement on application to process timers in the main loop. Reviewed-by: Andy Moreton Signed-off-by: Andrew Rybchenko --- drivers/net/sfc/sfc_ev.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/drivers/net/sfc/sfc_ev.c b/drivers/net/sfc/sfc_ev.c index a6a1ee2..179c4f8 100644 --- a/drivers/net/sfc/sfc_ev.c +++ b/drivers/net/sfc/sfc_ev.c @@ -29,6 +29,7 @@ #include #include +#include #include "efx.h" @@ -45,6 +46,9 @@ /* Event queue init approx timeout */ #define SFC_EVQ_INIT_TIMEOUT_US (2 * US_PER_S) +/* Management event queue polling period in microseconds */ +#define SFC_MGMT_EV_QPOLL_PERIOD_US (US_PER_S) + static boolean_t sfc_ev_initialized(void *arg) @@ -328,6 +332,34 @@ sfc_ev_qstop(struct sfc_adapter *sa, unsigned int sw_index) efx_ev_qdestroy(evq->common); } +static void +sfc_ev_mgmt_periodic_qpoll(void *arg) +{ + struct sfc_adapter *sa = arg; + int rc; + + sfc_ev_mgmt_qpoll(sa); + + rc = rte_eal_alarm_set(SFC_MGMT_EV_QPOLL_PERIOD_US, + sfc_ev_mgmt_periodic_qpoll, sa); + if (rc != 0) + sfc_panic(sa, + "cannot rearm management EVQ polling alarm (rc=%d)", + rc); +} + +static void +sfc_ev_mgmt_periodic_qpoll_start(struct sfc_adapter *sa) +{ + sfc_ev_mgmt_periodic_qpoll(sa); +} + +static void +sfc_ev_mgmt_periodic_qpoll_stop(struct sfc_adapter *sa) +{ + rte_eal_alarm_cancel(sfc_ev_mgmt_periodic_qpoll, sa); +} + int sfc_ev_start(struct sfc_adapter *sa) { @@ -349,6 +381,14 @@ sfc_ev_start(struct sfc_adapter *sa) rte_spinlock_unlock(&sa->mgmt_evq_lock); /* + * Start management EVQ polling. If interrupts are disabled + * (not used), it is required to process link status change + * and other device level events to avoid unrecoverable + * error because the event queue overflow. + */ + sfc_ev_mgmt_periodic_qpoll_start(sa); + + /* * Rx/Tx event queues are started/stopped when corresponding * Rx/Tx queue is started/stopped. */ @@ -371,6 +411,8 @@ sfc_ev_stop(struct sfc_adapter *sa) sfc_log_init(sa, "entry"); + sfc_ev_mgmt_periodic_qpoll_stop(sa); + /* Make sure that all event queues are stopped */ sw_index = sa->evq_count; while (sw_index-- > 0) {