From owner-svn-src-stable-8@freebsd.org Mon Mar 14 23:43:11 2016 Return-Path: Delivered-To: svn-src-stable-8@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4BE37AD04A3; Mon, 14 Mar 2016 23:43:11 +0000 (UTC) (envelope-from davidcs@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 mx1.freebsd.org (Postfix) with ESMTPS id 1F7FE1F73; Mon, 14 Mar 2016 23:43:11 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u2ENhAO7080151; Mon, 14 Mar 2016 23:43:10 GMT (envelope-from davidcs@FreeBSD.org) Received: (from davidcs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u2ENhAHB080150; Mon, 14 Mar 2016 23:43:10 GMT (envelope-from davidcs@FreeBSD.org) Message-Id: <201603142343.u2ENhAHB080150@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: davidcs set sender to davidcs@FreeBSD.org using -f From: David C Somayajulu Date: Mon, 14 Mar 2016 23:43:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r296878 - stable/8/sys/dev/bxe X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Mar 2016 23:43:11 -0000 Author: davidcs Date: Mon Mar 14 23:43:09 2016 New Revision: 296878 URL: https://svnweb.freebsd.org/changeset/base/296878 Log: MFC r296579 Fix code so that buf_ring allocation for Tx Queues and their mutexes is done during during bxe_attach() and freed during bxe_detach() Modified: stable/8/sys/dev/bxe/bxe.c Directory Properties: stable/8/ (props changed) stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) Modified: stable/8/sys/dev/bxe/bxe.c ============================================================================== --- stable/8/sys/dev/bxe/bxe.c Mon Mar 14 23:33:38 2016 (r296877) +++ stable/8/sys/dev/bxe/bxe.c Mon Mar 14 23:43:09 2016 (r296878) @@ -680,6 +680,8 @@ static void bxe_handle_fp_tq(void *conte static int bxe_add_cdev(struct bxe_softc *sc); static void bxe_del_cdev(struct bxe_softc *sc); static int bxe_grc_dump(struct bxe_softc *sc); +static int bxe_alloc_buf_rings(struct bxe_softc *sc); +static void bxe_free_buf_rings(struct bxe_softc *sc); /* calculate crc32 on a buffer (NOTE: crc32_length MUST be aligned to 8) */ uint32_t @@ -4204,9 +4206,20 @@ bxe_nic_unload(struct bxe_softc *sc, { uint8_t global = FALSE; uint32_t val; + int i; BXE_CORE_LOCK_ASSERT(sc); + sc->ifnet->if_drv_flags &= ~IFF_DRV_RUNNING; + + for (i = 0; i < sc->num_queues; i++) { + struct bxe_fastpath *fp; + + fp = &sc->fp[i]; + BXE_FP_TX_LOCK(fp); + BXE_FP_TX_UNLOCK(fp); + } + BLOGD(sc, DBG_LOAD, "Starting NIC unload...\n"); /* mark driver as unloaded in shmem2 */ @@ -6254,8 +6267,6 @@ bxe_free_fp_buffers(struct bxe_softc *sc m_freem(m); BXE_FP_TX_UNLOCK(fp); } - buf_ring_free(fp->tx_br, M_DEVBUF); - fp->tx_br = NULL; } #endif @@ -6285,14 +6296,6 @@ bxe_free_fp_buffers(struct bxe_softc *sc } /* XXX verify all mbufs were reclaimed */ - - if (mtx_initialized(&fp->tx_mtx)) { - mtx_destroy(&fp->tx_mtx); - } - - if (mtx_initialized(&fp->rx_mtx)) { - mtx_destroy(&fp->rx_mtx); - } } } @@ -6514,15 +6517,6 @@ bxe_alloc_fp_buffers(struct bxe_softc *s for (i = 0; i < sc->num_queues; i++) { fp = &sc->fp[i]; -#if __FreeBSD_version >= 800000 - fp->tx_br = buf_ring_alloc(BXE_BR_SIZE, M_DEVBUF, - M_DONTWAIT, &fp->tx_mtx); - if (fp->tx_br == NULL) { - BLOGE(sc, "buf_ring alloc fail for fp[%02d]\n", i); - goto bxe_alloc_fp_buffers_error; - } -#endif - ring_prod = cqe_ring_prod = 0; fp->rx_bd_cons = 0; fp->rx_cq_cons = 0; @@ -9630,14 +9624,6 @@ bxe_init_eth_fp(struct bxe_softc *sc, fp->sc = sc; fp->index = idx; - snprintf(fp->tx_mtx_name, sizeof(fp->tx_mtx_name), - "bxe%d_fp%d_tx_lock", sc->unit, idx); - mtx_init(&fp->tx_mtx, fp->tx_mtx_name, NULL, MTX_DEF); - - snprintf(fp->rx_mtx_name, sizeof(fp->rx_mtx_name), - "bxe%d_fp%d_rx_lock", sc->unit, idx); - mtx_init(&fp->rx_mtx, fp->rx_mtx_name, NULL, MTX_DEF); - fp->igu_sb_id = (sc->igu_base_sb + idx + CNIC_SUPPORT(sc)); fp->fw_sb_id = (sc->base_fw_ndsb + idx + CNIC_SUPPORT(sc)); @@ -15829,6 +15815,89 @@ bxe_add_sysctls(struct bxe_softc *sc) } } +static int +bxe_alloc_buf_rings(struct bxe_softc *sc) +{ +#if __FreeBSD_version >= 800000 + + int i; + struct bxe_fastpath *fp; + + for (i = 0; i < sc->num_queues; i++) { + + fp = &sc->fp[i]; + + fp->tx_br = buf_ring_alloc(BXE_BR_SIZE, M_DEVBUF, + M_NOWAIT, &fp->tx_mtx); + if (fp->tx_br == NULL) + return (-1); + } +#endif + return (0); +} + +static void +bxe_free_buf_rings(struct bxe_softc *sc) +{ +#if __FreeBSD_version >= 800000 + + int i; + struct bxe_fastpath *fp; + + for (i = 0; i < sc->num_queues; i++) { + + fp = &sc->fp[i]; + + if (fp->tx_br) { + buf_ring_free(fp->tx_br, M_DEVBUF); + fp->tx_br = NULL; + } + } + +#endif +} + +static void +bxe_init_fp_mutexs(struct bxe_softc *sc) +{ + int i; + struct bxe_fastpath *fp; + + for (i = 0; i < sc->num_queues; i++) { + + fp = &sc->fp[i]; + + snprintf(fp->tx_mtx_name, sizeof(fp->tx_mtx_name), + "bxe%d_fp%d_tx_lock", sc->unit, i); + mtx_init(&fp->tx_mtx, fp->tx_mtx_name, NULL, MTX_DEF); + + snprintf(fp->rx_mtx_name, sizeof(fp->rx_mtx_name), + "bxe%d_fp%d_rx_lock", sc->unit, i); + mtx_init(&fp->rx_mtx, fp->rx_mtx_name, NULL, MTX_DEF); + } +} + +static void +bxe_destroy_fp_mutexs(struct bxe_softc *sc) +{ + int i; + struct bxe_fastpath *fp; + + for (i = 0; i < sc->num_queues; i++) { + + fp = &sc->fp[i]; + + if (mtx_initialized(&fp->tx_mtx)) { + mtx_destroy(&fp->tx_mtx); + } + + if (mtx_initialized(&fp->rx_mtx)) { + mtx_destroy(&fp->rx_mtx); + } + } +} + + /* * Device attach function. * @@ -15940,8 +16009,25 @@ bxe_attach(device_t dev) return (ENXIO); } + bxe_init_fp_mutexs(sc); + + if (bxe_alloc_buf_rings(sc) != 0) { + bxe_free_buf_rings(sc); + bxe_interrupt_free(sc); + bxe_del_cdev(sc); + if (sc->ifnet != NULL) { + ether_ifdetach(sc->ifnet); + } + ifmedia_removeall(&sc->ifmedia); + bxe_release_mutexes(sc); + bxe_deallocate_bars(sc); + pci_disable_busmaster(dev); + return (ENXIO); + } + /* allocate ilt */ if (bxe_alloc_ilt_mem(sc) != 0) { + bxe_free_buf_rings(sc); bxe_interrupt_free(sc); bxe_del_cdev(sc); if (sc->ifnet != NULL) { @@ -15957,6 +16043,7 @@ bxe_attach(device_t dev) /* allocate the host hardware/software hsi structures */ if (bxe_alloc_hsi_mem(sc) != 0) { bxe_free_ilt_mem(sc); + bxe_free_buf_rings(sc); bxe_interrupt_free(sc); bxe_del_cdev(sc); if (sc->ifnet != NULL) { @@ -16064,12 +16151,16 @@ bxe_detach(device_t dev) /* free ilt */ bxe_free_ilt_mem(sc); + bxe_free_buf_rings(sc); + /* release the interrupts */ bxe_interrupt_free(sc); /* Release the mutexes*/ + bxe_destroy_fp_mutexs(sc); bxe_release_mutexes(sc); + /* Release the PCIe BAR mapped memory */ bxe_deallocate_bars(sc); From owner-svn-src-stable-8@freebsd.org Tue Mar 15 03:20:26 2016 Return-Path: Delivered-To: svn-src-stable-8@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8A966AC2313; Tue, 15 Mar 2016 03:20:26 +0000 (UTC) (envelope-from ian@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 mx1.freebsd.org (Postfix) with ESMTPS id 41995A94; Tue, 15 Mar 2016 03:20:26 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u2F3KPA9045609; Tue, 15 Mar 2016 03:20:25 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u2F3KPcs045606; Tue, 15 Mar 2016 03:20:25 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201603150320.u2F3KPcs045606@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Tue, 15 Mar 2016 03:20:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r296887 - stable/8/usr.bin/xlint/lint1 X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Mar 2016 03:20:26 -0000 Author: ian Date: Tue Mar 15 03:20:24 2016 New Revision: 296887 URL: https://svnweb.freebsd.org/changeset/base/296887 Log: MFC r206424: (by rdivacky in 2010) Rename the ALIGN macro to LINT_ALIGN so it does not clash with machine/param.h Bump the alignment to 16bytes because lint1 memory allocator is used for objects that require 16bytes alignment on amd64 (ie. val_t). This makes lint1 work when compiled with compiler(s) that use SSE for memcpy on amd64. (e.g. clang). This allows me to compile stable-8 on a 64-bit build host running 10-stable, without dying during the xlint build. It should work fine on 11-current too. Modified: stable/8/usr.bin/xlint/lint1/decl.c stable/8/usr.bin/xlint/lint1/lint1.h stable/8/usr.bin/xlint/lint1/mem1.c Directory Properties: stable/8/usr.bin/xlint/ (props changed) Modified: stable/8/usr.bin/xlint/lint1/decl.c ============================================================================== --- stable/8/usr.bin/xlint/lint1/decl.c Tue Mar 15 01:37:58 2016 (r296886) +++ stable/8/usr.bin/xlint/lint1/decl.c Tue Mar 15 03:20:24 2016 (r296887) @@ -825,15 +825,15 @@ getbound(type_t *tp) } else if (t == FUNC) { /* compiler takes alignment of function */ error(14); - a = ALIGN(1) * CHAR_BIT; + a = LINT_ALIGN(1) * CHAR_BIT; } else { if ((a = size(t)) == 0) { a = CHAR_BIT; - } else if (a > ALIGN(1) * CHAR_BIT) { - a = ALIGN(1) * CHAR_BIT; + } else if (a > LINT_ALIGN(1) * CHAR_BIT) { + a = LINT_ALIGN(1) * CHAR_BIT; } } - if (a < CHAR_BIT || a > ALIGN(1) * CHAR_BIT) + if (a < CHAR_BIT || a > LINT_ALIGN(1) * CHAR_BIT) lerror("getbound() 1"); return (a); } Modified: stable/8/usr.bin/xlint/lint1/lint1.h ============================================================================== --- stable/8/usr.bin/xlint/lint1/lint1.h Tue Mar 15 01:37:58 2016 (r296886) +++ stable/8/usr.bin/xlint/lint1/lint1.h Tue Mar 15 03:20:24 2016 (r296887) @@ -38,8 +38,8 @@ __FBSDID("$FreeBSD$"); #include "op.h" /* XXX - works for most systems, but the whole ALIGN thing needs to go away */ -#ifndef ALIGN -#define ALIGN(x) (((x) + 7) & ~7) +#ifndef LINT_ALIGN +#define LINT_ALIGN(x) (((x) + 15) & ~15) #endif /* Modified: stable/8/usr.bin/xlint/lint1/mem1.c ============================================================================== --- stable/8/usr.bin/xlint/lint1/mem1.c Tue Mar 15 01:37:58 2016 (r296886) +++ stable/8/usr.bin/xlint/lint1/mem1.c Tue Mar 15 03:20:24 2016 (r296887) @@ -203,7 +203,7 @@ xgetblk(mbl_t **mbp, size_t s) void *p; size_t t = 0; - s = ALIGN(s); + s = LINT_ALIGN(s); if ((mb = *mbp) == NULL || mb->nfree < s) { if ((mb = frmblks) == NULL) { if (s > mblklen) { From owner-svn-src-stable-8@freebsd.org Tue Mar 15 04:03:16 2016 Return-Path: Delivered-To: svn-src-stable-8@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 93F1CAD0309; Tue, 15 Mar 2016 04:03:16 +0000 (UTC) (envelope-from ian@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 mx1.freebsd.org (Postfix) with ESMTPS id 6148BFB; Tue, 15 Mar 2016 04:03:16 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u2F43FFq060776; Tue, 15 Mar 2016 04:03:15 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u2F43FSl060775; Tue, 15 Mar 2016 04:03:15 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201603150403.u2F43FSl060775@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Tue, 15 Mar 2016 04:03:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r296888 - stable/8 X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Mar 2016 04:03:16 -0000 Author: ian Date: Tue Mar 15 04:03:15 2016 New Revision: 296888 URL: https://svnweb.freebsd.org/changeset/base/296888 Log: When building on a newer host, boostrap using lex from the stable-8 source to match the yacc being used from that source. This avoids a build error caused by the newer lex emitting a yylex() decl that's already in the source. This is a direct commit to stable-8; there is no corresponding change in later branches to MFC from. For the record, the new lex came in at version 1000032, but slipping it into the 1000013 block makes more sense than creating a whole new .if block for it. Modified: stable/8/Makefile.inc1 Modified: stable/8/Makefile.inc1 ============================================================================== --- stable/8/Makefile.inc1 Tue Mar 15 03:20:24 2016 (r296887) +++ stable/8/Makefile.inc1 Tue Mar 15 04:03:15 2016 (r296888) @@ -953,6 +953,7 @@ _lex= usr.bin/lex .endif .if ${BOOTSTRAPPING} >= 1000013 +_lex= usr.bin/lex _yacc= lib/liby \ usr.bin/yacc .endif