[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Re: [PATCH 14/15] megasas: LSI Megaraid SAS emulation
From: |
Hannes Reinecke |
Subject: |
[Qemu-devel] Re: [PATCH 14/15] megasas: LSI Megaraid SAS emulation |
Date: |
Thu, 25 Nov 2010 15:50:51 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.15) Gecko/20101026 SUSE/3.0.10 Thunderbird/3.0.10 |
On 11/25/2010 03:36 PM, Stefan Hajnoczi wrote:
> On Wed, Nov 24, 2010 at 11:16 AM, Hannes Reinecke <address@hidden> wrote:
>> +static int megasas_pd_get_info_submit(SCSIDevice * sdev, int lun,
>> + struct megasas_cmd_t *cmd)
>> +{
>> + struct mfi_pd_info * info = cmd->iov_buf;
>> + uint8_t cmdbuf[6];
>> + SCSIRequest *req;
>> +
>> + if (info->inquiry_data[4] == 0) {
>> + /* Additional length is zero, resubmit */
>> + megasas_setup_inquiry(cmdbuf, 0, info->inquiry_data,
>> + sizeof(info->inquiry_data));
>> + req = sdev->info->alloc_req(sdev, (uint32_t) -1, lun);
>> + if (!req) {
>> + return MFI_STAT_FLASH_ALLOC_FAIL;
>> + }
>> + DPRINTF_DCMD("PD get info submit std inquiry to dev %d\n", lun);
>> + req->hba_private = cmd;
>> + if (cmd->sdev->info->send_command(req, cmdbuf) > 0)
>> + cmd->sdev->info->read_data(req);
>> + return MFI_STAT_INVALID_STATUS;
>
> Here...
>
>> + } else if (info->vpd_page83[3] == 0) {
>> + /* Additional length is zero, resubmit */
>> + megasas_setup_inquiry(cmdbuf, 0x83,(uint8_t *)info->vpd_page83,
>> + sizeof(info->vpd_page83));
>> + req = sdev->info->alloc_req(sdev, (uint32_t) -1, lun);
>> + if (!req) {
>> + return MFI_STAT_FLASH_ALLOC_FAIL;
>> + }
>> + DPRINTF_DCMD("PD get info submit vpd inquiry to dev %d\n", lun);
>> + req->hba_private = cmd;
>> + if (cmd->sdev->info->send_command(req, cmdbuf) > 0)
>> + cmd->sdev->info->read_data(req);
>> + return MFI_STAT_INVALID_STATUS;
>
> ...and here I can't tell for sure if an error status is returned
> intentionally or whether this is an if statement without {}-related
> bug.
>
> On one hand it looks like it could be intentional. On the other hand
> we went through the trouble of sending an inquiry command that may
> have succeeded but we're still returning an error status.
>
MFI_STAT_INVALID_STATUS is _not_ an error status. It's used
internally to signal that a command is still being processed.
->read_data() itself doesn't have a meaningful return code;
we need to wait for the ->complete callback to get results.
So we're returning MFI_STAT_INVALID_STATUS to signal this condition.
So that's ok.
Cheers,
Hannes
--
Dr. Hannes Reinecke zSeries & Storage
address@hidden +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Markus Rex, HRB 16746 (AG Nürnberg)
- Re: [Qemu-devel] [PATCH 13/15] scsi: Implement alloc_req_iov callback, (continued)
- [Qemu-devel] [PATCH 04/15] scsi: Move sense handling into the driver, Hannes Reinecke, 2010/11/24
- [Qemu-devel] [PATCH 15/15] Make SCSI HBA configurable, Hannes Reinecke, 2010/11/24
- [Qemu-devel] [PATCH 10/15] scsi-disk: add data direction checking, Hannes Reinecke, 2010/11/24
- [Qemu-devel] [PATCH 09/15] scsi: Use 'SCSIRequest' directly, Hannes Reinecke, 2010/11/24
- [Qemu-devel] [PATCH 06/15] scsi: Update sense code handling, Hannes Reinecke, 2010/11/24
- [Qemu-devel] [PATCH 11/15] Remove 'bus' argument from SCSI command completion callbacks, Hannes Reinecke, 2010/11/24
- [Qemu-devel] [PATCH 14/15] megasas: LSI Megaraid SAS emulation, Hannes Reinecke, 2010/11/24
- [Qemu-devel] Re: [PATCH 14/15] megasas: LSI Megaraid SAS emulation, Sebastian Herbszt, 2010/11/25
- Re: [Qemu-devel] [PATCH 00/15] Megasas HBA emulation and SCSI update v.3, Christoph Hellwig, 2010/11/24