All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brian King <brking@linux.vnet.ibm.com>
To: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: linux-scsi@vger.kernel.org, nab@linux-iscsi.org
Subject: Re: [PATCH 3/3] tcm ibmvscsis driver
Date: Thu, 10 Feb 2011 13:15:29 -0600	[thread overview]
Message-ID: <4D543951.2000207@linux.vnet.ibm.com> (raw)
In-Reply-To: <1297340495-13347-4-git-send-email-fujita.tomonori@lab.ntt.co.jp>

On 02/10/2011 06:21 AM, FUJITA Tomonori wrote:

> +static int process_mad_iu(struct iu_entry *iue)
> +{
> +	union viosrp_iu *iu = vio_iu(iue);
> +	struct viosrp_adapter_info *info;
> +	struct viosrp_host_config *conf;
> +
> +	switch (iu->mad.empty_iu.common.type) {
> +	case VIOSRP_EMPTY_IU_TYPE:
> +		printk(KERN_ERR "%s\n", "Unsupported EMPTY MAD IU");
> +		break;
> +	case VIOSRP_ERROR_LOG_TYPE:
> +		printk(KERN_ERR "%s\n", "Unsupported ERROR LOG MAD IU");
> +		iu->mad.error_log.common.status = 1;
> +		send_iu(iue, sizeof(iu->mad.error_log),	VIOSRP_MAD_FORMAT);
> +		break;
> +	case VIOSRP_ADAPTER_INFO_TYPE:
> +		info = &iu->mad.adapter_info;
> +		info->common.status = send_adapter_info(iue, info->buffer,
> +							info->common.length);
> +		send_iu(iue, sizeof(*info), VIOSRP_MAD_FORMAT);
> +		break;
> +	case VIOSRP_HOST_CONFIG_TYPE:
> +		conf = &iu->mad.host_config;
> +		conf->common.status = 1;
> +		send_iu(iue, sizeof(*conf), VIOSRP_MAD_FORMAT);
> +		break;
> +	default:
> +		printk(KERN_ERR "Unknown type %u\n", iu->srp.rsp.opcode);

We should be sending back the MAD not supported response here (0xF1):

iu->mad.common.status = 0xF1;
send_iu(iue, sizeof(iu->mad.common), VIOSRP_MAD_FORMAT);

Should also be doing this for the unsupported MAD types above, otherwise
the client never receives a response to these commands and times them out.


> +	}
> +
> +	return 1;
> +}
> +


> +
> +static int ibmvscsis_new_cmd_map(struct se_cmd *se_cmd)
> +{
> +	struct ibmvscsis_cmnd *cmd =
> +		container_of(se_cmd, struct ibmvscsis_cmnd, se_cmd);
> +	struct scsi_cmnd *sc = &cmd->sc;
> +	struct iu_entry *iue = (struct iu_entry *)sc->SCp.ptr;
> +	struct srp_cmd *scmd = iue->sbuf->buf;
> +	int ret;
> +
> +	/*
> +	 * Allocate the necessary tasks to complete the received CDB+data
> +	 */
> +	ret = transport_generic_allocate_tasks(se_cmd, scmd->cdb);
> +	if (ret == -1) {
> +		/* Out of Resources */
> +		return PYX_TRANSPORT_LU_COMM_FAILURE;
> +	} else if (ret == -2) {
> +		/*
> +		 * Handle case for SAM_STAT_RESERVATION_CONFLICT
> +		 */
> +		if (se_cmd->se_cmd_flags & SCF_SCSI_RESERVATION_CONFLICT)
> +			return PYX_TRANSPORT_RESERVATION_CONFLICT;

Does this imply the driver supports scsi reservations? If it supports SCSI-2 reservations,
there is a capability that could be set in the capabilities MAD to advertise this
fact such that it can be used by the client.

> +		/*
> +		 * Otherwise, return SAM_STAT_CHECK_CONDITION and return
> +		 * sense data
> +		 */
> +		return PYX_TRANSPORT_USE_SENSE_REASON;
> +	}
> +
> +	return 0;
> +}
> +

