From: Tomas Henzl <thenzl@redhat.com>
To: "Stephen M. Cameron" <scameron@beardog.cce.hp.com>,
james.bottomley@hansenpartnership.com
Cc: dab@hp.com, martin.petersen@oracle.com,
linux-scsi@vger.kernel.org, stephenmcameron@gmail.com,
joseph.t.handzik@hp.com, michael.miller@canonical.com,
scott.teel@hp.com
Subject: Re: [PATCH 19/35] hpsa: add task management for ioaccel mode 2
Date: Wed, 26 Mar 2014 17:09:00 +0100 [thread overview]
Message-ID: <5332FB9C.3030404@redhat.com> (raw)
In-Reply-To: <20140218195645.15787.67456.stgit@beardog.cce.hp.com>
On 02/18/2014 08:56 PM, Stephen M. Cameron wrote:
> From: Scott Teel <scott.teel@hp.com>
>
> Underlying firmware cannot handle task abort on accelerated path (SSD Smart Path).
> Change abort requests for accelerated path commands to physical target reset.
> Send reset request on normal IO path.
>
> Signed-off-by: Scott Teel <scott.teel@hp.com>
> Signed-off-by: Mike Miller <michael.miller@canonical.com>
> Acked-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
> ---
> drivers/scsi/hpsa.c | 166 ++++++++++++++++++++++++++++++++++++++++++++++-
> drivers/scsi/hpsa_cmd.h | 7 +-
> 2 files changed, 167 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
> index 021d077..8880f54 100644
> --- a/drivers/scsi/hpsa.c
> +++ b/drivers/scsi/hpsa.c
> @@ -2307,6 +2307,85 @@ static int add_ext_target_dev(struct ctlr_info *h,
> }
>
> /*
> + * Get address of physical disk used for an ioaccel2 mode command:
> + * 1. Extract ioaccel2 handle from the command.
> + * 2. Find a matching ioaccel2 handle from list of physical disks.
> + * 3. Return:
> + * 1 and set scsi3addr to address of matching physical
> + * 0 if no matching physical disk was found.
> + */
> +static int hpsa_get_pdisk_of_ioaccel2(struct ctlr_info *h,
> + struct CommandList *ioaccel2_cmd_to_abort, unsigned char *scsi3addr)
> +{
> + struct ReportExtendedLUNdata *physicals = NULL;
> + int responsesize = 24; /* size of physical extended response */
> + int extended = 2; /* flag forces reporting 'other dev info'. */
> + int reportsize = sizeof(*physicals) + HPSA_MAX_PHYS_LUN * responsesize;
> + u32 nphysicals = 0; /* number of reported physical devs */
> + int found = 0; /* found match (1) or not (0) */
> + u32 find; /* handle we need to match */
> + int i;
> + struct scsi_cmnd *scmd; /* scsi command within request being aborted */
> + struct hpsa_scsi_dev_t *d; /* device of request being aborted */
> + struct io_accel2_cmd *c2a; /* ioaccel2 command to abort */
> + u32 it_nexus; /* 4 byte device handle for the ioaccel2 cmd */
> + u32 scsi_nexus; /* 4 byte device handle for the ioaccel2 cmd */
> +
> + if (ioaccel2_cmd_to_abort->cmd_type != CMD_IOACCEL2)
> + return 0; /* no match */
> +
> + /* point to the ioaccel2 device handle */
> + c2a = &h->ioaccel2_cmd_pool[ioaccel2_cmd_to_abort->cmdindex];
> + if (c2a == NULL)
> + return 0; /* no match */
> +
> + scmd = (struct scsi_cmnd *) ioaccel2_cmd_to_abort->scsi_cmd;
> + if (scmd == NULL)
> + return 0; /* no match */
> +
> + d = scmd->device->hostdata;
> + if (d == NULL)
> + return 0; /* no match */
> +
> + it_nexus = cpu_to_le32((u32) d->ioaccel_handle);
> + scsi_nexus = cpu_to_le32((u32) c2a->scsi_nexus);
> + find = c2a->scsi_nexus;
> +
> + /* Get the list of physical devices */
> + physicals = kzalloc(reportsize, GFP_KERNEL);
Hi, please add a test for physicals != NULL
Tomas
> + if (hpsa_scsi_do_report_phys_luns(h, (struct ReportLUNdata *) physicals,
> + reportsize, extended)) {
> + dev_err(&h->pdev->dev,
> + "Can't lookup %s device handle: report physical LUNs failed.\n",
> + "HP SSD Smart Path");
> + kfree(physicals);
> + return 0;
> + }
> + nphysicals = be32_to_cpu(*((__be32 *)physicals->LUNListLength)) /
> + responsesize;
> +
> +
> + /* find ioaccel2 handle in list of physicals: */
> + for (i = 0; i < nphysicals; i++) {
> + /* handle is in bytes 28-31 of each lun */
> + if (memcmp(&((struct ReportExtendedLUNdata *)
> + physicals)->LUN[i][20], &find, 4) != 0) {
> + continue; /* didn't match */
> + }
> + found = 1;
> + memcpy(scsi3addr, &((struct ReportExtendedLUNdata *)
> + physicals)->LUN[i][0], 8);
> + break; /* found it */
> + }
> +
> + kfree(physicals);
> + if (found)
> + return 1;
> + else
> + return 0;
> +
> +}
> +/*
> * Do CISS_REPORT_PHYS and CISS_REPORT_LOG. Data is returned in physdev,
> * logdev. The number of luns in physdev and logdev are returned in
> * *nphysicals and *nlogicals, respectively.
> @@ -3423,12 +3502,20 @@ static void hpsa_get_tag(struct ctlr_info *h,
> &h->ioaccel_cmd_pool[c->cmdindex];
> *tagupper = cm1->Tag.upper;
> *taglower = cm1->Tag.lower;
> - } else {
> - *tagupper = c->Header.Tag.upper;
> - *taglower = c->Header.Tag.lower;
> + return;
> + }
> + if (c->cmd_type == CMD_IOACCEL2) {
> + struct io_accel2_cmd *cm2 = (struct io_accel2_cmd *)
> + &h->ioaccel2_cmd_pool[c->cmdindex];
> + *tagupper = cm2->Tag.upper;
> + *taglower = cm2->Tag.lower;
> + return;
> }
> + *tagupper = c->Header.Tag.upper;
> + *taglower = c->Header.Tag.lower;
> }
>
> +
> static int hpsa_send_abort(struct ctlr_info *h, unsigned char *scsi3addr,
> struct CommandList *abort, int swizzle)
> {
> @@ -3524,6 +3611,71 @@ static struct CommandList *hpsa_find_cmd_in_queue_by_tag(struct ctlr_info *h,
> return NULL;
> }
>
> +/* ioaccel2 path firmware cannot handle abort task requests.
> + * Change abort requests to physical target reset, and send to the
> + * address of the physical disk used for the ioaccel 2 command.
> + * Return 0 on success (IO_OK)
> + * -1 on failure
> + */
> +
> +static int hpsa_send_reset_as_abort_ioaccel2(struct ctlr_info *h,
> + unsigned char *scsi3addr, struct CommandList *abort)
> +{
> + int rc = IO_OK;
> + struct scsi_cmnd *scmd; /* scsi command within request being aborted */
> + struct hpsa_scsi_dev_t *dev; /* device to which scsi cmd was sent */
> + unsigned char phys_scsi3addr[8]; /* addr of phys disk with volume */
> + unsigned char *psa = &phys_scsi3addr[0];
> +
> + /* Get a pointer to the hpsa logical device. */
> + scmd = (struct scsi_cmnd *) abort->scsi_cmd;
> + dev = (struct hpsa_scsi_dev_t *)(scmd->device->hostdata);
> + if (dev == NULL) {
> + dev_warn(&h->pdev->dev,
> + "Cannot abort: no device pointer for command.\n");
> + return -1; /* not abortable */
> + }
> +
> + if (!dev->offload_enabled) {
> + dev_warn(&h->pdev->dev,
> + "Can't abort: device is not operating in HP SSD Smart Path mode.\n");
> + return -1; /* not abortable */
> + }
> +
> + /* Incoming scsi3addr is logical addr. We need physical disk addr. */
> + if (!hpsa_get_pdisk_of_ioaccel2(h, abort, psa)) {
> + dev_warn(&h->pdev->dev, "Can't abort: Failed lookup of physical address.\n");
> + return -1; /* not abortable */
> + }
> +
> + /* send the reset */
> + rc = hpsa_send_reset(h, psa, HPSA_RESET_TYPE_TARGET);
> + if (rc != 0) {
> + dev_warn(&h->pdev->dev,
> + "Reset as abort: Failed on physical device at scsi3addr 0x%02x%02x%02x%02x%02x%02x%02x%02x\n",
> + psa[0], psa[1], psa[2], psa[3],
> + psa[4], psa[5], psa[6], psa[7]);
> + return rc; /* failed to reset */
> + }
> +
> + /* wait for device to recover */
> + if (wait_for_device_to_become_ready(h, psa) != 0) {
> + dev_warn(&h->pdev->dev,
> + "Reset as abort: Failed: Device never recovered from reset: 0x%02x%02x%02x%02x%02x%02x%02x%02x\n",
> + psa[0], psa[1], psa[2], psa[3],
> + psa[4], psa[5], psa[6], psa[7]);
> + return -1; /* failed to recover */
> + }
> +
> + /* device recovered */
> + dev_info(&h->pdev->dev,
> + "Reset as abort: Device recovered from reset: scsi3addr 0x%02x%02x%02x%02x%02x%02x%02x%02x\n",
> + psa[0], psa[1], psa[2], psa[3],
> + psa[4], psa[5], psa[6], psa[7]);
> +
> + return rc; /* success */
> +}
> +
> /* Some Smart Arrays need the abort tag swizzled, and some don't. It's hard to
> * tell which kind we're dealing with, so we send the abort both ways. There
> * shouldn't be any collisions between swizzled and unswizzled tags due to the
> @@ -3537,6 +3689,14 @@ static int hpsa_send_abort_both_ways(struct ctlr_info *h,
> struct CommandList *c;
> int rc = 0, rc2 = 0;
>
> + /* ioccelerator mode 2 commands should be aborted via the
> + * accelerated path, since RAID path is unaware of these commands,
> + * but underlying firmware can't handle abort TMF.
> + * Change abort to physical device reset.
> + */
> + if (abort->cmd_type == CMD_IOACCEL2)
> + return hpsa_send_reset_as_abort_ioaccel2(h, scsi3addr, abort);
> +
> /* we do not expect to find the swizzled tag in our queue, but
> * check anyway just to be sure the assumptions which make this
> * the case haven't become wrong.
> diff --git a/drivers/scsi/hpsa_cmd.h b/drivers/scsi/hpsa_cmd.h
> index f6430b4..e048167 100644
> --- a/drivers/scsi/hpsa_cmd.h
> +++ b/drivers/scsi/hpsa_cmd.h
> @@ -82,8 +82,9 @@
> #define ATTR_ACA 0x07
>
> /* cdb type */
> -#define TYPE_CMD 0x00
> -#define TYPE_MSG 0x01
> +#define TYPE_CMD 0x00
> +#define TYPE_MSG 0x01
> +#define TYPE_IOACCEL2_CMD 0x81 /* 0x81 is not used by hardware */
>
> /* Message Types */
> #define HPSA_TASK_MANAGEMENT 0x00
> @@ -525,7 +526,7 @@ struct io_accel2_cmd {
> * FIXME: this can't be all I need mfm
> */
> #define IOACCEL2_IU_TYPE 0x40
> -#define IU_TYPE_TMF 0x41
> +#define IOACCEL2_IU_TMF_TYPE 0x41
> #define IOACCEL2_DIR_NO_DATA 0x00
> #define IOACCEL2_DIR_DATA_IN 0x01
> #define IOACCEL2_DIR_DATA_OUT 0x02
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2014-03-26 16:16 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-18 19:55 [PATCH 00/35] hpsa February 2014 driver updates Stephen M. Cameron
2014-02-18 19:55 ` [PATCH 01/35] hpsa: use extended report luns command for HP SSD SmartPath Stephen M. Cameron
2014-02-18 19:55 ` [PATCH 02/35] hpsa: mark last scatter gather element as the last Stephen M. Cameron
2014-02-18 19:55 ` [PATCH 03/35] hpsa: add support for 'fastpath' i/o Stephen M. Cameron
2014-02-18 19:55 ` [PATCH 04/35] hpsa: only allow REQ_TYPE_FS to use fast path Stephen M. Cameron
2014-02-18 19:55 ` [PATCH 05/35] hpsa: fix task management for mode-1 ioaccell path Stephen M. Cameron
2014-02-18 19:55 ` [PATCH 06/35] hpsa: add ioaccell mode 1 RAID offload support Stephen M. Cameron
2014-02-18 19:55 ` [PATCH 07/35] hpsa: update raid offload status on device rescan Stephen M. Cameron
2014-02-18 19:55 ` [PATCH 08/35] hpsa: poll controller to detect device change event Stephen M. Cameron
2014-02-18 19:55 ` [PATCH 09/35] hpsa: do not rescan controllers known to be locked up Stephen M. Cameron
2014-02-18 19:55 ` [PATCH 10/35] hpsa: add hp_ssd_smart_path_enabled sysfs attribute Stephen M. Cameron
2014-03-13 11:28 ` James Bottomley
2014-02-18 19:55 ` [PATCH 11/35] hpsa: complain if physical or logical aborts are not supported Stephen M. Cameron
2014-02-18 19:56 ` [PATCH 12/35] hpsa: add ioaccel mode 2 structure definitions Stephen M. Cameron
2014-02-18 19:56 ` [PATCH 13/35] hpsa: Acknowledge controller events in ioaccell mode 2 as well as mode 1 Stephen M. Cameron
2014-02-18 19:56 ` [PATCH 14/35] hpsa: do ioaccel mode 2 resource allocations Stephen M. Cameron
2014-02-18 19:56 ` [PATCH 15/35] hpsa: get physical device handles for io accel mode 2 as well as mode 1 Stephen M. Cameron
2014-02-18 19:56 ` [PATCH 16/35] hpsa: initialize controller to perform io accelerator mode 2 Stephen M. Cameron
2014-02-18 19:56 ` [PATCH 17/35] hpsa: get ioaccel mode 2 i/o working Stephen M. Cameron
2014-02-18 19:56 ` [PATCH 18/35] hpsa: teach hpsa_device_reset to do either target or lun reset Stephen M. Cameron
2014-02-18 19:56 ` [PATCH 19/35] hpsa: add task management for ioaccel mode 2 Stephen M. Cameron
2014-03-26 16:09 ` Tomas Henzl [this message]
2014-02-18 19:56 ` [PATCH 20/35] hpsa: make device update copy the raid map also Stephen M. Cameron
2014-02-18 19:56 ` [PATCH 21/35] hpsa: complete the ioaccel raidmap code Stephen M. Cameron
2014-02-18 19:57 ` [PATCH 22/35] hpsa: allow user to disable accelerated i/o path Stephen M. Cameron
2014-02-18 19:57 ` [PATCH 23/35] hpsa: rescan devices on ioaccel2 error Stephen M. Cameron
2014-02-18 19:57 ` [PATCH 24/35] hpsa: allow VPD page zero to be queried Stephen M. Cameron
2014-02-18 19:57 ` [PATCH 25/35] hpsa: do not inquire for unsupported ioaccel status vpd page Stephen M. Cameron
2014-02-18 19:57 ` [PATCH 26/35] hpsa: retry certain ioaccel error cases on the RAID path Stephen M. Cameron
2014-02-18 19:57 ` [PATCH 27/35] hpsa: update source file copyrights Stephen M. Cameron
2014-02-18 19:57 ` [PATCH 28/35] hpsa: add controller base data-at-rest encryption compatibility ioaccel2 Stephen M. Cameron
2014-02-18 19:57 ` [PATCH 29/35] hpsa: when switching out of accel mode await only accel command completions Stephen M. Cameron
2014-02-18 19:57 ` [PATCH 30/35] hpsa: only do device rescan for certain events Stephen M. Cameron
2014-02-18 19:57 ` [PATCH 31/35] hpsa: improve error messages for driver initiated commands Stephen M. Cameron
2014-02-18 19:57 ` [PATCH 32/35] hpsa add sysfs debug switch for raid map debugging messages Stephen M. Cameron
2014-02-18 19:57 ` [PATCH 33/35] pci: add HP/3PAR vendor id to pci_ids.h Stephen M. Cameron
2014-02-18 19:58 ` [PATCH 34/35] hpsa: Add support for a few HP Storage controllers Stephen M. Cameron
2014-02-18 19:58 ` [PATCH 35/35] hpsa: fixup MSI-X registration Stephen M. Cameron
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=5332FB9C.3030404@redhat.com \
--to=thenzl@redhat.com \
--cc=dab@hp.com \
--cc=james.bottomley@hansenpartnership.com \
--cc=joseph.t.handzik@hp.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=michael.miller@canonical.com \
--cc=scameron@beardog.cce.hp.com \
--cc=scott.teel@hp.com \
--cc=stephenmcameron@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox