From owner-freebsd-scsi@FreeBSD.ORG Fri Nov 3 00:01:14 2006 Return-Path: X-Original-To: freebsd-scsi@freebsd.org Delivered-To: freebsd-scsi@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7DC6F16A40F for ; Fri, 3 Nov 2006 00:01:14 +0000 (UTC) (envelope-from mjacob@freebsd.org) Received: from ns1.feral.com (ns1.feral.com [192.67.166.1]) by mx1.FreeBSD.org (Postfix) with ESMTP id 13BA343D53 for ; Fri, 3 Nov 2006 00:01:14 +0000 (GMT) (envelope-from mjacob@freebsd.org) Received: from ns1.feral.com (localhost [127.0.0.1]) by ns1.feral.com (8.13.8/8.13.8) with ESMTP id kA301Dvk041258 for ; Thu, 2 Nov 2006 16:01:13 -0800 (PST) (envelope-from mjacob@freebsd.org) Received: from localhost (mjacob@localhost) by ns1.feral.com (8.13.8/8.13.8/Submit) with ESMTP id kA301DId041255 for ; Thu, 2 Nov 2006 16:01:13 -0800 (PST) (envelope-from mjacob@freebsd.org) X-Authentication-Warning: ns1.feral.com: mjacob owned process doing -bs Date: Thu, 2 Nov 2006 16:01:13 -0800 (PST) From: mjacob@freebsd.org X-X-Sender: mjacob@ns1.feral.com To: freebsd-scsi@freebsd.org Message-ID: <20061102154941.S41199@ns1.feral.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Subject: basic domain validation patches X-BeenThere: freebsd-scsi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: mjacob@freebsd.org List-Id: SCSI subsystem List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Nov 2006 00:01:14 -0000 See http://people.freebsd.org/~mjacob/DV_PATCHES The ANSI document on Domain Validation gives an algorithm for doing Basic Domain Validation as, in part: Send an INQUIRY command to a SCSI device 3 times- twice with the default transfer agreement and once with the transfer agreement set to the fastest supported values. The Basic test fails when the first 36 bytes of data returned at the negotiated synchronous speed does not match the data received at the asynchronous transfer speed. In addition, the Basic test fails if a CRC error (or parity error for non-DT clocking) or a timeout occurs. If data miscompare occurs, the test should be repeated (e.g., this could be due to the target changing INQUIRY data during SCSI device initialization). After a finite number of retries, if data miscompare recurs then fall-back should be attempted (see 5.5.2). and 5.5.2 has: If Basic or Enhanced tests fail, a fall-back setting is set and the tests are performed again. The recommended fall-back order is: 1. fast-160 2. fast-80 3. fast-40 (with DT clocking enabled) 4. fast-40 (with ST clocking enabled) 5. fast-20 6. fast-10; and 7. asynchrnous transfer. I've done an implementation interwoven into the probe code in cam_xpt such that the following occurs.. The normal sequence is: ... INQUIRY (short) INQUIRY (long) ... ('default' sync settings are enabled) ... PROBE_TUR_FOR_NEGOTIATION I've changed to be: PROBE_TUR_FOR_NEGOTIATION PROBE_INQUIRY_BASIC_DV1 ... PROBE_INQUIRY_BASIC_DV2 ... The idea here is to leverage the two initial INQUIRY commands done at async mode and compare with the last known one and to do *two* additional INQUIRY commands (at speed) to see if they compare with the last ASYNC long INQUIRY command. If they don't, we can do backoff and just re-enter the state machine at PROBE_TUR_FOR_NEGOTIATION. The backoff doesn't do DT/ST settings, but just simply increments the sync_period factor until we hit 0xf (5 MHz) and then drops to async. I don't mess with PPR settings on the theory that the SIM will do the right thing with PPR settings depending on the values of sync period and offset. By doing fault injection (e..g, failed compares) I've done some testing and this *appears* to do what one would want. Any comments? I *know* there are people out there on this list who have more experience with DV than I do so I'd appreciate some comments. -matt