From owner-svn-src-head@freebsd.org Fri Apr 7 00:33:05 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4E5EBD30558; Fri, 7 Apr 2017 00:33:05 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2B68AB6D; Fri, 7 Apr 2017 00:33:05 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v370X4Vw046199; Fri, 7 Apr 2017 00:33:04 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v370X4BZ046196; Fri, 7 Apr 2017 00:33:04 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201704070033.v370X4BZ046196@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Fri, 7 Apr 2017 00:33:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r316596 - in head/sys: dev/e1000 net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Apr 2017 00:33:05 -0000 Author: sbruno Date: Fri Apr 7 00:33:03 2017 New Revision: 316596 URL: https://svnweb.freebsd.org/changeset/base/316596 Log: Move pause frame counter out of struct if_ctx and into struct if_softc_ctx_t so that we can use it in iflib to detect pause frames. The igb(4) driver definitely used to use this in its old timer function and I see no reason to restrict it to that driver only. Sponsored by: Limelight Networks Modified: head/sys/dev/e1000/if_em.c head/sys/net/iflib.c head/sys/net/iflib.h Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Thu Apr 6 23:40:51 2017 (r316595) +++ head/sys/dev/e1000/if_em.c Fri Apr 7 00:33:03 2017 (r316596) @@ -3705,6 +3705,11 @@ em_update_stats_counters(struct adapter adapter->stats.xonrxc += E1000_READ_REG(&adapter->hw, E1000_XONRXC); adapter->stats.xontxc += E1000_READ_REG(&adapter->hw, E1000_XONTXC); adapter->stats.xoffrxc += E1000_READ_REG(&adapter->hw, E1000_XOFFRXC); + /* + ** For watchdog management we need to know if we have been + ** paused during the last interval, so capture that here. + */ + adapter->shared->isc_pause_frames = adapter->stats.xoffrxc; adapter->stats.xofftxc += E1000_READ_REG(&adapter->hw, E1000_XOFFTXC); adapter->stats.fcruc += E1000_READ_REG(&adapter->hw, E1000_FCRUC); adapter->stats.prc64 += E1000_READ_REG(&adapter->hw, E1000_PRC64); Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Thu Apr 6 23:40:51 2017 (r316595) +++ head/sys/net/iflib.c Fri Apr 7 00:33:03 2017 (r316596) @@ -170,7 +170,6 @@ struct iflib_ctx { int ifc_link_state; int ifc_link_irq; - int ifc_pause_frames; int ifc_watchdog_events; struct cdev *ifc_led_dev; struct resource *ifc_msix_mem; @@ -2087,6 +2086,7 @@ iflib_timer(void *arg) { iflib_txq_t txq = arg; if_ctx_t ctx = txq->ift_ctx; + if_softc_ctx_t sctx = &ctx->ifc_softc_ctx; if (!(if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_RUNNING)) return; @@ -2098,7 +2098,7 @@ iflib_timer(void *arg) IFDI_TIMER(ctx, txq->ift_id); if ((txq->ift_qstatus == IFLIB_QUEUE_HUNG) && ((txq->ift_cleaned_prev == txq->ift_cleaned) || - (ctx->ifc_pause_frames == 0))) + (sctx->isc_pause_frames == 0))) goto hung; if (ifmp_ring_is_stalled(txq->ift_br)) @@ -2108,7 +2108,7 @@ iflib_timer(void *arg) if (txq->ift_db_pending) GROUPTASK_ENQUEUE(&txq->ift_task); - ctx->ifc_pause_frames = 0; + sctx->isc_pause_frames = 0; if (if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_RUNNING) callout_reset_on(&txq->ift_timer, hz/2, iflib_timer, txq, txq->ift_timer.c_cpu); return; @@ -2120,7 +2120,6 @@ hung: IFDI_WATCHDOG_RESET(ctx); ctx->ifc_watchdog_events++; - ctx->ifc_pause_frames = 0; ctx->ifc_flags |= IFC_DO_RESET; iflib_admin_intr_deferred(ctx); Modified: head/sys/net/iflib.h ============================================================================== --- head/sys/net/iflib.h Thu Apr 6 23:40:51 2017 (r316595) +++ head/sys/net/iflib.h Fri Apr 7 00:33:03 2017 (r316596) @@ -215,6 +215,7 @@ typedef struct if_softc_ctx { iflib_intr_mode_t isc_intr; uint16_t isc_max_frame_size; /* set at init time by driver */ + uint32_t isc_pause_frames; /* set by driver for iflib_timer to detect */ pci_vendor_info_t isc_vendor_info; /* set by iflib prior to attach_pre */ int isc_disable_msix; if_txrx_t isc_txrx;