diff options
author | shurd <shurd@FreeBSD.org> | 2018-05-11 20:40:26 +0000 |
---|---|---|
committer | shurd <shurd@FreeBSD.org> | 2018-05-11 20:40:26 +0000 |
commit | 01c2925034311b85a59106349a9bc6be4a463619 (patch) | |
tree | 98a954af5c8bef00e8de3901d9c52bf9d509aa60 | |
parent | 93a0075d515d528a41256f63611e6946c63b255f (diff) | |
download | FreeBSD-src-01c2925034311b85a59106349a9bc6be4a463619.zip FreeBSD-src-01c2925034311b85a59106349a9bc6be4a463619.tar.gz |
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
-rw-r--r-- | sys/net/iflib.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/sys/net/iflib.c b/sys/net/iflib.c index 9768ccc..2a0a9c3 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -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_shared_ctx_t sctx, if_ctx_t *ct 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); } |