From owner-svn-src-all@freebsd.org Mon Aug 10 09:02:35 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 9415799D582; Mon, 10 Aug 2015 09:02:35 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::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 83E686E4; Mon, 10 Aug 2015 09:02:35 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t7A92Zmf037377; Mon, 10 Aug 2015 09:02:35 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t7A92YTa037374; Mon, 10 Aug 2015 09:02:34 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201508100902.t7A92YTa037374@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Mon, 10 Aug 2015 09:02:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286568 - head/sys/dev/mps 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: Mon, 10 Aug 2015 09:02:35 -0000 Author: scottl Date: Mon Aug 10 09:02:34 2015 New Revision: 286568 URL: https://svnweb.freebsd.org/changeset/base/286568 Log: Remove mps_request_polled(), it's redundant to mps_wait_command() Obtained from: Netflix, Inc. Modified: head/sys/dev/mps/mps.c head/sys/dev/mps/mps_config.c head/sys/dev/mps/mpsvar.h Modified: head/sys/dev/mps/mps.c ============================================================================== --- head/sys/dev/mps/mps.c Mon Aug 10 08:57:34 2015 (r286567) +++ head/sys/dev/mps/mps.c Mon Aug 10 09:02:34 2015 (r286568) @@ -2084,7 +2084,7 @@ mps_update_events(struct mps_softc *sc, cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mps_request_polled(sc, cm); + error = mps_wait_command(sc, cm, 60, 0); reply = (MPI2_EVENT_NOTIFICATION_REPLY *)cm->cm_reply; if ((reply == NULL) || (reply->IOCStatus & MPI2_IOCSTATUS_MASK) != MPI2_IOCSTATUS_SUCCESS) @@ -2508,18 +2508,21 @@ mps_wait_command(struct mps_softc *sc, s return EBUSY; cm->cm_complete = NULL; - cm->cm_flags |= (MPS_CM_FLAGS_WAKEUP + MPS_CM_FLAGS_POLLED); + cm->cm_flags |= MPS_CM_FLAGS_POLLED; error = mps_map_command(sc, cm); if ((error != 0) && (error != EINPROGRESS)) return (error); - // Check for context and wait for 50 mSec at a time until time has - // expired or the command has finished. If msleep can't be used, need - // to poll. + /* + * Check for context and wait for 50 mSec at a time until time has + * expired or the command has finished. If msleep can't be used, need + * to poll. + */ if (curthread->td_no_sleeping != 0) sleep_flag = NO_SLEEP; getmicrotime(&start_time); if (mtx_owned(&sc->mps_mtx) && sleep_flag == CAN_SLEEP) { + cm->cm_flags |= MPS_CM_FLAGS_WAKEUP; error = msleep(cm, &sc->mps_mtx, 0, "mpswait", timeout*hz); } else { while ((cm->cm_flags & MPS_CM_FLAGS_COMPLETE) == 0) { @@ -2548,54 +2551,6 @@ mps_wait_command(struct mps_softc *sc, s } /* - * This is the routine to enqueue a command synchonously and poll for - * completion. Its use should be rare. - */ -int -mps_request_polled(struct mps_softc *sc, struct mps_command *cm) -{ - int error, timeout = 0, rc; - struct timeval cur_time, start_time; - - error = 0; - - cm->cm_flags |= MPS_CM_FLAGS_POLLED; - cm->cm_complete = NULL; - mps_map_command(sc, cm); - - getmicrotime(&start_time); - while ((cm->cm_flags & MPS_CM_FLAGS_COMPLETE) == 0) { - mps_intr_locked(sc); - - if (mtx_owned(&sc->mps_mtx)) - msleep(&sc->msleep_fake_chan, &sc->mps_mtx, 0, - "mpspoll", hz/20); - else - pause("mpsdiag", hz/20); - - /* - * Check for real-time timeout and fail if more than 60 seconds. - */ - getmicrotime(&cur_time); - timeout = cur_time.tv_sec - start_time.tv_sec; - if (timeout > 60) { - mps_dprint(sc, MPS_FAULT, "polling failed\n"); - error = ETIMEDOUT; - break; - } - } - - if (error) { - mps_dprint(sc, MPS_FAULT, "Calling Reinit from %s\n", __func__); - rc = mps_reinit(sc); - mps_dprint(sc, MPS_FAULT, "Reinit %s\n", (rc == 0) ? "success" : - "failed"); - } - - return (error); -} - -/* * The MPT driver had a verbose interface for config pages. In this driver, * reduce it to much simplier terms, similar to the Linux driver. */ Modified: head/sys/dev/mps/mps_config.c ============================================================================== --- head/sys/dev/mps/mps_config.c Mon Aug 10 08:57:34 2015 (r286567) +++ head/sys/dev/mps/mps_config.c Mon Aug 10 09:02:34 2015 (r286568) @@ -230,7 +230,7 @@ mps_config_get_man_pg10(struct mps_softc * This page must be polled because the IOC isn't ready yet when this * page is needed. */ - error = mps_request_polled(sc, cm); + error = mps_wait_command(sc, cm, 60, 0); reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ @@ -286,7 +286,7 @@ mps_config_get_man_pg10(struct mps_softc * This page must be polled because the IOC isn't ready yet when this * page is needed. */ - error = mps_request_polled(sc, cm); + error = mps_wait_command(sc, cm, 60, 0); reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ @@ -1123,7 +1123,7 @@ mps_config_get_raid_volume_pg0(struct mp * This page must be polled because the IOC isn't ready yet when this * page is needed. */ - error = mps_request_polled(sc, cm); + error = mps_wait_command(sc, cm, 60, 0); reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ @@ -1180,7 +1180,7 @@ mps_config_get_raid_volume_pg0(struct mp * This page must be polled because the IOC isn't ready yet when this * page is needed. */ - error = mps_request_polled(sc, cm); + error = mps_wait_command(sc, cm, 60, 0); reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ @@ -1409,7 +1409,7 @@ mps_config_get_raid_pd_pg0(struct mps_so * This page must be polled because the IOC isn't ready yet when this * page is needed. */ - error = mps_request_polled(sc, cm); + error = mps_wait_command(sc, cm, 60, 0); reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ @@ -1466,7 +1466,7 @@ mps_config_get_raid_pd_pg0(struct mps_so * This page must be polled because the IOC isn't ready yet when this * page is needed. */ - error = mps_request_polled(sc, cm); + error = mps_wait_command(sc, cm, 60, 0); reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ Modified: head/sys/dev/mps/mpsvar.h ============================================================================== --- head/sys/dev/mps/mpsvar.h Mon Aug 10 08:57:34 2015 (r286567) +++ head/sys/dev/mps/mpsvar.h Mon Aug 10 09:02:34 2015 (r286568) @@ -712,7 +712,6 @@ void mpssas_record_event(struct mps_soft int mps_map_command(struct mps_softc *sc, struct mps_command *cm); int mps_wait_command(struct mps_softc *sc, struct mps_command *cm, int timeout, int sleep_flag); -int mps_request_polled(struct mps_softc *sc, struct mps_command *cm); int mps_config_get_bios_pg3(struct mps_softc *sc, Mpi2ConfigReply_t *mpi_reply, Mpi2BiosPage3_t *config_page);