From owner-svn-src-stable@freebsd.org Fri Jan 6 07:33:23 2017 Return-Path: Delivered-To: svn-src-stable@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 8CAE5CA11CC; Fri, 6 Jan 2017 07:33:23 +0000 (UTC) (envelope-from arybchik@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 40C261B8D; Fri, 6 Jan 2017 07:33:23 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v067XMwC047129; Fri, 6 Jan 2017 07:33:22 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v067XMxm047128; Fri, 6 Jan 2017 07:33:22 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201701060733.v067XMxm047128@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Fri, 6 Jan 2017 07:33:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r311497 - stable/10/sys/dev/sfxge X-SVN-Group: stable-10 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.23 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, 06 Jan 2017 07:33:23 -0000 Author: arybchik Date: Fri Jan 6 07:33:22 2017 New Revision: 311497 URL: https://svnweb.freebsd.org/changeset/base/311497 Log: MFC r310818 sfxge(4): support per-command MCDI timeout Submitted by: Andy Moreton Sponsored by: Solarflare Communications, Inc. Modified: stable/10/sys/dev/sfxge/sfxge_mcdi.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/sfxge/sfxge_mcdi.c ============================================================================== --- stable/10/sys/dev/sfxge/sfxge_mcdi.c Fri Jan 6 07:32:19 2017 (r311496) +++ stable/10/sys/dev/sfxge/sfxge_mcdi.c Fri Jan 6 07:33:22 2017 (r311497) @@ -55,7 +55,6 @@ __FBSDID("$FreeBSD$"); #define SFXGE_MCDI_POLL_INTERVAL_MIN 10 /* 10us in 1us units */ #define SFXGE_MCDI_POLL_INTERVAL_MAX 100000 /* 100ms in 1us units */ -#define SFXGE_MCDI_WATCHDOG_INTERVAL 10000000 /* 10s in 1us units */ static void sfxge_mcdi_timeout(struct sfxge_softc *sc) @@ -70,7 +69,7 @@ sfxge_mcdi_timeout(struct sfxge_softc *s } static void -sfxge_mcdi_poll(struct sfxge_softc *sc) +sfxge_mcdi_poll(struct sfxge_softc *sc, uint32_t timeout_us) { efx_nic_t *enp; clock_t delay_total; @@ -87,7 +86,7 @@ sfxge_mcdi_poll(struct sfxge_softc *sc) return; } - if (delay_total > SFXGE_MCDI_WATCHDOG_INTERVAL) { + if (delay_total > timeout_us) { aborted = efx_mcdi_request_abort(enp); KASSERT(aborted, ("abort failed")); sfxge_mcdi_timeout(sc); @@ -115,6 +114,7 @@ sfxge_mcdi_execute(void *arg, efx_mcdi_r { struct sfxge_softc *sc; struct sfxge_mcdi *mcdi; + uint32_t timeout_us = 0; sc = (struct sfxge_softc *)arg; mcdi = &sc->mcdi; @@ -125,8 +125,11 @@ sfxge_mcdi_execute(void *arg, efx_mcdi_r ("MCDI not initialized")); /* Issue request and poll for completion. */ + efx_mcdi_get_timeout(sc->enp, emrp, &timeout_us); + KASSERT(timeout_us > 0, ("MCDI timeout not initialized")); + efx_mcdi_request_start(sc->enp, emrp, B_FALSE); - sfxge_mcdi_poll(sc); + sfxge_mcdi_poll(sc, timeout_us); SFXGE_MCDI_UNLOCK(mcdi); }