> +
> +static int ibmvscsis_inquery(struct ibmvscsis_adapter *adapter,

/inquery/inquiry/

> +			      struct srp_cmd *cmd, char *data)
> +{
> +	struct se_portal_group *se_tpg = &adapter->se_tpg;
> +	struct inquiry_data *id = (struct inquiry_data *)data;
> +	u64 unpacked_lun, lun = cmd->lun;
> +	u8 *cdb = cmd->cdb;
> +	int len;
> +
> +	if (!data)
> +		printk(KERN_INFO "%s %d: oomu\n", __func__, __LINE__);
> +
> +	if (((cdb[1] & 0x3) == 0x3) || (!(cdb[1] & 0x3) && cdb[2])) {
> +		printk(KERN_INFO "%s %d: invalid req\n", __func__, __LINE__);
> +		return 0;
> +	}
> +
> +	if (cdb[1] & 0x3)
> +		printk(KERN_INFO "%s %d: needs the normal path\n",
> +		       __func__, __LINE__);
> +	else {
> +		id->qual_type = TYPE_DISK;
> +		id->rmb_reserve = 0x00;
> +		id->version = 0x84; /* ISO/IE */
> +		id->aerc_naca_hisup_format = 0x22; /* naca & fmt 0x02 */
> +		id->addl_len = sizeof(*id) - 4;
> +		id->bque_encserv_vs_multip_mchngr_reserved = 0x00;
> +		id->reladr_reserved_linked_cmdqueue_vs = 0x02; /* CMDQ */
> +		memcpy(id->vendor, "IBM	    ", 8);
> +		/*
> +		 * Don't even ask about the next bit.  AIX uses
> +		 * hardcoded device naming to recognize device types
> +		 * and their client won't  work unless we use VOPTA and
> +		 * VDASD.
> +		 */
> +		if (id->qual_type == TYPE_ROM)
> +			memcpy(id->product, "VOPTA blkdev    ", 16);
> +		else
> +			memcpy(id->product, "VDASD blkdev    ", 16);
> +
> +		memcpy(id->revision, "0001", 4);
> +
> +		snprintf(id->unique, sizeof(id->unique),
> +			 "IBM-VSCSI-%s-P%d-%x-%d-%d-%d\n",
> +			 system_id,
> +			 partition_number,
> +			 adapter->dma_dev->unit_address,
> +			 GETBUS(lun),
> +			 GETTARGET(lun),
> +			 GETLUN(lun));
> +	}

Do we have any persistent unique identifying data which we could use to
build a page 0x83 response such that persistent naming would work in the client?

> +
> +	len = min_t(int, sizeof(*id), cdb[4]);
> +
> +	unpacked_lun = scsi_lun_to_int(cmd->lun);
> +
> +	spin_lock(&se_tpg->tpg_lun_lock);
> +
> +	if (unpacked_lun < TRANSPORT_MAX_LUNS_PER_TPG &&
> +	    se_tpg->tpg_lun_list[unpacked_lun].lun_status ==
> +	    TRANSPORT_LUN_STATUS_ACTIVE)
> +		;
> +	else
> +		data[0] = TYPE_NO_LUN;
> +
> +	spin_unlock(&se_tpg->tpg_lun_lock);
> +
> +	return len;
> +}

Thanks!

Brian

-- 
Brian King
Linux on Power Virtualization
IBM Linux Technology Center



  parent reply	other threads:[~2011-02-10 19:15 UTC|newest]

