From owner-svn-src-all@freebsd.org Thu Oct 8 07:18:29 2015 Return-Path: Delivered-To: svn-src-all@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 C456B9D0A33; Thu, 8 Oct 2015 07:18:29 +0000 (UTC) (envelope-from adrian@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 9E7DE2F5; Thu, 8 Oct 2015 07:18:29 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t987ISST048331; Thu, 8 Oct 2015 07:18:28 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t987ISqf048330; Thu, 8 Oct 2015 07:18:28 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510080718.t987ISqf048330@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Thu, 8 Oct 2015 07:18:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r289008 - head/sys/dev/wpi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Oct 2015 07:18:30 -0000 Author: adrian Date: Thu Oct 8 07:18:28 2015 New Revision: 289008 URL: https://svnweb.freebsd.org/changeset/base/289008 Log: wpi(4): add some branch predictions. Submitted by: Differential Revision: https://reviews.freebsd.org/D3759 Modified: head/sys/dev/wpi/if_wpi.c Modified: head/sys/dev/wpi/if_wpi.c ============================================================================== --- head/sys/dev/wpi/if_wpi.c Thu Oct 8 07:17:35 2015 (r289007) +++ head/sys/dev/wpi/if_wpi.c Thu Oct 8 07:18:28 2015 (r289008) @@ -1925,7 +1925,7 @@ wpi_rx_done(struct wpi_softc *sc, struct stat = (struct wpi_rx_stat *)(desc + 1); - if (stat->len > WPI_STAT_MAXLEN) { + if (__predict_false(stat->len > WPI_STAT_MAXLEN)) { device_printf(sc->sc_dev, "invalid RX statistic header\n"); goto fail1; } @@ -1955,7 +1955,7 @@ wpi_rx_done(struct wpi_softc *sc, struct } m1 = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, MJUMPAGESIZE); - if (m1 == NULL) { + if (__predict_false(m1 == NULL)) { DPRINTF(sc, WPI_DEBUG_ANY, "%s: no mbuf to restock ring\n", __func__); goto fail1; @@ -1964,7 +1964,7 @@ wpi_rx_done(struct wpi_softc *sc, struct error = bus_dmamap_load(ring->data_dmat, data->map, mtod(m1, void *), MJUMPAGESIZE, wpi_dma_map_addr, &paddr, BUS_DMA_NOWAIT); - if (error != 0 && error != EFBIG) { + if (__predict_false(error != 0 && error != EFBIG)) { device_printf(sc->sc_dev, "%s: bus_dmamap_load failed, error %d\n", __func__, error); m_freem(m1); @@ -2198,7 +2198,7 @@ wpi_notif_intr(struct wpi_softc *sc) /* An 802.11 frame has been received. */ wpi_rx_done(sc, desc, data); - if (sc->sc_running == 0) { + if (__predict_false(sc->sc_running == 0)) { /* wpi_stop() was called. */ return; } @@ -2527,7 +2527,8 @@ wpi_intr(void *arg) r1 = WPI_READ(sc, WPI_INT); - if (r1 == 0xffffffff || (r1 & 0xfffffff0) == 0xa5a5a5a0) + if (__predict_false(r1 == 0xffffffff || + (r1 & 0xfffffff0) == 0xa5a5a5a0)) goto end; /* Hardware gone! */ r2 = WPI_READ(sc, WPI_FH_INT); @@ -2542,7 +2543,7 @@ wpi_intr(void *arg) WPI_WRITE(sc, WPI_INT, r1); WPI_WRITE(sc, WPI_FH_INT, r2); - if (r1 & (WPI_INT_SW_ERR | WPI_INT_HW_ERR)) { + if (__predict_false(r1 & (WPI_INT_SW_ERR | WPI_INT_HW_ERR))) { device_printf(sc->sc_dev, "fatal firmware error\n"); #ifdef WPI_DEBUG wpi_debug_registers(sc); @@ -2567,7 +2568,7 @@ wpi_intr(void *arg) done: /* Re-enable interrupts. */ - if (sc->sc_running) + if (__predict_true(sc->sc_running)) WPI_WRITE(sc, WPI_INT_MASK, WPI_INT_MASK_DEF); end: WPI_UNLOCK(sc); @@ -2591,7 +2592,7 @@ wpi_cmd2(struct wpi_softc *sc, struct wp DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_BEGIN, __func__); - if (sc->sc_running == 0) { + if (__predict_false(sc->sc_running == 0)) { /* wpi_stop() was called */ error = ENETDOWN; goto fail; @@ -2644,7 +2645,7 @@ wpi_cmd2(struct wpi_softc *sc, struct wp error = bus_dmamap_load_mbuf_sg(ring->data_dmat, data->map, buf->m, segs, &nsegs, BUS_DMA_NOWAIT); - if (error != 0) { + if (__predict_false(error != 0)) { device_printf(sc->sc_dev, "%s: can't map mbuf (error %d)\n", __func__, error); @@ -3061,7 +3062,7 @@ wpi_transmit(struct ieee80211com *ic, st DPRINTF(sc, WPI_DEBUG_XMIT, "%s: called\n", __func__); /* Check if interface is up & running. */ - if (sc->sc_running == 0) { + if (__predict_false(sc->sc_running == 0)) { error = ENXIO; goto unlock; } @@ -3160,7 +3161,7 @@ wpi_cmd(struct wpi_softc *sc, int code, DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_BEGIN, __func__); - if (sc->sc_running == 0) { + if (__predict_false(sc->sc_running == 0)) { /* wpi_stop() was called */ if (code == WPI_CMD_SCAN) error = ENETDOWN;