Re: [PATCH V2 05/24] aacraid: Retrieve and update the device types
On Thu, Jan 26, 2017 at 09:00:42PM +, Raghava Aditya Renukunta wrote: > > > > -Original Message- > > From: linux-scsi-ow...@vger.kernel.org [mailto:linux-scsi- > > ow...@vger.kernel.org] On Behalf Of Raghava Aditya Renukunta > > Sent: Thursday, January 26, 2017 10:44 AM > > To: Johannes Thumshirn > > Cc: j...@linux.vnet.ibm.com; martin.peter...@oracle.com; linux- > > s...@vger.kernel.org; Dave Carroll ; Gana > > Sridaran ; Scott Benesh > > > > Subject: RE: [PATCH V2 05/24] aacraid: Retrieve and update the device types > > > > EXTERNAL EMAIL > > > > > > > -Original Message- > > > From: Johannes Thumshirn [mailto:jthumsh...@suse.de] > > > Sent: Thursday, January 26, 2017 1:00 AM > > > To: Raghava Aditya Renukunta > > > > > > Cc: j...@linux.vnet.ibm.com; martin.peter...@oracle.com; linux- > > > s...@vger.kernel.org; Dave Carroll ; Gana > > > Sridaran ; Scott Benesh > > > > > > Subject: Re: [PATCH V2 05/24] aacraid: Retrieve and update the device > > types > > > > > > EXTERNAL EMAIL > > > > > > > > > On Wed, Jan 25, 2017 at 10:00:52AM -0800, Raghava Aditya Renukunta > > wrote: > > > > This patch adds support to retrieve the type of each adapter connected > > > > device. Applicable to HBA1000 and SmartIOC2000 products > > > > > > > > Signed-off-by: Raghava Aditya Renukunta > > > > > > > Signed-off-by: Dave Carroll > > > > > > > > --- > > > > > > [...] > > > > > > > /* > > > > * Adapter Information Block > > > > * > > > > @@ -1056,7 +1091,28 @@ struct aac_supplement_adapter_info > > > > /* StructExpansion == 1 */ > > > > __le32 FeatureBits3; > > > > __le32 SupportedPerformanceModes; > > > > - __le32 ReservedForFutureGrowth[80]; > > > > + u8 HostBusType;/* uses HOST_BUS_TYPE_xxx defines > > > > */ > > > > + u8 HostBusWidth; /* actual width in bits or links > > > > */ > > > > + u16 HostBusSpeed; /* actual bus speed/link rate in > > > > MHz */ > > > > + u8 MaxRRCDrives; /* max. number of ITP-RRC > > > > drives/pool */ > > > > + u8 MaxDiskXtasks; /* max. possible num of DiskX > > > > Tasks */ > > > > + > > > > + u8 CpldVerLoaded; > > > > + u8 CpldVerInFlash; > > > > + > > > > + __le64 MaxRRCCapacity; > > > > + __le32 CompiledMaxHistLogLevel; > > > > + u8 CustomBoardName[12]; > > > > + u16 SupportedCntlrMode; /* identify supported controller > > > > mode > > */ > > > > + u16 ReservedForFuture16; > > > > + __le32 SupportedOptions3; /* reserved for future options */ > > > > + > > > > + __le16 VirtDeviceBus; /* virt. SCSI device for Thor */ > > > > + __le16 VirtDeviceTarget; > > > > + __le16 VirtDeviceLUN; > > > > + __le16 Unused; > > > > + __le32 ReservedForFutureGrowth[68]; > > > > + > > > > Same here. > > On second thought changing all of the variables here will open up > Pandoras box. I will leave them as it is for now and change the whole > structure and anything attached it in one of my next patch submission series. > > Will that be ok? Yes that's something I can live with, *iff* it really happens. Thanks, Johannes -- Johannes Thumshirn Storage jthumsh...@suse.de+49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [dm-devel] split scsi passthrough fields out of struct request V2
On 01/26/2017 11:40 PM, Jens Axboe wrote: > On 01/26/2017 06:22 PM, Jens Axboe wrote: >> On 01/26/2017 06:15 PM, Bart Van Assche wrote: >>> On Thu, 2017-01-26 at 17:41 -0700, Jens Axboe wrote: On 01/26/2017 05:38 PM, Bart Van Assche wrote: > I see similar behavior with the blk-mq-sched branch of > git://git.kernel.dk/linux-block.git (git commit ID 0efe27068ecf): > booting happens much slower than usual and I/O hangs if I run the > srp-test software. Please don't run that, run for-4.11/block and merge it to master. Same behavior? >>> >>> I have not yet had the chance to run the srp-test software against that >>> kernel. But I already see that booting takes more than ten times longer >>> than usual. Note: as far as I know the dm-mpath driver is not involved >>> in the boot process of my test system. >> >> What's your boot device? I've been booting this on a variety of setups, >> no problems observed. It's booting my laptop, and on SCSI and SATA as >> well. What is your root drive? What is the queue depth of it? >> Controller? > > Are you using dm for your root device? > > I think I see what is going on. The scheduler framework put the > insertion of flushes on the side, whereas it's integrated "nicely" > on the legacy side. > > Can you try with this applied? This is on top of the previous two that > we already went through. Or, you can just pull: > > git://git.kernel.dk/linux-block for-4.11/next > > which is for-4.11/block with the next set of fixes on top that I haven't > pulled in yet. The previous patch had a bug if you didn't use a scheduler, here's a version that should work fine in both cases. I've also updated the above mentioned branch, so feel free to pull that as well and merge to master like before. commit 2f54ba92a274a7c1a5ceb34a56565f84f7b994b7 Author: Jens Axboe Date: Fri Jan 27 01:00:47 2017 -0700 blk-mq-sched: add flush insertion into blk_mq_sched_insert_request() Instead of letting the caller check this and handle the details of inserting a flush request, put the logic in the scheduler insertion function. This fixes direct flush insertion outside of the usual make_request_fn calls, like from dm via blk_insert_cloned_request(). Signed-off-by: Jens Axboe diff --git a/block/blk-core.c b/block/blk-core.c index a61f1407f4f6..78daf5b6d7cb 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -2129,7 +2129,7 @@ int blk_insert_cloned_request(struct request_queue *q, struct request *rq) if (q->mq_ops) { if (blk_queue_io_stat(q)) blk_account_io_start(rq, true); - blk_mq_sched_insert_request(rq, false, true, false); + blk_mq_sched_insert_request(rq, false, true, false, false); return 0; } diff --git a/block/blk-exec.c b/block/blk-exec.c index 86656fdfa637..ed1f10165268 100644 --- a/block/blk-exec.c +++ b/block/blk-exec.c @@ -66,7 +66,7 @@ void blk_execute_rq_nowait(struct request_queue *q, struct gendisk *bd_disk, * be reused after dying flag is set */ if (q->mq_ops) { - blk_mq_sched_insert_request(rq, at_head, true, false); + blk_mq_sched_insert_request(rq, at_head, true, false, false); return; } diff --git a/block/blk-flush.c b/block/blk-flush.c index d7de34ee39c2..4427896641ac 100644 --- a/block/blk-flush.c +++ b/block/blk-flush.c @@ -456,7 +456,7 @@ void blk_insert_flush(struct request *rq) if ((policy & REQ_FSEQ_DATA) && !(policy & (REQ_FSEQ_PREFLUSH | REQ_FSEQ_POSTFLUSH))) { if (q->mq_ops) - blk_mq_sched_insert_request(rq, false, true, false); + blk_mq_sched_insert_request(rq, false, true, false, false); else list_add_tail(&rq->queuelist, &q->queue_head); return; diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c index c27613de80c5..5e91743e193a 100644 --- a/block/blk-mq-sched.c +++ b/block/blk-mq-sched.c @@ -336,6 +336,64 @@ void blk_mq_sched_restart_queues(struct blk_mq_hw_ctx *hctx) } } +/* + * Add flush/fua to the queue. If we fail getting a driver tag, then + * punt to the requeue list. Requeue will re-invoke us from a context + * that's safe to block from. + */ +static void blk_mq_sched_insert_flush(struct blk_mq_hw_ctx *hctx, + struct request *rq, bool can_block) +{ + if (blk_mq_get_driver_tag(rq, &hctx, can_block)) { + blk_insert_flush(rq); + blk_mq_run_hw_queue(hctx, true); + } else + blk_mq_add_to_requeue_list(rq, true, true); +} + +void blk_mq_sched_insert_request(struct request *rq, bool at_head, +bool run_queue, bool async, bool can_block) +{ + struct request_queue *q = rq->q; + struct elevator_queue *e = q->elevator; + struct
Re: [PATCH] scsi: srp_transport: Fix 'always false comparison' in srp_tmo_valid()
On Thu, Jan 26, 2017 at 3:11 PM, Bart Van Assche wrote: > This patch is wrong. The purpose of the dev_loss_tmo >= LONG_MAX / HZ check > is to avoid that the expression 1UL * dev_loss_tmo * HZ further down > overflows. Can you check whether changing the if-statement into if (1UL * > dev_loss_tmo >= LONG_MAX / HZ) also suppresses the compiler warning? Hi Bart, Right, now a I see... Doing your proposed change the warning go away... Do you want me to send a new patch for that? -- Augusto Mecking Caringi -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH 1/2] scsi: scsi_transport_fc: Provide a lightweight option for Virtual FC Hosts.
> -Original Message- > From: Christoph Hellwig [mailto:h...@infradead.org] > Sent: Thursday, January 19, 2017 7:12 AM > To: Cathy Avery > Cc: KY Srinivasan ; Haiyang Zhang > ; j...@linux.vnet.ibm.com; > martin.peter...@oracle.com; de...@linuxdriverproject.org; linux- > ker...@vger.kernel.org; linux-scsi@vger.kernel.org > Subject: Re: [PATCH 1/2] scsi: scsi_transport_fc: Provide a lightweight option > for Virtual FC Hosts. > > On Wed, Jan 18, 2017 at 03:28:57PM -0500, Cathy Avery wrote: > > The patch provides a means to offer a lightweight option to the > > current FC transport class. The new option is selected by a > > driver when it indicates it wants the lightweight > > transport via fc_function_template. > > This need some really good documentation in the code and changelog > what "lightweight" means. It's a pretty horrible term, btw. This was a concept that James proposed almost a year ago. I agree, we need to document this better. K. Y -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: split scsi passthrough fields out of struct request V2
On Wed, Jan 25 2017, Christoph Hellwig wrote: > Hi all, > > this series splits the support for SCSI passthrough commands from the > main struct request used all over the block layer into a separate > scsi_request structure that drivers that want to support SCSI passthough > need to embedded as the first thing into their request-private data, > similar to how we handle NVMe passthrough commands. > > To support this I've added support for that the private data after > request structure to the legacy request path instead, so that it can > be treated the same way as the blk-mq path. Compare to the current > scsi_cmnd allocator that actually is a major simplification. > > Changes since V1: > - fix handling of a NULL sense pointer in __scsi_execute > - clean up handling of the flush flags in the block layer and MD > - additional small cleanup in dm-rq I've queued this up for 4.11. Since some of the patches had dependencies on changes in master since for-4.11/block was forked, they are sitting in a separate branch that has both for-4.11/block and v4.10-rc5 pulled in first. for-next has everything, as usual. -- Jens Axboe -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 05/18] block: allow specifying size for extra command data
On Wed, Jan 25, 2017 at 10:15:55PM -0500, Martin K. Petersen wrote: > +static void *alloc_request_size(gfp_t gfp_mask, void *data) > > I like alloc_request_simple() but alloc_request_size() seems a bit > contrived. _reserve? _extra? _special? Don't have any good suggestions, > I'm afraid. Not that I'm a fan of _size, but I like the other suggestions even less. -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: split scsi passthrough fields out of struct request V2
On Fri, Jan 27, 2017 at 09:11:14AM -0700, Jens Axboe wrote: > I've queued this up for 4.11. Since some of the patches had dependencies > on changes in master since for-4.11/block was forked, they are sitting > in a separate branch that has both for-4.11/block and v4.10-rc5 pulled > in first. for-next has everything, as usual. Eww. I just had a couple non-trivial updates that I now do again. In case you haven't pushed it out yet can you let me repost first? -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: split scsi passthrough fields out of struct request V2
On 01/27/2017 09:23 AM, Christoph Hellwig wrote: > On Fri, Jan 27, 2017 at 09:21:46AM -0700, Jens Axboe wrote: >> On 01/27/2017 09:17 AM, Christoph Hellwig wrote: >>> On Fri, Jan 27, 2017 at 09:11:14AM -0700, Jens Axboe wrote: I've queued this up for 4.11. Since some of the patches had dependencies on changes in master since for-4.11/block was forked, they are sitting in a separate branch that has both for-4.11/block and v4.10-rc5 pulled in first. for-next has everything, as usual. >>> >>> Eww. I just had a couple non-trivial updates that I now do again. >>> In case you haven't pushed it out yet can you let me repost first? >> >> Why the eww?! You can't fix this with a repost. > > Not because of the merge, mostly because I just spent two same > time adding all the ACKs, fixing typos and adding the removal of > the ->cmd tracing to the series and was getting ready for a repost. Feel free to repost it, I have no problem rebasing that branch as it's standalone for now. -- Jens Axboe -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 01/19] block: add a op_is_flush helper
This centralizes the checks for bios that needs to be go into the flush state machine. Signed-off-by: Christoph Hellwig Reviewed-by: Bart Van Assche Reviewed-by: Martin K. Petersen --- block/blk-core.c | 8 block/blk-mq-sched.c | 5 ++--- block/blk-mq.c | 4 ++-- drivers/md/bcache/request.c | 2 +- drivers/md/dm-cache-target.c | 13 +++-- drivers/md/dm-thin.c | 13 + include/linux/blk_types.h| 9 + 7 files changed, 26 insertions(+), 28 deletions(-) diff --git a/block/blk-core.c b/block/blk-core.c index 78daf5b..4bfd867 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -1035,7 +1035,7 @@ static bool blk_rq_should_init_elevator(struct bio *bio) * Flush requests do not use the elevator so skip initialization. * This allows a request to share the flush and elevator data. */ - if (bio->bi_opf & (REQ_PREFLUSH | REQ_FUA)) + if (op_is_flush(bio->bi_opf)) return false; return true; @@ -1641,7 +1641,7 @@ static blk_qc_t blk_queue_bio(struct request_queue *q, struct bio *bio) return BLK_QC_T_NONE; } - if (bio->bi_opf & (REQ_PREFLUSH | REQ_FUA)) { + if (op_is_flush(bio->bi_opf)) { spin_lock_irq(q->queue_lock); where = ELEVATOR_INSERT_FLUSH; goto get_rq; @@ -2145,7 +2145,7 @@ int blk_insert_cloned_request(struct request_queue *q, struct request *rq) */ BUG_ON(blk_queued_rq(rq)); - if (rq->cmd_flags & (REQ_PREFLUSH | REQ_FUA)) + if (op_is_flush(rq->cmd_flags)) where = ELEVATOR_INSERT_FLUSH; add_acct_request(q, rq, where); @@ -3256,7 +3256,7 @@ void blk_flush_plug_list(struct blk_plug *plug, bool from_schedule) /* * rq is already accounted, so use raw insert */ - if (rq->cmd_flags & (REQ_PREFLUSH | REQ_FUA)) + if (op_is_flush(rq->cmd_flags)) __elv_add_request(q, rq, ELEVATOR_INSERT_FLUSH); else __elv_add_request(q, rq, ELEVATOR_INSERT_SORT_MERGE); diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c index 5e91743..1112752 100644 --- a/block/blk-mq-sched.c +++ b/block/blk-mq-sched.c @@ -111,7 +111,6 @@ struct request *blk_mq_sched_get_request(struct request_queue *q, struct blk_mq_hw_ctx *hctx; struct blk_mq_ctx *ctx; struct request *rq; - const bool is_flush = op & (REQ_PREFLUSH | REQ_FUA); blk_queue_enter_live(q); ctx = blk_mq_get_ctx(q); @@ -126,7 +125,7 @@ struct request *blk_mq_sched_get_request(struct request_queue *q, * Flush requests are special and go directly to the * dispatch list. */ - if (!is_flush && e->type->ops.mq.get_request) { + if (!op_is_flush(op) && e->type->ops.mq.get_request) { rq = e->type->ops.mq.get_request(q, op, data); if (rq) rq->rq_flags |= RQF_QUEUED; @@ -139,7 +138,7 @@ struct request *blk_mq_sched_get_request(struct request_queue *q, } if (rq) { - if (!is_flush) { + if (!op_is_flush(op)) { rq->elv.icq = NULL; if (e && e->type->icq_cache) blk_mq_sched_assign_ioc(q, rq, bio); diff --git a/block/blk-mq.c b/block/blk-mq.c index 68b..ff70219 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -1405,7 +1405,7 @@ static void blk_mq_try_issue_directly(struct request *rq, blk_qc_t *cookie) static blk_qc_t blk_mq_make_request(struct request_queue *q, struct bio *bio) { const int is_sync = op_is_sync(bio->bi_opf); - const int is_flush_fua = bio->bi_opf & (REQ_PREFLUSH | REQ_FUA); + const int is_flush_fua = op_is_flush(bio->bi_opf); struct blk_mq_alloc_data data = { .flags = 0 }; struct request *rq; unsigned int request_count = 0, srcu_idx; @@ -1527,7 +1527,7 @@ static blk_qc_t blk_mq_make_request(struct request_queue *q, struct bio *bio) static blk_qc_t blk_sq_make_request(struct request_queue *q, struct bio *bio) { const int is_sync = op_is_sync(bio->bi_opf); - const int is_flush_fua = bio->bi_opf & (REQ_PREFLUSH | REQ_FUA); + const int is_flush_fua = op_is_flush(bio->bi_opf); struct blk_plug *plug; unsigned int request_count = 0; struct blk_mq_alloc_data data = { .flags = 0 }; diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c index 76d2087..01035e7 100644 --- a/drivers/md/bcache/request.c +++ b/drivers/md/bcache/request.c @@ -666,7 +666,7 @@ static inline struct search *search_alloc(struct bio *bio, s->iop.write_prio = 0; s->iop.error= 0; s->iop.flags
split scsi passthrough fields out of struct request V3
Hi all, this series splits the support for SCSI passthrough commands from the main struct request used all over the block layer into a separate scsi_request structure that drivers that want to support SCSI passthough need to embedded as the first thing into their request-private data, similar to how we handle NVMe passthrough commands. To support this I've added support for that the private data after request structure to the legacy request path instead, so that it can be treated the same way as the blk-mq path. Compare to the current scsi_cmnd allocator that actually is a major simplification. Changes since V2: - remove req->cmd tracing - minor spelling fixes Changes since V1: - fix handling of a NULL sense pointer in __scsi_execute - clean up handling of the flush flags in the block layer and MD - additional small cleanup in dm-rq -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 02/19] md: cleanup bio op / flags handling in raid1_write_request
No need for the local variables, the bio is still live and we can just assign the bits we want directly. Make me wonder why we can't assign all the bio flags to start with. Signed-off-by: Christoph Hellwig Reviewed-by: Bart Van Assche Reviewed-by: Martin K. Petersen --- drivers/md/raid1.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 7b0f647..67b0365 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -1170,10 +1170,6 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio, int i, disks; struct bitmap *bitmap = mddev->bitmap; unsigned long flags; - const int op = bio_op(bio); - const unsigned long do_sync = (bio->bi_opf & REQ_SYNC); - const unsigned long do_flush_fua = (bio->bi_opf & - (REQ_PREFLUSH | REQ_FUA)); struct md_rdev *blocked_rdev; struct blk_plug_cb *cb; struct raid1_plug_cb *plug = NULL; @@ -1389,7 +1385,8 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio, conf->mirrors[i].rdev->data_offset); mbio->bi_bdev = conf->mirrors[i].rdev->bdev; mbio->bi_end_io = raid1_end_write_request; - bio_set_op_attrs(mbio, op, do_flush_fua | do_sync); + mbio->bi_opf = bio_op(bio) | + (bio->bi_opf & (REQ_SYNC | REQ_PREFLUSH | REQ_FUA)); if (test_bit(FailFast, &conf->mirrors[i].rdev->flags) && !test_bit(WriteMostly, &conf->mirrors[i].rdev->flags) && conf->raid_disks - mddev->degraded > 1) -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: split scsi passthrough fields out of struct request V2
On Fri, Jan 27, 2017 at 09:27:02AM -0700, Jens Axboe wrote: > Feel free to repost it, I have no problem rebasing that branch as it's > standalone for now. Ok, I'll repost what I have right now, which is on top of a merge of your block/for-4.11/next and your for-next from this morning my time. Btw, I disagred with your patch to use op_is_flush in generic_make_request_checks - given that we clear these flags just below I think using the helper obsfucates what's really going on. -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 07/18] dm: always defer request allocation to the owner of the request_queue
On Wed, Jan 25 2017 at 12:25pm -0500, Christoph Hellwig wrote: > DM already calls blk_mq_alloc_request on the request_queue of the > underlying device if it is a blk-mq device. But now that we allow drivers > to allocate additional data and initialize it ahead of time we need to do > the same for all drivers. Doing so and using the new cmd_size > infrastructure in the block layer greatly simplifies the dm-rq and mpath > code, and should also make arbitrary combinations of SQ and MQ devices > with SQ or MQ device mapper tables easily possible as a further step. > > Signed-off-by: Christoph Hellwig > Reviewed-by: Hannes Reinecke > Reviewed-by: Mike Snitzer ... > diff --git a/drivers/md/dm-rq.c b/drivers/md/dm-rq.c > index 3f12916..8d06834 100644 > --- a/drivers/md/dm-rq.c > +++ b/drivers/md/dm-rq.c > @@ -185,7 +163,7 @@ static void end_clone_bio(struct bio *clone) > > static struct dm_rq_target_io *tio_from_request(struct request *rq) > { > - return (rq->q->mq_ops ? blk_mq_rq_to_pdu(rq) : rq->special); > + return blk_mq_rq_to_pdu(rq); > } Noticed after further review that it seems a bit weird to have the non blk-mq support in drivers calling blk_mq_rq_to_pdu(). But I'm not sure a blk_rq_to_pdu() macro to blk_mq_rq_to_pdu() is the right thing. What do you guys think? -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 07/18] dm: always defer request allocation to the owner of the request_queue
On Fri, Jan 27, 2017 at 11:34:34AM -0500, Mike Snitzer wrote: > Noticed after further review that it seems a bit weird to have the non > blk-mq support in drivers calling blk_mq_rq_to_pdu(). But I'm not sure > a blk_rq_to_pdu() macro to blk_mq_rq_to_pdu() is the right thing. What > do you guys think? My first version had an additional name for it, but it caused more confusion than help. -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: split scsi passthrough fields out of struct request V2
On 01/27/2017 09:17 AM, Christoph Hellwig wrote: > On Fri, Jan 27, 2017 at 09:11:14AM -0700, Jens Axboe wrote: >> I've queued this up for 4.11. Since some of the patches had dependencies >> on changes in master since for-4.11/block was forked, they are sitting >> in a separate branch that has both for-4.11/block and v4.10-rc5 pulled >> in first. for-next has everything, as usual. > > Eww. I just had a couple non-trivial updates that I now do again. > In case you haven't pushed it out yet can you let me repost first? Why the eww?! You can't fix this with a repost. It's fine, I'll just ship off for-4.11/block first (as usual), then for-4.11/rq-refactor. The two issues is in virtio_blk and raid1. For some reason, raid1 included a refactor of a function later in the cycle (hrmpf). So there's really no good way to solve this, unless I pull in v4.10-rc5 into for-4.11/block. And I don't want to do that. Hence the topic branch for this work. I have pushed it out, but it's not merged into for-next yet, it's just standalone. When I've done some sanity testing, I'll push it out. -- Jens Axboe -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: split scsi passthrough fields out of struct request V2
On Fri, Jan 27, 2017 at 09:21:46AM -0700, Jens Axboe wrote: > On 01/27/2017 09:17 AM, Christoph Hellwig wrote: > > On Fri, Jan 27, 2017 at 09:11:14AM -0700, Jens Axboe wrote: > >> I've queued this up for 4.11. Since some of the patches had dependencies > >> on changes in master since for-4.11/block was forked, they are sitting > >> in a separate branch that has both for-4.11/block and v4.10-rc5 pulled > >> in first. for-next has everything, as usual. > > > > Eww. I just had a couple non-trivial updates that I now do again. > > In case you haven't pushed it out yet can you let me repost first? > > Why the eww?! You can't fix this with a repost. Not because of the merge, mostly because I just spent two same time adding all the ACKs, fixing typos and adding the removal of the ->cmd tracing to the series and was getting ready for a repost. -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 07/18] dm: always defer request allocation to the owner of the request_queue
On Fri, Jan 27 2017 at 11:36am -0500, Christoph Hellwig wrote: > On Fri, Jan 27, 2017 at 11:34:34AM -0500, Mike Snitzer wrote: > > Noticed after further review that it seems a bit weird to have the non > > blk-mq support in drivers calling blk_mq_rq_to_pdu(). But I'm not sure > > a blk_rq_to_pdu() macro to blk_mq_rq_to_pdu() is the right thing. What > > do you guys think? > > My first version had an additional name for it, but it caused more > confusion than help. And renaming blk_mq_rq_to_pdu() to blk_rq_to_pdu() tree-wide would be too much churn? I can live with blk_mq_rq_to_pdu(); just figured I'd ask. -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: split scsi passthrough fields out of struct request V2
On Fri, Jan 27, 2017 at 09:38:40AM -0700, Jens Axboe wrote: > > Ok, I'll repost what I have right now, which is on top of a merge > > of your block/for-4.11/next and your for-next from this morning > > my time. > > Perfect. At least I tried, looks like the mail server is overloaded and crapped out three mails into it. For now there is a git tree here: http://git.infradead.org/users/hch/block.git/shortlog/refs/heads/block-pc-refactor > > > Btw, I disagred with your patch to use op_is_flush in > > generic_make_request_checks - given that we clear these flags just > > below I think using the helper obsfucates what's really going on. > > Why? It's the exact same check. The ugly part is the fact that > we strip the flags later on, imho. But before it was pretty obvious that it clears exactly the flags checked two lines earlier. Now it's not as obvious. -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [dm-devel] split scsi passthrough fields out of struct request V2
On Thu, 2017-01-26 at 18:22 -0700, Jens Axboe wrote: > What's your boot device? I've been booting this on a variety of setups, > no problems observed. It's booting my laptop, and on SCSI and SATA as > well. What is your root drive? What is the queue depth of it? > Controller? The boot device in my test setup is a SATA hard disk: # cat /proc/cmdline BOOT_IMAGE=/boot/vmlinuz-4.10.0-rc5-dbg+ root=UUID=60a4b064-b3ef-4d28-96d3-3c13ecbec43e resume=/dev/sda2 showopts # ls -l /dev/disk/by-uuid/60a4b064-b3ef-4d28-96d3-3c13ecbec43e lrwxrwxrwx 1 root root 10 Jan 27 08:43 /dev/disk/by-uuid/60a4b064-b3ef-4d28-96d3-3c13ecbec43e -> ../../sda1 # cat /sys/block/sda/queue/nr_requests 31 # lsscsi | grep sda [0:0:0:0] disk ATA ST1000NM0033-9ZM GA67 /dev/sda # hdparm -i /dev/sda /dev/sda: Model=ST1000NM0033-9ZM173, FwRev=GA67, SerialNo=Z1W2HM75 Config={ HardSect NotMFM HdSw>15uSec Fixed DTR>10Mbs RotSpdTol>.5% } RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=0 BuffType=unknown, BuffSize=unknown, MaxMultSect=16, MultSect=off CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=1953525168 IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120} PIO modes: pio0 pio1 pio2 pio3 pio4 DMA modes: mdma0 mdma1 mdma2 UDMA modes: udma0 udma1 udma2 udma3 udma4 udma5 *udma6 AdvancedPM=no WriteCache=disabled Drive conforms to: Unspecified: ATA/ATAPI-4,5,6,7 * signifies the current active mode Bart.-- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [dm-devel] split scsi passthrough fields out of struct request V2
On 01/27/2017 09:52 AM, Bart Van Assche wrote: > On Fri, 2017-01-27 at 01:04 -0700, Jens Axboe wrote: >> The previous patch had a bug if you didn't use a scheduler, here's a >> version that should work fine in both cases. I've also updated the >> above mentioned branch, so feel free to pull that as well and merge to >> master like before. > > Booting time is back to normal with commit f3a8ab7d55bc merged with > v4.10-rc5. That's a great improvement. However, running the srp-test > software triggers now a new complaint: > > [ 215.600386] sd 11:0:0:0: [sdh] Attached SCSI disk > [ 215.609485] sd 11:0:0:0: alua: port group 00 state A non-preferred > supports TOlUSNA > [ 215.722900] scsi 13:0:0:0: alua: Detached > [ 215.724452] general protection fault: [#1] SMP > [ 215.724484] Modules linked in: dm_service_time ib_srp scsi_transport_srp > target_core_user uio target_core_pscsi target_core_file ib_srpt > target_core_iblock target_core_mod brd netconsole xt_CHECKSUM iptable_mangle > ipt_MASQUERADE nf_nat_masquerade_ipv4 iptable_nat nf_nat_ipv4 nf_nat > libcrc32c nf_conntrack_ipv4 nf_defrag_ipv4 xt_conntrack nf_conntrack > ipt_REJECT nf_reject_ipv4 xt_tcpudp tun bridge stp llc ebtable_filter > ebtables ip6table_filter ip6_tables iptable_filter ip_tables x_tables > af_packet ib_ipoib rdma_ucm ib_ucm ib_uverbs ib_umad rdma_cm msr configfs > ib_cm iw_cm mlx4_ib ib_core sb_edac edac_core x86_pkg_temp_thermal > intel_powerclamp ipmi_ssif coretemp kvm_intel hid_generic kvm usbhid > irqbypass crct10dif_pclmul crc32_pclmul crc32c_intel mlx4_core > ghash_clmulni_intel iTCO_wdt dcdbas pcbc tg3 > [ 215.724629] iTCO_vendor_support ptp aesni_intel pps_core aes_x86_64 > pcspkr crypto_simd libphy ipmi_si glue_helper cryptd ipmi_devintf tpm_tis > devlink fjes ipmi_msghandler tpm_tis_core tpm mei_me lpc_ich mei mfd_core > button shpchp wmi mgag200 i2c_algo_bit drm_kms_helper syscopyarea sysfillrect > sysimgblt fb_sys_fops ttm drm sr_mod cdrom ehci_pci ehci_hcd usbcore > usb_common sg dm_multipath dm_mod scsi_dh_rdac scsi_dh_emc scsi_dh_alua > autofs4 > [ 215.724719] CPU: 9 PID: 8043 Comm: multipathd Not tainted 4.10.0-rc5-dbg+ > #1 > [ 215.724748] Hardware name: Dell Inc. PowerEdge R430/03XKDV, BIOS 1.0.2 > 11/17/2014 > [ 215.724775] task: 8801717998c0 task.stack: c90002a9c000 > [ 215.724804] RIP: 0010:scsi_device_put+0xb/0x30 > [ 215.724829] RSP: 0018:c90002a9faa0 EFLAGS: 00010246 > [ 215.724855] RAX: 6b6b6b6b6b6b6b6b RBX: 88038bf85698 RCX: > 0006 > [ 215.724880] RDX: 0006 RSI: 88017179a108 RDI: > 88038bf85698 > [ 215.724906] RBP: c90002a9faa8 R08: 880384786008 R09: > 000100170007 > [ 215.724932] R10: R11: R12: > 88038bf85698 > [ 215.724958] R13: 88038919f090 R14: dead0100 R15: > 88038a41dd28 > [ 215.724983] FS: 7fbf8c6cf700() GS:88046f44() > knlGS: > [ 215.725010] CS: 0010 DS: ES: CR0: 80050033 > [ 215.725035] CR2: 7f1262ef3ee0 CR3: 00044f6cc000 CR4: > 001406e0 > [ 215.725060] Call Trace: > [ 215.725086] scsi_disk_put+0x2d/0x40 > [ 215.725110] sd_release+0x3d/0xb0 > [ 215.725137] __blkdev_put+0x29e/0x360 > [ 215.725163] blkdev_put+0x49/0x170 > [ 215.725192] dm_put_table_device+0x58/0xc0 [dm_mod] > [ 215.725219] dm_put_device+0x70/0xc0 [dm_mod] > [ 215.725269] free_priority_group+0x92/0xc0 [dm_multipath] > [ 215.725295] free_multipath+0x70/0xc0 [dm_multipath] > [ 215.725320] multipath_dtr+0x19/0x20 [dm_multipath] > [ 215.725348] dm_table_destroy+0x67/0x120 [dm_mod] > [ 215.725379] dev_suspend+0xde/0x240 [dm_mod] > [ 215.725434] ctl_ioctl+0x1f5/0x520 [dm_mod] > [ 215.725489] dm_ctl_ioctl+0xe/0x20 [dm_mod] > [ 215.725515] do_vfs_ioctl+0x8f/0x700 > [ 215.725589] SyS_ioctl+0x3c/0x70 > [ 215.725614] entry_SYSCALL_64_fastpath+0x18/0xad > [ 215.725641] RIP: 0033:0x7fbf8aca0667 > [ 215.725665] RSP: 002b:7fbf8c6cd668 EFLAGS: 0246 ORIG_RAX: > 0010 > [ 215.725692] RAX: ffda RBX: 0046 RCX: > 7fbf8aca0667 > [ 215.725716] RDX: 7fbf8006b940 RSI: c138fd06 RDI: > 0007 > [ 215.725743] RBP: 0009 R08: 7fbf8c6cb3c0 R09: > 7fbf8b68d8d8 > [ 215.725768] R10: 0075 R11: 0246 R12: > 7fbf8c6cd770 > [ 215.725793] R13: 0013 R14: 006168f0 R15: > 00f74780 > [ 215.725820] Code: bc 24 b8 00 00 00 e8 55 c8 1c 00 48 83 c4 08 48 89 d8 5b > 41 5c 41 5d 41 5e 41 5f 5d c3 0f 1f 00 55 48 89 e5 53 48 8b 07 48 89 fb <48> > 8b 80 a8 01 00 00 48 8b 38 e8 f6 68 c5 ff 48 8d bb 38 02 00 > [ 215.725903] RIP: scsi_device_put+0xb/0x30 RSP: c90002a9faa0 > > (gdb) list *(scsi_device_put+0xb) > 0x8149fc2b is in scsi_device_put (drivers/scsi/scsi.c:957). > 952 * count of the underlying LLDD module. The device is freed once the > las
Re: [dm-devel] split scsi passthrough fields out of struct request V2
On Fri, 2017-01-27 at 01:04 -0700, Jens Axboe wrote: > The previous patch had a bug if you didn't use a scheduler, here's a > version that should work fine in both cases. I've also updated the > above mentioned branch, so feel free to pull that as well and merge to > master like before. Booting time is back to normal with commit f3a8ab7d55bc merged with v4.10-rc5. That's a great improvement. However, running the srp-test software triggers now a new complaint: [ 215.600386] sd 11:0:0:0: [sdh] Attached SCSI disk [ 215.609485] sd 11:0:0:0: alua: port group 00 state A non-preferred supports TOlUSNA [ 215.722900] scsi 13:0:0:0: alua: Detached [ 215.724452] general protection fault: [#1] SMP [ 215.724484] Modules linked in: dm_service_time ib_srp scsi_transport_srp target_core_user uio target_core_pscsi target_core_file ib_srpt target_core_iblock target_core_mod brd netconsole xt_CHECKSUM iptable_mangle ipt_MASQUERADE nf_nat_masquerade_ipv4 iptable_nat nf_nat_ipv4 nf_nat libcrc32c nf_conntrack_ipv4 nf_defrag_ipv4 xt_conntrack nf_conntrack ipt_REJECT nf_reject_ipv4 xt_tcpudp tun bridge stp llc ebtable_filter ebtables ip6table_filter ip6_tables iptable_filter ip_tables x_tables af_packet ib_ipoib rdma_ucm ib_ucm ib_uverbs ib_umad rdma_cm msr configfs ib_cm iw_cm mlx4_ib ib_core sb_edac edac_core x86_pkg_temp_thermal intel_powerclamp ipmi_ssif coretemp kvm_intel hid_generic kvm usbhid irqbypass crct10dif_pclmul crc32_pclmul crc32c_intel mlx4_core ghash_clmulni_intel iTCO_wdt dcdbas pcbc tg3 [ 215.724629] iTCO_vendor_support ptp aesni_intel pps_core aes_x86_64 pcspkr crypto_simd libphy ipmi_si glue_helper cryptd ipmi_devintf tpm_tis devlink fjes ipmi_msghandler tpm_tis_core tpm mei_me lpc_ich mei mfd_core button shpchp wmi mgag200 i2c_algo_bit drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops ttm drm sr_mod cdrom ehci_pci ehci_hcd usbcore usb_common sg dm_multipath dm_mod scsi_dh_rdac scsi_dh_emc scsi_dh_alua autofs4 [ 215.724719] CPU: 9 PID: 8043 Comm: multipathd Not tainted 4.10.0-rc5-dbg+ #1 [ 215.724748] Hardware name: Dell Inc. PowerEdge R430/03XKDV, BIOS 1.0.2 11/17/2014 [ 215.724775] task: 8801717998c0 task.stack: c90002a9c000 [ 215.724804] RIP: 0010:scsi_device_put+0xb/0x30 [ 215.724829] RSP: 0018:c90002a9faa0 EFLAGS: 00010246 [ 215.724855] RAX: 6b6b6b6b6b6b6b6b RBX: 88038bf85698 RCX: 0006 [ 215.724880] RDX: 0006 RSI: 88017179a108 RDI: 88038bf85698 [ 215.724906] RBP: c90002a9faa8 R08: 880384786008 R09: 000100170007 [ 215.724932] R10: R11: R12: 88038bf85698 [ 215.724958] R13: 88038919f090 R14: dead0100 R15: 88038a41dd28 [ 215.724983] FS: 7fbf8c6cf700() GS:88046f44() knlGS: [ 215.725010] CS: 0010 DS: ES: CR0: 80050033 [ 215.725035] CR2: 7f1262ef3ee0 CR3: 00044f6cc000 CR4: 001406e0 [ 215.725060] Call Trace: [ 215.725086] scsi_disk_put+0x2d/0x40 [ 215.725110] sd_release+0x3d/0xb0 [ 215.725137] __blkdev_put+0x29e/0x360 [ 215.725163] blkdev_put+0x49/0x170 [ 215.725192] dm_put_table_device+0x58/0xc0 [dm_mod] [ 215.725219] dm_put_device+0x70/0xc0 [dm_mod] [ 215.725269] free_priority_group+0x92/0xc0 [dm_multipath] [ 215.725295] free_multipath+0x70/0xc0 [dm_multipath] [ 215.725320] multipath_dtr+0x19/0x20 [dm_multipath] [ 215.725348] dm_table_destroy+0x67/0x120 [dm_mod] [ 215.725379] dev_suspend+0xde/0x240 [dm_mod] [ 215.725434] ctl_ioctl+0x1f5/0x520 [dm_mod] [ 215.725489] dm_ctl_ioctl+0xe/0x20 [dm_mod] [ 215.725515] do_vfs_ioctl+0x8f/0x700 [ 215.725589] SyS_ioctl+0x3c/0x70 [ 215.725614] entry_SYSCALL_64_fastpath+0x18/0xad [ 215.725641] RIP: 0033:0x7fbf8aca0667 [ 215.725665] RSP: 002b:7fbf8c6cd668 EFLAGS: 0246 ORIG_RAX: 0010 [ 215.725692] RAX: ffda RBX: 0046 RCX: 7fbf8aca0667 [ 215.725716] RDX: 7fbf8006b940 RSI: c138fd06 RDI: 0007 [ 215.725743] RBP: 0009 R08: 7fbf8c6cb3c0 R09: 7fbf8b68d8d8 [ 215.725768] R10: 0075 R11: 0246 R12: 7fbf8c6cd770 [ 215.725793] R13: 0013 R14: 006168f0 R15: 00f74780 [ 215.725820] Code: bc 24 b8 00 00 00 e8 55 c8 1c 00 48 83 c4 08 48 89 d8 5b 41 5c 41 5d 41 5e 41 5f 5d c3 0f 1f 00 55 48 89 e5 53 48 8b 07 48 89 fb <48> 8b 80 a8 01 00 00 48 8b 38 e8 f6 68 c5 ff 48 8d bb 38 02 00 [ 215.725903] RIP: scsi_device_put+0xb/0x30 RSP: c90002a9faa0 (gdb) list *(scsi_device_put+0xb) 0x8149fc2b is in scsi_device_put (drivers/scsi/scsi.c:957). 952 * count of the underlying LLDD module. The device is freed once the last 953 * user vanishes. 954 */ 955 void scsi_device_put(struct scsi_device *sdev) 956 { 957 module_put(sdev->host->hostt->module); 958 put_device(&sdev->sdev_gendev); 959 } 960 EXPORT_SYMBOL(scsi_de
Re: [PATCH 05/18] block: allow specifying size for extra command data
On 01/27/2017 10:21 AM, Bart Van Assche wrote: > On Fri, 2017-01-27 at 17:12 +0100, Christoph Hellwig wrote: >> On Wed, Jan 25, 2017 at 10:15:55PM -0500, Martin K. Petersen wrote: >>> +static void *alloc_request_size(gfp_t gfp_mask, void *data) >>> >>> I like alloc_request_simple() but alloc_request_size() seems a bit >>> contrived. _reserve? _extra? _special? Don't have any good suggestions, >>> I'm afraid. >> >> Not that I'm a fan of _size, but I like the other suggestions even less. > > Hello Christoph and Martin, > > How about using the function names alloc_full_request() / free_full_request() > together with a comment that mentions that cmd_size is set by the LLD? Since we use pdu in other places, how about alloc_request_pdu() or alloc_request_with_pdu()? And since it's all queued up, any bike shedding changes will have to be incremental. -- Jens Axboe -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: split scsi passthrough fields out of struct request V2
On 01/27/2017 09:34 AM, Christoph Hellwig wrote: > On Fri, Jan 27, 2017 at 09:27:02AM -0700, Jens Axboe wrote: >> Feel free to repost it, I have no problem rebasing that branch as it's >> standalone for now. > > Ok, I'll repost what I have right now, which is on top of a merge > of your block/for-4.11/next and your for-next from this morning > my time. Perfect. > Btw, I disagred with your patch to use op_is_flush in > generic_make_request_checks - given that we clear these flags just > below I think using the helper obsfucates what's really going on. Why? It's the exact same check. The ugly part is the fact that we strip the flags later on, imho. -- Jens Axboe -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 05/18] block: allow specifying size for extra command data
On 01/27/2017 10:30 AM, Bart Van Assche wrote: > On Fri, 2017-01-27 at 10:26 -0700, Jens Axboe wrote: >> On 01/27/2017 10:21 AM, Bart Van Assche wrote: >>> On Fri, 2017-01-27 at 17:12 +0100, Christoph Hellwig wrote: On Wed, Jan 25, 2017 at 10:15:55PM -0500, Martin K. Petersen wrote: > +static void *alloc_request_size(gfp_t gfp_mask, void *data) > > I like alloc_request_simple() but alloc_request_size() seems a bit > contrived. _reserve? _extra? _special? Don't have any good suggestions, > I'm afraid. Not that I'm a fan of _size, but I like the other suggestions even less. >>> >>> Hello Christoph and Martin, >>> >>> How about using the function names alloc_full_request() / >>> free_full_request() >>> together with a comment that mentions that cmd_size is set by the LLD? >> >> Since we use pdu in other places, how about alloc_request_pdu() or >> alloc_request_with_pdu()? >> >> And since it's all queued up, any bike shedding changes will have to be >> incremental. > > Hello Jens, > > Other Linux subsystems use the term "private data" instead of PDU. How about > modifying the block layer such that it uses the same terminology? I'm > referring to function names like blk_mq_rq_from_pdu() and blk_mq_rq_to_pdu() It's been pdu since it was introduced in 3.13, I really don't see a good reason to change it. At least pdu or payload means something, where as private is just... Well, not a big fan. -- Jens Axboe -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: split scsi passthrough fields out of struct request V2
On 01/27/2017 09:42 AM, Christoph Hellwig wrote: > On Fri, Jan 27, 2017 at 09:38:40AM -0700, Jens Axboe wrote: >>> Ok, I'll repost what I have right now, which is on top of a merge >>> of your block/for-4.11/next and your for-next from this morning >>> my time. >> >> Perfect. > > At least I tried, looks like the mail server is overloaded and crapped > out three mails into it. For now there is a git tree here: > > http://git.infradead.org/users/hch/block.git/shortlog/refs/heads/block-pc-refactor I grabbed it all from there. for-4.11/rq-refactor has been rebased to v3. Basic testing looks fine here, at least on v2. I'll repeat the same and then merge it into for-next as well. -- Jens Axboe -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 05/18] block: allow specifying size for extra command data
On Fri, 2017-01-27 at 17:12 +0100, Christoph Hellwig wrote: > On Wed, Jan 25, 2017 at 10:15:55PM -0500, Martin K. Petersen wrote: > > +static void *alloc_request_size(gfp_t gfp_mask, void *data) > > > > I like alloc_request_simple() but alloc_request_size() seems a bit > > contrived. _reserve? _extra? _special? Don't have any good suggestions, > > I'm afraid. > > Not that I'm a fan of _size, but I like the other suggestions even less. Hello Christoph and Martin, How about using the function names alloc_full_request() / free_full_request() together with a comment that mentions that cmd_size is set by the LLD? Bart.-- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 11/18] scsi: remove gfp_flags member in scsi_host_cmd_pool
On Wed, 2017-01-25 at 18:25 +0100, Christoph Hellwig wrote: > When using the slab allocator we already decide at cache creation time if > an allocation comes from a GFP_DMA pool using the SLAB_CACHE_DMA flag, > and there is no point passing the kmalloc-family only GFP_DMA flag to > kmem_cache_alloc. Drop all the infrastructure for doing so. Reviewed-by: Bart Van Assche -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [dm-devel] split scsi passthrough fields out of struct request V2
On Fri, 2017-01-27 at 09:56 -0700, Jens Axboe wrote: > I have no idea what this is, I haven't messed with life time or devices > or queues at all in that branch. The srp-test software passes with kernel v4.9. Something must have changed. I'll see whether I can find some time to look further into this. Bart.-- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 12/18] scsi: respect unchecked_isa_dma for blk-mq
On Wed, 2017-01-25 at 18:25 +0100, Christoph Hellwig wrote: > Currently blk-mq always allocates the sense buffer using normal GFP_KERNEL > allocation. Refactor the cmd pool code to split the cmd and sense allocation > and share the code to allocate the sense buffers as well as the sense buffer > slab caches between the legacy and blk-mq path. > > Note that this switches to lazy allocation of the sense slab caches - the > slab caches (not the actual allocations) won't be destroy until the scsi > module is unloaded instead of keeping track of hosts using them. Reviewed-by: Bart Van Assche -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 06/18] dm: remove incomple BLOCK_PC support
On Wed, 2017-01-25 at 18:25 +0100, Christoph Hellwig wrote: > DM tries to copy a few fields around for BLOCK_PC requests, but given > that no dm-target ever wires up scsi_cmd_ioctl BLOCK_PC can't actually > be sent to dm. Reviewed-by: Bart Van Assche -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 13/18] scsi: remove scsi_cmd_dma_pool
On Wed, 2017-01-25 at 18:25 +0100, Christoph Hellwig wrote: > There is no need for GFP_DMA allocations of the scsi_cmnd structures > themselves, all that might be DMAed to or from is the actual payload, > or the sense buffers. Reviewed-by: Bart Van Assche -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 14/18] scsi: remove __scsi_alloc_queue
On Wed, 2017-01-25 at 18:25 +0100, Christoph Hellwig wrote: > diff --git a/include/scsi/scsi_transport.h b/include/scsi/scsi_transport.h > index 8129239..b6e07b5 100644 > --- a/include/scsi/scsi_transport.h > +++ b/include/scsi/scsi_transport.h > @@ -119,4 +119,6 @@ scsi_transport_device_data(struct scsi_device *sdev) > + shost->transportt->device_private_offset; > } > > +void __scsi_init_queue(struct Scsi_Host *shost, struct request_queue *q); > + > #endif /* SCSI_TRANSPORT_H */ Hello Christoph, Since __scsi_init_queue() modifies data in the Scsi_Host structure, have you considered to add the declaration for this function to ? If you want to keep this declaration in please add a direct include of that header file to drivers/scsi/scsi_lib.c such that the declaration remains visible to the compiler if someone would minimize the number of #include directives in SCSI header files. Thanks, Bart.-- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 05/18] block: allow specifying size for extra command data
On Fri, 2017-01-27 at 10:26 -0700, Jens Axboe wrote: > On 01/27/2017 10:21 AM, Bart Van Assche wrote: > > On Fri, 2017-01-27 at 17:12 +0100, Christoph Hellwig wrote: > > > On Wed, Jan 25, 2017 at 10:15:55PM -0500, Martin K. Petersen wrote: > > > > +static void *alloc_request_size(gfp_t gfp_mask, void *data) > > > > > > > > I like alloc_request_simple() but alloc_request_size() seems a bit > > > > contrived. _reserve? _extra? _special? Don't have any good suggestions, > > > > I'm afraid. > > > > > > Not that I'm a fan of _size, but I like the other suggestions even less. > > > > Hello Christoph and Martin, > > > > How about using the function names alloc_full_request() / > > free_full_request() > > together with a comment that mentions that cmd_size is set by the LLD? > > Since we use pdu in other places, how about alloc_request_pdu() or > alloc_request_with_pdu()? > > And since it's all queued up, any bike shedding changes will have to be > incremental. Hello Jens, Other Linux subsystems use the term "private data" instead of PDU. How about modifying the block layer such that it uses the same terminology? I'm referring to function names like blk_mq_rq_from_pdu() and blk_mq_rq_to_pdu() Thanks, Bart.-- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH V2 05/24] aacraid: Retrieve and update the device types
> -Original Message- > From: Johannes Thumshirn [mailto:jthumsh...@suse.de] > Sent: Friday, January 27, 2017 12:08 AM > To: Raghava Aditya Renukunta > > Cc: j...@linux.vnet.ibm.com; martin.peter...@oracle.com; linux- > s...@vger.kernel.org; Dave Carroll ; Gana > Sridaran ; Scott Benesh > > Subject: Re: [PATCH V2 05/24] aacraid: Retrieve and update the device types > > EXTERNAL EMAIL > > > On Thu, Jan 26, 2017 at 09:00:42PM +, Raghava Aditya Renukunta wrote: > > > > > > > -Original Message- > > > From: linux-scsi-ow...@vger.kernel.org [mailto:linux-scsi- > > > ow...@vger.kernel.org] On Behalf Of Raghava Aditya Renukunta > > > Sent: Thursday, January 26, 2017 10:44 AM > > > To: Johannes Thumshirn > > > Cc: j...@linux.vnet.ibm.com; martin.peter...@oracle.com; linux- > > > s...@vger.kernel.org; Dave Carroll ; Gana > > > Sridaran ; Scott Benesh > > > > > > Subject: RE: [PATCH V2 05/24] aacraid: Retrieve and update the device > types > > > > > > EXTERNAL EMAIL > > > > > > > > > > -Original Message- > > > > From: Johannes Thumshirn [mailto:jthumsh...@suse.de] > > > > Sent: Thursday, January 26, 2017 1:00 AM > > > > To: Raghava Aditya Renukunta > > > > > > > > Cc: j...@linux.vnet.ibm.com; martin.peter...@oracle.com; linux- > > > > s...@vger.kernel.org; Dave Carroll ; > Gana > > > > Sridaran ; Scott Benesh > > > > > > > > Subject: Re: [PATCH V2 05/24] aacraid: Retrieve and update the device > > > types > > > > > > > > EXTERNAL EMAIL > > > > > > > > > > > > On Wed, Jan 25, 2017 at 10:00:52AM -0800, Raghava Aditya Renukunta > > > wrote: > > > > > This patch adds support to retrieve the type of each adapter > connected > > > > > device. Applicable to HBA1000 and SmartIOC2000 products > > > > > > > > > > Signed-off-by: Raghava Aditya Renukunta > > > > > > > > > Signed-off-by: Dave Carroll > > > > > > > > > > --- > > > > > > > > [...] > > > > > > > > > /* > > > > > * Adapter Information Block > > > > > * > > > > > @@ -1056,7 +1091,28 @@ struct aac_supplement_adapter_info > > > > > /* StructExpansion == 1 */ > > > > > __le32 FeatureBits3; > > > > > __le32 SupportedPerformanceModes; > > > > > - __le32 ReservedForFutureGrowth[80]; > > > > > + u8 HostBusType;/* uses HOST_BUS_TYPE_xxx > > > > > defines */ > > > > > + u8 HostBusWidth; /* actual width in bits or > > > > > links */ > > > > > + u16 HostBusSpeed; /* actual bus speed/link rate > > > > > in MHz */ > > > > > + u8 MaxRRCDrives; /* max. number of ITP-RRC > > > > > drives/pool > */ > > > > > + u8 MaxDiskXtasks; /* max. possible num of DiskX > > > > > Tasks */ > > > > > + > > > > > + u8 CpldVerLoaded; > > > > > + u8 CpldVerInFlash; > > > > > + > > > > > + __le64 MaxRRCCapacity; > > > > > + __le32 CompiledMaxHistLogLevel; > > > > > + u8 CustomBoardName[12]; > > > > > + u16 SupportedCntlrMode; /* identify supported controller > mode > > > */ > > > > > + u16 ReservedForFuture16; > > > > > + __le32 SupportedOptions3; /* reserved for future options > > > > > */ > > > > > + > > > > > + __le16 VirtDeviceBus; /* virt. SCSI device for Thor */ > > > > > + __le16 VirtDeviceTarget; > > > > > + __le16 VirtDeviceLUN; > > > > > + __le16 Unused; > > > > > + __le32 ReservedForFutureGrowth[68]; > > > > > + > > > > > > Same here. > > > > On second thought changing all of the variables here will open up > > Pandoras box. I will leave them as it is for now and change the whole > > structure and anything attached it in one of my next patch submission > series. > > > > Will that be ok? > > Yes that's something I can live with, *iff* it really happens. I plan to make it happen, in the next set of patches that I send. :) Thank you, Raghava Aditya > > -- > Johannes Thumshirn Storage > jthumsh...@suse.de+49 911 74053 689 > SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg > GF: Felix Imendörffer, Jane Smithard, Graham Norton > HRB 21284 (AG Nürnberg) > Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 15/18] scsi: allocate scsi_cmnd structures as part of struct request
On Wed, 2017-01-25 at 18:25 +0100, Christoph Hellwig wrote: > -unsigned char *scsi_alloc_sense_buffer(struct Scsi_Host *shost, gfp_t > gfp_mask, > - int numa_node) > +static unsigned char *scsi_alloc_sense_buffer(struct Scsi_Host *shost, > + gfp_t gfp_mask, int numa_node) > { > return kmem_cache_alloc_node(scsi_select_sense_cache(shost), gfp_mask, > numa_node); > @@ -697,14 +696,13 @@ static bool scsi_end_request(struct request *req, int > error, > > if (bidi_bytes) > scsi_release_bidi_buffers(cmd); > + scsi_release_buffers(cmd); > + scsi_put_command(cmd); > > spin_lock_irqsave(q->queue_lock, flags); > blk_finish_request(req, error); > spin_unlock_irqrestore(q->queue_lock, flags); > > - scsi_release_buffers(cmd); > - > - scsi_put_command(cmd); > scsi_run_queue(q); > } Hello Christoph, Why have the scsi_release_buffers() and scsi_put_command(cmd) calls been moved up? I haven't found an explanation for this change in the patch description. Please also consider to remove the cmd->request->special = NULL assignments via this patch. Since this patch makes the lifetime of struct scsi_cmnd and struct request identical these assignments are no longer needed. This patch introduces the function scsi_exit_rq(). Having two functions for the single-queue path that release resources (scsi_release_buffers() and scsi_exit_rq()) is confusing. Since every scsi_release_buffers() call is followed by a blk_unprep_request() call, have you considered to move the scsi_release_buffers() call into scsi_unprep_fn() via an additional patch? Thanks, Bart. -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 16/18] block/bsg: move queue creation into bsg_setup_queue
On Wed, 2017-01-25 at 18:25 +0100, Christoph Hellwig wrote: > Simply the boilerplate code needed for bsg nodes a bit. Did you perhaps mean "Simplify"? Anyway, nice work! Reviewed-by: Bart Van Assche -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: split scsi passthrough fields out of struct request V3
On Fri, 2017-01-27 at 17:34 +0100, Christoph Hellwig wrote: > this series splits the support for SCSI passthrough commands from the > main struct request used all over the block layer into a separate > scsi_request structure that drivers that want to support SCSI passthough > need to embedded as the first thing into their request-private data, > similar to how we handle NVMe passthrough commands. > > To support this I've added support for that the private data after > request structure to the legacy request path instead, so that it can > be treated the same way as the blk-mq path. Compare to the current > scsi_cmnd allocator that actually is a major simplification. > > Changes since V2: > - remove req->cmd tracing > - minor spelling fixes > > Changes since V1: > - fix handling of a NULL sense pointer in __scsi_execute > - clean up handling of the flush flags in the block layer and MD > - additional small cleanup in dm-rq Hello Christoph, Version 3 of the patch with title "block: split scsi_request out of struct request" (commit 3c30af6ebe12) differs significantly from v2 of that patch that has been posted on several mailing lists. E.g. v2 moves __cmd[], cmd and cmd_len from struct request into struct scsi_request but v3 not. Which version do you want us to review? Thanks, Bart.-- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] scsi: srp_transport: Fix 'always false comparison' in srp_tmo_valid()
On Fri, 2017-01-27 at 10:06 +, Augusto Mecking Caringi wrote: > On Thu, Jan 26, 2017 at 3:11 PM, Bart Van Assche > wrote: > > This patch is wrong. The purpose of the dev_loss_tmo >= LONG_MAX / HZ check > > is to avoid that the expression 1UL * dev_loss_tmo * HZ further down > > overflows. Can you check whether changing the if-statement into if (1UL * > > dev_loss_tmo >= LONG_MAX / HZ) also suppresses the compiler warning? > > Hi Bart, > > Right, now a I see... > > Doing your proposed change the warning go away... > > Do you want me to send a new patch for that? Hello Augusto, If you want your patch to go upstream you will have to repost it. Bart.-- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 2/2] virtio_scsi: Implement fc_host
- Original Message - > From: "Michael S. Tsirkin" > To: "Fam Zheng" > Cc: linux-ker...@vger.kernel.org, "Paolo Bonzini" , > linux-scsi@vger.kernel.org, "James E.J. > Bottomley" , "Jason Wang" , > "Martin K. Petersen" > , stefa...@redhat.com, > virtualizat...@lists.linux-foundation.org > Sent: Thursday, January 26, 2017 11:06:27 PM > Subject: Re: [PATCH v2 2/2] virtio_scsi: Implement fc_host > > On Thu, Jan 26, 2017 at 11:41:09AM +0800, Fam Zheng wrote: > > This implements the VIRTIO_SCSI_F_FC_HOST feature by reading the config > > fields and presenting them as sysfs fc_host attributes. The config > > change handler is added here because primary_active will toggle during > > migration. > > Looks like there's active discussion on virtio tc mailing list. > It's ok to post patches meanwhile but best as RFC, > and repost after controversy is resolved. Discussion on the TC mailing list was not about the merit of the feature, only about the timing of the vote. Paolo > > > > > Signed-off-by: Fam Zheng > > --- > > drivers/scsi/virtio_scsi.c | 60 > > +- > > 1 file changed, 59 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c > > index ec91bd0..1bb330c 100644 > > --- a/drivers/scsi/virtio_scsi.c > > +++ b/drivers/scsi/virtio_scsi.c > > @@ -28,6 +28,7 @@ > > #include > > #include > > #include > > +#include > > #include > > > > #define VIRTIO_SCSI_MEMPOOL_SZ 64 > > @@ -795,6 +796,15 @@ static struct scsi_host_template > > virtscsi_host_template_multi = { > > .track_queue_depth = 1, > > }; > > > > +static struct fc_function_template virtscsi_fc_template = { > > + .show_host_node_name = 1, > > + .show_host_port_name = 1, > > + .show_host_port_type = 1, > > + .show_host_port_state = 1, > > +}; > > + > > +static struct scsi_transport_template *virtscsi_fc_transport_template; > > + > > #define virtscsi_config_get(vdev, fld) \ > > ({ \ > > typeof(((struct virtio_scsi_config *)0)->fld) __val; \ > > @@ -956,15 +966,42 @@ static int virtscsi_init(struct virtio_device *vdev, > > return err; > > } > > > > +static void virtscsi_update_fc_host_attrs(struct virtio_device *vdev) > > +{ > > + struct Scsi_Host *shost = vdev->priv; > > + u8 node_name[8], port_name[8]; > > + > > + if (virtscsi_config_get(vdev, primary_active)) { > > + virtio_cread_bytes(vdev, > > + offsetof(struct virtio_scsi_config, primary_wwnn), > > + &node_name, 8); > > + virtio_cread_bytes(vdev, > > + offsetof(struct virtio_scsi_config, primary_wwpn), > > + &port_name, 8); > > + } else { > > + virtio_cread_bytes(vdev, > > + offsetof(struct virtio_scsi_config, secondary_wwnn), > > + &node_name, 8); > > + virtio_cread_bytes(vdev, > > + offsetof(struct virtio_scsi_config, secondary_wwpn), > > + &port_name, 8); > > + } > > This is racy, isn't it? You need to wrap this in a generation check > otherwise read can race with primary_active changing. > And you might want a wrapper to virtio_cread_bytes that does not > include generation check. > > > + fc_host_node_name(shost) = wwn_to_u64(node_name); > > + fc_host_port_name(shost) = wwn_to_u64(port_name); > > + fc_host_port_type(shost) = FC_PORTTYPE_NPORT; > > + fc_host_port_state(shost) = FC_PORTSTATE_ONLINE; > > +} > > + > > static int virtscsi_probe(struct virtio_device *vdev) > > { > > - struct Scsi_Host *shost; > > + struct Scsi_Host *shost = NULL; > > struct virtio_scsi *vscsi; > > int err; > > u32 sg_elems, num_targets; > > u32 cmd_per_lun; > > u32 num_queues; > > struct scsi_host_template *hostt; > > + bool fc_host_enabled; > > > > if (!vdev->config->get) { > > dev_err(&vdev->dev, "%s failure: config access disabled\n", > > @@ -987,6 +1024,9 @@ static int virtscsi_probe(struct virtio_device *vdev) > > if (!shost) > > return -ENOMEM; > > > > + fc_host_enabled = virtio_has_feature(vdev, VIRTIO_SCSI_F_FC_HOST); > > + if (fc_host_enabled) > > + shost->transportt = virtscsi_fc_transport_template; > > sg_elems = virtscsi_config_get(vdev, seg_max) ?: 1; > > shost->sg_tablesize = sg_elems; > > vscsi = shost_priv(shost); > > @@ -1032,6 +1072,9 @@ static int virtscsi_probe(struct virtio_device *vdev) > > if (err) > > goto scsi_add_host_failed; > > > > + if (fc_host_enabled) > > + virtscsi_update_fc_host_attrs(vdev); > > + > > virtio_device_ready(vdev); > > > > if (virtio_has_feature(vdev, VIRTIO_SCSI_F_HOTPLUG)) > > @@ -1098,6 +1141,11 @@ static int virtscsi_restore(struct virtio_device > > *vdev) > > } > > #endif > > > > +static void virtscsi_config_changed(struct virtio_device *vdev) > > +{ > > This is called uncon
Re: [PATCH] target: Add WRITE_VERIFY_16 Support
On Fri, 2017-01-27 at 14:49 -0600, Bryant G. Ly wrote: > For clients who want to utilize more than 2GB you need > WRITE AND VERIFY 16 support. Hello Bryant, This patch introduces a bug for WRITE AND VERIFY(16) parsing that already exists for WRITE AND VERIFY(10) parsing, namely that the value of the BYTCHK field is ignored. Is it OK for you to wait a few weeks with adding WRITE AND VERIFY(16) support and to come back to this after I have posted my WRITE AND VERIFY(10) fix? Bart.-- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] target: Add WRITE_VERIFY_16 Support
On Fri, 2017-01-27 at 14:49 -0600, Bryant G. Ly wrote: For clients who want to utilize more than 2GB you need WRITE AND VERIFY 16 support. Hello Bryant, This patch introduces a bug for WRITE AND VERIFY(16) parsing that already exists for WRITE AND VERIFY(10) parsing, namely that the value of the BYTCHK field is ignored. Is it OK for you to wait a few weeks with adding WRITE AND VERIFY(16) support and to come back to this after I have posted my WRITE AND VERIFY(10) fix? Bart. Sounds good, thanks. I'll have to look at your patch sets that fixes that bug. -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: split scsi passthrough fields out of struct request V2
On Wed, 2017-01-25 at 18:25 +0100, Christoph Hellwig wrote: > this series splits the support for SCSI passthrough commands from the > main struct request used all over the block layer into a separate > scsi_request structure that drivers that want to support SCSI passthough > need to embedded as the first thing into their request-private data, > similar to how we handle NVMe passthrough commands. > > To support this I've added support for that the private data after > request structure to the legacy request path instead, so that it can > be treated the same way as the blk-mq path. Compare to the current > scsi_cmnd allocator that actually is a major simplification. > > Changes since V1: > - fix handling of a NULL sense pointer in __scsi_execute > - clean up handling of the flush flags in the block layer and MD > - additional small cleanup in dm-rq Hello Christoph, A general comment: patch "block: allow specifying size for extra command data" is a very welcome improvement but unfortunately also introduces an inconsistency among block drivers. This patch series namely creates two kinds of block drivers: - Block drivers that use the block layer core to allocate request-private data. These block drivers set request.cmd_size to a non-zero value and do not need request.special. - Block drivers that allocate request-private data themselves. These block drivers set request.cmd_size to zero and use request.special to translate a request pointer into the private data pointer. Have you considered to convert all block drivers to the new approach and to get rid of request.special? If so, do you already have plans to start working on this? I'm namely wondering wheter I should start working on this myself. Thanks, Bart.-- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] wd719x: add check for dma mapping errors
wd719x_queuecommand() doesn't check if mapping dma memory succeed. The patch adds the check and failure handling. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov --- drivers/scsi/wd719x.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/scsi/wd719x.c b/drivers/scsi/wd719x.c index 2a9da2e0ea6b..41ddbdcf02e0 100644 --- a/drivers/scsi/wd719x.c +++ b/drivers/scsi/wd719x.c @@ -244,6 +244,12 @@ static int wd719x_queuecommand(struct Scsi_Host *sh, struct scsi_cmnd *cmd) scb->sense_buf_length = SCSI_SENSE_BUFFERSIZE; cmd->SCp.dma_handle = dma_map_single(&wd->pdev->dev, cmd->sense_buffer, SCSI_SENSE_BUFFERSIZE, DMA_FROM_DEVICE); + if (dma_mapping_error(&wd->pdev->dev, cmd->SCp.dma_handle)) { + dev_err(&wd->pdev->dev, "unable to map dma\n"); + wd719x_finish_cmd(cmd, DID_ERROR); + spin_unlock_irqrestore(wd->sh->host_lock, flags); + return 0; + } scb->sense_buf = cpu_to_le32(cmd->SCp.dma_handle); /* request autosense */ -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] wd719x: add check for dma mapping errors
On Sat, 2017-01-28 at 01:30 +0300, Alexey Khoroshilov wrote: > wd719x_queuecommand() doesn't check if mapping dma memory succeed. > The patch adds the check and failure handling. > > Found by Linux Driver Verification project (linuxtesting.org). > > Signed-off-by: Alexey Khoroshilov > --- > drivers/scsi/wd719x.c | 6 ++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/scsi/wd719x.c b/drivers/scsi/wd719x.c > index 2a9da2e0ea6b..41ddbdcf02e0 100644 > --- a/drivers/scsi/wd719x.c > +++ b/drivers/scsi/wd719x.c > @@ -244,6 +244,12 @@ static int wd719x_queuecommand(struct Scsi_Host > *sh, struct scsi_cmnd *cmd) > scb->sense_buf_length = SCSI_SENSE_BUFFERSIZE; > cmd->SCp.dma_handle = dma_map_single(&wd->pdev->dev, cmd > ->sense_buffer, > SCSI_SENSE_BUFFERSIZE, DMA_FROM_DEVICE); > + if (dma_mapping_error(&wd->pdev->dev, cmd->SCp.dma_handle)) > { > + dev_err(&wd->pdev->dev, "unable to map dma\n"); > + wd719x_finish_cmd(cmd, DID_ERROR); > + spin_unlock_irqrestore(wd->sh->host_lock, flags); > + return 0; > + } I'm not at all convinced of the wisdom of doing this for an ancient driver: this thing is presumably x86 and ancient in which case it will never fail anyway. However, for the future, a mapping error is transient, meaning we want the command retried, not errored, so from queuecommand you return SCSI_MLQUEUE_HOST_BUSY to induce a pause and retry. James -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] target: Add WRITE_VERIFY_16 Support
For clients who want to utilize more than 2GB you need WRITE AND VERIFY 16 support. Reported-by: Michael Cyr Signed-off-by: Bryant G. Ly --- drivers/target/target_core_sbc.c | 1 + include/scsi/scsi_proto.h| 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c index 04f616b..e26acf2 100644 --- a/drivers/target/target_core_sbc.c +++ b/drivers/target/target_core_sbc.c @@ -918,6 +918,7 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops) cmd->se_cmd_flags |= SCF_SCSI_DATA_CDB; cmd->execute_cmd = sbc_execute_rw; break; + case WRITE_VERIFY_16: case WRITE_16: sectors = transport_get_sectors_16(cdb); cmd->t_task_lba = transport_lba_64(cdb); diff --git a/include/scsi/scsi_proto.h b/include/scsi/scsi_proto.h index d1defd1..b39c321 100644 --- a/include/scsi/scsi_proto.h +++ b/include/scsi/scsi_proto.h @@ -112,6 +112,7 @@ #define WRITE_16 0x8a #define READ_ATTRIBUTE0x8c #define WRITE_ATTRIBUTE 0x8d +#define WRITE_VERIFY_16 0x8e #define VERIFY_160x8f #define SYNCHRONIZE_CACHE_16 0x91 #define WRITE_SAME_160x93 -- 2.5.4 (Apple Git-61) -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH V3 18/24] aacraid: VPD 83 type3 support
This patch adds support to retrieve the unique identifier data (VPD page 83 type3) for Logical drives created on SmartIOC 2000 products. In addition added a sysfs device structure to expose the id information. Signed-off-by: Raghava Aditya Renukunta Signed-off-by: Dave Carroll --- Changes in V2: None Changes in V3: None drivers/scsi/aacraid/aachba.c | 180 ++--- drivers/scsi/aacraid/aacraid.h | 2 + drivers/scsi/aacraid/linit.c | 31 +++ 3 files changed, 150 insertions(+), 63 deletions(-) diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index c76db95..74b9bb1 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c @@ -167,46 +167,56 @@ struct inquiry_data { }; /* Added for VPD 0x83 */ -typedef struct { - u8 CodeSet:4; /* VPD_CODE_SET */ - u8 Reserved:4; - u8 IdentifierType:4;/* VPD_IDENTIFIER_TYPE */ - u8 Reserved2:4; - u8 Reserved3; - u8 IdentifierLength; - u8 VendId[8]; - u8 ProductId[16]; - u8 SerialNumber[8]; /* SN in ASCII */ - -} TVPD_ID_Descriptor_Type_1; +struct tvpd_id_descriptor_type_1 { + u8 codeset:4; /* VPD_CODE_SET */ + u8 reserved:4; + u8 identifiertype:4;/* VPD_IDENTIFIER_TYPE */ + u8 reserved2:4; + u8 reserved3; + u8 identifierlength; + u8 venid[8]; + u8 productid[16]; + u8 serialnumber[8]; /* SN in ASCII */ -typedef struct { - u8 CodeSet:4; /* VPD_CODE_SET */ - u8 Reserved:4; - u8 IdentifierType:4;/* VPD_IDENTIFIER_TYPE */ - u8 Reserved2:4; - u8 Reserved3; - u8 IdentifierLength; - struct TEU64Id { +}; + +struct tvpd_id_descriptor_type_2 { + u8 codeset:4; /* VPD_CODE_SET */ + u8 reserved:4; + u8 identifiertype:4;/* VPD_IDENTIFIER_TYPE */ + u8 reserved2:4; + u8 reserved3; + u8 identifierlength; + struct teu64id { u32 Serial; /* The serial number supposed to be 40 bits, * bit we only support 32, so make the last byte zero. */ - u8 Reserved; - u8 VendId[3]; - } EU64Id; + u8 reserved; + u8 venid[3]; + } eu64id; -} TVPD_ID_Descriptor_Type_2; +}; -typedef struct { +struct tvpd_id_descriptor_type_3 { + u8 codeset : 4; /* VPD_CODE_SET */ + u8 reserved : 4; + u8 identifiertype : 4; /* VPD_IDENTIFIER_TYPE */ + u8 reserved2 : 4; + u8 reserved3; + u8 identifierlength; + u8 Identifier[16]; +}; + +struct tvpd_page83 { u8 DeviceType:5; u8 DeviceTypeQualifier:3; u8 PageCode; - u8 Reserved; + u8 reserved; u8 PageLength; - TVPD_ID_Descriptor_Type_1 IdDescriptorType1; - TVPD_ID_Descriptor_Type_2 IdDescriptorType2; - -} TVPD_Page83; + struct tvpd_id_descriptor_type_1 type1; + struct tvpd_id_descriptor_type_2 type2; + struct tvpd_id_descriptor_type_3 type3; +}; /* * M O D U L E G L O B A L S @@ -613,6 +623,7 @@ static void _aac_probe_container2(void * context, struct fib * fibptr) struct fsa_dev_info *fsa_dev_ptr; int (*callback)(struct scsi_cmnd *); struct scsi_cmnd * scsicmd = (struct scsi_cmnd *)context; + int i; if (!aac_valid_context(scsicmd, fibptr)) @@ -635,6 +646,10 @@ static void _aac_probe_container2(void * context, struct fib * fibptr) fsa_dev_ptr->block_size = le32_to_cpu(dresp->mnt[0].fileinfo.bdevinfo.block_size); } + for (i = 0; i < 16; i++) + fsa_dev_ptr->identifier[i] = + dresp->mnt[0].fileinfo.bdevinfo + .identifier[i]; fsa_dev_ptr->valid = 1; /* sense_key holds the current state of the spin-up */ if (dresp->mnt[0].state & cpu_to_le32(FSCS_NOT_READY)) @@ -929,6 +944,28 @@ static void setinqstr(struct aac_dev *dev, void *data, int tindex) inqstrcpy ("V1.0", str->prl); } +static void build_vpd83_type3(struct tvpd_page83 *vpdpage83data, + struct aac_dev *dev, struct scsi_cmnd *scsicmd) +{ + int container; + + vpdpage83data->type3.codeset = 1; + vpdpage83data->type3.identifiertype = 3; + vpdpage83data->type3.identifierlength = sizeof(vpdpage83data->type3) + - 4; + + for (container = 0; container < dev->maximum_num_containers; + container++) { + + if (scmd_id(scsicmd) == container) { + memcpy(vpdpage83data->type3.Identifier, + dev->fsa_dev[container].identif
[PATCH V3 03/24] aacraid: added support for init_struct_8
This patch lays the groundwork for supporting the new HBA-1000 controller family.A new INIT structure INIT_STRUCT_8 has been added which allows for a variable size for MSI-x vectors among other things, and is used for both Series-8, HBA-1000 and SmartIOC-2000. Signed-off-by: Raghava Aditya Renukunta Signed-off-by: Dave Carroll --- Changes in V2: None Changes in V3: Removed Camel Case header variable definitions drivers/scsi/aacraid/aachba.c | 8 +- drivers/scsi/aacraid/aacraid.h | 100 +++-- drivers/scsi/aacraid/comminit.c | 239 +--- drivers/scsi/aacraid/commsup.c | 13 ++- drivers/scsi/aacraid/linit.c| 2 +- drivers/scsi/aacraid/rkt.c | 2 +- drivers/scsi/aacraid/rx.c | 4 +- drivers/scsi/aacraid/sa.c | 4 +- drivers/scsi/aacraid/src.c | 27 +++-- 9 files changed, 261 insertions(+), 138 deletions(-) diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index 6678d1f..8a58b96 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c @@ -1144,7 +1144,9 @@ static int aac_read_raw_io(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u3 long ret; aac_fib_init(fib); - if (dev->comm_interface == AAC_COMM_MESSAGE_TYPE2 && !dev->sync_mode) { + if ((dev->comm_interface == AAC_COMM_MESSAGE_TYPE2 || + dev->comm_interface == AAC_COMM_MESSAGE_TYPE3) && + !dev->sync_mode) { struct aac_raw_io2 *readcmd2; readcmd2 = (struct aac_raw_io2 *) fib_data(fib); memset(readcmd2, 0, sizeof(struct aac_raw_io2)); @@ -1270,7 +1272,9 @@ static int aac_write_raw_io(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u long ret; aac_fib_init(fib); - if (dev->comm_interface == AAC_COMM_MESSAGE_TYPE2 && !dev->sync_mode) { + if ((dev->comm_interface == AAC_COMM_MESSAGE_TYPE2 || + dev->comm_interface == AAC_COMM_MESSAGE_TYPE3) && + !dev->sync_mode) { struct aac_raw_io2 *writecmd2; writecmd2 = (struct aac_raw_io2 *) fib_data(fib); memset(writecmd2, 0, sizeof(struct aac_raw_io2)); diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h index 01b457b..f712d8d 100644 --- a/drivers/scsi/aacraid/aacraid.h +++ b/drivers/scsi/aacraid/aacraid.h @@ -82,6 +82,11 @@ enum { #define AAC_DEBUG_INSTRUMENT_AIF_DELETE /* + * Interrupts + */ +#define AAC_MAX_HRRQ 64 + +/* * These macros convert from physical channels to virtual channels */ #define CONTAINER_CHANNEL (0) @@ -491,41 +496,64 @@ enum fib_xfer_state { #define ADAPTER_INIT_STRUCT_REVISION_4 4 // rocket science #define ADAPTER_INIT_STRUCT_REVISION_6 6 /* PMC src */ #define ADAPTER_INIT_STRUCT_REVISION_7 7 /* Denali */ +#define ADAPTER_INIT_STRUCT_REVISION_8 8 // Thor -struct aac_init +union aac_init { - __le32 InitStructRevision; - __le32 Sa_MSIXVectors; - __le32 fsrev; - __le32 CommHeaderAddress; - __le32 FastIoCommAreaAddress; - __le32 AdapterFibsPhysicalAddress; - __le32 AdapterFibsVirtualAddress; - __le32 AdapterFibsSize; - __le32 AdapterFibAlign; - __le32 printfbuf; - __le32 printfbufsiz; - __le32 HostPhysMemPages; /* number of 4k pages of host - physical memory */ - __le32 HostElapsedSeconds; /* number of seconds since 1970. */ - /* -* ADAPTER_INIT_STRUCT_REVISION_4 begins here -*/ - __le32 InitFlags; /* flags for supported features */ + struct _r7 { + __le32 init_struct_revision; + __le32 no_of_msix_vectors; + __le32 fsrev; + __le32 comm_header_address; + __le32 fast_io_comm_area_address; + __le32 adapter_fibs_physical_address; + __le32 adapter_fibs_virtual_address; + __le32 adapter_fibs_size; + __le32 adapter_fib_align; + __le32 printfbuf; + __le32 printfbufsiz; + /* number of 4k pages of host phys. mem. */ + __le32 host_phys_mem_pages; + /* number of seconds since 1970. */ + __le32 host_elapsed_seconds; + /* ADAPTER_INIT_STRUCT_REVISION_4 begins here */ + __le32 init_flags; /* flags for supported features */ #define INITFLAGS_NEW_COMM_SUPPORTED 0x0001 #define INITFLAGS_DRIVER_USES_UTC_TIME 0x0010 #define INITFLAGS_DRIVER_SUPPORTS_PM 0x0020 #define INITFLAGS_NEW_COMM_TYPE1_SUPPORTED 0x0040 #define INITFLAGS_FAST_JBOD_SUPPORTED 0x0080 #define INITFLAGS_NEW_COMM_TYPE2_SUPPORTED 0x0100 - __le32 MaxIoCommands; /* max outstanding commands */ - __le32 MaxIoSize; /* largest I/O co
[PATCH V3 10/24] aacraid: Reworked aac_command_thread
Reworked aac_command_thread into aac_process_events Signed-off-by: Raghava Aditya Renukunta Signed-off-by: Dave Carroll --- Changes in V2: None Changes in V3: None drivers/scsi/aacraid/commsup.c | 411 ++--- 1 file changed, 217 insertions(+), 194 deletions(-) diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c index 4b1177a..346c1c0 100644 --- a/drivers/scsi/aacraid/commsup.c +++ b/drivers/scsi/aacraid/commsup.c @@ -1729,6 +1729,222 @@ int aac_check_health(struct aac_dev * aac) return BlinkLED; } +static void aac_process_events(struct aac_dev *dev) +{ + struct hw_fib *hw_fib, *hw_newfib; + struct fib *fib, *newfib; + struct aac_fib_context *fibctx; + unsigned long flags; + spinlock_t *t_lock; + + spin_lock_irqsave(dev->queues->queue[HostNormCmdQueue].lock, flags); + while (!list_empty(&(dev->queues->queue[HostNormCmdQueue].cmdq))) { + struct list_head *entry; + struct aac_aifcmd *aifcmd; + u32 time_now, time_last; + unsigned long flagv; + unsigned int num; + struct hw_fib **hw_fib_pool, **hw_fib_p; + struct fib **fib_pool, **fib_p; + + set_current_state(TASK_RUNNING); + + entry = dev->queues->queue[HostNormCmdQueue].cmdq.next; + list_del(entry); + + + t_lock = dev->queues->queue[HostNormCmdQueue].lock; + spin_unlock_irqrestore(t_lock, flags); + + fib = list_entry(entry, struct fib, fiblink); + hw_fib = fib->hw_fib_va; + /* +* We will process the FIB here or pass it to a +* worker thread that is TBD. We Really can't +* do anything at this point since we don't have +* anything defined for this thread to do. +*/ + memset(fib, 0, sizeof(struct fib)); + fib->type = FSAFS_NTC_FIB_CONTEXT; + fib->size = sizeof(struct fib); + fib->hw_fib_va = hw_fib; + fib->data = hw_fib->data; + fib->dev = dev; + /* +* We only handle AifRequest fibs from the adapter. +*/ + + aifcmd = (struct aac_aifcmd *) hw_fib->data; + if (aifcmd->command == cpu_to_le32(AifCmdDriverNotify)) { + /* Handle Driver Notify Events */ + aac_handle_aif(dev, fib); + *(__le32 *)hw_fib->data = cpu_to_le32(ST_OK); + aac_fib_adapter_complete(fib, (u16)sizeof(u32)); + continue; + } + /* +* The u32 here is important and intended. We are using +* 32bit wrapping time to fit the adapter field +*/ + + + /* Sniff events */ + if ((aifcmd->command == cpu_to_le32(AifCmdEventNotify)) || + (aifcmd->command == + cpu_to_le32(AifCmdJobProgress))) { + aac_handle_aif(dev, fib); + } + + time_now = jiffies/HZ; + + /* +* Warning: no sleep allowed while +* holding spinlock. We take the estimate +* and pre-allocate a set of fibs outside the +* lock. +*/ + num = le32_to_cpu(dev->init->r7.adapter_fibs_size) + / sizeof(struct hw_fib); /* some extra */ + spin_lock_irqsave(&dev->fib_lock, flagv); + entry = dev->fib_list.next; + while (entry != &dev->fib_list) { + entry = entry->next; + ++num; + } + spin_unlock_irqrestore(&dev->fib_lock, flagv); + hw_fib_pool = kmalloc_array(num, sizeof(struct hw_fib *), + GFP_KERNEL); + fib_pool = kmalloc_array(num, sizeof(struct fib *), + GFP_KERNEL); + if (num && fib_pool && hw_fib_pool) { + hw_fib_p = hw_fib_pool; + fib_p = fib_pool; + while (hw_fib_p < &hw_fib_pool[num]) { + *(hw_fib_p) = kmalloc(sizeof(struct hw_fib), + GFP_KERNEL); + if (!(*(hw_fib_p++))) { + --hw_fib_p; + break; + } + *(fib_p) = kmalloc(sizeof(struct fib), + GFP_KERNEL); + if (!(*(fib_p++))) { +
[PATCH V3 06/24] aacraid: Reworked scsi command submission path
Moved the READ and WRITE switch cases to the top. Added a default case to the switch case and replaced duplicate scsi result value with a macro. Signed-off-by: Raghava Aditya Renukunta Signed-off-by: Dave Carroll --- Changes in V2: None Changes in V3: None drivers/scsi/aacraid/aachba.c | 172 +- 1 file changed, 70 insertions(+), 102 deletions(-) diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index f2ec795..e7456a0 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c @@ -106,6 +106,8 @@ #define ASENCODE_LUN_FAILED_SELF_CONFIG0x00 #define ASENCODE_OVERLAPPED_COMMAND0x00 +#define AAC_STAT_GOOD (DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_GOOD) + #define BYTE0(x) (unsigned char)(x) #define BYTE1(x) (unsigned char)((x) >> 8) #define BYTE2(x) (unsigned char)((x) >> 16) @@ -2476,8 +2478,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) if((cid >= dev->maximum_num_containers) || (scsicmd->device->lun != 0)) { scsicmd->result = DID_NO_CONNECT << 16; - scsicmd->scsi_done(scsicmd); - return 0; + goto scsi_done_ret; } /* @@ -2512,8 +2513,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) return aac_send_srb_fib(scsicmd); } else { scsicmd->result = DID_NO_CONNECT << 16; - scsicmd->scsi_done(scsicmd); - return 0; + goto scsi_done_ret; } } } @@ -2531,13 +2531,34 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) memcpy(scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data, min_t(size_t, sizeof(dev->fsa_dev[cid].sense_data), SCSI_SENSE_BUFFERSIZE)); - scsicmd->scsi_done(scsicmd); - return 0; + goto scsi_done_ret; } - - /* Handle commands here that don't really require going out to the adapter */ switch (scsicmd->cmnd[0]) { + case READ_6: + case READ_10: + case READ_12: + case READ_16: + if (dev->in_reset) + return -1; + return aac_read(scsicmd); + + case WRITE_6: + case WRITE_10: + case WRITE_12: + case WRITE_16: + if (dev->in_reset) + return -1; + return aac_write(scsicmd); + + case SYNCHRONIZE_CACHE: + if (((aac_cache & 6) == 6) && dev->cache_protected) { + scsicmd->result = AAC_STAT_GOOD; + break; + } + /* Issue FIB to tell Firmware to flush it's cache */ + if ((aac_cache & 6) != 2) + return aac_synchronize(scsicmd); case INQUIRY: { struct inquiry_data inq_data; @@ -2560,8 +2581,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) arr[1] = scsicmd->cmnd[2]; scsi_sg_copy_from_buffer(scsicmd, &inq_data, sizeof(inq_data)); - scsicmd->result = DID_OK << 16 | - COMMAND_COMPLETE << 8 | SAM_STAT_GOOD; + scsicmd->result = AAC_STAT_GOOD; } else if (scsicmd->cmnd[2] == 0x80) { /* unit serial number page */ arr[3] = setinqserial(dev, &arr[4], @@ -2572,8 +2592,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) if (aac_wwn != 2) return aac_get_container_serial( scsicmd); - scsicmd->result = DID_OK << 16 | - COMMAND_COMPLETE << 8 | SAM_STAT_GOOD; + scsicmd->result = AAC_STAT_GOOD; } else if (scsicmd->cmnd[2] == 0x83) { /* vpd page 0x83 - Device Identification Page */ char *sno = (char *)&inq_data; @@ -2582,8 +2601,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) if (aac_wwn != 2) return aac_get_container_serial( scsicmd); - scsicmd->result = DID_OK << 16 | - COMMAND_COMPLETE << 8 | SAM_STAT_GOOD; + scsicmd->result
[PATCH V3 02/24] aacraid: Added aacraid.h include guard
Added aacraid.h include guard Signed-off-by: Raghava Aditya Renukunta Signed-off-by: Dave Carroll Reviewed-by: Johannes Thumshirn --- Changes in V2: None Changes in V3: None drivers/scsi/aacraid/aacraid.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h index f059c14..01b457b 100644 --- a/drivers/scsi/aacraid/aacraid.h +++ b/drivers/scsi/aacraid/aacraid.h @@ -1,3 +1,5 @@ +#ifndef _AACRAID_H_ +#define _AACRAID_H_ #ifndef dprintk # define dprintk(x) #endif @@ -2194,3 +2196,4 @@ extern int aac_commit; extern int update_interval; extern int check_interval; extern int aac_check_reset; +#endif -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH V3 00/24] aacraid: Patchset for Smart Family Support
This patchset adds support to the HBA1000 and SMARTIOC2000 family of cards. The driver version is now updated to 50740 Changes in V2: Fixed kbuild test robot warnings Changes in V3: Removed Camel case definitions Misc fixes Raghava Aditya Renukunta (24): [SCSI] aacraid: Remove duplicate irq management code [SCSI] aacraid: Added aacraid.h include guard [SCSI] aacraid: added support for init_struct_8 [SCSI] aacraid: Added sa firmware support [SCSI] aacraid: Retrieve and update the device types [SCSI] aacraid: Reworked scsi command submission path [SCSI] aacraid: Process Error for response I/O [SCSI] aacraid: Added support for response path [SCSI] aacraid: Added support for read medium error [SCSI] aacraid: Reworked aac_command_thread [SCSI] aacraid: Added support for periodic wellness sync [SCSI] aacraid: Retrieve Queue Depth from Adapter FW [SCSI] aacraid: Added support to set QD of attached drives [SCSI] aacraid: Added support for hotplug [SCSI] aacraid: Include HBA direct interface [SCSI] aacraid: Add task management functionality [SCSI] aacraid: Added support to abort cmd and reset lun [SCSI] aacraid: VPD 83 type3 support [SCSI] aacraid: Added new IWBR reset [SCSI] aacraid: Added ioctl to trigger IOP/IWBR reset [SCSI] aacraid: Retrieve HBA host information ioctl [SCSI] aacraid: Update copyrights [SCSI] aacraid: Change Driver Version Prefix [SCSI] aacraid: update version drivers/scsi/aacraid/aachba.c | 1294 +-- drivers/scsi/aacraid/aacraid.h | 648 +--- drivers/scsi/aacraid/commctrl.c | 342 --- drivers/scsi/aacraid/comminit.c | 330 +- drivers/scsi/aacraid/commsup.c | 901 +++ drivers/scsi/aacraid/dpcsup.c | 159 +++-- drivers/scsi/aacraid/linit.c| 556 +++-- drivers/scsi/aacraid/nark.c |3 +- drivers/scsi/aacraid/rkt.c |5 +- drivers/scsi/aacraid/rx.c | 17 +- drivers/scsi/aacraid/sa.c |9 +- drivers/scsi/aacraid/src.c | 336 +++--- 12 files changed, 3390 insertions(+), 1210 deletions(-) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH V3 16/24] aacraid: Add task management functionality
Added support to send out task management commands. Signed-off-by: Raghava Aditya Renukunta Signed-off-by: Dave Carroll --- Changes in V2: Fixed overflow warning Changes in V3: None drivers/scsi/aacraid/aachba.c | 364 +- 1 file changed, 360 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index cc003d1..c76db95 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c @@ -217,9 +217,13 @@ static long aac_build_sg64(struct scsi_cmnd *scsicmd, struct sgmap64 *psg); static long aac_build_sgraw(struct scsi_cmnd *scsicmd, struct sgmapraw *psg); static long aac_build_sgraw2(struct scsi_cmnd *scsicmd, struct aac_raw_io2 *rio2, int sg_max); +static long aac_build_sghba(struct scsi_cmnd *scsicmd, + struct aac_hba_cmd_req *hbacmd, + int sg_max, u64 sg_address); static int aac_convert_sgraw2(struct aac_raw_io2 *rio2, int pages, int nseg, int nseg_new); static int aac_send_srb_fib(struct scsi_cmnd* scsicmd); +static int aac_send_hba_fib(struct scsi_cmnd *scsicmd); #ifdef AAC_DETAILED_STATUS_INFO static char *aac_get_status_string(u32 status); #endif @@ -1446,6 +1450,52 @@ static struct aac_srb * aac_scsi_common(struct fib * fib, struct scsi_cmnd * cmd return srbcmd; } +static struct aac_hba_cmd_req *aac_construct_hbacmd(struct fib *fib, + struct scsi_cmnd *cmd) +{ + struct aac_hba_cmd_req *hbacmd; + struct aac_dev *dev; + int bus, target; + u64 address; + + dev = (struct aac_dev *)cmd->device->host->hostdata; + + hbacmd = (struct aac_hba_cmd_req *)fib->hw_fib_va; + memset(hbacmd, 0, 96); /* sizeof(*hbacmd) is not necessary */ + /* iu_type is a parameter of aac_hba_send */ + switch (cmd->sc_data_direction) { + case DMA_TO_DEVICE: + hbacmd->byte1 = 2; + break; + case DMA_FROM_DEVICE: + case DMA_BIDIRECTIONAL: + hbacmd->byte1 = 1; + break; + case DMA_NONE: + default: + break; + } + hbacmd->lun[1] = cpu_to_le32(cmd->device->lun); + + bus = aac_logical_to_phys(scmd_channel(cmd)); + target = scmd_id(cmd); + hbacmd->it_nexus = dev->hba_map[bus][target].rmw_nexus; + + /* we fill in reply_qid later in aac_src_deliver_message */ + /* we fill in iu_type, request_id later in aac_hba_send */ + /* we fill in emb_data_desc_count later in aac_build_sghba */ + + memcpy(hbacmd->cdb, cmd->cmnd, cmd->cmd_len); + hbacmd->data_length = cpu_to_le32(scsi_bufflen(cmd)); + + address = (u64)fib->hw_error_pa; + hbacmd->error_ptr_hi = cpu_to_le32((u32)(address >> 32)); + hbacmd->error_ptr_lo = cpu_to_le32((u32)(address & 0x)); + hbacmd->error_length = cpu_to_le32(FW_ERROR_BUFFER_SIZE); + + return hbacmd; +} + static void aac_srb_callback(void *context, struct fib * fibptr); static int aac_scsi_64(struct fib * fib, struct scsi_cmnd * cmd) @@ -1516,6 +1566,31 @@ static int aac_scsi_32_64(struct fib * fib, struct scsi_cmnd * cmd) return aac_scsi_32(fib, cmd); } +static int aac_adapter_hba(struct fib *fib, struct scsi_cmnd *cmd) +{ + struct aac_hba_cmd_req *hbacmd = aac_construct_hbacmd(fib, cmd); + struct aac_dev *dev; + // u16 fibsize; + long ret; + + dev = (struct aac_dev *)cmd->device->host->hostdata; + + ret = aac_build_sghba(cmd, hbacmd, + dev->scsi_host_ptr->sg_tablesize, (u64)fib->hw_sgl_pa); + if (ret < 0) + return ret; + + /* +* Now send the HBA command to the adapter +*/ + fib->hbacmd_size = 64 + le32_to_cpu(hbacmd->emb_data_desc_count) * + sizeof(struct aac_hba_sgl); + + return aac_hba_send(HBA_IU_TYPE_SCSI_CMD_REQ, fib, + (fib_callback) aac_hba_callback, + (void *) cmd); +} + int aac_issue_bmic_identify(struct aac_dev *dev, u32 bus, u32 target) { struct fib *fibptr; @@ -1528,6 +1603,7 @@ int aac_issue_bmic_identify(struct aac_dev *dev, u32 bus, u32 target) u32 vbus, vid; u16 temp; + fibptr = aac_fib_alloc(dev); if (!fibptr) return -ENOMEM; @@ -2003,6 +2079,11 @@ int aac_get_adapter_info(struct aac_dev* dev) (dev->scsi_host_ptr->sg_tablesize * 8) + 112; } } + if (!dev->sync_mode && dev->sa_firmware && + dev->scsi_host_ptr->sg_tablesize > HBA_MAX_SG_SEPARATE) + dev->scsi_host_ptr->sg_tablesize = dev->sg_tablesize = + HBA_MAX_SG_SEPARATE; + /* FIB should be freed only after getting the response from th
[PATCH V3 15/24] aacraid: Include HBA direct interface
Added support to send direct pasthru srb commands from management utilty to the controller. Signed-off-by: Raghava Aditya Renukunta Signed-off-by: Dave Carroll --- Changes in V2: None Changes in V3: None drivers/scsi/aacraid/aacraid.h | 175 ++-- drivers/scsi/aacraid/commctrl.c | 294 ++-- drivers/scsi/aacraid/commsup.c | 134 +++--- drivers/scsi/aacraid/dpcsup.c | 136 --- drivers/scsi/aacraid/linit.c| 1 + drivers/scsi/aacraid/src.c | 118 ++-- 6 files changed, 669 insertions(+), 189 deletions(-) diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h index d7d1585..77c4749 100644 --- a/drivers/scsi/aacraid/aacraid.h +++ b/drivers/scsi/aacraid/aacraid.h @@ -86,6 +86,7 @@ enum { #define AAC_MAX_BUSES 5 #define AAC_MAX_TARGETS256 #define AAC_MAX_NATIVE_SIZE2048 +#define FW_ERROR_BUFFER_SIZE 512 /* Thor AIF events */ #define SA_AIF_HOTPLUG (1<<1) @@ -95,6 +96,141 @@ enum { #define SA_AIF_BPSTAT_CHANGE (1<<30) #define SA_AIF_BPCFG_CHANGE(1<<31) +#define HBA_MAX_SG_EMBEDDED28 +#define HBA_MAX_SG_SEPARATE90 +#define HBA_SENSE_DATA_LEN_MAX 32 +#define HBA_REQUEST_TAG_ERROR_FLAG 0x0002 +#define HBA_SGL_FLAGS_EXT 0x8000UL + +struct aac_hba_sgl { + u32 addr_lo; /* Lower 32-bits of SGL element address */ + u32 addr_hi; /* Upper 32-bits of SGL element address */ + u32 len;/* Length of SGL element in bytes */ + u32 flags; /* SGL element flags */ +}; + +enum { + HBA_IU_TYPE_SCSI_CMD_REQ= 0x40, + HBA_IU_TYPE_SCSI_TM_REQ = 0x41, + HBA_IU_TYPE_SATA_REQ= 0x42, + HBA_IU_TYPE_RESP= 0x60, + HBA_IU_TYPE_COALESCED_RESP = 0x61, + HBA_IU_TYPE_INT_COALESCING_CFG_REQ = 0x70 +}; + +enum { + HBA_CMD_BYTE1_DATA_DIR_IN = 0x1, + HBA_CMD_BYTE1_DATA_DIR_OUT = 0x2, + HBA_CMD_BYTE1_DATA_TYPE_DDR = 0x4, + HBA_CMD_BYTE1_CRYPTO_ENABLE = 0x8 +}; + +enum { + HBA_CMD_BYTE1_BITOFF_DATA_DIR_IN= 0x0, + HBA_CMD_BYTE1_BITOFF_DATA_DIR_OUT, + HBA_CMD_BYTE1_BITOFF_DATA_TYPE_DDR, + HBA_CMD_BYTE1_BITOFF_CRYPTO_ENABLE +}; + +enum { + HBA_RESP_DATAPRES_NO_DATA = 0x0, + HBA_RESP_DATAPRES_RESPONSE_DATA, + HBA_RESP_DATAPRES_SENSE_DATA +}; + +enum { + HBA_RESP_SVCRES_TASK_COMPLETE = 0x0, + HBA_RESP_SVCRES_FAILURE, + HBA_RESP_SVCRES_TMF_COMPLETE, + HBA_RESP_SVCRES_TMF_SUCCEEDED, + HBA_RESP_SVCRES_TMF_REJECTED, + HBA_RESP_SVCRES_TMF_LUN_INVALID +}; + +enum { + HBA_RESP_STAT_IO_ERROR = 0x1, + HBA_RESP_STAT_IO_ABORTED, + HBA_RESP_STAT_NO_PATH_TO_DEVICE, + HBA_RESP_STAT_INVALID_DEVICE, + HBA_RESP_STAT_HBAMODE_DISABLED = 0xE, + HBA_RESP_STAT_UNDERRUN = 0x51, + HBA_RESP_STAT_OVERRUN = 0x75 +}; + +struct aac_hba_cmd_req { + u8 iu_type;/* HBA information unit type */ + /* +* byte1: +* [1:0] DIR - 0=No data, 0x1 = IN, 0x2 = OUT +* [2] TYPE - 0=PCI, 1=DDR +* [3] CRYPTO_ENABLE - 0=Crypto disabled, 1=Crypto enabled +*/ + u8 byte1; + u8 reply_qid; /* Host reply queue to post response to */ + u8 reserved1; + __le32 it_nexus; /* Device handle for the request */ + __le32 request_id; /* Sender context */ + /* Lower 32-bits of tweak value for crypto enabled IOs */ + __le32 tweak_value_lo; + u8 cdb[16];/* SCSI CDB of the command */ + u8 lun[8]; /* SCSI LUN of the command */ + + /* Total data length in bytes to be read/written (if any) */ + __le32 data_length; + + /* [2:0] Task Attribute, [6:3] Command Priority */ + u8 attr_prio; + + /* Number of SGL elements embedded in the HBA req */ + u8 emb_data_desc_count; + + __le16 dek_index; /* DEK index for crypto enabled IOs */ + + /* Lower 32-bits of reserved error data target location on the host */ + __le32 error_ptr_lo; + + /* Upper 32-bits of reserved error data target location on the host */ + __le32 error_ptr_hi; + + /* Length of reserved error data area on the host in bytes */ + __le32 error_length; + + /* Upper 32-bits of tweak value for crypto enabled IOs */ + __le32 tweak_value_hi; + + struct aac_hba_sgl sge[HBA_MAX_SG_SEPARATE+2]; /* SG list space */ + + /* +* structure must not exceed +* AAC_MAX_NATIVE_SIZE-FW_ERROR_BUFFER_SIZE
[PATCH V3 07/24] aacraid: Process Error for response I/O
Make sure that the driver processes error conditions even in the fast response path for response from the adapter. Signed-off-by: Raghava Aditya Renukunta Signed-off-by: Dave Carroll Reviewed-by: Johannes Thumshirn --- Changes in V2: None Changes in V3: None drivers/scsi/aacraid/aachba.c | 289 ++ 1 file changed, 151 insertions(+), 138 deletions(-) diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index e7456a0..d848335 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c @@ -3068,16 +3068,11 @@ static void aac_srb_callback(void *context, struct fib * fibptr) return; BUG_ON(fibptr == NULL); - dev = fibptr->dev; - - scsi_dma_unmap(scsicmd); - /* expose physical device if expose_physicald flag is on */ - if (scsicmd->cmnd[0] == INQUIRY && !(scsicmd->cmnd[1] & 0x01) - && expose_physicals > 0) - aac_expose_phy_device(scsicmd); + dev = fibptr->dev; srbreply = (struct aac_srb_reply *) fib_data(fibptr); + scsicmd->sense_buffer[0] = '\0'; /* Initialize sense valid flag to false */ if (fibptr->flags & FIB_CONTEXT_FLAG_FASTRESP) { @@ -3090,158 +3085,176 @@ static void aac_srb_callback(void *context, struct fib * fibptr) */ scsi_set_resid(scsicmd, scsi_bufflen(scsicmd) - le32_to_cpu(srbreply->data_xfer_length)); - /* -* First check the fib status -*/ + } - if (le32_to_cpu(srbreply->status) != ST_OK) { - int len; - printk(KERN_WARNING "aac_srb_callback: srb failed, status = %d\n", le32_to_cpu(srbreply->status)); - len = min_t(u32, le32_to_cpu(srbreply->sense_data_size), - SCSI_SENSE_BUFFERSIZE); - scsicmd->result = DID_ERROR << 16 - | COMMAND_COMPLETE << 8 - | SAM_STAT_CHECK_CONDITION; - memcpy(scsicmd->sense_buffer, - srbreply->sense_data, len); - } + scsi_dma_unmap(scsicmd); - /* -* Next check the srb status -*/ - switch ((le32_to_cpu(srbreply->srb_status))&0x3f) { - case SRB_STATUS_ERROR_RECOVERY: - case SRB_STATUS_PENDING: - case SRB_STATUS_SUCCESS: - scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8; - break; - case SRB_STATUS_DATA_OVERRUN: - switch (scsicmd->cmnd[0]) { - case READ_6: - case WRITE_6: - case READ_10: - case WRITE_10: - case READ_12: - case WRITE_12: - case READ_16: - case WRITE_16: - if (le32_to_cpu(srbreply->data_xfer_length) - < scsicmd->underflow) - printk(KERN_WARNING"aacraid: SCSI CMD underflow\n"); - else - printk(KERN_WARNING"aacraid: SCSI CMD Data Overrun\n"); - scsicmd->result = DID_ERROR << 16 - | COMMAND_COMPLETE << 8; - break; - case INQUIRY: { - scsicmd->result = DID_OK << 16 - | COMMAND_COMPLETE << 8; - break; - } - default: - scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8; - break; - } - break; - case SRB_STATUS_ABORTED: - scsicmd->result = DID_ABORT << 16 | ABORT << 8; - break; - case SRB_STATUS_ABORT_FAILED: - /* -* Not sure about this one - but assuming the -* hba was trying to abort for some reason -*/ - scsicmd->result = DID_ERROR << 16 | ABORT << 8; - break; - case SRB_STATUS_PARITY_ERROR: - scsicmd->result = DID_PARITY << 16 - | MSG_PARITY_ERROR << 8; - break; - case SRB_STATUS_NO_DEVICE: - case SRB_STATUS_INVALID_PATH_ID: - case SRB_STATU
[PATCH V3 21/24] aacraid: Retrieve HBA host information ioctl
Added a new ioctl interface to retrieve the host device information. Signed-off-by: Raghava Aditya Renukunta Signed-off-by: Dave Carroll --- Changes in V2: None Changes in V3: None drivers/scsi/aacraid/aacraid.h | 52 + drivers/scsi/aacraid/commctrl.c | 26 + 2 files changed, 78 insertions(+) diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h index 6b80a63..e14916e 100644 --- a/drivers/scsi/aacraid/aacraid.h +++ b/drivers/scsi/aacraid/aacraid.h @@ -2338,6 +2338,7 @@ struct revision #define FSACTL_GET_CONTAINERS 2131 #define FSACTL_SEND_LARGE_FIB CTL_CODE(2138, METHOD_BUFFERED) #define FSACTL_RESET_IOP CTL_CODE(2140, METHOD_BUFFERED) +#define FSACTL_GET_HBA_INFOCTL_CODE(2150, METHOD_BUFFERED) /* flags defined for IOP & HW SOFT RESET */ #define HW_IOP_RESET 0x01 #define HW_SOFT_RESET 0x02 @@ -2377,6 +2378,57 @@ struct aac_common extern struct aac_common aac_config; /* + * This is for management ioctl purpose only. + */ +struct aac_hba_info { + + u8 DriverName[50]; + u8 AdapterNumber; + u8 SystemIoBusNumber; + u8 DeviceNumber; + u32 FunctionNumber; + u32 VendorID; + u32 DeviceID; + u32 SubVendorID; + u32 SubSystemID; + u32 MappedBaseAddressSize; + u32 BasePhysicalAddress_HighPart; + u32 BasePhysicalAddress_LowPart; + + u32 MaxCommandSize; + u32 MaxFibSize; + u32 MaxScatterGatherFromOs; + u32 MaxScatterGatherToFw; + u32 MaxOutstandingFibs; + + u32 QueueStartThreshold; + u32 QueueDumpThreshold; + u32 MaxIoSizeQueued; + u32 OutstandingIO; + + u32 FirmwareBuildNumber; + u32 BIOSBuildNumber; + u32 DriverBuildNumber; + u32 SerialNumber_HighPart; + u32 SerialNumber_LowPart; + u32 SupportedOptions; + u32 FeatureBits; + u32 currentnumberPorts; + + u8 NewCommInterface:1; + u8 NewCommandsSupported:1; + u8 DisablePassthrough:1; + u8 ExposeNonDasd:1; + u8 QueueAllowed:1; + u8 BLEDCheckEnabled:1; + u8 reserved1:1; + u8 reserted2:1; + + u32 reserved3[10]; + +}; + +/* * The following macro is used when sending and receiving FIBs. It is * only used for debugging. */ diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c index 4b65b91..9ade2b4 100644 --- a/drivers/scsi/aacraid/commctrl.c +++ b/drivers/scsi/aacraid/commctrl.c @@ -1011,6 +1011,29 @@ static int aac_get_pci_info(struct aac_dev* dev, void __user *arg) } return 0; } + +static int aac_get_hba_info(struct aac_dev *dev, void __user *arg) +{ + struct aac_hba_info hbainfo; + + hbainfo.AdapterNumber = (u8) dev->id; + hbainfo.SystemIoBusNumber = dev->pdev->bus->number; + hbainfo.DeviceNumber= (dev->pdev->devfn >> 3); + hbainfo.FunctionNumber = (dev->pdev->devfn & 0x0007); + + hbainfo.VendorID= dev->pdev->vendor; + hbainfo.DeviceID= dev->pdev->device; + hbainfo.SubVendorID = dev->pdev->subsystem_vendor; + hbainfo.SubSystemID = dev->pdev->subsystem_device; + + if (copy_to_user(arg, &hbainfo, sizeof(struct aac_hba_info))) { + dprintk((KERN_DEBUG "aacraid: Could not copy hba info\n")); + return -EFAULT; + } + + return 0; +} + struct aac_reset_iop { u8 reset_type; }; @@ -1070,6 +1093,9 @@ int aac_do_ioctl(struct aac_dev * dev, int cmd, void __user *arg) case FSACTL_GET_PCI_INFO: status = aac_get_pci_info(dev,arg); break; + case FSACTL_GET_HBA_INFO: + status = aac_get_hba_info(dev, arg); + break; case FSACTL_RESET_IOP: status = aac_send_reset_adapter(dev, arg); break; -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH V3 11/24] aacraid: Added support for periodic wellness sync
This patch adds a new functions that periodically sync the time of host to the adapter. In addition also informs the adapter that the driver is alive and kicking. Only applicable to the HBA1000 and SMARTIOC2000. Signed-off-by: Raghava Aditya Renukunta Signed-off-by: Dave Carroll --- Changes in V2: None Changes in V3: None drivers/scsi/aacraid/aacraid.h | 3 + drivers/scsi/aacraid/commsup.c | 176 + 2 files changed, 148 insertions(+), 31 deletions(-) diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h index b54c1bf..05884e6 100644 --- a/drivers/scsi/aacraid/aacraid.h +++ b/drivers/scsi/aacraid/aacraid.h @@ -88,6 +88,9 @@ enum { #define AAC_MAX_NATIVE_SIZE2048 #define CISS_REPORT_PHYSICAL_LUNS 0xc3 +#define WRITE_HOST_WELLNESS0xa5 +#define BMIC_IN0x26 +#define BMIC_OUT 0x27 struct aac_ciss_phys_luns_resp { u8 list_length[4]; /* LUN list length (N-7, big endian) */ diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c index 346c1c0..0c009f1 100644 --- a/drivers/scsi/aacraid/commsup.c +++ b/drivers/scsi/aacraid/commsup.c @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -1946,6 +1947,143 @@ static void aac_process_events(struct aac_dev *dev) flags); } +static int aac_send_wellness_command(struct aac_dev *dev, char *wellness_str, + u32 datasize) +{ + struct aac_srb *srbcmd; + struct sgmap64 *sg64; + dma_addr_t addr; + char *dma_buf; + struct fib *fibptr; + int ret = -ENOMEM; + + fibptr = aac_fib_alloc(dev); + if (fibptr) { + aac_fib_init(fibptr); + + dma_buf = pci_alloc_consistent(dev->pdev, datasize, &addr); + if (dma_buf != NULL) { + u32 vbus, vid; + + vbus = (u32)le16_to_cpu( + dev->supplement_adapter_info.VirtDeviceBus); + vid = (u32)le16_to_cpu( + dev->supplement_adapter_info.VirtDeviceTarget); + + srbcmd = (struct aac_srb *)fib_data(fibptr); + + srbcmd->function = cpu_to_le32(SRBF_ExecuteScsi); + srbcmd->channel = cpu_to_le32(vbus); + srbcmd->id = cpu_to_le32(vid); + srbcmd->lun = 0; + srbcmd->flags = cpu_to_le32(SRB_DataOut); + srbcmd->timeout = cpu_to_le32(10); + srbcmd->retry_limit = 0; + srbcmd->cdb_size = cpu_to_le32(12); + srbcmd->count = cpu_to_le32(datasize); + + memset(srbcmd->cdb, 0, sizeof(srbcmd->cdb)); + srbcmd->cdb[0] = BMIC_OUT; + srbcmd->cdb[6] = WRITE_HOST_WELLNESS; + memcpy(dma_buf, (char *)wellness_str, datasize); + + sg64 = (struct sgmap64 *)&srbcmd->sg; + sg64->count = cpu_to_le32(1); + sg64->sg[0].addr[1] = + cpu_to_le32((u32)(((addr) >> 16) >> 16)); + sg64->sg[0].addr[0] = + cpu_to_le32((u32)(addr & 0x)); + sg64->sg[0].count = cpu_to_le32(datasize); + + ret = aac_fib_send(ScsiPortCommand64, fibptr, + sizeof(struct aac_srb), FsaNormal, + 1, 1, NULL, NULL); + + pci_free_consistent(dev->pdev, datasize, + (void *)dma_buf, addr); + } + + /* +* Do not set XferState to zero unless +* receives a response from F/W +*/ + if (ret >= 0) + aac_fib_complete(fibptr); + + /* +* FIB should be freed only after +* getting the response from the F/W +*/ + if (ret != -ERESTARTSYS) + aac_fib_free(fibptr); + } + + return ret; +} + +int aac_send_hosttime(struct aac_dev *dev, struct timeval *now) +{ + int ret = -ENOMEM; + struct fib *fibptr; + + /* +* This whole block needs to be rewritten with helpers +* Changing tabs to a single space should not be allowed!! +*/ + + if (dev->sa_firmware) { + struct tm cur_tm; + char wellness_str[] = "TD\010\0\0\0\0\0\0\0\0\0DW\0\0ZZ"; + u32 datasize = sizeof(wellness_str); + unsigned long local_time; + + local_time = (u32)(now->tv_sec - (sys_tz.tz_minuteswest * 60)); + t
[PATCH V3 09/24] aacraid: Added support for read medium error
This patch processes Raw IO read medium errors. Signed-off-by: Raghava Aditya Renukunta Signed-off-by: Dave Carroll --- Changes in V2: None Changes in V3: None drivers/scsi/aacraid/aachba.c | 10 ++ drivers/scsi/aacraid/aacraid.h | 1 + 2 files changed, 11 insertions(+) diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index 4bb94a2..e441a54 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c @@ -62,6 +62,7 @@ #define SENCODE_END_OF_DATA0x00 #define SENCODE_BECOMING_READY 0x04 #define SENCODE_INIT_CMD_REQUIRED 0x04 +#define SENCODE_UNRECOVERED_READ_ERROR 0x11 #define SENCODE_PARAM_LIST_LENGTH_ERROR0x1A #define SENCODE_INVALID_COMMAND0x20 #define SENCODE_LBA_OUT_OF_RANGE 0x21 @@ -1997,6 +1998,15 @@ static void io_callback(void *context, struct fib * fibptr) min_t(size_t, sizeof(dev->fsa_dev[cid].sense_data), SCSI_SENSE_BUFFERSIZE)); break; + case ST_MEDERR: + scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | + SAM_STAT_CHECK_CONDITION; + set_sense(&dev->fsa_dev[cid].sense_data, MEDIUM_ERROR, + SENCODE_UNRECOVERED_READ_ERROR, ASENCODE_NO_SENSE, 0, 0); + memcpy(scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data, + min_t(size_t, sizeof(dev->fsa_dev[cid].sense_data), +SCSI_SENSE_BUFFERSIZE)); + break; default: #ifdef AAC_DETAILED_STATUS_INFO printk(KERN_WARNING "io_callback: io failed, status = %d\n", diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h index d1f5a66..b54c1bf 100644 --- a/drivers/scsi/aacraid/aacraid.h +++ b/drivers/scsi/aacraid/aacraid.h @@ -1462,6 +1462,7 @@ struct aac_dev #defineST_IO 5 #defineST_NXIO 6 #defineST_E2BIG7 +#defineST_MEDERR 8 #defineST_ACCES13 #defineST_EXIST17 #defineST_XDEV 18 -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH V3 01/24] aacraid: Remove duplicate irq management code
Removed duplicate code that for acquiring and releasing irqs Signed-off-by: Raghava Aditya Renukunta Signed-off-by: Dave Carroll Reviewed-by: Johannes Thumshirn --- Changes in V2: None Changes in V3: None drivers/scsi/aacraid/linit.c | 58 +++- 1 file changed, 3 insertions(+), 55 deletions(-) diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index 3ecbf20..fd26a2d 100644 --- a/drivers/scsi/aacraid/linit.c +++ b/drivers/scsi/aacraid/linit.c @@ -1327,35 +1327,12 @@ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) static void aac_release_resources(struct aac_dev *aac) { - int i; - aac_adapter_disable_int(aac); - if (aac->pdev->device == PMC_DEVICE_S6 || - aac->pdev->device == PMC_DEVICE_S7 || - aac->pdev->device == PMC_DEVICE_S8 || - aac->pdev->device == PMC_DEVICE_S9) { - if (aac->max_msix > 1) { - for (i = 0; i < aac->max_msix; i++) - free_irq(pci_irq_vector(aac->pdev, i), - &(aac->aac_msix[i])); - } else { - free_irq(aac->pdev->irq, &(aac->aac_msix[0])); - } - } else { - free_irq(aac->pdev->irq, aac); - } - if (aac->msi) - pci_disable_msi(aac->pdev); - else if (aac->max_msix > 1) - pci_disable_msix(aac->pdev); - + aac_free_irq(aac); } static int aac_acquire_resources(struct aac_dev *dev) { - int i, j; - int instance = dev->id; - const char *name = dev->name; unsigned long status; /* * First clear out all interrupts. Then enable the one's that we @@ -1377,37 +1354,8 @@ static int aac_acquire_resources(struct aac_dev *dev) if (dev->msi_enabled) aac_src_access_devreg(dev, AAC_ENABLE_MSIX); - if (!dev->sync_mode && dev->msi_enabled && dev->max_msix > 1) { - for (i = 0; i < dev->max_msix; i++) { - dev->aac_msix[i].vector_no = i; - dev->aac_msix[i].dev = dev; - - if (request_irq(pci_irq_vector(dev->pdev, i), - dev->a_ops.adapter_intr, - 0, "aacraid", &(dev->aac_msix[i]))) { - printk(KERN_ERR "%s%d: Failed to register IRQ for vector %d.\n", - name, instance, i); - for (j = 0 ; j < i ; j++) - free_irq(pci_irq_vector(dev->pdev, j), -&(dev->aac_msix[j])); - pci_disable_msix(dev->pdev); - goto error_iounmap; - } - } - } else { - dev->aac_msix[0].vector_no = 0; - dev->aac_msix[0].dev = dev; - - if (request_irq(dev->pdev->irq, dev->a_ops.adapter_intr, - IRQF_SHARED, "aacraid", - &(dev->aac_msix[0])) < 0) { - if (dev->msi) - pci_disable_msi(dev->pdev); - printk(KERN_ERR "%s%d: Interrupt unavailable.\n", - name, instance); - goto error_iounmap; - } - } + if (aac_acquire_irq(dev)) + goto error_iounmap; aac_adapter_enable_int(dev); -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH V3 20/24] aacraid: Added ioctl to trigger IOP/IWBR reset
Added a new ioctl interface to trigger an IOP or IWBR reset from ioctl. Primary used by management utility to trigger resets. Signed-off-by: Raghava Aditya Renukunta Signed-off-by: Dave Carroll --- Changes in V2: None Changes in V3: None drivers/scsi/aacraid/aacraid.h | 1 + drivers/scsi/aacraid/commctrl.c | 19 +++ 2 files changed, 20 insertions(+) diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h index e2df7a5..6b80a63 100644 --- a/drivers/scsi/aacraid/aacraid.h +++ b/drivers/scsi/aacraid/aacraid.h @@ -2337,6 +2337,7 @@ struct revision #define FSACTL_FORCE_DELETE_DISK CTL_CODE(2120, METHOD_NEITHER) #define FSACTL_GET_CONTAINERS 2131 #define FSACTL_SEND_LARGE_FIB CTL_CODE(2138, METHOD_BUFFERED) +#define FSACTL_RESET_IOP CTL_CODE(2140, METHOD_BUFFERED) /* flags defined for IOP & HW SOFT RESET */ #define HW_IOP_RESET 0x01 #define HW_SOFT_RESET 0x02 diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c index b2af77f..4b65b91 100644 --- a/drivers/scsi/aacraid/commctrl.c +++ b/drivers/scsi/aacraid/commctrl.c @@ -1011,7 +1011,22 @@ static int aac_get_pci_info(struct aac_dev* dev, void __user *arg) } return 0; } +struct aac_reset_iop { + u8 reset_type; +}; + +static int aac_send_reset_adapter(struct aac_dev *dev, void __user *arg) +{ + struct aac_reset_iop reset; + int retval; + if (copy_from_user((void *)&reset, arg, sizeof(struct aac_reset_iop))) + return -EFAULT; + + retval = aac_reset_adapter(dev, 0, reset.reset_type); + return retval; + +} int aac_do_ioctl(struct aac_dev * dev, int cmd, void __user *arg) { @@ -1055,6 +1070,10 @@ int aac_do_ioctl(struct aac_dev * dev, int cmd, void __user *arg) case FSACTL_GET_PCI_INFO: status = aac_get_pci_info(dev,arg); break; + case FSACTL_RESET_IOP: + status = aac_send_reset_adapter(dev, arg); + break; + default: status = -ENOTTY; break; -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH V3 19/24] aacraid: Added new IWBR reset
Added a new IWBR soft reset type, reworked the IOP reset interface for a bit. Signed-off-by: Raghava Aditya Renukunta Signed-off-by: Dave Carroll --- Changes in V2: None Changes in V3: None drivers/scsi/aacraid/aacraid.h | 15 +++-- drivers/scsi/aacraid/commsup.c | 15 +++-- drivers/scsi/aacraid/linit.c | 8 ++- drivers/scsi/aacraid/rx.c | 10 ++-- drivers/scsi/aacraid/sa.c | 2 +- drivers/scsi/aacraid/src.c | 129 ++--- 6 files changed, 127 insertions(+), 52 deletions(-) diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h index 07a60a3..e2df7a5 100644 --- a/drivers/scsi/aacraid/aacraid.h +++ b/drivers/scsi/aacraid/aacraid.h @@ -882,7 +882,7 @@ struct adapter_ops void (*adapter_enable_int)(struct aac_dev *dev); int (*adapter_sync_cmd)(struct aac_dev *dev, u32 command, u32 p1, u32 p2, u32 p3, u32 p4, u32 p5, u32 p6, u32 *status, u32 *r1, u32 *r2, u32 *r3, u32 *r4); int (*adapter_check_health)(struct aac_dev *dev); - int (*adapter_restart)(struct aac_dev *dev, int bled); + int (*adapter_restart)(struct aac_dev *dev, int bled, u8 reset_type); void (*adapter_start)(struct aac_dev *dev); /* Transport operations */ int (*adapter_ioremap)(struct aac_dev * dev, u32 size); @@ -1661,8 +1661,8 @@ struct aac_dev #define aac_adapter_check_health(dev) \ (dev)->a_ops.adapter_check_health(dev) -#define aac_adapter_restart(dev,bled) \ - (dev)->a_ops.adapter_restart(dev,bled) +#define aac_adapter_restart(dev, bled, reset_type) \ + ((dev)->a_ops.adapter_restart(dev, bled, reset_type)) #define aac_adapter_start(dev) \ ((dev)->a_ops.adapter_start(dev)) @@ -2337,6 +2337,13 @@ struct revision #define FSACTL_FORCE_DELETE_DISK CTL_CODE(2120, METHOD_NEITHER) #define FSACTL_GET_CONTAINERS 2131 #define FSACTL_SEND_LARGE_FIB CTL_CODE(2138, METHOD_BUFFERED) +/* flags defined for IOP & HW SOFT RESET */ +#define HW_IOP_RESET 0x01 +#define HW_SOFT_RESET 0x02 +#define IOP_HWSOFT_RESET (HW_IOP_RESET | HW_SOFT_RESET) +/* HW Soft Reset register offset */ +#define IBW_SWR_OFFSET 0x4000 +#define SOFT_RESET_TIME60 struct aac_common @@ -2573,7 +2580,7 @@ unsigned int aac_command_normal(struct aac_queue * q); unsigned int aac_intr_normal(struct aac_dev *dev, u32 Index, int isAif, int isFastResponse, struct hw_fib *aif_fib); -int aac_reset_adapter(struct aac_dev * dev, int forced); +int aac_reset_adapter(struct aac_dev *dev, int forced, u8 reset_type); int aac_check_health(struct aac_dev * dev); int aac_command_thread(void *data); int aac_close_fib_context(struct aac_dev * dev, struct aac_fib_context *fibctx); diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c index 3aac5b1..3a98b1f 100644 --- a/drivers/scsi/aacraid/commsup.c +++ b/drivers/scsi/aacraid/commsup.c @@ -1455,7 +1455,7 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr) } } -static int _aac_reset_adapter(struct aac_dev *aac, int forced) +static int _aac_reset_adapter(struct aac_dev *aac, int forced, u8 reset_type) { int index, quirks; int retval; @@ -1464,6 +1464,7 @@ static int _aac_reset_adapter(struct aac_dev *aac, int forced) struct scsi_cmnd *command; struct scsi_cmnd *command_list; int jafo = 0; + int bled; /* * Assumptions: @@ -1488,7 +1489,8 @@ static int _aac_reset_adapter(struct aac_dev *aac, int forced) * If a positive health, means in a known DEAD PANIC * state and the adapter could be reset to `try again'. */ - retval = aac_adapter_restart(aac, forced ? 0 : aac_adapter_check_health(aac)); + bled = forced ? 0 : aac_adapter_check_health(aac); + retval = aac_adapter_restart(aac, bled, reset_type); if (retval) goto out; @@ -1598,7 +1600,7 @@ static int _aac_reset_adapter(struct aac_dev *aac, int forced) return retval; } -int aac_reset_adapter(struct aac_dev * aac, int forced) +int aac_reset_adapter(struct aac_dev *aac, int forced, u8 reset_type) { unsigned long flagv = 0; int retval; @@ -1651,7 +1653,9 @@ int aac_reset_adapter(struct aac_dev * aac, int forced) if (forced < 2) aac_send_shutdown(aac); spin_lock_irqsave(host->host_lock, flagv); - retval = _aac_reset_adapter(aac, forced ? forced : ((aac_check_reset != 0) && (aac_check_reset != 1))); + retval = _aac_reset_adapter(aac, + forced ? forced : ((aac_check_reset != 0) && + (aac_check_reset != 1)), reset_type); spin_unlock_irqrestore(host->host_lock, flagv); if ((forced < 2) && (retval ==
[PATCH V3 23/24] aacraid: Change Driver Version Prefix
Change the aacraid driver prefix from 1.2-1 to 1.2.1 Signed-off-by: Raghava Aditya Renukunta Signed-off-by: Dave Carroll --- Changes in V2: None Changes in V3: None drivers/scsi/aacraid/linit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index 786776d..5efdd18 100644 --- a/drivers/scsi/aacraid/linit.c +++ b/drivers/scsi/aacraid/linit.c @@ -58,7 +58,7 @@ #include "aacraid.h" -#define AAC_DRIVER_VERSION "1.2-1" +#define AAC_DRIVER_VERSION "1.2.1" #ifndef AAC_DRIVER_BRANCH #define AAC_DRIVER_BRANCH "" #endif -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH V3 24/24] aacraid: update version
Update the driver version to 50740 Signed-off-by: Raghava Aditya Renukunta Signed-off-by: Dave Carroll --- Changes in V2: None Changes in V3: None drivers/scsi/aacraid/aacraid.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h index 3835375..9a3b510 100644 --- a/drivers/scsi/aacraid/aacraid.h +++ b/drivers/scsi/aacraid/aacraid.h @@ -97,8 +97,8 @@ enum { #definePMC_GLOBAL_INT_BIT0 0x0001 #ifndef AAC_DRIVER_BUILD -# define AAC_DRIVER_BUILD 41066 -# define AAC_DRIVER_BRANCH "-ms" +# define AAC_DRIVER_BUILD 50740 +# define AAC_DRIVER_BRANCH "-custom" #endif #define MAXIMUM_NUM_CONTAINERS 32 -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH V3 12/24] aacraid: Retrieve Queue Depth from Adapter FW
Retrieved queue depth from fw and saved it for future use. Only applicable for HBA1000 drives. Signed-off-by: Raghava Aditya Renukunta Signed-off-by: Dave Carroll --- Changes in V2: None Changes in V3: None drivers/scsi/aacraid/aachba.c | 84 - drivers/scsi/aacraid/aacraid.h | 85 +- 2 files changed, 167 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index e441a54..c34686f 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c @@ -1516,6 +1516,83 @@ static int aac_scsi_32_64(struct fib * fib, struct scsi_cmnd * cmd) return aac_scsi_32(fib, cmd); } +int aac_issue_bmic_identify(struct aac_dev *dev, u32 bus, u32 target) +{ + struct fib *fibptr; + int rcode = -1; + u16 fibsize, datasize; + struct aac_srb *srbcmd; + struct sgmap64 *sg64; + struct aac_ciss_identify_pd *identify_resp; + dma_addr_t addr; + u32 vbus, vid; + u16 temp; + + fibptr = aac_fib_alloc(dev); + if (!fibptr) + return -ENOMEM; + + temp = AAC_MAX_LUN + target; + + fibsize = sizeof(struct aac_srb) - + sizeof(struct sgentry) + sizeof(struct sgentry64); + datasize = sizeof(struct aac_ciss_identify_pd); + + identify_resp = (struct aac_ciss_identify_pd *) + pci_alloc_consistent(dev->pdev, datasize, &addr); + + if (identify_resp != NULL) { + vbus = (u32)le16_to_cpu( + dev->supplement_adapter_info.VirtDeviceBus); + vid = (u32)le16_to_cpu( + dev->supplement_adapter_info.VirtDeviceTarget); + + aac_fib_init(fibptr); + srbcmd = (struct aac_srb *) fib_data(fibptr); + + srbcmd->function = cpu_to_le32(SRBF_ExecuteScsi); + srbcmd->channel = cpu_to_le32(vbus); + srbcmd->id = cpu_to_le32(vid); + srbcmd->lun = 0; + srbcmd->flags= cpu_to_le32(SRB_DataIn); + srbcmd->timeout = cpu_to_le32(10); + srbcmd->retry_limit = 0; + srbcmd->cdb_size = cpu_to_le32(12); + srbcmd->count = cpu_to_le32(datasize); + + memset(srbcmd->cdb, 0, sizeof(srbcmd->cdb)); + srbcmd->cdb[0] = 0x26; + srbcmd->cdb[2] = (u8)(temp & 0x00FF); + + srbcmd->cdb[6] = CISS_IDENTIFY_PHYSICAL_DEVICE; + + sg64 = (struct sgmap64 *)&srbcmd->sg; + sg64->count = cpu_to_le32(1); + sg64->sg[0].addr[1] = cpu_to_le32((u32)(((addr) >> 16) >> 16)); + sg64->sg[0].addr[0] = cpu_to_le32((u32)(addr & 0x)); + sg64->sg[0].count = cpu_to_le32(datasize); + + rcode = aac_fib_send(ScsiPortCommand64, + fibptr, fibsize, FsaNormal, 1, 1, NULL, NULL); + + if (identify_resp->current_queue_depth_limit <= 0 || + identify_resp->current_queue_depth_limit > 32) + dev->hba_map[bus][target].qd_limit = 32; + else + dev->hba_map[bus][target].qd_limit = + identify_resp->current_queue_depth_limit; + + pci_free_consistent(dev->pdev, datasize, + (void *)identify_resp, addr); + + aac_fib_complete(fibptr); + } + + aac_fib_free(fibptr); + + return rcode; +} + /** * aac_update hba_map()- update current hba map with data from FW * @dev: aac_dev structure @@ -1565,6 +1642,9 @@ void aac_update_hba_map(struct aac_dev *dev, if (devtype != AAC_DEVTYPE_NATIVE_RAW) goto update_devtype; + if (aac_issue_bmic_identify(dev, bus, target) < 0) + dev->hba_map[bus][target].qd_limit = 32; + update_devtype: dev->hba_map[bus][target].devtype = devtype; } @@ -1711,8 +1791,10 @@ int aac_get_adapter_info(struct aac_dev* dev) /* reset all previous mapped devices (i.e. for init. after IOP_RESET) */ for (bus = 0; bus < AAC_MAX_BUSES; bus++) { - for (target = 0; target < AAC_MAX_TARGETS; target++) + for (target = 0; target < AAC_MAX_TARGETS; target++) { dev->hba_map[bus][target].devtype = 0; + dev->hba_map[bus][target].qd_limit = 0; + } } /* diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h index 05884e6..e541394 100644 --- a/drivers/scsi/aacraid/aacraid.h +++ b/drivers/scsi/aacraid/aacraid.h @@ -74,7 +74,7 @@ enum { #define AAC_NUM_IO_FIB (1024 - AAC_NUM_MGT_FIB) #define AAC_NUM_FIB(AAC_NUM_IO_FIB + AAC_NUM_MGT_FIB) -#define AAC_MAX_LUN(8) +#def
[PATCH V3 13/24] aacraid: Added support to set QD of attached drives
Added support to set qd of drives in slave_configure.This only works for HBA1000 attached drives. Signed-off-by: Raghava Aditya Renukunta Signed-off-by: Dave Carroll --- Changes in V2: None Changes in V3: None drivers/scsi/aacraid/linit.c | 100 --- 1 file changed, 66 insertions(+), 34 deletions(-) diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index 1912e7b..77d07b7 100644 --- a/drivers/scsi/aacraid/linit.c +++ b/drivers/scsi/aacraid/linit.c @@ -401,20 +401,33 @@ static int aac_biosparm(struct scsi_device *sdev, struct block_device *bdev, static int aac_slave_configure(struct scsi_device *sdev) { struct aac_dev *aac = (struct aac_dev *)sdev->host->hostdata; - if (aac->jbod && (sdev->type == TYPE_DISK)) - sdev->removable = 1; - if ((sdev->type == TYPE_DISK) && + int chn, tid, is_native_device = 0; + + chn = aac_logical_to_phys(sdev_channel(sdev)); + tid = sdev_id(sdev); + if (chn < AAC_MAX_BUSES && tid < AAC_MAX_TARGETS && + aac->hba_map[chn][tid].devtype == AAC_DEVTYPE_NATIVE_RAW) + is_native_device = 1; + + + if (!is_native_device) { + if (aac->jbod && (sdev->type == TYPE_DISK)) + sdev->removable = 1; + if ((sdev->type == TYPE_DISK) && (sdev_channel(sdev) != CONTAINER_CHANNEL) && (!aac->jbod || sdev->inq_periph_qual) && (!aac->raid_scsi_mode || (sdev_channel(sdev) != 2))) { - if (expose_physicals == 0) - return -ENXIO; - if (expose_physicals < 0) - sdev->no_uld_attach = 1; + if (expose_physicals == 0) + return -ENXIO; + if (expose_physicals < 0) + sdev->no_uld_attach = 1; + } } - if (sdev->tagged_supported && (sdev->type == TYPE_DISK) && + + if (is_native_device || + (sdev->tagged_supported && (sdev->type == TYPE_DISK) && (!aac->raid_scsi_mode || (sdev_channel(sdev) != 2)) && - !sdev->no_uld_attach) { + !sdev->no_uld_attach)) { struct scsi_device * dev; struct Scsi_Host *host = sdev->host; unsigned num_lsu = 0; @@ -428,34 +441,41 @@ static int aac_slave_configure(struct scsi_device *sdev) */ if (sdev->request_queue->rq_timeout < (45 * HZ)) blk_queue_rq_timeout(sdev->request_queue, 45*HZ); - for (cid = 0; cid < aac->maximum_num_containers; ++cid) - if (aac->fsa_dev[cid].valid) - ++num_lsu; - __shost_for_each_device(dev, host) { - if (dev->tagged_supported && (dev->type == TYPE_DISK) && + if (!is_native_device) { + for (cid = 0; cid < aac->maximum_num_containers; ++cid) + if (aac->fsa_dev[cid].valid) + ++num_lsu; + __shost_for_each_device(dev, host) { + if (dev->tagged_supported && + (dev->type == TYPE_DISK) && (!aac->raid_scsi_mode || - (sdev_channel(sdev) != 2)) && + (sdev_channel(sdev) != 2)) && !dev->no_uld_attach) { - if ((sdev_channel(dev) != CONTAINER_CHANNEL) -|| !aac->fsa_dev[sdev_id(dev)].valid) - ++num_lsu; - } else - ++num_one; + if ((sdev_channel(dev) + != CONTAINER_CHANNEL) +|| !aac->fsa_dev[sdev_id(dev)].valid) { + ++num_lsu; + } + } else { + ++num_one; + } + } + if (num_lsu == 0) + ++num_lsu; + depth = (host->can_queue - num_one) / num_lsu; + if (depth > 256) + depth = 256; + else if (depth < 2) + depth = 2; + scsi_change_queue_depth(sdev, depth); + } else { + scsi_change_queue_depth(sdev, + aac->hba_map[chn][tid].qd_limit);
[PATCH V3 04/24] aacraid: Added sa firmware support
sa_firmware adds the capability to differentiate the new SmartIOC family of adapters from the series 8 and below. Signed-off-by: Raghava Aditya Renukunta Signed-off-by: Dave Carroll --- Changes in V2: None Changes in V3: Removed unnecessary brackets drivers/scsi/aacraid/aacraid.h | 4 ++ drivers/scsi/aacraid/comminit.c | 98 + drivers/scsi/aacraid/linit.c| 2 +- 3 files changed, 45 insertions(+), 59 deletions(-) diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h index f712d8d..1069c01 100644 --- a/drivers/scsi/aacraid/aacraid.h +++ b/drivers/scsi/aacraid/aacraid.h @@ -1130,6 +1130,7 @@ struct aac_bus_info_response { #define AAC_OPT_SUPPLEMENT_ADAPTER_INFOcpu_to_le32(1<<16) #define AAC_OPT_NEW_COMM cpu_to_le32(1<<17) #define AAC_OPT_NEW_COMM_64cpu_to_le32(1<<18) +#define AAC_OPT_EXTENDED cpu_to_le32(1<<23) #define AAC_OPT_NEW_COMM_TYPE1 cpu_to_le32(1<<28) #define AAC_OPT_NEW_COMM_TYPE2 cpu_to_le32(1<<29) #define AAC_OPT_NEW_COMM_TYPE3 cpu_to_le32(1<<30) @@ -1141,6 +1142,8 @@ struct aac_bus_info_response { #define AAC_COMM_MESSAGE_TYPE2 4 #define AAC_COMM_MESSAGE_TYPE3 5 +#define AAC_EXTOPT_SA_FIRMWARE cpu_to_le32(1<<1) + /* MSIX context */ struct aac_msix_ctx { int vector_no; @@ -1272,6 +1275,7 @@ struct aac_dev u8 printf_enabled; u8 in_reset; u8 msi; + u8 sa_firmware; int management_fib_count; spinlock_t manage_lock; spinlock_t sync_lock; diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c index 480ff01..5aad018 100644 --- a/drivers/scsi/aacraid/comminit.c +++ b/drivers/scsi/aacraid/comminit.c @@ -75,14 +75,22 @@ static int aac_alloc_comm(struct aac_dev *dev, void **commaddr, unsigned long co if ((dev->comm_interface == AAC_COMM_MESSAGE_TYPE1) || (dev->comm_interface == AAC_COMM_MESSAGE_TYPE2) || - (dev->comm_interface == AAC_COMM_MESSAGE_TYPE3)) + (dev->comm_interface == AAC_COMM_MESSAGE_TYPE3 && + !dev->sa_firmware)) { host_rrq_size = (dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB) * sizeof(u32); - else + aac_init_size = sizeof(union aac_init); + } else if (dev->comm_interface == AAC_COMM_MESSAGE_TYPE3 && + dev->sa_firmware) { + host_rrq_size = (dev->scsi_host_ptr->can_queue + + AAC_NUM_MGT_FIB) * sizeof(u32) * AAC_MAX_MSIX; + aac_init_size = sizeof(union aac_init) + + (AAC_MAX_HRRQ - 1) * sizeof(struct _rrq); + } else { host_rrq_size = 0; - - aac_init_size = sizeof(union aac_init); + aac_init_size = sizeof(union aac_init); + } size = fibsize + aac_init_size + commsize + commalign + printfbufsiz + host_rrq_size; @@ -466,9 +474,13 @@ void aac_define_int_mode(struct aac_dev *dev) if (dev->max_msix > msi_count) dev->max_msix = msi_count; } - dev->vector_cap = - (dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB) / - msi_count; + if (dev->comm_interface == AAC_COMM_MESSAGE_TYPE3 && dev->sa_firmware) + dev->vector_cap = dev->scsi_host_ptr->can_queue + + AAC_NUM_MGT_FIB; + else + dev->vector_cap = (dev->scsi_host_ptr->can_queue + + AAC_NUM_MGT_FIB) / msi_count; + } struct aac_dev *aac_init_adapter(struct aac_dev *dev) { @@ -527,6 +539,12 @@ struct aac_dev *aac_init_adapter(struct aac_dev *dev) dev->sync_mode = 1; } } + if ((status[1] & le32_to_cpu(AAC_OPT_EXTENDED)) && + (status[4] & le32_to_cpu(AAC_EXTOPT_SA_FIRMWARE))) + dev->sa_firmware = 1; + else + dev->sa_firmware = 0; + if ((dev->comm_interface == AAC_COMM_MESSAGE) && (status[2] > dev->base_size)) { aac_adapter_ioremap(dev, 0); @@ -563,61 +581,25 @@ struct aac_dev *aac_init_adapter(struct aac_dev *dev) dev->sg_tablesize = status[2] & 0x; if (dev->pdev->device == PMC_DEVICE_S7 || dev->pdev->device == PMC_DEVICE_S8 || - dev->pdev->device == PMC_DEVICE_S9) - host->can_queue = ((status[3] >> 16) ? (status[3] >> 16) : - (status[3] & 0x)) - AAC_NUM_MGT_FIB; - else -
[PATCH V3 17/24] aacraid: Added support to abort cmd and reset lun
Added task management command support to abort any timed out commands in case of a eh_abort call and to reset lun's in case of eh_reset call. Signed-off-by: Raghava Aditya Renukunta Signed-off-by: Dave Carroll --- Changes in V2: Fixed freeing of initialized address Changes in V3: None drivers/scsi/aacraid/aacraid.h | 48 ++ drivers/scsi/aacraid/linit.c | 351 +++-- drivers/scsi/aacraid/src.c | 33 +++- 3 files changed, 345 insertions(+), 87 deletions(-) diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h index 77c4749..4b32ff1 100644 --- a/drivers/scsi/aacraid/aacraid.h +++ b/drivers/scsi/aacraid/aacraid.h @@ -206,6 +206,53 @@ struct aac_hba_cmd_req { */ }; +/* Task Management Functions (TMF) */ +#define HBA_TMF_ABORT_TASK 0x01 +#define HBA_TMF_LUN_RESET 0x08 + +struct aac_hba_tm_req { + u8 iu_type;/* HBA information unit type */ + u8 reply_qid; /* Host reply queue to post response to */ + u8 tmf;/* Task management function */ + u8 reserved1; + + __le32 it_nexus; /* Device handle for the command */ + + u8 lun[8]; /* SCSI LUN */ + + /* Used to hold sender context. */ + __le32 request_id; /* Sender context */ + __le32 reserved2; + + /* Request identifier of managed task */ + __le32 managed_request_id; /* Sender context being managed */ + __le32 reserved3; + + /* Lower 32-bits of reserved error data target location on the host */ + __le32 error_ptr_lo; + /* Upper 32-bits of reserved error data target location on the host */ + __le32 error_ptr_hi; + /* Length of reserved error data area on the host in bytes */ + __le32 error_length; +}; + +struct aac_hba_reset_req { + u8 iu_type;/* HBA information unit type */ + /* 0 - reset specified device, 1 - reset all devices */ + u8 reset_type; + u8 reply_qid; /* Host reply queue to post response to */ + u8 reserved1; + + __le32 it_nexus; /* Device handle for the command */ + __le32 request_id; /* Sender context */ + /* Lower 32-bits of reserved error data target location on the host */ + __le32 error_ptr_lo; + /* Upper 32-bits of reserved error data target location on the host */ + __le32 error_ptr_hi; + /* Length of reserved error data area on the host in bytes */ + __le32 error_length; +}; + struct aac_hba_resp { u8 iu_type;/* HBA information unit type */ u8 reserved1[3]; @@ -223,6 +270,7 @@ struct aac_hba_resp { struct aac_native_hba { union { struct aac_hba_cmd_req cmd; + struct aac_hba_tm_req tmr; u8 cmd_bytes[AAC_MAX_NATIVE_SIZE-FW_ERROR_BUFFER_SIZE]; } cmd; union { diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index 202ed34..9740a05 100644 --- a/drivers/scsi/aacraid/linit.c +++ b/drivers/scsi/aacraid/linit.c @@ -566,46 +566,136 @@ static int aac_eh_abort(struct scsi_cmnd* cmd) struct scsi_device * dev = cmd->device; struct Scsi_Host * host = dev->host; struct aac_dev * aac = (struct aac_dev *)host->hostdata; - int count; + int count, found; + u32 bus, cid; int ret = FAILED; - printk(KERN_ERR "%s: Host adapter abort request (%d,%d,%d,%llu)\n", - AAC_DRIVERNAME, - host->host_no, sdev_channel(dev), sdev_id(dev), dev->lun); - switch (cmd->cmnd[0]) { - case SERVICE_ACTION_IN_16: - if (!(aac->raw_io_interface) || - !(aac->raw_io_64) || - ((cmd->cmnd[1] & 0x1f) != SAI_READ_CAPACITY_16)) - break; - case INQUIRY: - case READ_CAPACITY: - /* Mark associated FIB to not complete, eh handler does this */ + bus = aac_logical_to_phys(scmd_channel(cmd)); + cid = scmd_id(cmd); + if (aac->hba_map[bus][cid].devtype == AAC_DEVTYPE_NATIVE_RAW) { + struct fib *fib; + struct aac_hba_tm_req *tmf; + int status; + u64 address; + __le32 managed_request_id; + + pr_err("%s: Host adapter abort request (%d,%d,%d,%d)\n", +AAC_DRIVERNAME, +host->host_no, sdev_channel(dev), sdev_id(dev), (int)dev->lun); + + found = 0; for (count = 0; count < (host->can_queue + AAC_NUM_MGT_FIB); ++count) { - struct fib * fib = &aac->fibs[count]; - if (fib->hw_fib_va->header.XferState && - (fib->flags & FIB_CONTEXT_FLAG) && - (fib->callback_data == cmd)) { - fib->flags |= FIB_CONTEXT_FLAG_TIME
[PATCH V3 14/24] aacraid: Added support for hotplug
Added support for drive hotplug add and removal Signed-off-by: Raghava Aditya Renukunta Signed-off-by: Dave Carroll --- Changes in V2: None Changes in V2: None drivers/scsi/aacraid/aachba.c | 13 ++-- drivers/scsi/aacraid/aacraid.h | 17 +- drivers/scsi/aacraid/commsup.c | 136 + 3 files changed, 159 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index c34686f..cc003d1 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c @@ -1601,7 +1601,7 @@ int aac_issue_bmic_identify(struct aac_dev *dev, u32 bus, u32 target) * Update our hba map with the information gathered from the FW */ void aac_update_hba_map(struct aac_dev *dev, - struct aac_ciss_phys_luns_resp *phys_luns) + struct aac_ciss_phys_luns_resp *phys_luns, int rescan) { /* ok and extended reporting */ u32 lun_count, nexus; @@ -1646,7 +1646,10 @@ void aac_update_hba_map(struct aac_dev *dev, dev->hba_map[bus][target].qd_limit = 32; update_devtype: - dev->hba_map[bus][target].devtype = devtype; + if (rescan == AAC_INIT) + dev->hba_map[bus][target].devtype = devtype; + else + dev->hba_map[bus][target].new_devtype = devtype; } } @@ -1658,7 +1661,7 @@ void aac_update_hba_map(struct aac_dev *dev, * Execute a CISS REPORT PHYS LUNS and process the results into * the current hba_map. */ -int aac_report_phys_luns(struct aac_dev *dev, struct fib *fibptr) +int aac_report_phys_luns(struct aac_dev *dev, struct fib *fibptr, int rescan) { int fibsize, datasize; struct aac_ciss_phys_luns_resp *phys_luns; @@ -1718,7 +1721,7 @@ int aac_report_phys_luns(struct aac_dev *dev, struct fib *fibptr) /* analyse data */ if (rcode >= 0 && phys_luns->resp_flag == 2) { /* ok and extended reporting */ - aac_update_hba_map(dev, phys_luns); + aac_update_hba_map(dev, phys_luns, rescan); } pci_free_consistent(dev->pdev, datasize, (void *) phys_luns, addr); @@ -1831,7 +1834,7 @@ int aac_get_adapter_info(struct aac_dev* dev) if (!dev->sync_mode && dev->sa_firmware && dev->supplement_adapter_info.VirtDeviceBus != 0x) { /* Thor SA Firmware -> CISS_REPORT_PHYSICAL_LUNS */ - rcode = aac_report_phys_luns(dev, fibptr); + rcode = aac_report_phys_luns(dev, fibptr, AAC_INIT); } if (!dev->in_reset) { diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h index e541394..d7d1585 100644 --- a/drivers/scsi/aacraid/aacraid.h +++ b/drivers/scsi/aacraid/aacraid.h @@ -74,7 +74,7 @@ enum { #define AAC_NUM_IO_FIB (1024 - AAC_NUM_MGT_FIB) #define AAC_NUM_FIB(AAC_NUM_IO_FIB + AAC_NUM_MGT_FIB) -#define AAC_MAX_LUN(256) +#define AAC_MAX_LUN256 #define AAC_MAX_HOSTPHYSMEMPAGES (0xf) #define AAC_MAX_32BIT_SGBCOUNT ((unsigned short)256) @@ -87,6 +87,14 @@ enum { #define AAC_MAX_TARGETS256 #define AAC_MAX_NATIVE_SIZE2048 +/* Thor AIF events */ +#define SA_AIF_HOTPLUG (1<<1) +#define SA_AIF_HARDWARE(1<<2) +#define SA_AIF_PDEV_CHANGE (1<<4) +#define SA_AIF_LDEV_CHANGE (1<<5) +#define SA_AIF_BPSTAT_CHANGE (1<<30) +#define SA_AIF_BPCFG_CHANGE(1<<31) + #define CISS_REPORT_PHYSICAL_LUNS 0xc3 #define WRITE_HOST_WELLNESS0xa5 #define CISS_IDENTIFY_PHYSICAL_DEVICE 0x15 @@ -198,6 +206,7 @@ struct aac_ciss_identify_pd { #define CONTAINER_TO_CHANNEL(cont) (CONTAINER_CHANNEL) #define CONTAINER_TO_ID(cont) (cont) #define CONTAINER_TO_LUN(cont) (0) +#define ENCLOSURE_CHANNEL (3) #define PMC_DEVICE_S6 0x28b #define PMC_DEVICE_S7 0x28c @@ -1102,6 +,9 @@ struct fib { u32 hbacmd_size;/* cmd size for native */ }; +#define AAC_INIT 0 +#define AAC_RESCAN 1 + #define AAC_DEVTYPE_RAID_MEMBER1 #define AAC_DEVTYPE_ARC_RAW2 #define AAC_DEVTYPE_NATIVE_RAW 3 @@ -,6 +1123,7 @@ struct fib { struct aac_hba_map_info { __le32 rmw_nexus; /* nexus for native HBA devices */ u8 devtype;/* device type */ + u8 new_devtype; u8 reset_state;/* 0 - no reset, 1..x - */ /* after xth TM LUN reset */ u16 qd_limit; @@ -2321,7 +2334,7 @@ static inline unsigned int cap_to_cyls(sector_t capacity, unsigned divisor) int aac_acquire_irq(struct aac_dev *dev); void aac_free_irq(struct aac_dev *dev); -int aac_report_phys_luns(struct aac_dev
[PATCH V3 05/24] aacraid: Retrieve and update the device types
This patch adds support to retrieve the type of each adapter connected device. Applicable to HBA1000 and SmartIOC2000 products Signed-off-by: Raghava Aditya Renukunta Signed-off-by: Dave Carroll Reviewed-by: Johannes Thumshirn --- Changes in V2: Fixed uninitialized return value Changes in V3: None drivers/scsi/aacraid/aachba.c | 144 - drivers/scsi/aacraid/aacraid.h | 60 - 2 files changed, 202 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index 8a58b96..f2ec795 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c @@ -1509,11 +1509,141 @@ static int aac_scsi_32_64(struct fib * fib, struct scsi_cmnd * cmd) return aac_scsi_32(fib, cmd); } +/** + * aac_update hba_map()- update current hba map with data from FW + * @dev: aac_dev structure + * @phys_luns: FW information from report phys luns + * + * Update our hba map with the information gathered from the FW + */ +void aac_update_hba_map(struct aac_dev *dev, + struct aac_ciss_phys_luns_resp *phys_luns) +{ + /* ok and extended reporting */ + u32 lun_count, nexus; + u32 i, bus, target; + u8 expose_flag, attribs; + u8 devtype; + + lun_count = ((phys_luns->list_length[0] << 24) + + (phys_luns->list_length[1] << 16) + + (phys_luns->list_length[2] << 8) + + (phys_luns->list_length[3])) / 24; + + for (i = 0; i < lun_count; ++i) { + + bus = phys_luns->lun[i].level2[1] & 0x3f; + target = phys_luns->lun[i].level2[0]; + expose_flag = phys_luns->lun[i].bus >> 6; + attribs = phys_luns->lun[i].node_ident[9]; + nexus = *((u32 *) &phys_luns->lun[i].node_ident[12]); + + if (bus >= AAC_MAX_BUSES || target >= AAC_MAX_TARGETS) + continue; + + dev->hba_map[bus][target].expose = expose_flag; + + if (expose_flag != 0) { + devtype = AAC_DEVTYPE_RAID_MEMBER; + goto update_devtype; + } + + if (nexus != 0 && (attribs & 8)) { + devtype = AAC_DEVTYPE_NATIVE_RAW; + dev->hba_map[bus][target].rmw_nexus = + nexus; + } else + devtype = AAC_DEVTYPE_ARC_RAW; + + if (devtype != AAC_DEVTYPE_NATIVE_RAW) + goto update_devtype; + +update_devtype: + dev->hba_map[bus][target].devtype = devtype; + } +} + +/** + * aac_report_phys_luns() Process topology change + * @dev: aac_dev structure + * @fibptr:fib pointer + * + * Execute a CISS REPORT PHYS LUNS and process the results into + * the current hba_map. + */ +int aac_report_phys_luns(struct aac_dev *dev, struct fib *fibptr) +{ + int fibsize, datasize; + struct aac_ciss_phys_luns_resp *phys_luns; + struct aac_srb *srbcmd; + struct sgmap64 *sg64; + dma_addr_t addr; + u32 vbus, vid; + u32 rcode = 0; + + /* Thor SA Firmware -> CISS_REPORT_PHYSICAL_LUNS */ + fibsize = sizeof(struct aac_srb) - sizeof(struct sgentry) + + sizeof(struct sgentry64); + datasize = sizeof(struct aac_ciss_phys_luns_resp) + + (AAC_MAX_TARGETS - 1) * sizeof(struct _ciss_lun); + + phys_luns = (struct aac_ciss_phys_luns_resp *) pci_alloc_consistent( + dev->pdev, datasize, &addr); + + if (phys_luns == NULL) { + rcode = -ENOMEM; + goto err_out; + } + + vbus = (u32) le16_to_cpu( + dev->supplement_adapter_info.VirtDeviceBus); + vid = (u32) le16_to_cpu( + dev->supplement_adapter_info.VirtDeviceTarget); + + aac_fib_init(fibptr); + + srbcmd = (struct aac_srb *) fib_data(fibptr); + srbcmd->function = cpu_to_le32(SRBF_ExecuteScsi); + srbcmd->channel = cpu_to_le32(vbus); + srbcmd->id = cpu_to_le32(vid); + srbcmd->lun = 0; + srbcmd->flags = cpu_to_le32(SRB_DataIn); + srbcmd->timeout = cpu_to_le32(10); + srbcmd->retry_limit = 0; + srbcmd->cdb_size = cpu_to_le32(12); + srbcmd->count = cpu_to_le32(datasize); + + memset(srbcmd->cdb, 0, sizeof(srbcmd->cdb)); + srbcmd->cdb[0] = CISS_REPORT_PHYSICAL_LUNS; + srbcmd->cdb[1] = 2; /* extended reporting */ + srbcmd->cdb[8] = (u8)(datasize >> 8); + srbcmd->cdb[9] = (u8)(datasize); + + sg64 = (struct sgmap64 *) &srbcmd->sg; + sg64->count = cpu_to_le32(1); + sg64->sg[0].addr[1] = cpu_to_le32(upper_32_bits(addr)); + sg64->sg[0].addr[0] = cpu_to_le32(lower_32_bits(addr)); + sg64->sg[0].count = cpu_to_le32(
[PATCH V3 22/24] aacraid: Update copyrights
Added new copyright messages Signed-off-by: Raghava Aditya Renukunta Signed-off-by: Dave Carroll --- Changes in V2: None Changes in V3: None drivers/scsi/aacraid/aachba.c | 8 +++- drivers/scsi/aacraid/aacraid.h | 32 drivers/scsi/aacraid/commctrl.c | 3 ++- drivers/scsi/aacraid/comminit.c | 3 ++- drivers/scsi/aacraid/commsup.c | 3 ++- drivers/scsi/aacraid/dpcsup.c | 3 ++- drivers/scsi/aacraid/linit.c| 3 ++- drivers/scsi/aacraid/nark.c | 3 ++- drivers/scsi/aacraid/rkt.c | 3 ++- drivers/scsi/aacraid/rx.c | 3 ++- drivers/scsi/aacraid/sa.c | 3 ++- drivers/scsi/aacraid/src.c | 3 ++- 12 files changed, 59 insertions(+), 11 deletions(-) diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index 74b9bb1..4205d93 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c @@ -6,7 +6,8 @@ * Adaptec aacraid device driver for Linux. * * Copyright (c) 2000-2010 Adaptec, Inc. - * 2010 PMC-Sierra, Inc. (aacr...@pmc-sierra.com) + * 2010-2015 PMC-Sierra, Inc. (aacr...@pmc-sierra.com) + * 2016-2017 Microsemi Corp. (aacr...@microsemi.com) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,6 +23,11 @@ * along with this program; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * + * Module Name: + * aachba.c + * + * Abstract: Contains Interfaces to manage IOs. + * */ #include diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h index e14916e..3835375 100644 --- a/drivers/scsi/aacraid/aacraid.h +++ b/drivers/scsi/aacraid/aacraid.h @@ -1,3 +1,35 @@ +/* + * Adaptec AAC series RAID controller driver + * (c) Copyright 2001 Red Hat Inc. + * + * based on the old aacraid driver that is.. + * Adaptec aacraid device driver for Linux. + * + * Copyright (c) 2000-2010 Adaptec, Inc. + * 2010-2015 PMC-Sierra, Inc. (aacr...@pmc-sierra.com) + * 2016-2017 Microsemi Corp. (aacr...@microsemi.com) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Module Name: + * aacraid.h + * + * Abstract: Contains all routines for control of the aacraid driver + * + */ + #ifndef _AACRAID_H_ #define _AACRAID_H_ #ifndef dprintk diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c index 9ade2b4..a704e8d 100644 --- a/drivers/scsi/aacraid/commctrl.c +++ b/drivers/scsi/aacraid/commctrl.c @@ -6,7 +6,8 @@ * Adaptec aacraid device driver for Linux. * * Copyright (c) 2000-2010 Adaptec, Inc. - * 2010 PMC-Sierra, Inc. (aacr...@pmc-sierra.com) + * 2010-2015 PMC-Sierra, Inc. (aacr...@pmc-sierra.com) + * 2016-2017 Microsemi Corp. (aacr...@microsemi.com) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c index 5aad018..d0c7724 100644 --- a/drivers/scsi/aacraid/comminit.c +++ b/drivers/scsi/aacraid/comminit.c @@ -6,7 +6,8 @@ * Adaptec aacraid device driver for Linux. * * Copyright (c) 2000-2010 Adaptec, Inc. - * 2010 PMC-Sierra, Inc. (aacr...@pmc-sierra.com) + * 2010-2015 PMC-Sierra, Inc. (aacr...@pmc-sierra.com) + * 2016-2017 Microsemi Corp. (aacr...@microsemi.com) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c index 3a98b1f..69d98b7 100644 --- a/drivers/scsi/aacraid/commsup.c +++ b/drivers/scsi/aacraid/commsup.c @@ -6,7 +6,8 @@ * Adaptec aacraid device driver for Linux. * * Copyright (c) 2000-2010 Adaptec, Inc. - * 2010 PMC-Sierra, Inc. (aacr...@pmc-sierra.com) + * 2010-2015 PMC-Sierra, Inc. (aacr...@pmc-sierra.com) + * 2016-2017 Microsemi Corp. (aacr...@microsemi.com) * * This program is free software; you can redistribute it and/or modify * it under the terms of t
[PATCH V3 08/24] aacraid: Added support for response path
This patch enables the driver to actually process the I/O, or srb replies from adapter. In addition to any HBA1000 or SmartIOC2000 adapter events. Signed-off-by: Raghava Aditya Renukunta Signed-off-by: Dave Carroll --- Changes in V2: None Changes in V3: None drivers/scsi/aacraid/aachba.c | 34 +++ drivers/scsi/aacraid/aacraid.h | 52 +++--- drivers/scsi/aacraid/commsup.c | 17 +- drivers/scsi/aacraid/dpcsup.c | 20 drivers/scsi/aacraid/src.c | 38 ++ 5 files changed, 99 insertions(+), 62 deletions(-) diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index d848335..4bb94a2 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c @@ -329,7 +329,7 @@ static inline int aac_valid_context(struct scsi_cmnd *scsicmd, } scsicmd->SCp.phase = AAC_OWNER_MIDLEVEL; device = scsicmd->device; - if (unlikely(!device || !scsi_device_online(device))) { + if (unlikely(!device)) { dprintk((KERN_WARNING "aac_valid_context: scsi device corrupt\n")); aac_fib_complete(fibptr); return 0; @@ -475,16 +475,26 @@ int aac_get_containers(struct aac_dev *dev) if (maximum_num_containers < MAXIMUM_NUM_CONTAINERS) maximum_num_containers = MAXIMUM_NUM_CONTAINERS; - fsa_dev_ptr = kzalloc(sizeof(*fsa_dev_ptr) * maximum_num_containers, - GFP_KERNEL); - if (!fsa_dev_ptr) - return -ENOMEM; + if ((dev->fsa_dev == NULL) || + (dev->maximum_num_containers != maximum_num_containers)) { + + fsa_dev_ptr = dev->fsa_dev; - dev->fsa_dev = fsa_dev_ptr; - dev->maximum_num_containers = maximum_num_containers; + dev->fsa_dev = kzalloc(sizeof(*fsa_dev_ptr) * + maximum_num_containers, GFP_KERNEL); - for (index = 0; index < dev->maximum_num_containers; ) { - fsa_dev_ptr[index].devname[0] = '\0'; + kfree(fsa_dev_ptr); + fsa_dev_ptr = NULL; + + + if (!dev->fsa_dev) + return -ENOMEM; + + dev->maximum_num_containers = maximum_num_containers; + } + for (index = 0; index < dev->maximum_num_containers; index++) { + dev->fsa_dev[index].devname[0] = '\0'; + dev->fsa_dev[index].valid = 0; status = aac_probe_container(dev, index); @@ -492,12 +502,6 @@ int aac_get_containers(struct aac_dev *dev) printk(KERN_WARNING "aac_get_containers: SendFIB failed.\n"); break; } - - /* -* If there are no more containers, then stop asking. -*/ - if (++index >= status) - break; } return status; } diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h index 00df610..d1f5a66 100644 --- a/drivers/scsi/aacraid/aacraid.h +++ b/drivers/scsi/aacraid/aacraid.h @@ -407,7 +407,7 @@ struct aac_fibhdr { __le32 SenderFibAddressHigh;/* upper 32bit of phys. FIB address */ __le32 TimeStamp; /* otherwise timestamp for FW internal use */ } u; - u32 Handle; /* FIB handle used for MSGU commnunication */ + __le32 Handle; /* FIB handle used for MSGU commnunication */ u32 Previous; /* FW internal use */ u32 Next; /* FW internal use */ }; @@ -872,18 +872,20 @@ struct rkt_registers { #define src_inbound rx_inbound struct src_mu_registers { - /* PCI*| Name */ - __le32 reserved0[6]; /* 00h | Reserved */ - __le32 IOAR[2];/* 18h | IOA->host interrupt register */ - __le32 IDR;/* 20h | Inbound Doorbell Register */ - __le32 IISR; /* 24h | Inbound Int. Status Register */ - __le32 reserved1[3]; /* 28h | Reserved */ - __le32 OIMR; /* 34h | Outbound Int. Mask Register */ - __le32 reserved2[25]; /* 38h | Reserved */ - __le32 ODR_R; /* 9ch | Outbound Doorbell Read */ - __le32 ODR_C; /* a0h | Outbound Doorbell Clear */ - __le32 reserved3[6]; /* a4h | Reserved */ - __le32 OMR;/* bch | Outbound Message Register */ + /* PCI*| Name */ + __le32 reserved0[6]; /* 00h | Reserved */ + __le32 IOAR[2];/* 18h | IOA->host interrupt register */ + __le32 IDR;/* 20h | Inbound Doorbell Register */ + __le32 IISR; /* 24h | Inbound Int. Status Register */ + __le32 reserved1[3]; /* 28h | Reserved */ + __le32 O