Thread overview: 81+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-10 12:21 [PATCH 0/3] ibmvscsis driver rewrite FUJITA Tomonori
2011-02-10 12:21 ` [PATCH 1/3] libsrp: add srp_data_length helper function FUJITA Tomonori
2011-02-10 12:21 ` [PATCH 2/3] libsrp: fix dma_unmap_sg FUJITA Tomonori
2011-02-10 12:21 ` [PATCH 3/3] tcm ibmvscsis driver FUJITA Tomonori
2011-02-10 19:03   ` Nicholas A. Bellinger
2011-02-14  1:36     ` FUJITA Tomonori
2011-02-14  3:26     ` FUJITA Tomonori
2011-02-14  9:01       ` Nicholas A. Bellinger
2011-02-14  9:29         ` FUJITA Tomonori
2011-02-14  9:27           ` Nicholas A. Bellinger
2011-02-14  9:46             ` FUJITA Tomonori
2011-02-14  9:51               ` Nicholas A. Bellinger
2011-02-10 19:15   ` Brian King [this message]
2011-02-10 19:38     ` Nicholas A. Bellinger
2011-02-11 21:13       ` Brian King
2011-02-12 20:27         ` James Bottomley
2011-03-07  4:41           ` FUJITA Tomonori
2011-03-07  6:17             ` Nicholas A. Bellinger
2011-03-07  6:24               ` FUJITA Tomonori
2011-03-07  6:55                 ` Nicholas A. Bellinger
2011-03-07 14:40             ` James Bottomley
2011-03-18 16:57               ` James Bottomley
2011-03-18 20:58               ` Brian King
2011-03-18 22:09                 ` Nicholas A. Bellinger
2011-03-19 14:32                 ` James Bottomley
2011-03-21  1:09                 ` FUJITA Tomonori
2011-03-21 12:56                   ` Brian King
2011-03-21 21:01                   ` Brian King
2011-03-21 21:01                     ` Nicholas A. Bellinger
2011-03-21 21:24                       ` Brian King
2011-03-21 22:29                         ` Nicholas A. Bellinger
2011-03-21 23:20                         ` FUJITA Tomonori
2011-03-21 23:50                           ` Nicholas A. Bellinger
2011-03-21 23:55                             ` FUJITA Tomonori
2011-03-22  0:26                               ` Nicholas A. Bellinger
2011-03-22  0:32                                 ` FUJITA Tomonori
2011-03-22  2:28                                   ` Nicholas A. Bellinger
2011-03-22  3:26                                     ` FUJITA Tomonori
2011-03-21 21:05                     ` James Bottomley
2011-03-21 22:37                       ` Brian King
2011-03-21 22:22                   ` Brian King
2011-03-21 22:31                     ` Brian King
2011-03-21 22:48                       ` Nicholas A. Bellinger
2011-03-22 12:53                         ` Brian King
2011-03-22 22:06                           ` Nicholas A. Bellinger
2011-03-22 22:49                             ` FUJITA Tomonori
2011-03-23  1:35                               ` Nicholas A. Bellinger
2011-03-23  5:12                                 ` FUJITA Tomonori
2011-03-23  8:26                                   ` Nicholas A. Bellinger
2011-03-23  8:48                                     ` FUJITA Tomonori
2011-03-23 10:00                                       ` Nicholas A. Bellinger
2011-03-23 12:04                                         ` FUJITA Tomonori
2011-03-23 21:17                                           ` Nicholas A. Bellinger
2011-03-24  1:54                                             ` FUJITA Tomonori
2011-03-24  7:29                                               ` Nicholas A. Bellinger
2011-03-23 15:19                             ` Brian King
2011-03-23 20:34                               ` Nicholas A. Bellinger
2011-03-25 14:33                                 ` Brian King
2011-03-25 20:13                                   ` Nicholas A. Bellinger
2011-03-21 22:34                     ` Nicholas A. Bellinger
2011-03-21 23:06                       ` FUJITA Tomonori
2011-03-21 23:13                         ` Nicholas A. Bellinger
2011-03-21 23:22                           ` FUJITA Tomonori
2011-03-22  0:03                             ` Nicholas A. Bellinger
2011-03-21 23:30                     ` FUJITA Tomonori
2011-02-14  1:42       ` FUJITA Tomonori
2011-02-14  1:42     ` FUJITA Tomonori
2011-02-14  7:16   ` Bart Van Assche
2011-02-14  9:11     ` FUJITA Tomonori
2011-02-14  9:18       ` Nicholas A. Bellinger
2011-02-14  9:19         ` Nicholas A. Bellinger
2011-02-14  9:31           ` FUJITA Tomonori
2011-02-14  9:29             ` Nicholas A. Bellinger
2011-02-14 11:50       ` Bart Van Assche
2011-02-15  3:42         ` FUJITA Tomonori
2011-02-15 19:20           ` Bart Van Assche
2011-02-15 23:21             ` FUJITA Tomonori
2011-02-10 18:34 ` [PATCH 0/3] ibmvscsis driver rewrite Nicholas A. Bellinger
2011-02-14  1:36   ` FUJITA Tomonori
2011-02-14  8:48     ` Nicholas A. Bellinger
     [not found] ` <4D53DE96.2020502@suse.de>
     [not found]   ` <1297363312.18212.153.camel@haakon2.linux-iscsi.org>
2011-02-10 21:22     ` Bart Van Assche

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D543951.2000207@linux.vnet.ibm.com \
    --to=brking@linux.vnet.ibm.com \
    --cc=fujita.tomonori@lab.ntt.co.jp \
    --cc=linux-scsi@vger.kernel.org \
    --cc=nab@linux-iscsi.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.