tpgs.c revision cc25db92ff252ca1b7f63bd54f087f4ddf0dda4e
29493bd8e037cbaea9095b34172305abb589cb6bvn * CDDL HEADER START
29493bd8e037cbaea9095b34172305abb589cb6bvn * The contents of this file are subject to the terms of the
29493bd8e037cbaea9095b34172305abb589cb6bvn * Common Development and Distribution License (the "License").
29493bd8e037cbaea9095b34172305abb589cb6bvn * You may not use this file except in compliance with the License.
29493bd8e037cbaea9095b34172305abb589cb6bvn * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
29493bd8e037cbaea9095b34172305abb589cb6bvn * See the License for the specific language governing permissions
29493bd8e037cbaea9095b34172305abb589cb6bvn * and limitations under the License.
29493bd8e037cbaea9095b34172305abb589cb6bvn * When distributing Covered Code, include this CDDL HEADER in each
29493bd8e037cbaea9095b34172305abb589cb6bvn * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
29493bd8e037cbaea9095b34172305abb589cb6bvn * If applicable, add the following below this CDDL HEADER, with the
29493bd8e037cbaea9095b34172305abb589cb6bvn * fields enclosed by brackets "[]" replaced with your own identifying
29493bd8e037cbaea9095b34172305abb589cb6bvn * information: Portions Copyright [yyyy] [name of copyright owner]
29493bd8e037cbaea9095b34172305abb589cb6bvn * CDDL HEADER END
29493bd8e037cbaea9095b34172305abb589cb6bvn * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
29493bd8e037cbaea9095b34172305abb589cb6bvn * Use is subject to license terms.
29493bd8e037cbaea9095b34172305abb589cb6bvn * Implementation of "scsi_vhci_f_tpgs" T10 standard based failover_ops.
29493bd8e037cbaea9095b34172305abb589cb6bvn * NOTE: for non-sequential devices only.
29493bd8e037cbaea9095b34172305abb589cb6bvn/* Supported device table entries. */
29493bd8e037cbaea9095b34172305abb589cb6bvn/* Failover module plumbing. */
29493bd8e037cbaea9095b34172305abb589cb6bvn * max time for failover to complete is 3 minutes. Compute
29493bd8e037cbaea9095b34172305abb589cb6bvn * number of retries accordingly, to ensure we wait for at least
29493bd8e037cbaea9095b34172305abb589cb6bvn * 3 minutes
29493bd8e037cbaea9095b34172305abb589cb6bvn#define STD_FO_MAX_RETRIES (3*60*1000000)/STD_FO_RETRY_DELAY
29493bd8e037cbaea9095b34172305abb589cb6bvn/* ARGSUSED */
29493bd8e037cbaea9095b34172305abb589cb6bvnstd_device_probe(struct scsi_device *sd, struct scsi_inquiry *inq,
29493bd8e037cbaea9095b34172305abb589cb6bvn VHCI_DEBUG(6, (CE_NOTE, NULL, "std_device_probe: vidpid %s\n",
29493bd8e037cbaea9095b34172305abb589cb6bvn "!std_device_probe: not a standard tpgs device"));
29493bd8e037cbaea9095b34172305abb589cb6bvn "!std_device_probe: Detected a "
29493bd8e037cbaea9095b34172305abb589cb6bvn "Standard Asymmetric device "
29493bd8e037cbaea9095b34172305abb589cb6bvn "not yet supported\n"));
return (SFO_DEVICE_PROBE_PHCI);
return (SFO_DEVICE_PROBE_PHCI);
return (SFO_DEVICE_PROBE_VHCI);
return (SFO_DEVICE_PROBE_VHCI);
return (SFO_DEVICE_PROBE_VHCI);
return (SFO_DEVICE_PROBE_PHCI);
int *retry_cnt)
if ((*retry_cnt)++ >=
case STATUS_GOOD:
case STATUS_CHECK:
case STATUS_QFULL:
case STATUS_BUSY:
void *ctpriv)
(void *)sd));
if (retval != 0) {
(void *)sd));
(void *)sd));
if (!bp) {
(void *)sd));
if (!pkt) {
(void *)sd));
retry_cnt = 0;
retry_cmd_cnt = 0;
goto retry;
case CMD_CMPLT:
retry_cmd_cnt = 0;
if (retval != 0) {
goto retry;
case CMD_TIMEOUT:
case CMD_INCOMPLETE:
case CMD_RESET:
case CMD_ABORTED:
case CMD_TRAN_ERR:
goto retry;
return (retval);
void *ctpriv)
void *ctpriv)
if (preferred) {
void *ctpriv)
return (rval);
return (ENOENT);
return (EINVAL);