From owner-svn-src-head@freebsd.org Fri Sep 30 17:30:40 2016 Return-Path: Delivered-To: svn-src-head@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 ED1B8C03D86; Fri, 30 Sep 2016 17:30:40 +0000 (UTC) (envelope-from loos@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 AC149FC1; Fri, 30 Sep 2016 17:30:40 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8UHUddD051709; Fri, 30 Sep 2016 17:30:39 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8UHUdRR051708; Fri, 30 Sep 2016 17:30:39 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201609301730.u8UHUdRR051708@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Fri, 30 Sep 2016 17:30:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r306513 - head/sys/arm/ti/cpsw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Sep 2016 17:30:41 -0000 Author: loos Date: Fri Sep 30 17:30:39 2016 New Revision: 306513 URL: https://svnweb.freebsd.org/changeset/base/306513 Log: Remove the GLOBAL queue lock which just adds unnecessary complexity to code (when used together with the individual tx and rx locks). Sponsored by: Rubicon Communications, LLC (Netgate) Modified: head/sys/arm/ti/cpsw/if_cpsw.c Modified: head/sys/arm/ti/cpsw/if_cpsw.c ============================================================================== --- head/sys/arm/ti/cpsw/if_cpsw.c Fri Sep 30 17:27:17 2016 (r306512) +++ head/sys/arm/ti/cpsw/if_cpsw.c Fri Sep 30 17:30:39 2016 (r306513) @@ -301,25 +301,6 @@ cpsw_debugf(const char *fmt, ...) #define CPSW_RX_UNLOCK(sc) mtx_unlock(&(sc)->rx.lock) #define CPSW_RX_LOCK_ASSERT(sc) mtx_assert(&(sc)->rx.lock, MA_OWNED) -#define CPSW_GLOBAL_LOCK(sc) do { \ - if ((mtx_owned(&(sc)->tx.lock) ? 1 : 0) != \ - (mtx_owned(&(sc)->rx.lock) ? 1 : 0)) { \ - panic("cpsw deadlock possibility detection!"); \ - } \ - mtx_lock(&(sc)->tx.lock); \ - mtx_lock(&(sc)->rx.lock); \ -} while (0) - -#define CPSW_GLOBAL_UNLOCK(sc) do { \ - CPSW_RX_UNLOCK(sc); \ - CPSW_TX_UNLOCK(sc); \ -} while (0) - -#define CPSW_GLOBAL_LOCK_ASSERT(sc) do { \ - CPSW_TX_LOCK_ASSERT(sc); \ - CPSW_RX_LOCK_ASSERT(sc); \ -} while (0) - #define CPSW_PORT_LOCK(_sc) do { \ mtx_assert(&(_sc)->lock, MA_NOTOWNED); \ mtx_lock(&(_sc)->lock); \ @@ -1179,7 +1160,7 @@ cpsw_rx_teardown_locked(struct cpsw_soft cpsw_write_4(sc, CPSW_CPDMA_RX_TEARDOWN, 0); for (;;) { received = cpsw_rx_dequeue(sc); - CPSW_GLOBAL_UNLOCK(sc); + CPSW_RX_UNLOCK(sc); while (received != NULL) { next = received->m_nextpkt; received->m_nextpkt = NULL; @@ -1188,7 +1169,7 @@ cpsw_rx_teardown_locked(struct cpsw_soft if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); received = next; } - CPSW_GLOBAL_LOCK(sc); + CPSW_RX_LOCK(sc); if (!sc->rx.running) { CPSW_DEBUGF(sc, ("finished RX teardown (%d retries)", i)); @@ -1245,10 +1226,12 @@ cpswp_stop_locked(struct cpswp_softc *sc /* Tear down the RX/TX queues. */ if (cpsw_ports_down(sc->swsc)) { - CPSW_GLOBAL_LOCK(sc->swsc); + CPSW_RX_LOCK(sc->swsc); cpsw_rx_teardown_locked(sc->swsc); + CPSW_RX_UNLOCK(sc->swsc); + CPSW_TX_LOCK(sc->swsc); cpsw_tx_teardown_locked(sc->swsc); - CPSW_GLOBAL_UNLOCK(sc->swsc); + CPSW_TX_UNLOCK(sc->swsc); } /* Stop MAC RX/TX modules. */ @@ -2155,7 +2138,7 @@ cpsw_tx_watchdog(void *msc) struct cpsw_softc *sc; sc = msc; - CPSW_GLOBAL_LOCK(sc); + CPSW_TX_LOCK(sc); if (sc->tx.active_queue_len == 0 || !sc->tx.running) { sc->watchdog.timer = 0; /* Nothing to do. */ } else if (sc->tx.queue_removes > sc->tx.queue_removes_at_last_tick) { @@ -2172,7 +2155,7 @@ cpsw_tx_watchdog(void *msc) } } sc->tx.queue_removes_at_last_tick = sc->tx.queue_removes; - CPSW_GLOBAL_UNLOCK(sc); + CPSW_TX_UNLOCK(sc); /* Schedule another timeout one second from now */ callout_reset(&sc->watchdog.callout, hz, cpsw_tx_watchdog, sc);