From owner-svn-src-stable-11@freebsd.org Thu May 14 21:59:24 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 259D32E18BE; Thu, 14 May 2020 21:59:24 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49NQRw09L6z40rT; Thu, 14 May 2020 21:59:24 +0000 (UTC) (envelope-from erj@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 F082019E31; Thu, 14 May 2020 21:59:23 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 04ELxNQ4033157; Thu, 14 May 2020 21:59:23 GMT (envelope-from erj@FreeBSD.org) Received: (from erj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 04ELxNnA033156; Thu, 14 May 2020 21:59:23 GMT (envelope-from erj@FreeBSD.org) Message-Id: <202005142159.04ELxNnA033156@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: erj set sender to erj@FreeBSD.org using -f From: Eric Joyner Date: Thu, 14 May 2020 21:59:23 +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: r361063 - stable/11/sys/net X-SVN-Group: stable-11 X-SVN-Commit-Author: erj X-SVN-Commit-Paths: stable/11/sys/net X-SVN-Commit-Revision: 361063 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-11@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2020 21:59:24 -0000 Author: erj Date: Thu May 14 21:59:23 2020 New Revision: 361063 URL: https://svnweb.freebsd.org/changeset/base/361063 Log: Partially MFC r354344: iflib: properly release memory allocated for DMA This also removes the unused function iflib_deregister(); accidentally introduced in a previous MFC. Sponsored by: Intel Corporation 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 Thu May 14 21:46:12 2020 (r361062) +++ stable/11/sys/net/iflib.c Thu May 14 21:59:23 2020 (r361063) @@ -731,7 +731,6 @@ static int iflib_legacy_setup(if_ctx_t ctx, driver_fil static void iflib_txq_check_drain(iflib_txq_t txq, int budget); static uint32_t iflib_txq_can_drain(struct ifmp_ring *); static int iflib_register(if_ctx_t); -static void iflib_deregister(if_ctx_t); static void iflib_unregister_vlan_handlers(if_ctx_t ctx); static void iflib_init_locked(if_ctx_t ctx); static void iflib_add_device_sysctl_pre(if_ctx_t ctx); @@ -1596,10 +1595,8 @@ iflib_txsd_destroy(if_ctx_t ctx, iflib_txq_t txq, int { bus_dmamap_t map; - map = NULL; - if (txq->ift_sds.ifsd_map != NULL) + if (txq->ift_sds.ifsd_map != NULL) { map = txq->ift_sds.ifsd_map[i]; - if (map != NULL) { bus_dmamap_unload(txq->ift_desc_tag, map); bus_dmamap_destroy(txq->ift_desc_tag, map); txq->ift_sds.ifsd_map[i] = NULL; @@ -2008,9 +2005,6 @@ iflib_fl_bufs_free(iflib_fl_t fl) if (fl->ifl_sds.ifsd_map != NULL) { bus_dmamap_t sd_map = fl->ifl_sds.ifsd_map[i]; bus_dmamap_unload(fl->ifl_desc_tag, sd_map); - // XXX: Should this get moved out? - if (iflib_in_detach(fl->ifl_rxq->ifr_ctx)) - bus_dmamap_destroy(fl->ifl_desc_tag, sd_map); } if (*sd_m != NULL) { m_init(*sd_m, M_NOWAIT, MT_DATA, 0); @@ -4856,29 +4850,6 @@ iflib_unregister_vlan_handlers(if_ctx_t ctx) } -static void -iflib_deregister(if_ctx_t ctx) -{ - if_t ifp = ctx->ifc_ifp; - - /* Remove all media */ - ifmedia_removeall(&ctx->ifc_media); - - /* Ensure that VLAN event handlers are unregistered */ - iflib_unregister_vlan_handlers(ctx); - - /* Release kobject reference */ - kobj_delete((kobj_t) ctx, NULL); - - /* Free the ifnet structure */ - if_free(ifp); - - STATE_LOCK_DESTROY(ctx); - - /* ether_ifdetach calls if_qflush - lock must be destroy afterwards*/ - CTX_LOCK_DESTROY(ctx); -} - static int iflib_queues_alloc(if_ctx_t ctx) { @@ -5173,8 +5144,12 @@ static void iflib_rx_structures_free(if_ctx_t ctx) { iflib_rxq_t rxq = ctx->ifc_rxqs; + if_shared_ctx_t sctx = ctx->ifc_sctx; + int i, j; - for (int i = 0; i < ctx->ifc_softc_ctx.isc_nrxqsets; i++, rxq++) { + for (i = 0; i < ctx->ifc_softc_ctx.isc_nrxqsets; i++, rxq++) { + for (j = 0; j < sctx->isc_nrxqs; j++) + iflib_dma_free(&rxq->ifr_ifdi[j]); iflib_rx_sds_free(rxq); } free(ctx->ifc_rxqs, M_IFLIB);