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
This commit is contained in:
Sean Bruno 2017-04-07 00:33:03 +00:00
parent a3b7d0fb60
commit 60596476cf
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=316596
3 changed files with 9 additions and 4 deletions

View File

@ -3705,6 +3705,11 @@ em_update_stats_counters(struct adapter *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);

View File

@ -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 @@ iflib_timer(void *arg)
IFDI_WATCHDOG_RESET(ctx);
ctx->ifc_watchdog_events++;
ctx->ifc_pause_frames = 0;
ctx->ifc_flags |= IFC_DO_RESET;
iflib_admin_intr_deferred(ctx);

View File

@ -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;