Date: Fri, 11 May 2018 20:40:26 +0000 (UTC) From: Stephen Hurd <shurd@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r333503 - stable/11/sys/net Message-ID: <201805112040.w4BKeQvO053076@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: shurd Date: Fri May 11 20:40:26 2018 New Revision: 333503 URL: https://svnweb.freebsd.org/changeset/base/333503 Log: MFC r333329, r333366, r333373 r333329: Fix off-by-one error requesting tx interrupt r333366: Cleanup queues when iflib_device_register fails r333373: Log iflib_tx_structures_setup failure in function Approved by: re (gjb@) Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D15354 Modified: stable/11/sys/net/iflib.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/net/iflib.c ============================================================================== --- stable/11/sys/net/iflib.c Fri May 11 20:08:28 2018 (r333502) +++ stable/11/sys/net/iflib.c Fri May 11 20:40:26 2018 (r333503) @@ -3269,7 +3269,7 @@ defrag: */ txq->ift_rs_pending += nsegs + 1; if (txq->ift_rs_pending > TXQ_MAX_RS_DEFERRED(txq) || - iflib_no_tx_batch || (TXQ_AVAIL(txq) - nsegs - 1) <= MAX_TX_DESC(ctx)) { + iflib_no_tx_batch || (TXQ_AVAIL(txq) - nsegs) <= MAX_TX_DESC(ctx) + 2) { pi.ipi_flags |= IPI_TX_INTR; txq->ift_rs_pending = 0; } @@ -4342,10 +4342,8 @@ iflib_device_register(device_t dev, void *sc, if_share goto fail; } - if ((err = iflib_qset_structures_setup(ctx))) { - device_printf(dev, "qset structure setup failed %d\n", err); + if ((err = iflib_qset_structures_setup(ctx))) goto fail_queues; - } /* * Group taskqueues aren't properly set up until SMP is started, * so we disable interrupts until we can handle them post @@ -4392,7 +4390,8 @@ fail_intr_free: if (scctx->isc_intr == IFLIB_INTR_MSIX || scctx->isc_intr == IFLIB_INTR_MSI) pci_release_msi(ctx->ifc_dev); fail_queues: - /* XXX free queues */ + iflib_tx_structures_free(ctx); + iflib_rx_structures_free(ctx); fail: IFDI_DETACH(ctx); return (err); @@ -5003,14 +5002,18 @@ iflib_qset_structures_setup(if_ctx_t ctx) { int err; - if ((err = iflib_tx_structures_setup(ctx)) != 0) + /* + * It is expected that the caller takes care of freeing queues if this + * fails. + */ + if ((err = iflib_tx_structures_setup(ctx)) != 0) { + device_printf(ctx->ifc_dev, "iflib_tx_structures_setup failed: %d\n", err); return (err); + } - if ((err = iflib_rx_structures_setup(ctx)) != 0) { + if ((err = iflib_rx_structures_setup(ctx)) != 0) device_printf(ctx->ifc_dev, "iflib_rx_structures_setup failed: %d\n", err); - iflib_tx_structures_free(ctx); - iflib_rx_structures_free(ctx); - } + return (err); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201805112040.w4BKeQvO053076>