From owner-svn-src-stable@freebsd.org Fri May 11 20:40:27 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 09EC2FCBE8C; Fri, 11 May 2018 20:40:27 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B148C6A819; Fri, 11 May 2018 20:40:26 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 926D1148D0; Fri, 11 May 2018 20:40:26 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4BKeQ3U053077; Fri, 11 May 2018 20:40:26 GMT (envelope-from shurd@FreeBSD.org) Received: (from shurd@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4BKeQvO053076; Fri, 11 May 2018 20:40:26 GMT (envelope-from shurd@FreeBSD.org) Message-Id: <201805112040.w4BKeQvO053076@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: shurd set sender to shurd@FreeBSD.org using -f From: Stephen Hurd Date: Fri, 11 May 2018 20:40:26 +0000 (UTC) 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 X-SVN-Group: stable-11 X-SVN-Commit-Author: shurd X-SVN-Commit-Paths: stable/11/sys/net X-SVN-Commit-Revision: 333503 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 May 2018 20:40:27 -0000 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); }