From owner-freebsd-current@FreeBSD.ORG Wed Nov 21 16:31:36 2007 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 075C316A468 for ; Wed, 21 Nov 2007 16:31:36 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from tarsier.geekcn.org (tarsier.geekcn.org [210.51.165.229]) by mx1.freebsd.org (Postfix) with ESMTP id 97A8613C474 for ; Wed, 21 Nov 2007 16:31:34 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from localhost (tarsier.geekcn.org [210.51.165.229]) by tarsier.geekcn.org (Postfix) with ESMTP id 0A6F8EB5FEB; Thu, 22 Nov 2007 00:31:37 +0800 (CST) X-Virus-Scanned: amavisd-new at geekcn.org Received: from tarsier.geekcn.org ([210.51.165.229]) by localhost (mail.geekcn.org [210.51.165.229]) (amavisd-new, port 10024) with ESMTP id CXJAtLP64Saj; Thu, 22 Nov 2007 00:31:25 +0800 (CST) Received: from charlie.delphij.net (c-67-161-39-180.hsd1.ca.comcast.net [67.161.39.180]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by tarsier.geekcn.org (Postfix) with ESMTP id 3FBD5EB5F8C; Thu, 22 Nov 2007 00:31:15 +0800 (CST) DomainKey-Signature: a=rsa-sha1; s=default; d=delphij.net; c=nofws; q=dns; h=message-id:date:from:reply-to:organization:user-agent: mime-version:to:cc:subject:references:in-reply-to: x-enigmail-version:content-type; b=uwkEiQ5vjsxtP0gpgd2IvGZBklb4/8yJLYSQoyhXeSaMTC0spWNSNcMgI49O8qOb0 NARp/cHc3SRyh8v5rY5Hg== Message-ID: <47445D4D.9060207@delphij.net> Date: Wed, 21 Nov 2007 08:31:09 -0800 From: Xin LI Organization: The FreeBSD Project User-Agent: Thunderbird 2.0.0.9 (X11/20071115) MIME-Version: 1.0 To: Christoph Hoffmann References: In-Reply-To: X-Enigmail-Version: 0.95.5 Content-Type: multipart/mixed; boundary="------------060709020508000509010004" Cc: FreeBSD Current Subject: Re: ciss driver X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: d@delphij.net List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Nov 2007 16:31:36 -0000 This is a multi-part message in MIME format. --------------060709020508000509010004 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Christoph Hoffmann wrote: > Hello Everybody, > > is there any time plans/time frame to get the latest ciss driver > > 8.0-CURRENT > ciss.c,v 1.85 2007/11/05 13:54:23 iwasaki > > (fix the ADAPTER HEARTBEAT FAILED problem) > > back-ported to 7.0 and 6? Try this patch? (RELENG_7) Cheers, - -- Xin LI http://www.delphij.net/ FreeBSD - The Power to Serve! -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (FreeBSD) iD8DBQFHRF1NhcUczkLqiksRAsT0AJ0fJE2CpgTf1CPuJ8ac6JDiRl5n0QCfUag4 0L76W1H0a//Hg6thVv4+kXg= =4o/2 -----END PGP SIGNATURE----- --------------060709020508000509010004 Content-Type: text/x-patch; name="ciss-mfc.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="ciss-mfc.diff" Index: ciss.c =================================================================== RCS file: /home/ncvs/src/sys/dev/ciss/ciss.c,v retrieving revision 1.81.2.1 diff -u -p -r1.81.2.1 ciss.c --- ciss.c 19 Oct 2007 15:19:22 -0000 1.81.2.1 +++ ciss.c 21 Nov 2007 16:29:35 -0000 @@ -183,6 +183,8 @@ static int ciss_name_device(struct ciss_ /* periodic status monitoring */ static void ciss_periodic(void *arg); +static void ciss_nop_complete(struct ciss_request *cr); +static void ciss_disable_adapter(struct ciss_softc *sc); static void ciss_notify_event(struct ciss_softc *sc); static void ciss_notify_complete(struct ciss_request *cr); static int ciss_notify_abort(struct ciss_softc *sc); @@ -3068,6 +3070,9 @@ static void ciss_periodic(void *arg) { struct ciss_softc *sc; + struct ciss_request *cr = NULL; + struct ciss_command *cc = NULL; + int error = 0; debug_called(1); @@ -3082,7 +3087,8 @@ ciss_periodic(void *arg) sc->ciss_heartbeat, sc->ciss_heart_attack); if (sc->ciss_heart_attack == 3) { ciss_printf(sc, "ADAPTER HEARTBEAT FAILED\n"); - /* XXX should reset adapter here */ + ciss_disable_adapter(sc); + return; } } else { sc->ciss_heartbeat = sc->ciss_cfg->heartbeat; @@ -3091,6 +3097,24 @@ ciss_periodic(void *arg) } /* + * Send the NOP message and wait for a response. + */ + if ((error = ciss_get_request(sc, &cr)) == 0) { + cc = CISS_FIND_COMMAND(cr); + cr->cr_complete = ciss_nop_complete; + cc->cdb.cdb_length = 1; + cc->cdb.type = CISS_CDB_TYPE_MESSAGE; + cc->cdb.attribute = CISS_CDB_ATTRIBUTE_SIMPLE; + cc->cdb.direction = CISS_CDB_DIRECTION_WRITE; + cc->cdb.timeout = 0; + cc->cdb.cdb[0] = CISS_OPCODE_MESSAGE_NOP; + + if ((error = ciss_start(cr)) != 0) { + ciss_printf(sc, "SENDING NOP MESSAGE FAILED\n"); + } + } + + /* * If the notify event request has died for some reason, or has * not started yet, restart it. */ @@ -3105,6 +3129,74 @@ ciss_periodic(void *arg) callout_reset(&sc->ciss_periodic, CISS_HEARTBEAT_RATE * hz, ciss_periodic, sc); } +static void +ciss_nop_complete(struct ciss_request *cr) +{ + struct ciss_softc *sc; + + sc = cr->cr_sc; + if (ciss_report_request(cr, NULL, NULL) != 0) { + ciss_printf(sc, "SENDING NOP MESSAGE FAILED\n"); + } + + ciss_release_request(cr); +} + +/************************************************************************ + * Disable the adapter. + * + * The all requests in completed queue is failed with hardware error. + * This will cause failover in a multipath configuration. + */ +static void +ciss_disable_adapter(struct ciss_softc *sc) +{ + struct ciss_request *cr; + struct ciss_command *cc; + struct ciss_error_info *ce; + int s; + + s = splcam(); + + CISS_TL_SIMPLE_DISABLE_INTERRUPTS(sc); + pci_disable_busmaster(sc->ciss_dev); + sc->ciss_flags &= ~CISS_FLAG_RUNNING; + + for (;;) { + if ((cr = ciss_dequeue_busy(sc)) == NULL) + break; + + cc = CISS_FIND_COMMAND(cr); + ce = (struct ciss_error_info *)&(cc->sg[0]); + ce->command_status = CISS_CMD_STATUS_HARDWARE_ERROR; + ciss_enqueue_complete(cr); + } + + for (;;) { + if ((cr = ciss_dequeue_complete(sc)) == NULL) + break; + + /* + * If the request has a callback, invoke it. + */ + if (cr->cr_complete != NULL) { + cr->cr_complete(cr); + continue; + } + + /* + * If someone is sleeping on this request, wake them up. + */ + if (cr->cr_flags & CISS_REQ_SLEEP) { + cr->cr_flags &= ~CISS_REQ_SLEEP; + wakeup(cr); + continue; + } + } + + splx(s); +} + /************************************************************************ * Request a notification response from the adapter. * --------------060709020508000509010004--