diff options
| author | Hannes Reinecke <hare@suse.de> | 2021-11-08 08:11:28 +0100 |
|---|---|---|
| committer | Hannes Reinecke <hare@suse.de> | 2021-11-08 08:14:01 +0100 |
| commit | e6b8e84251bef24827e609d3a87c5d6652302b85 (patch) | |
| tree | 72a1f76fb99831efc485f626296fcd365f816695 | |
| parent | 61a69f51e293b8d4db00c3421426ce7961be0017 (diff) | |
| download | scsi-devel-e6b8e84251bef24827e609d3a87c5d6652302b85.tar.gz | |
aacraid: add 'owner' field to 'struct fib'
Add an 'owner' field to struct fib to avoid having to use SCp.
Signed-off-by: Hannes Reinecke <hare@suse.de>
| -rw-r--r-- | drivers/scsi/aacraid/aachba.c | 22 | ||||
| -rw-r--r-- | drivers/scsi/aacraid/aacraid.h | 5 | ||||
| -rw-r--r-- | drivers/scsi/aacraid/comminit.c | 29 | ||||
| -rw-r--r-- | drivers/scsi/aacraid/linit.c | 14 |
4 files changed, 44 insertions, 26 deletions
diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index 71da013271895..48181256abee6 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c @@ -338,7 +338,7 @@ static inline int aac_valid_context(struct scsi_cmnd *scsicmd, aac_fib_complete(fibptr); return 0; } - scsicmd->SCp.phase = AAC_OWNER_MIDLEVEL; + fibptr->owner = AAC_OWNER_MIDLEVEL; device = scsicmd->device; if (unlikely(!device)) { dprintk((KERN_WARNING "aac_valid_context: scsi device corrupt\n")); @@ -592,7 +592,7 @@ static int aac_get_container_name(struct scsi_cmnd * scsicmd) aac_fib_init(cmd_fibcontext); dinfo = (struct aac_get_name *) fib_data(cmd_fibcontext); - scsicmd->SCp.phase = AAC_OWNER_FIRMWARE; + cmd_fibcontext->owner = AAC_OWNER_FIRMWARE; dinfo->command = cpu_to_le32(VM_ContainerConfig); dinfo->type = cpu_to_le32(CT_READ_NAME); @@ -733,7 +733,7 @@ static void _aac_probe_container1(void * context, struct fib * fibptr) dinfo->count = cpu_to_le32(cid); dinfo->type = cpu_to_le32(FT_FILESYS); - scsicmd->SCp.phase = AAC_OWNER_FIRMWARE; + fibptr->owner = AAC_OWNER_FIRMWARE; status = aac_fib_send(ContainerCommand, fibptr, @@ -782,7 +782,7 @@ static int _aac_probe_container(struct fib * fibptr, int (*callback)(struct scsi dinfo->count = cpu_to_le32(cid); dinfo->type = cpu_to_le32(FT_FILESYS); fibptr->scsi_callback = callback; - scsicmd->SCp.phase = AAC_OWNER_FIRMWARE; + fibptr->owner = AAC_OWNER_FIRMWARE; status = aac_fib_send(ContainerCommand, fibptr, @@ -1141,7 +1141,7 @@ static int aac_get_container_serial(struct scsi_cmnd * scsicmd) dinfo->command = cpu_to_le32(VM_ContainerConfig); dinfo->type = cpu_to_le32(CT_CID_TO_32BITS_UID); dinfo->cid = cpu_to_le32(scmd_id(scsicmd)); - scsicmd->SCp.phase = AAC_OWNER_FIRMWARE; + cmd_fibcontext->owner = AAC_OWNER_FIRMWARE; status = aac_fib_send(ContainerCommand, cmd_fibcontext, @@ -2499,7 +2499,7 @@ static int aac_read(struct scsi_cmnd * scsicmd) * Alocate and initialize a Fib */ cmd_fibcontext = aac_fib_alloc_tag(dev, scsicmd); - scsicmd->SCp.phase = AAC_OWNER_FIRMWARE; + cmd_fibcontext->owner = AAC_OWNER_FIRMWARE; status = aac_adapter_read(cmd_fibcontext, scsicmd, lba, count); /* @@ -2590,7 +2590,7 @@ static int aac_write(struct scsi_cmnd * scsicmd) * Allocate and initialize a Fib then setup a BlockWrite command */ cmd_fibcontext = aac_fib_alloc_tag(dev, scsicmd); - scsicmd->SCp.phase = AAC_OWNER_FIRMWARE; + cmd_fibcontext->owner = AAC_OWNER_FIRMWARE; status = aac_adapter_write(cmd_fibcontext, scsicmd, lba, count, fua); /* @@ -2673,7 +2673,7 @@ static int aac_synchronize(struct scsi_cmnd *scsicmd) synchronizecmd->cid = cpu_to_le32(scmd_id(scsicmd)); synchronizecmd->count = cpu_to_le32(sizeof(((struct aac_synchronize_reply *)NULL)->data)); - scsicmd->SCp.phase = AAC_OWNER_FIRMWARE; + cmd_fibcontext->owner = AAC_OWNER_FIRMWARE; /* * Now send the Fib to the adapter @@ -2749,7 +2749,7 @@ static int aac_start_stop(struct scsi_cmnd *scsicmd) pmcmd->cid = cpu_to_le32(sdev_id(sdev)); pmcmd->parm = (scsicmd->cmnd[1] & 1) ? cpu_to_le32(CT_PM_UNIT_IMMEDIATE) : 0; - scsicmd->SCp.phase = AAC_OWNER_FIRMWARE; + cmd_fibcontext->owner = AAC_OWNER_FIRMWARE; /* * Now send the Fib to the adapter @@ -3741,7 +3741,7 @@ static int aac_send_srb_fib(struct scsi_cmnd* scsicmd) * Allocate and initialize a Fib then setup a BlockWrite command */ cmd_fibcontext = aac_fib_alloc_tag(dev, scsicmd); - scsicmd->SCp.phase = AAC_OWNER_FIRMWARE; + cmd_fibcontext->owner = AAC_OWNER_FIRMWARE; status = aac_adapter_scsi(cmd_fibcontext, scsicmd); /* @@ -3785,7 +3785,7 @@ static int aac_send_hba_fib(struct scsi_cmnd *scsicmd) if (!cmd_fibcontext) return -1; - scsicmd->SCp.phase = AAC_OWNER_FIRMWARE; + cmd_fibcontext->owner = AAC_OWNER_FIRMWARE; status = aac_adapter_hba(cmd_fibcontext, scsicmd); /* diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h index 4e199bc5da4f6..10d9001030dc0 100644 --- a/drivers/scsi/aacraid/aacraid.h +++ b/drivers/scsi/aacraid/aacraid.h @@ -1308,6 +1308,11 @@ struct fib { int (*scsi_callback)(struct scsi_cmnd *scmd); /* + * The current owner of the command + */ + int owner; + + /* * This is the event the sendfib routine will wait on if the * caller did not pass one and this is synch io. */ diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c index 0d5be76891b0e..6f0288a732ccb 100644 --- a/drivers/scsi/aacraid/comminit.c +++ b/drivers/scsi/aacraid/comminit.c @@ -272,35 +272,44 @@ static void aac_queue_init(struct aac_dev * dev, struct aac_queue * q, u32 *mem, q->entries = qsize; } +struct wait_for_io_iter_data { + struct aac_dev *dev; + int active; +}; + static bool wait_for_io_iter(struct scsi_cmnd *cmd, void *data, bool rsvd) { - int *active = data; + struct wait_for_io_iter_data *iter_data = data; + struct fib *fibptr = &iter_data->dev->fibs[scsi_cmd_to_rq(cmd)->tag]; - if (cmd->SCp.phase == AAC_OWNER_FIRMWARE) - *active = *active + 1; + if (fibptr->owner == AAC_OWNER_FIRMWARE) + iter_data->active++; return true; } static void aac_wait_for_io_completion(struct aac_dev *aac) { - int i = 0, active; + struct wait_for_io_iter_data data = { + .dev = aac, + }; + int i = 0; for (i = 60; i; --i) { - active = 0; + data.active = 0; scsi_host_busy_iter(aac->scsi_host_ptr, - wait_for_io_iter, &active); + wait_for_io_iter, &data); /* * We can exit If all the commands are complete */ - if (active == 0) + if (data.active == 0) break; dev_info(&aac->pdev->dev, - "Wait for %d commands to complete\n", active); + "Wait for %d commands to complete\n", data.active); ssleep(1); } - if (active) + if (data.active) dev_err(&aac->pdev->dev, - "%d outstanding commands during shutdown\n", active); + "%d outstanding commands during shutdown\n", data.active); } /** diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index a4a42efa53fbe..b4cdcfc172d11 100644 --- a/drivers/scsi/aacraid/linit.c +++ b/drivers/scsi/aacraid/linit.c @@ -627,6 +627,7 @@ static int aac_ioctl(struct scsi_device *sdev, unsigned int cmd, } struct fib_count_data { + struct aac_dev *dev; int mlcnt; int llcnt; int ehcnt; @@ -637,8 +638,9 @@ struct fib_count_data { static bool fib_count_iter(struct scsi_cmnd *scmnd, void *data, bool reserved) { struct fib_count_data *fib_count = data; + struct fib *fibptr = &data->dev->fibs[scsi_cmd_to_rq(scmnd)->tag]; - switch (scmnd->SCp.phase) { + switch (fibptr->owner) { case AAC_OWNER_FIRMWARE: fib_count->fwcnt++; break; @@ -663,7 +665,9 @@ static int get_num_of_incomplete_fibs(struct aac_dev *aac) { struct Scsi_Host *shost = aac->scsi_host_ptr; struct device *ctrl_dev; - struct fib_count_data fcnt = { }; + struct fib_count_data fcnt = { + .dev = aac, + }; scsi_host_busy_iter(shost, fib_count_iter, &fcnt); @@ -784,7 +788,7 @@ static int aac_eh_abort(struct scsi_cmnd* cmd) (fib->callback_data == cmd)) { fib->flags |= FIB_CONTEXT_FLAG_TIMED_OUT; - cmd->SCp.phase = + fib->owner = AAC_OWNER_ERROR_HANDLER; ret = SUCCESS; } @@ -811,7 +815,7 @@ static int aac_eh_abort(struct scsi_cmnd* cmd) (command->device == cmd->device)) { fib->flags |= FIB_CONTEXT_FLAG_TIMED_OUT; - command->SCp.phase = + fib->owner = AAC_OWNER_ERROR_HANDLER; if (command == cmd) ret = SUCCESS; @@ -1058,7 +1062,7 @@ static int aac_eh_bus_reset(struct scsi_cmnd* cmd) if (bus >= AAC_MAX_BUSES || cid >= AAC_MAX_TARGETS || info->devtype != AAC_DEVTYPE_NATIVE_RAW) { fib->flags |= FIB_CONTEXT_FLAG_EH_RESET; - cmd->SCp.phase = AAC_OWNER_ERROR_HANDLER; + fib->owner = AAC_OWNER_ERROR_HANDLER; } } } |
