Author: shurd
Date: Wed Apr 11 21:41:59 2018
New Revision: 332419
URL: https://svnweb.freebsd.org/changeset/base/332419

Log:
  Properly initialize ifc_nhwtxqs.
  
  Also, since ifc_nhwrxqs is only used in one place, remove it from the struct.
  This was preventing iflib_dma_free() from being called via
  iflib_device_detach().
  
  Submitted by: Matthew Macy <mm...@mattmacy.io>
  Reviewed by:  shurd
  Sponsored by: Limelight Networks

Modified:
  head/sys/net/iflib.c

Modified: head/sys/net/iflib.c
==============================================================================
--- head/sys/net/iflib.c        Wed Apr 11 20:04:06 2018        (r332418)
+++ head/sys/net/iflib.c        Wed Apr 11 21:41:59 2018        (r332419)
@@ -166,7 +166,6 @@ struct iflib_ctx {
        struct mtx ifc_mtx;
 
        uint16_t ifc_nhwtxqs;
-       uint16_t ifc_nhwrxqs;
 
        iflib_txq_t ifc_txqs;
        iflib_rxq_t ifc_rxqs;
@@ -2289,7 +2288,7 @@ iflib_stop(if_ctx_t ctx)
        for (i = 0; i < scctx->isc_nrxqsets; i++, rxq++) {
                /* make sure all transmitters have completed before proceeding 
XXX */
 
-               for (j = 0, di = txq->ift_ifdi; j < ctx->ifc_nhwrxqs; j++, di++)
+               for (j = 0, di = txq->ift_ifdi; j < rxq->ifr_nfl; j++, di++)
                        bzero((void *)di->idi_vaddr, di->idi_size);
                /* also resets the free lists pidx/cidx */
                for (j = 0, fl = rxq->ifr_fl; j < rxq->ifr_nfl; j++, fl++)
@@ -4198,6 +4197,7 @@ iflib_device_register(device_t dev, void *sc, if_share
 
        scctx = &ctx->ifc_softc_ctx;
        ifp = ctx->ifc_ifp;
+       ctx->ifc_nhwtxqs = sctx->isc_ntxqs;
 
        /*
         * XXX sanity check that ntxd & nrxd are a power of 2
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to