Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 Apr 2017 00:33:04 +0000 (UTC)
From:      Sean Bruno <sbruno@FreeBSD.org>
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
Message-ID:  <201704070033.v370X4BZ046196@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201704070033.v370X4BZ046196>