Re: [PATCH 16/20] [SCSI] mpt3sas: Added support for customer specific branding
On Tue, Jun 23, 2015 at 2:06 AM, Martin K. Petersen martin.peter...@oracle.com wrote: Sreekanth == Sreekanth Reddy sreekanth.re...@avagotech.com writes: Sreekanth I agree with you that these changes belong in pci.ids. But Sreekanth Customers are asking us to print the HBA branding name while Sreekanth loading the driver on their custom HBA's. Yes, and other HBA vendors have done the same (although thankfully this practice appears to be going out of fashion). Personally, I find SAS2308 orders of magnitude more useful and helpful than WHIZ-BANG2010 since the former tells me exactly what chip I'm dealing with. Anyway. No big deal. I just think it's a bad habit to use the kernel for marketing purposes. Agreed. Can you please consider this patch for this time. Next time onwards we take some actions to not encourage these types of request from customers. -- Martin K. Petersen Oracle Linux Engineering -- Regards, Sreekanth -- 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
[PATCHv1] mpt2sas: setpci reset kernel oops fix
This patch contains the fix for kernel oops on issuing setpci reset along with sysfs, cli access spinlock initialization modified to DEFINE_SPINLOCK as per the comments for previous version of the patch From edf1c00ddcc9b045fd1527a23631f3d4b1eea599 Mon Sep 17 00:00:00 2001 From: Nagarajkumar Narayanan nagarajkumar.naraya...@seagate.com Date: Thu, 25 Jun 2015 11:20:44 +0530 Subject: [PATCH] mpt2sas setpci reset oops fix issuing setpci reset to nytro warpdrive card along with sysfs access and cli ioctl access resulted in kernel oops 1. pci_access_mutex lock added to provide synchronization between IOCTL, sysfs, PCI resource handling path 2. gioc_lock spinlock to protect list operations over multiple controllers Signed-off-by: Nagarajkumar Narayanan nagarajkumar.naraya...@seagate.com --- drivers/scsi/mpt2sas/mpt2sas_base.c |9 ++ drivers/scsi/mpt2sas/mpt2sas_base.h | 19 - drivers/scsi/mpt2sas/mpt2sas_ctl.c | 48 + drivers/scsi/mpt2sas/mpt2sas_scsih.c | 16 ++- 4 files changed, 84 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c index 11248de..9081f07 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_base.c +++ b/drivers/scsi/mpt2sas/mpt2sas_base.c @@ -108,13 +108,17 @@ _scsih_set_fwfault_debug(const char *val, struct kernel_param *kp) { int ret = param_set_int(val, kp); struct MPT2SAS_ADAPTER *ioc; + unsigned long flags; if (ret) return ret; + /* global ioc spinlock to protect controller list on list operations */ printk(KERN_INFO setting fwfault_debug(%d)\n, mpt2sas_fwfault_debug); + spin_lock_irqsave(gioc_lock, flags); list_for_each_entry(ioc, mpt2sas_ioc_list, list) ioc-fwfault_debug = mpt2sas_fwfault_debug; + spin_unlock_irqrestore(gioc_lock, flags); return 0; } @@ -4436,6 +4440,9 @@ mpt2sas_base_free_resources(struct MPT2SAS_ADAPTER *ioc) __func__)); if (ioc-chip_phys ioc-chip) { + /* synchronizing freeing resource with pci_access_mutex lock */ + if (ioc-is_warpdrive) + mutex_lock(ioc-pci_access_mutex); _base_mask_interrupts(ioc); ioc-shost_recovery = 1; _base_make_ioc_ready(ioc, CAN_SLEEP, SOFT_RESET); @@ -4454,6 +4461,8 @@ mpt2sas_base_free_resources(struct MPT2SAS_ADAPTER *ioc) pci_disable_pcie_error_reporting(pdev); pci_disable_device(pdev); } + if (ioc-is_warpdrive) + mutex_unlock(ioc-pci_access_mutex); return; } diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.h b/drivers/scsi/mpt2sas/mpt2sas_base.h index caff8d1..c82bdb3 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_base.h +++ b/drivers/scsi/mpt2sas/mpt2sas_base.h @@ -799,6 +799,12 @@ typedef void (*MPT2SAS_FLUSH_RUNNING_CMDS)(struct MPT2SAS_ADAPTER *ioc); * @delayed_tr_list: target reset link list * @delayed_tr_volume_list: volume target reset link list * @@temp_sensors_count: flag to carry the number of temperature sensors + * @pci_access_mutex: Mutex to synchronize ioctl,sysfs show path and + * pci resource handling. PCI resource freeing will lead to free + * vital hardware/memory resource, which might be in use by cli/sysfs + * path functions resulting in Null pointer reference followed by kernel + * crash. To avoid the above race condition we use mutex syncrhonization + * which ensures the syncrhonization between cli/sysfs_show path */ struct MPT2SAS_ADAPTER { struct list_head list; @@ -1015,6 +1021,7 @@ struct MPT2SAS_ADAPTER { u8 mfg_pg10_hide_flag; u8 hide_drives; + struct mutex pci_access_mutex; }; typedef u8 (*MPT_CALLBACK)(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index, @@ -1023,6 +1030,17 @@ typedef u8 (*MPT_CALLBACK)(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index, /* base shared API */ extern struct list_head mpt2sas_ioc_list; +/* spinlock on list operations over IOCs + * Case: when multiple warpdrive cards(IOCs) are in use + * Each IOC will added to the ioc list stucture on initialization. + * Watchdog threads run at regular intervals to check IOC for any + * fault conditions which will trigger the dead_ioc thread to + * deallocate pci resource, resulting deleting the IOC netry from list, + * this deletion need to protected by spinlock to enusre that + * ioc removal is syncrhonized, if not synchronized it might lead to + * list_del corruption as the ioc list is traversed in cli path + */ +extern spinlock_t gioc_lock; void mpt2sas_base_start_watchdog(struct MPT2SAS_ADAPTER *ioc); void mpt2sas_base_stop_watchdog(struct MPT2SAS_ADAPTER *ioc); @@ -1099,7 +1117,6 @@ struct _sas_device *mpt2sas_scsih_sas_device_find_by_sas_address( struct MPT2SAS_ADAPTER *ioc, u64 sas_address); void
[PATCH 1/1] snic: Fixing duplicate cache names
This patch fixes duplicate cache names. Signed-off-by: Narsimhulu Musini nmus...@cisco.com --- drivers/scsi/snic/snic_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/snic/snic_main.c b/drivers/scsi/snic/snic_main.c index b2b87ce..47ed593 100644 --- a/drivers/scsi/snic/snic_main.c +++ b/drivers/scsi/snic/snic_main.c @@ -919,7 +919,7 @@ snic_global_data_init(void) snic_glob-req_cache[SNIC_REQ_CACHE_MAX_SGL] = cachep; len = sizeof(struct snic_host_req); - cachep = kmem_cache_create(snic_req_maxsgl, len, SNIC_SG_DESC_ALIGN, + cachep = kmem_cache_create(snic_tm_req, len, SNIC_SG_DESC_ALIGN, SLAB_HWCACHE_ALIGN, NULL); if (!cachep) { SNIC_ERR(Failed to create snic tm req slab\n); -- 1.8.5.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 1/1] scsi/snic: fixing the error print
On 25/06/15 3:22 pm, Maninder Singh maninder...@samsung.com wrote: Currently SNIC_HOST_ERR is called in both cases whether snic_disc_start returns zero or non-zero. From the code it looks like it has to print only if snic_disc_start return non-zero value, So calling SNIC_HOST_ERR only for non-zero return from snic_disc_start. Signed-off-by: Maninder Singh maninder...@samsung.com Reviewed-by: Rohit Thapliyal r.thapli...@samsung.com Acked-by: Narsimhulu Musini nmus...@cisco.com -- 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 1/1] ipr: Fix invalid array indexing for HRRQ
James, Here is one more fix for a rather nasty bug where the ipr driver can start accessing memory it doesn't own. I'd like to add to the queue of ipr patches. There are now two patches on top of the previously submitted series of four. If you want me to resend everything as a complete series, please let me know. Thanks, Brian 8 Fixes another signed / unsigned array indexing bug in the ipr driver. Signed-off-by: Brian King brk...@linux.vnet.ibm.com Tested-by: Wen Xiong wenxi...@linux.vnet.ibm.com Cc: sta...@vger.kernel.org --- drivers/scsi/ipr.c | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff -puN drivers/scsi/ipr.c~ipr_hrrq_index_fix drivers/scsi/ipr.c --- linux/drivers/scsi/ipr.c~ipr_hrrq_index_fix 2015-06-23 11:43:18.151741523 -0500 +++ linux-bjking1/drivers/scsi/ipr.c2015-06-23 11:43:18.157741435 -0500 @@ -1052,10 +1052,15 @@ static void ipr_send_blocking_cmd(struct static int ipr_get_hrrq_index(struct ipr_ioa_cfg *ioa_cfg) { + unsigned int hrrq; + if (ioa_cfg-hrrq_num == 1) - return 0; - else - return (atomic_add_return(1, ioa_cfg-hrrq_index) % (ioa_cfg-hrrq_num - 1)) + 1; + hrrq = 0; + else { + hrrq = atomic_add_return(1, ioa_cfg-hrrq_index); + hrrq = ((hrrq + 1) % (ioa_cfg-hrrq_num - 1)) + 1; + } + return hrrq; } /** _ -- 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 1/1] scsi/snic: fixing the error print
Currently SNIC_HOST_ERR is called in both cases whether snic_disc_start returns zero or non-zero. From the code it looks like it has to print only if snic_disc_start return non-zero value, So calling SNIC_HOST_ERR only for non-zero return from snic_disc_start. Signed-off-by: Maninder Singh maninder...@samsung.com Reviewed-by: Rohit Thapliyal r.thapli...@samsung.com --- drivers/scsi/snic/snic_disc.c |9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/snic/snic_disc.c b/drivers/scsi/snic/snic_disc.c index 5f63217..8c29d5e 100644 --- a/drivers/scsi/snic/snic_disc.c +++ b/drivers/scsi/snic/snic_disc.c @@ -514,12 +514,9 @@ snic_handle_disc(struct work_struct *work) ret = snic_disc_start(snic); if (ret) - goto disc_err; - -disc_err: - SNIC_HOST_ERR(snic-shost, - disc_work: Discovery Failed w/ err = %d\n, - ret); + SNIC_HOST_ERR(snic-shost, + disc_work: Discovery Failed w/ err = %d\n, + ret); } /* end of snic_disc_work */ /* -- 1.7.9.5 -- 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-wd33c93: Deletion of a check before the function call wd33c93_setup
On Wed, Jun 24, 2015 at 05:33:50PM +0200, SF Markus Elfring wrote: From: Markus Elfring elfr...@users.sourceforge.net Date: Wed, 24 Jun 2015 17:15:17 +0200 The wd33c93_setup() function performs also input parameter validation. Thus the test around the call is not needed. Guys, you should be aware that Markus auto generates his patches and he doesn't even do a cursory review. I find it acceptable that some of my update suggestions do not fit to your quality expectations at the moment. -- Markus Elfring (https://lkml.org/lkml/2015/1/22/446) regards, dan carpenter -- 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 1/1] scsi: remove check around pci_dev_put
pci_dev_put checks for NULL Pointer itself. Signed-off-by: Maninder Singh maninder...@samsung.com --- drivers/scsi/eata_pio.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/scsi/eata_pio.c b/drivers/scsi/eata_pio.c index ca8003f..481ecac 100644 --- a/drivers/scsi/eata_pio.c +++ b/drivers/scsi/eata_pio.c @@ -122,8 +122,7 @@ static int eata_pio_release(struct Scsi_Host *sh) release_region(sh-io_port, sh-n_io_port); } /* At this point the PCI reference can go */ - if (hd-pdev) - pci_dev_put(hd-pdev); + pci_dev_put(hd-pdev); return 1; } -- 1.7.9.5 -- 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/1] ipr: Fix invalid array indexing for HRRQ
On 06/25/2015, 03:44 PM, Brian King wrote: Fixes another signed / unsigned array indexing bug in the ipr driver. Could you be more specific? Specifically, I fail to see why you do +1 twice now. --- linux/drivers/scsi/ipr.c~ipr_hrrq_index_fix 2015-06-23 11:43:18.151741523 -0500 +++ linux-bjking1/drivers/scsi/ipr.c 2015-06-23 11:43:18.157741435 -0500 @@ -1052,10 +1052,15 @@ static void ipr_send_blocking_cmd(struct static int ipr_get_hrrq_index(struct ipr_ioa_cfg *ioa_cfg) { + unsigned int hrrq; + if (ioa_cfg-hrrq_num == 1) - return 0; - else - return (atomic_add_return(1, ioa_cfg-hrrq_index) % (ioa_cfg-hrrq_num - 1)) + 1; + hrrq = 0; + else { + hrrq = atomic_add_return(1, ioa_cfg-hrrq_index); + hrrq = ((hrrq + 1) % (ioa_cfg-hrrq_num - 1)) + 1; + } + return hrrq; thanks, -- js suse labs -- 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/1] ipr: Fix invalid array indexing for HRRQ
On 06/25/2015 09:36 AM, Jiri Slaby wrote: On 06/25/2015, 03:44 PM, Brian King wrote: Fixes another signed / unsigned array indexing bug in the ipr driver. Could you be more specific? Specifically, I fail to see why you do +1 twice now. Sure. With the code that is currently upstream, when hrrq_index wraps, it becomes a negative number. We do the modulo, but still have a negative number, so we end up indexing backwards in the array. Given where the hrrq array is located in memory, we probably won't actually reference memory we don't own, but nonetheless ipr is still looking at data within struct ipr_ioa_cfg and interpreting it as struct ipr_hrr_queue data, so bad things could certainly happen. As far as the fix goes... Each ipr adapter has anywhere from 1 to 16 HRRQs. By default, we use 2 on new adapters. Let's take an example: Assume ioa_cfg-hrrq_index=0x7fffe and ioa_cfg-hrrq_num=4: The atomic_add_return will then return -1. We mod this with 3 and get -2, add one and get -1 for an array index. Some background on the different hrrq uses. On adapters which support more than a single HRRQ, we dedicate HRRQ to adapter initialization and error interrupts so that we can optimize the other queues for fast path I/O. So all normal I/O uses HRRQ 1-15. So we want to spread the I/O requests across those HRRQs. I should add here that with the default module parameter settings, this bug won't hit, only when someone sets the ipr.number_of_msix parameter to a value larger than 3 is when bad things start to happen. Thanks, Brian --- linux/drivers/scsi/ipr.c~ipr_hrrq_index_fix 2015-06-23 11:43:18.151741523 -0500 +++ linux-bjking1/drivers/scsi/ipr.c 2015-06-23 11:43:18.157741435 -0500 @@ -1052,10 +1052,15 @@ static void ipr_send_blocking_cmd(struct static int ipr_get_hrrq_index(struct ipr_ioa_cfg *ioa_cfg) { +unsigned int hrrq; + if (ioa_cfg-hrrq_num == 1) -return 0; -else -return (atomic_add_return(1, ioa_cfg-hrrq_index) % (ioa_cfg-hrrq_num - 1)) + 1; +hrrq = 0; +else { +hrrq = atomic_add_return(1, ioa_cfg-hrrq_index); +hrrq = ((hrrq + 1) % (ioa_cfg-hrrq_num - 1)) + 1; +} +return hrrq; thanks, -- Brian King Power Linux I/O IBM Linux Technology Center -- 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 1/9] [SCSI] aacraid: Fix for logical device name and UID not exposed to the OS
On 06/11/2015 03:42 AM, rajinikanth.panduran...@pmcs.com wrote: From: Rajinikanth Pandurangan rajinikanth.panduran...@pmcs.com Description: Driver sends the right size of the response buffer. Signed-off-by: Rajinikanth Pandurangan rajinikanth.panduran...@pmcs.com Reviewed-by: Tomas Henzl the...@redhat.com Tomas -- 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/9] [SCSI] aacraid: Add Power Management support
On 06/11/2015 03:42 AM, rajinikanth.panduran...@pmcs.com wrote: From: Rajinikanth Pandurangan rajinikanth.panduran...@pmcs.com Description: * .suspend() and .resume() routines implemented in the driver * aac_release_resources() initiates firmware shutdown * aac_acquire_resources re-initializes the host interface Signed-off-by: Rajinikanth Pandurangan rajinikanth.panduran...@pmcs.com --- drivers/scsi/aacraid/aacraid.h | 5 ++ drivers/scsi/aacraid/comminit.c | 154 drivers/scsi/aacraid/linit.c| 147 ++ drivers/scsi/aacraid/rx.c | 1 + drivers/scsi/aacraid/sa.c | 1 + drivers/scsi/aacraid/src.c | 2 + 6 files changed, 232 insertions(+), 78 deletions(-) diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h index 40fe65c..62b0999 100644 --- a/drivers/scsi/aacraid/aacraid.h +++ b/drivers/scsi/aacraid/aacraid.h @@ -547,6 +547,7 @@ struct adapter_ops 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); + void (*adapter_start)(struct aac_dev *dev); /* Transport operations */ int (*adapter_ioremap)(struct aac_dev * dev, u32 size); irq_handler_t adapter_intr; @@ -1247,6 +1248,9 @@ struct aac_dev #define aac_adapter_restart(dev,bled) \ (dev)-a_ops.adapter_restart(dev,bled) +#define aac_adapter_start(dev) \ + ((dev)-a_ops.adapter_start(dev)) + #define aac_adapter_ioremap(dev, size) \ (dev)-a_ops.adapter_ioremap(dev, size) @@ -2127,6 +2131,7 @@ int aac_sa_init(struct aac_dev *dev); int aac_src_init(struct aac_dev *dev); int aac_srcv_init(struct aac_dev *dev); int aac_queue_get(struct aac_dev * dev, u32 * index, u32 qid, struct hw_fib * hw_fib, int wait, struct fib * fibptr, unsigned long *nonotify); +void aac_define_int_mode(struct aac_dev *dev); unsigned int aac_response_normal(struct aac_queue * q); unsigned int aac_command_normal(struct aac_queue * q); unsigned int aac_intr_normal(struct aac_dev *dev, u32 Index, diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c index 45db84a..e0a76d5 100644 --- a/drivers/scsi/aacraid/comminit.c +++ b/drivers/scsi/aacraid/comminit.c @@ -43,8 +43,6 @@ #include aacraid.h -static void aac_define_int_mode(struct aac_dev *dev); - struct aac_common aac_config = { .irq_mod = 1 }; @@ -338,6 +336,82 @@ static int aac_comm_init(struct aac_dev * dev) return 0; } +void aac_define_int_mode(struct aac_dev *dev) +{ + int i, msi_count; + + msi_count = i = 0; + /* max. vectors from GET_COMM_PREFERRED_SETTINGS */ + if (dev-max_msix == 0 || + dev-pdev-device == PMC_DEVICE_S6 || + dev-sync_mode) { + dev-max_msix = 1; + dev-vector_cap = + dev-scsi_host_ptr-can_queue + + AAC_NUM_MGT_FIB; + return; + } + + /* Don't bother allocating more MSI-X vectors than cpus */ + msi_count = min(dev-max_msix, + (unsigned int)num_online_cpus()); + + dev-max_msix = msi_count; + + if (msi_count AAC_MAX_MSIX) + msi_count = AAC_MAX_MSIX; + + for (i = 0; i msi_count; i++) + dev-msixentry[i].entry = i; + + if (msi_count 1 + pci_find_capability(dev-pdev, PCI_CAP_ID_MSIX)) { + i = pci_enable_msix_exact(dev-pdev, + dev-msixentry, + msi_count); + /* Che Hi, pci_enable_msix_exact returns either an error value or 0. Maybe what you wanted is pci_enable_msix_range (, 1, msi_count); Please do not make silent changes like this, without describing it - it looks like only a whole code block was moved. Also there is a rule which should be followed, that is that every single functional change need it's own patch. When you send a new version of any patch add a description what is new in that newer version. Cheers, Tomas ck how many MSIX vectors are allocated */ + if (i = 0) { + dev-msi_enabled = 1; + if (i) { + msi_count = i; + if (pci_enable_msix_exact(dev-pdev, + dev-msixentry, + msi_count)) { + dev-msi_enabled = 0; + printk(KERN_ERR %s%d: MSIX not supported!! Will try MSI 0x%x.\n, + dev-name, dev-id, i); + } + } + } else
[PATCH] scsi: storvsc: be more picky about scmnd-sc_data_direction
Under the 'default' case in scmnd-sc_data_direction we have 3 options: - DMA_NONE which we handle correctly. - DMA_BIDIRECTIONAL which is never supposed to be set by SCSI stack. - Garbage value. Do WARN() and return -EINVAL in the last two cases. virtio_scsi does BUG_ON() here but it looks like an overkill. Reported-by: Radim Krčmář rkrc...@redhat.com Signed-off-by: Vitaly Kuznetsov vkuzn...@redhat.com --- drivers/scsi/storvsc_drv.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c index 3c6584f..61f4855 100644 --- a/drivers/scsi/storvsc_drv.c +++ b/drivers/scsi/storvsc_drv.c @@ -1598,10 +1598,18 @@ static int storvsc_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *scmnd) vm_srb-data_in = READ_TYPE; vm_srb-win8_extension.srb_flags |= SRB_FLAGS_DATA_IN; break; - default: + case DMA_NONE: vm_srb-data_in = UNKNOWN_TYPE; vm_srb-win8_extension.srb_flags |= SRB_FLAGS_NO_DATA_TRANSFER; break; + default: + /* +* This is DMA_BIDIRECTIONAL or something else we are never +* supposed to see here. +*/ + WARN(1, Unexpected data direction: %d\n, +scmnd-sc_data_direction); + return -EINVAL; } -- 2.4.3 -- 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/11] qla2xxx: cleanup cmd in qla workqueue before processing TMR
From: Swapnil Nagle swapnil.na...@purestorage.com Since cmds go into qla_tgt_wq and TMRs don't, it's possible that TMR like TASK_ABORT can be queued over the cmd for which it was meant. To avoid this race, use a per-port list to keep track of cmds that are enqueued to qla_tgt_wq but not yet processed. When a TMR arrives, iterate through this list and remove any cmds that match the TMR. This patch supports TASK_ABORT and LUN_RESET. Cc: sta...@vger.kernel.org Signed-off-by: Swapnil Nagle swapnil.na...@purestorage.com Signed-off-by: Alexei Potashnik ale...@purestorage.com Acked-by: Quinn Tran quinn.t...@qlogic.com Signed-off-by: Himanshu Madhani himanshu.madh...@qlogic.com --- drivers/scsi/qla2xxx/qla_dbg.c |2 +- drivers/scsi/qla2xxx/qla_def.h |5 ++ drivers/scsi/qla2xxx/qla_os.c |3 + drivers/scsi/qla2xxx/qla_target.c | 123 ++-- drivers/scsi/qla2xxx/qla_target.h | 12 drivers/scsi/qla2xxx/tcm_qla2xxx.c |8 +-- 6 files changed, 140 insertions(+), 13 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c index e9ae6b9..e63aa07 100644 --- a/drivers/scsi/qla2xxx/qla_dbg.c +++ b/drivers/scsi/qla2xxx/qla_dbg.c @@ -68,7 +68,7 @@ * | || 0xd101-0xd1fe | * | || 0xd214-0xd2fe | * | Target Mode | 0xe079 || - * | Target Mode Management | 0xf080 | 0xf002 | + * | Target Mode Management | 0xf083 | 0xf002 | * | || 0xf046-0xf049 | * | Target Mode Task Management | 0x1000b || * -- diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index a47374d..2c10f1f 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -3600,6 +3600,11 @@ typedef struct scsi_qla_host { uint16_tfcoe_fcf_idx; uint8_t fcoe_vn_port_mac[6]; + /* list of commands waiting on workqueue */ + struct list_headqla_cmd_list; + struct list_headqla_sess_op_cmd_list; + spinlock_t cmd_list_lock; + uint32_tvp_abort_cnt; struct fc_vport *fc_vport; /* holds fc_vport * for each vport */ diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 7c7528b..7ce395a 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -3764,8 +3764,11 @@ struct scsi_qla_host *qla2x00_create_host(struct scsi_host_template *sht, INIT_LIST_HEAD(vha-vp_fcports); INIT_LIST_HEAD(vha-work_list); INIT_LIST_HEAD(vha-list); + INIT_LIST_HEAD(vha-qla_cmd_list); + INIT_LIST_HEAD(vha-qla_sess_op_cmd_list); spin_lock_init(vha-work_lock); + spin_lock_init(vha-cmd_list_lock); sprintf(vha-host_str, %s_%ld, QLA2XXX_DRIVER_NAME, vha-host_no); ql_dbg(ql_dbg_init, vha, 0x0041, diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index e5e255a..95066ac 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -1170,6 +1170,70 @@ static void qlt_24xx_retry_term_exchange(struct scsi_qla_host *vha, FCP_TMF_CMPL, true); } +static int abort_cmd_for_tag(struct scsi_qla_host *vha, uint32_t tag) +{ + struct qla_tgt_sess_op *op; + struct qla_tgt_cmd *cmd; + + spin_lock(vha-cmd_list_lock); + + list_for_each_entry(op, vha-qla_sess_op_cmd_list, cmd_list) { + if (tag == op-atio.u.isp24.exchange_addr) { + op-aborted = true; + spin_unlock(vha-cmd_list_lock); + return 1; + } + } + + list_for_each_entry(cmd, vha-qla_cmd_list, cmd_list) { + if (tag == cmd-atio.u.isp24.exchange_addr) { + cmd-state = QLA_TGT_STATE_ABORTED; + spin_unlock(vha-cmd_list_lock); + return 1; + } + } + + spin_unlock(vha-cmd_list_lock); + return 0; +} + +/* drop cmds for the given lun + * XXX only looks for cmds on the port through which lun reset was recieved + * XXX does not go through the list of other port (which may have cmds + * for the same lun) + */ +static void abort_cmds_for_lun(struct scsi_qla_host *vha, + uint32_t lun, uint8_t *s_id) +{ + struct qla_tgt_sess_op *op; + struct qla_tgt_cmd *cmd; + uint32_t key; + + key = sid_to_key(s_id); + spin_lock(vha-cmd_list_lock); + list_for_each_entry(op, vha-qla_sess_op_cmd_list, cmd_list) { + uint32_t op_key; + uint32_t op_lun; + + op_key =
[PATCH 00/11] qla2xxx: Updates for Target Mode driver
Hi James, This series is applied on top of patch series sent on June 10 [PATCH 0/9] qla2xxx: Patches for scsi misc branch (http://marc.info/?l=linux-scsim=143395156920505w=2) These set of patches addresses issue with reuse of stale command found in a customer enviorment. Here's sequence of events which could result into this reuse of stale command which could potentially lead to data corruption. - Backend driver goes out of sync with front end driver due to session management problem. - During this time a session receives a NEW login by the same initiator. - All the commands from previous session are not flushed before establishing a new session/connection. - These stale commands leaks into new session resulting into case where they could potentially share same Exchange ID. In such case data can cross path between old and new session when the frontend driver/fabric driver allows a new connection to be established without backend knowledge. To fix this problem, old session is destroyed first before creating new session. The session destroy process would wait for all existing commands to finish. Please apply these patches to scsi tree at your earliest for inclusion in the next mainline merge window. Thanks, Himanshu Alexei Potashnik (8): qla2xxx: delay plogi/prli ack until existing sessions are deleted qla2xxx: Abort stale cmds on qla_tgt_wq when plogi arrives qla2xxx: added sess generations to detect RSCN update races qla2xxx: disable scsi_transport_fc registration in target mode qla2xxx: drop cmds/tmrs arrived while session is being deleted qla2xxx: terminate exchange when command is aborted by LIO qla2xxx: delete session if initiator is gone from FW qla2xxx: wait for all conflicts before ack'ing PLOGI Himanshu Madhani (1): qla2xxx: Added interface to send ELS commands from driver. Roland Dreier (1): qla2xxx: kill sessions/log out initiator on RSCN and port down events Swapnil Nagle (1): qla2xxx: cleanup cmd in qla workqueue before processing TMR drivers/scsi/qla2xxx/qla_attr.c| 36 ++ drivers/scsi/qla2xxx/qla_dbg.c | 13 +- drivers/scsi/qla2xxx/qla_def.h | 35 ++- drivers/scsi/qla2xxx/qla_gbl.h |2 + drivers/scsi/qla2xxx/qla_init.c| 188 ++-- drivers/scsi/qla2xxx/qla_inline.h |2 + drivers/scsi/qla2xxx/qla_iocb.c| 192 drivers/scsi/qla2xxx/qla_isr.c |6 + drivers/scsi/qla2xxx/qla_os.c | 13 +- drivers/scsi/qla2xxx/qla_target.c | 930 +--- drivers/scsi/qla2xxx/qla_target.h | 88 +++- drivers/scsi/qla2xxx/tcm_qla2xxx.c | 23 +- 12 files changed, 1387 insertions(+), 141 deletions(-) -- 1.7.7 -- 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/11] qla2xxx: kill sessions/log out initiator on RSCN and port down events
From: Roland Dreier rol...@purestorage.com To fix some issues talking to ESX, this patch modifies the qla2xxx driver so that it never logs into remote ports. This has the side effect of getting rid of the rports entirely, which means we never log out of initiators and never tear down sessions when an initiator goes away. This is mostly OK, except that we can run into trouble if we have initiator A assigned FC address X:Y:Z by the fabric talking to us, and then initiator A goes away. Some time (could be a long time) later, initiator B comes along and also gets FC address X:Y:Z (which is available again, because initiator A is gone). If initiator B starts talking to us, then we'll still have the session for initiator A, and since we look up incoming IO based on the FC address X:Y:Z, initiator B will end up using ACLs for initiator A. Fix this by: 1. Handling RSCN events somewhat differently; instead of completely skipping the processing of fcports, we look through the list, and if an fcport disappears, we tell the target code the tear down the session and tell the HBA FW to release the N_Port handle. 2. Handling port down events by flushing all of our sessions. The firmware was already releasing the N_Port handle but we want the target code to drop all the sessions too. Cc: sta...@vger.kernel.org Signed-off-by: Roland Dreier rol...@purestorage.com Signed-off-by: Alexei Potashnik ale...@purestorage.com Acked-by: Quinn Tran quinn.t...@qlogic.com Signed-off-by: Himanshu Madhani himanshu.madh...@qlogic.com --- drivers/scsi/qla2xxx/qla_dbg.c|2 +- drivers/scsi/qla2xxx/qla_init.c | 137 ++--- drivers/scsi/qla2xxx/qla_target.c |9 ++- 3 files changed, 117 insertions(+), 31 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c index 0e6ee3c..e9ae6b9 100644 --- a/drivers/scsi/qla2xxx/qla_dbg.c +++ b/drivers/scsi/qla2xxx/qla_dbg.c @@ -68,7 +68,7 @@ * | || 0xd101-0xd1fe | * | || 0xd214-0xd2fe | * | Target Mode | 0xe079 || - * | Target Mode Management | 0xf072 | 0xf002 | + * | Target Mode Management | 0xf080 | 0xf002 | * | || 0xf046-0xf049 | * | Target Mode Task Management | 0x1000b || * -- diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index 766fdfc..4895a4a 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -3462,20 +3462,43 @@ qla2x00_configure_fabric(scsi_qla_host_t *vha) if ((fcport-flags FCF_FABRIC_DEVICE) == 0) continue; - if (fcport-scan_state == QLA_FCPORT_SCAN - atomic_read(fcport-state) == FCS_ONLINE) { - qla2x00_mark_device_lost(vha, fcport, - ql2xplogiabsentdevice, 0); - if (fcport-loop_id != FC_NO_LOOP_ID - (fcport-flags FCF_FCP2_DEVICE) == 0 - fcport-port_type != FCT_INITIATOR - fcport-port_type != FCT_BROADCAST) { - ha-isp_ops-fabric_logout(vha, - fcport-loop_id, - fcport-d_id.b.domain, - fcport-d_id.b.area, - fcport-d_id.b.al_pa); - qla2x00_clear_loop_id(fcport); + if (fcport-scan_state == QLA_FCPORT_SCAN) { + if (qla_ini_mode_enabled(base_vha) + atomic_read(fcport-state) == FCS_ONLINE) { + qla2x00_mark_device_lost(vha, fcport, + ql2xplogiabsentdevice, 0); + if (fcport-loop_id != FC_NO_LOOP_ID + (fcport-flags FCF_FCP2_DEVICE) == 0 + fcport-port_type != FCT_INITIATOR + fcport-port_type != FCT_BROADCAST) { + ha-isp_ops-fabric_logout(vha, + fcport-loop_id, + fcport-d_id.b.domain, + fcport-d_id.b.area, + fcport-d_id.b.al_pa); +
[PATCH 11/11] qla2xxx: wait for all conflicts before ack'ing PLOGI
From: Alexei Potashnik ale...@purestorage.com Until now ack'ing of a new PLOGI has only been delayed if there was an existing session for the same WWN. Ack was released when the session deletion completed. If there was another WWN session with the same fc_id/loop_id pair (aka conflicting session), PLOGI was still ack'ed immediately. This potentially caused a problem when old session deletion logged fc_id/loop_id out of FW after new session has been established. Two work-arounds were attempted before: 1. Dropping PLOGIs until conflicting session goes away. 2. Detecting initiator being logged out of FW and issuing LOGO to force re-login. This patch introduces proper solution to the problem where PLOGI is held until either existing session with same WWN or any conflicting session goes away. Mechanism supports one session holding two PLOGI acks as well as one PLOGI ack being held by many sessions. Cc: sta...@vger.kernel.org Signed-off-by: Alexei Potashnik ale...@purestorage.com Acked-by: Quinn Tran quinn.t...@qlogic.com Signed-off-by: Himanshu Madhani himanshu.madh...@qlogic.com --- drivers/scsi/qla2xxx/qla_dbg.c|4 +- drivers/scsi/qla2xxx/qla_def.h|2 + drivers/scsi/qla2xxx/qla_os.c |1 + drivers/scsi/qla2xxx/qla_target.c | 199 + drivers/scsi/qla2xxx/qla_target.h | 18 +++- 5 files changed, 174 insertions(+), 50 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c index d242fdf..44cd29d 100644 --- a/drivers/scsi/qla2xxx/qla_dbg.c +++ b/drivers/scsi/qla2xxx/qla_dbg.c @@ -26,7 +26,7 @@ * | || 0x3036,0x3038 | * | || 0x303a | * | DPC Thread | 0x4023 | 0x4002,0x4013 | - * | Async Events | 0x5087 | 0x502b-0x502f | + * | Async Events | 0x5089 | 0x502b-0x502f | * | || 0x5084,0x5075 | * | || 0x503d,0x5044 | * | || 0x507b,0x505f | @@ -67,7 +67,7 @@ * | || 0xd101-0xd1fe | * | || 0xd214-0xd2fe | * | Target Mode | 0xe080 || - * | Target Mode Management | 0xf096 | 0xf002 | + * | Target Mode Management | 0xf09b | 0xf002 | * | || 0xf046-0xf049 | * | Target Mode Task Management | 0x1000d || * -- diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index d90ff5b..db15ff9 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -3630,6 +3630,8 @@ typedef struct scsi_qla_host { int total_fcport_update_gen; /* List of pending LOGOs, protected by tgt_mutex */ struct list_headlogo_list; + /* List of pending PLOGI acks, protected by hw lock */ + struct list_headplogi_ack_list; uint32_tvp_abort_cnt; diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 43438c3..6e32a7a 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -3771,6 +3771,7 @@ struct scsi_qla_host *qla2x00_create_host(struct scsi_host_template *sht, INIT_LIST_HEAD(vha-qla_cmd_list); INIT_LIST_HEAD(vha-qla_sess_op_cmd_list); INIT_LIST_HEAD(vha-logo_list); + INIT_LIST_HEAD(vha-plogi_ack_list); spin_lock_init(vha-work_lock); spin_lock_init(vha-cmd_list_lock); diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 3ca93eb..e26c26b 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -118,10 +118,13 @@ static void qlt_send_notify_ack(struct scsi_qla_host *vha, struct imm_ntfy_from_isp *ntfy, uint32_t add_flags, uint16_t resp_code, int resp_code_valid, uint16_t srr_flags, uint16_t srr_reject_code, uint8_t srr_explan); +static void qlt_send_term_imm_notif(struct scsi_qla_host *vha, + struct imm_ntfy_from_isp *imm, int ha_locked); /* * Global Variables */ static struct kmem_cache *qla_tgt_mgmt_cmd_cachep; +static struct kmem_cache *qla_tgt_plogi_cachep; static mempool_t *qla_tgt_mgmt_cmd_mempool; static struct workqueue_struct *qla_tgt_wq; static DEFINE_MUTEX(qla_tgt_mutex); @@ -389,6 +392,85 @@ void qlt_response_pkt_all_vps(struct scsi_qla_host *vha, response_t *pkt) } +/* + * All qlt_plogi_ack_t operations are protected by hardware_lock + */ + +/* + * This is a zero-base ref-counting solution, since hardware_lock
[PATCH 06/11] qla2xxx: disable scsi_transport_fc registration in target mode
From: Alexei Potashnik ale...@purestorage.com There are multiple reasons for disabling this: 1. It provides no functional benefit. We pretty much only get a few more sysfs entries for each port, but all that information is already available from /sys/kernel/debug/target/qla-session-X 2. It already only works in private-loop mode. By disabling we'll be getting more uniform behavior with fabric mode. 3. It creates complications for the new PLOGI handling mechanism: scsi_transport_fc port deletion timer could race with new session from initiator and cause logout after successful login. Cc: sta...@vger.kernel.org Signed-off-by: Alexei Potashnik ale...@purestorage.com Signed-off-by: Himanshu Madhani himanshu.madh...@qlogic.com --- drivers/scsi/qla2xxx/qla_init.c | 14 +++--- drivers/scsi/qla2xxx/qla_os.c |3 ++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index 3f3cdbf..5ba5851 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -3338,8 +3338,7 @@ qla2x00_update_fcport(scsi_qla_host_t *vha, fc_port_t *fcport) if (IS_QLAFX00(vha-hw)) { qla2x00_set_fcport_state(fcport, FCS_ONLINE); - qla2x00_reg_remote_port(vha, fcport); - return; + goto reg_port; } fcport-login_retry = 0; fcport-flags = ~(FCF_LOGIN_NEEDED | FCF_ASYNC_SENT); @@ -3347,7 +3346,16 @@ qla2x00_update_fcport(scsi_qla_host_t *vha, fc_port_t *fcport) qla2x00_set_fcport_state(fcport, FCS_ONLINE); qla2x00_iidma_fcport(vha, fcport); qla24xx_update_fcport_fcp_prio(vha, fcport); - qla2x00_reg_remote_port(vha, fcport); + +reg_port: + if (qla_ini_mode_enabled(vha)) + qla2x00_reg_remote_port(vha, fcport); + else { + /* +* Create target mode FC NEXUS in qla_target.c +*/ + qlt_fc_port_added(vha, fcport); + } } /* diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index be6de2a..8a5cac8 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -3235,7 +3235,8 @@ qla2x00_schedule_rport_del(struct scsi_qla_host *vha, fc_port_t *fcport, qla2xxx_wake_dpc(base_vha); } else { int now; - fc_remote_port_delete(rport); + if (rport) + fc_remote_port_delete(rport); qlt_do_generation_tick(vha, now); qlt_fc_port_deleted(vha, fcport, now); } -- 1.7.7 -- 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 10/11] qla2xxx: delete session if initiator is gone from FW
From: Alexei Potashnik ale...@purestorage.com 1. Initiator A is logged in with fc_id(1)/loop_id(1) 2. Initiator A re-logs in with fc_id(2)/loop_id(2) 3. Part of old session deletion async logoout for 1/1 is queued 4. Initiator B logs in with fc_id(1)/loop_id(1), starts passing data and creates session. 5. Async logo from 3 is processed by DPC and sent to FW Now initiator B has the session but is logged out from FW. This condition is detected first with CTIO error 29 at which point we should delete current session. During session deletion we will send LOGO to initiator to force re-login. Under rare circumstances initiator might be logged out of FW, not have driver session, but still think it's logged in. E.g. the above sequence plus session deletion due to re-config. Incoming commands will fail to create local session because initiator is not found in FW. In this case we also issue LOGO to initiator to force him re-login. Finally this patch fixes exchange leak when commands where received in logged out state. In this case loop_id must be set to when corresponding exchange is terminated. The patch modifies exchange termination to always use , since in certain scenarios it's impossible to tell whether command was received in logged in or logged out state. Cc: sta...@vger.kernel.org Signed-off-by: Alexei Potashnik ale...@purestorage.com Signed-off-by: Himanshu Madhani himanshu.madh...@qlogic.com --- drivers/scsi/qla2xxx/qla_def.h|2 + drivers/scsi/qla2xxx/qla_os.c |1 + drivers/scsi/qla2xxx/qla_target.c | 108 +++-- drivers/scsi/qla2xxx/qla_target.h |9 +++ 4 files changed, 104 insertions(+), 16 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 12a78b9..d90ff5b 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -3628,6 +3628,8 @@ typedef struct scsi_qla_host { atomic_tgeneration_tick; /* Time when global fcport update has been scheduled */ int total_fcport_update_gen; + /* List of pending LOGOs, protected by tgt_mutex */ + struct list_headlogo_list; uint32_tvp_abort_cnt; diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 8a5cac8..43438c3 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -3770,6 +3770,7 @@ struct scsi_qla_host *qla2x00_create_host(struct scsi_host_template *sht, INIT_LIST_HEAD(vha-list); INIT_LIST_HEAD(vha-qla_cmd_list); INIT_LIST_HEAD(vha-qla_sess_op_cmd_list); + INIT_LIST_HEAD(vha-logo_list); spin_lock_init(vha-work_lock); spin_lock_init(vha-cmd_list_lock); diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 2832253..3ca93eb 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -389,6 +389,52 @@ void qlt_response_pkt_all_vps(struct scsi_qla_host *vha, response_t *pkt) } +typedef struct { + /* These fields must be initialized by the caller */ + port_id_t id; + /* +* number of cmds dropped while we were waiting for +* initiator to ack LOGO initialize to 1 if LOGO is +* triggered by a command, otherwise, to 0 +*/ + int cmd_count; + + /* These fields are used by callee */ + struct list_head list; +} qlt_port_logo_t; + +static void +qlt_send_first_logo(struct scsi_qla_host *vha, qlt_port_logo_t *logo) +{ + qlt_port_logo_t *tmp; + int res; + + mutex_lock(vha-vha_tgt.tgt_mutex); + + list_for_each_entry(tmp, vha-logo_list, list) { + if (tmp-id.b24 == logo-id.b24) { + tmp-cmd_count += logo-cmd_count; + mutex_unlock(vha-vha_tgt.tgt_mutex); + return; + } + } + + list_add_tail(logo-list, vha-logo_list); + + mutex_unlock(vha-vha_tgt.tgt_mutex); + + res = qla24xx_els_dcmd_iocb(vha, ELS_DCMD_LOGO, logo-id); + + mutex_lock(vha-vha_tgt.tgt_mutex); + list_del(logo-list); + mutex_unlock(vha-vha_tgt.tgt_mutex); + + dev_info(vha-hw-pdev-dev, +Finished LOGO to %02x:%02x:%02x, dropped %d cmds, res = %#x\n, +logo-id.b.domain, logo-id.b.area, logo-id.b.al_pa, +logo-cmd_count, res); +} + static void qlt_free_session_done(struct work_struct *work) { struct qla_tgt_sess *sess = container_of(work, struct qla_tgt_sess, @@ -402,14 +448,21 @@ static void qlt_free_session_done(struct work_struct *work) ql_dbg(ql_dbg_tgt_mgt, vha, 0xf084, %s: se_sess %p / sess %p from port %8phC loop_id %#04x -s_id %02x:%02x:%02x logout %d keep %d plogi %d\n, +s_id %02x:%02x:%02x logout %d keep %d plogi %d els_logo %d\n, __func__, sess-se_sess,
Re: [Patch V2 3/9] [SCSI] aacraid: Enable MSI interrupt for series-6 controller
On 06/11/2015 03:42 AM, rajinikanth.panduran...@pmcs.com wrote: From: Rajinikanth Pandurangan rajinikanth.panduran...@pmcs.com Description: Enable MSI interrupt mode for series-6 controller. What seem problematic to me is that you still keep the module option 'aac_msi' and a poor user might try IRQ handling. 0=PIC(default), 1=MSI, 2=MSI-X(unsupported, uses MSI)); to manipulate the driver naturally withou any success. Please either change the above description or add a new option so it is not confusing. Btw msi-x is now supported? Cheers, Tomas Signed-off-by: Rajinikanth Pandurangan rajinikanth.panduran...@pmcs.com --- drivers/scsi/aacraid/src.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/aacraid/src.c b/drivers/scsi/aacraid/src.c index b147341..eb07b3d 100644 --- a/drivers/scsi/aacraid/src.c +++ b/drivers/scsi/aacraid/src.c @@ -742,7 +742,7 @@ int aac_src_init(struct aac_dev *dev) if (dev-comm_interface != AAC_COMM_MESSAGE_TYPE1) goto error_iounmap; - dev-msi = aac_msi !pci_enable_msi(dev-pdev); + dev-msi = !pci_enable_msi(dev-pdev); dev-aac_msix[0].vector_no = 0; dev-aac_msix[0].dev = dev; -- 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] bnxfc:Make the function bnx2fc_alloc_work static
Make sense. Acked-by: Chad Dupuis chad.dup...@qlogic.com On Tue, 23 Jun 2015, Nicholas Krause wrote: This makes the function bnx_2fc_alloc_work static now due to this function's only caller being in this particular function's definition/declaration file of bnx2fc_hwi.c. Signed-off-by: Nicholas Krause xerofo...@gmail.com --- drivers/scsi/bnx2fc/bnx2fc_hwi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/bnx2fc/bnx2fc_hwi.c b/drivers/scsi/bnx2fc/bnx2fc_hwi.c index c6688d7..15eef07 100644 --- a/drivers/scsi/bnx2fc/bnx2fc_hwi.c +++ b/drivers/scsi/bnx2fc/bnx2fc_hwi.c @@ -994,7 +994,7 @@ void bnx2fc_arm_cq(struct bnx2fc_rport *tgt) } -struct bnx2fc_work *bnx2fc_alloc_work(struct bnx2fc_rport *tgt, u16 wqe) +static struct bnx2fc_work *bnx2fc_alloc_work(struct bnx2fc_rport *tgt, u16 wqe) { struct bnx2fc_work *work; work = kzalloc(sizeof(struct bnx2fc_work), GFP_ATOMIC); -- 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/1] ipr: Fix invalid array indexing for HRRQ
On 06/25/2015 09:36 AM, Jiri Slaby wrote: On 06/25/2015, 03:44 PM, Brian King wrote: Fixes another signed / unsigned array indexing bug in the ipr driver. Could you be more specific? Specifically, I fail to see why you do +1 twice now. Regarding the extra +1, you are correct. Its not needed. Let me fix up the commit comment and this and resend. Thanks, Brian --- linux/drivers/scsi/ipr.c~ipr_hrrq_index_fix 2015-06-23 11:43:18.151741523 -0500 +++ linux-bjking1/drivers/scsi/ipr.c 2015-06-23 11:43:18.157741435 -0500 @@ -1052,10 +1052,15 @@ static void ipr_send_blocking_cmd(struct static int ipr_get_hrrq_index(struct ipr_ioa_cfg *ioa_cfg) { +unsigned int hrrq; + if (ioa_cfg-hrrq_num == 1) -return 0; -else -return (atomic_add_return(1, ioa_cfg-hrrq_index) % (ioa_cfg-hrrq_num - 1)) + 1; +hrrq = 0; +else { +hrrq = atomic_add_return(1, ioa_cfg-hrrq_index); +hrrq = ((hrrq + 1) % (ioa_cfg-hrrq_num - 1)) + 1; +} +return hrrq; thanks, -- Brian King Power Linux I/O IBM Linux Technology Center -- 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
[PATCHv2 1/1] ipr: Fix invalid array indexing for HRRQ
Updated version per comments from Jiri Slaby. Thanks! 8 Fixes another signed / unsigned array indexing bug in the ipr driver. Currently, when hrrq_index wraps, it becomes a negative number. We do the modulo, but still have a negative number, so we end up indexing backwards in the array. Given where the hrrq array is located in memory, we probably won't actually reference memory we don't own, but nonetheless ipr is still looking at data within struct ipr_ioa_cfg and interpreting it as struct ipr_hrr_queue data, so bad things could certainly happen. Each ipr adapter has anywhere from 1 to 16 HRRQs. By default, we use 2 on new adapters. Let's take an example: Assume ioa_cfg-hrrq_index=0x7fffe and ioa_cfg-hrrq_num=4: The atomic_add_return will then return -1. We mod this with 3 and get -2, add one and get -1 for an array index. On adapters which support more than a single HRRQ, we dedicate HRRQ to adapter initialization and error interrupts so that we can optimize the other queues for fast path I/O. So all normal I/O uses HRRQ 1-15. So we want to spread the I/O requests across those HRRQs. With the default module parameter settings, this bug won't hit, only when someone sets the ipr.number_of_msix parameter to a value larger than 3 is when bad things start to happen. Signed-off-by: Brian King brk...@linux.vnet.ibm.com Tested-by: Wen Xiong wenxi...@linux.vnet.ibm.com Cc: sta...@vger.kernel.org --- drivers/scsi/ipr.c | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff -puN drivers/scsi/ipr.c~ipr_hrrq_index_fix drivers/scsi/ipr.c --- linux/drivers/scsi/ipr.c~ipr_hrrq_index_fix 2015-06-23 11:43:18.151741523 -0500 +++ linux-bjking1/drivers/scsi/ipr.c2015-06-25 10:54:24.954615461 -0500 @@ -1052,10 +1052,15 @@ static void ipr_send_blocking_cmd(struct static int ipr_get_hrrq_index(struct ipr_ioa_cfg *ioa_cfg) { + unsigned int hrrq; + if (ioa_cfg-hrrq_num == 1) - return 0; - else - return (atomic_add_return(1, ioa_cfg-hrrq_index) % (ioa_cfg-hrrq_num - 1)) + 1; + hrrq = 0; + else { + hrrq = atomic_add_return(1, ioa_cfg-hrrq_index); + hrrq = (hrrq % (ioa_cfg-hrrq_num - 1)) + 1; + } + return hrrq; } /** _ -- 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-libfc: Delete an unnecessary check before the function call fc_fcp_ddp_done
On Wed, 2015-06-24 at 17:54 +0200, SF Markus Elfring wrote: From: Markus Elfring elfr...@users.sourceforge.net Date: Wed, 24 Jun 2015 17:50:32 +0200 The fc_fcp_ddp_done() function tests whether its argument is NULL and then returns immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring elfr...@users.sourceforge.net --- drivers/scsi/libfc/fc_exch.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c index 1b3a094..aad6f48 100644 --- a/drivers/scsi/libfc/fc_exch.c +++ b/drivers/scsi/libfc/fc_exch.c @@ -2120,8 +2120,7 @@ static struct fc_seq *fc_exch_seq_send(struct fc_lport *lport, spin_unlock_bh(ep-ex_lock); return sp; err: - if (fsp) - fc_fcp_ddp_done(fsp); + fc_fcp_ddp_done(fsp); rc = fc_exch_done_locked(ep); spin_unlock_bh(ep-ex_lock); if (!rc) Looks good. Acked-by: Vasu Dev vasu@intel.com -- 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/9] [SCSI] aacraid: Add Power Management support
Hello Tomas, Please see my response below. Thanks, -Raj P. -Original Message- From: Tomas Henzl [mailto:the...@redhat.com] Sent: Thursday, June 25, 2015 8:43 AM To: Rajinikanth Pandurangan; jbottom...@parallels.com; linux-scsi@vger.kernel.org Cc: aacr...@pmc-sierra.com; Harry Yang; Mahesh Rajashekhara; Rich Bono; Achim Leubner; Murthy Bhat Subject: Re: [Patch V2 2/9] [SCSI] aacraid: Add Power Management support On 06/11/2015 03:42 AM, rajinikanth.panduran...@pmcs.com wrote: From: Rajinikanth Pandurangan rajinikanth.panduran...@pmcs.com Description: * .suspend() and .resume() routines implemented in the driver * aac_release_resources() initiates firmware shutdown * aac_acquire_resources re-initializes the host interface Signed-off-by: Rajinikanth Pandurangan rajinikanth.panduran...@pmcs.com --- drivers/scsi/aacraid/aacraid.h | 5 ++ drivers/scsi/aacraid/comminit.c | 154 drivers/scsi/aacraid/linit.c| 147 ++ drivers/scsi/aacraid/rx.c | 1 + drivers/scsi/aacraid/sa.c | 1 + drivers/scsi/aacraid/src.c | 2 + 6 files changed, 232 insertions(+), 78 deletions(-) diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h index 40fe65c..62b0999 100644 --- a/drivers/scsi/aacraid/aacraid.h +++ b/drivers/scsi/aacraid/aacraid.h @@ -547,6 +547,7 @@ struct adapter_ops 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); + void (*adapter_start)(struct aac_dev *dev); /* Transport operations */ int (*adapter_ioremap)(struct aac_dev * dev, u32 size); irq_handler_t adapter_intr; @@ -1247,6 +1248,9 @@ struct aac_dev #define aac_adapter_restart(dev,bled) \ (dev)-a_ops.adapter_restart(dev,bled) +#define aac_adapter_start(dev) \ + ((dev)-a_ops.adapter_start(dev)) + #define aac_adapter_ioremap(dev, size) \ (dev)-a_ops.adapter_ioremap(dev, size) @@ -2127,6 +2131,7 @@ int aac_sa_init(struct aac_dev *dev); int aac_src_init(struct aac_dev *dev); int aac_srcv_init(struct aac_dev *dev); int aac_queue_get(struct aac_dev * dev, u32 * index, u32 qid, struct hw_fib * hw_fib, int wait, struct fib * fibptr, unsigned long *nonotify); +void aac_define_int_mode(struct aac_dev *dev); unsigned int aac_response_normal(struct aac_queue * q); unsigned int aac_command_normal(struct aac_queue * q); unsigned int aac_intr_normal(struct aac_dev *dev, u32 Index, diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c index 45db84a..e0a76d5 100644 --- a/drivers/scsi/aacraid/comminit.c +++ b/drivers/scsi/aacraid/comminit.c @@ -43,8 +43,6 @@ #include aacraid.h -static void aac_define_int_mode(struct aac_dev *dev); - struct aac_common aac_config = { .irq_mod = 1 }; @@ -338,6 +336,82 @@ static int aac_comm_init(struct aac_dev * dev) return 0; } +void aac_define_int_mode(struct aac_dev *dev) { + int i, msi_count; + + msi_count = i = 0; + /* max. vectors from GET_COMM_PREFERRED_SETTINGS */ + if (dev-max_msix == 0 || + dev-pdev-device == PMC_DEVICE_S6 || + dev-sync_mode) { + dev-max_msix = 1; + dev-vector_cap = + dev-scsi_host_ptr-can_queue + + AAC_NUM_MGT_FIB; + return; + } + + /* Don't bother allocating more MSI-X vectors than cpus */ + msi_count = min(dev-max_msix, + (unsigned int)num_online_cpus()); + + dev-max_msix = msi_count; + + if (msi_count AAC_MAX_MSIX) + msi_count = AAC_MAX_MSIX; + + for (i = 0; i msi_count; i++) + dev-msixentry[i].entry = i; + + if (msi_count 1 + pci_find_capability(dev-pdev, PCI_CAP_ID_MSIX)) { + i = pci_enable_msix_exact(dev-pdev, + dev-msixentry, + msi_count); + /* Che Hi, pci_enable_msix_exact returns either an error value or 0. Maybe what you wanted is pci_enable_msix_range (, 1, msi_count); Please do not make silent changes like this, without describing it - it looks like only a whole code block was moved. Also there is a rule which should be followed, that is that every single functional change need it's own patch. When you send a new version of any patch add a description what is new in that newer version. [RajP] Yes, original intention was just to move the whole code block up. But when you reviewed my V1, you suggested to change pci_enable_msix() as it's deprecated. So I made this change in my V2, and I included the following in my description but
Re: [Patch V2 4/9] [SCSI] aacraid: Enable 64-bit write to controller register
On 06/11/2015 03:42 AM, rajinikanth.panduran...@pmcs.com wrote: From: Rajinikanth Pandurangan rajinikanth.panduran...@pmcs.com Description: If writeq() not supported, then do atomic two 32bit write Signed-off-by: Rajinikanth Pandurangan rajinikanth.panduran...@pmcs.com Reviewed-by: Tomas Henzl the...@redhat.com Tomas -- 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 04/11] qla2xxx: Abort stale cmds on qla_tgt_wq when plogi arrives
From: Alexei Potashnik ale...@purestorage.com cancel any commands from initiator's s_id that are still waiting on qla_tgt_wq when PLOGI arrives. Cc: sta...@vger.kernel.org Signed-off-by: Alexei Potashnik ale...@purestorage.com Acked-by: Quinn Tran quinn.t...@qlogic.com Signed-off-by: Himanshu Madhani himanshu.madh...@qlogic.com --- drivers/scsi/qla2xxx/qla_target.c | 35 +++ 1 files changed, 35 insertions(+), 0 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 34f7f4d..74afe92 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -4068,6 +4068,38 @@ qlt_find_sess_invalidate_other(struct qla_tgt *tgt, uint64_t wwn, return sess; } +/* Abort any commands for this s_id waiting on qla_tgt_wq workqueue */ +static int abort_cmds_for_s_id(struct scsi_qla_host *vha, port_id_t *s_id) +{ + struct qla_tgt_sess_op *op; + struct qla_tgt_cmd *cmd; + uint32_t key; + int count = 0; + + key = (((u32)s_id-b.domain 16) | + ((u32)s_id-b.area 8) | + ((u32)s_id-b.al_pa)); + + spin_lock(vha-cmd_list_lock); + list_for_each_entry(op, vha-qla_sess_op_cmd_list, cmd_list) { + uint32_t op_key = sid_to_key(op-atio.u.isp24.fcp_hdr.s_id); + if (op_key == key) { + op-aborted = true; + count++; + } + } + list_for_each_entry(cmd, vha-qla_cmd_list, cmd_list) { + uint32_t cmd_key = sid_to_key(cmd-atio.u.isp24.fcp_hdr.s_id); + if (cmd_key == key) { + cmd-state = QLA_TGT_STATE_ABORTED; + count++; + } + } + spin_unlock(vha-cmd_list_lock); + + return count; +} + /* * ha-hardware_lock supposed to be held on entry. Might drop it, then reaquire */ @@ -4101,6 +4133,9 @@ static int qlt_24xx_handle_els(struct scsi_qla_host *vha, switch (iocb-u.isp24.status_subcode) { case ELS_PLOGI: + /* Mark all stale commands in qla_tgt_wq for deletion */ + abort_cmds_for_s_id(vha, port_id); + if (wwn) sess = qlt_find_sess_invalidate_other(tgt, wwn, port_id, loop_id); -- 1.7.7 -- 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 03/11] qla2xxx: delay plogi/prli ack until existing sessions are deleted
From: Alexei Potashnik ale...@purestorage.com - keep qla_tgt_sess object on the session list until it's freed - modify use of sess-deleted flag to differentiate delayed session deletion that can be cancelled from irreversible one: QLA_SESS_DELETION_PENDING vs QLA_SESS_DELETION_IN_PROGRESS - during IN_PROGRESS deletion all newly arrived commands and TMRs will be rejected, existing commands and TMRs will be terminated when given by the core to the fabric or simply dropped if session logout has already happened (logout terminates all existing exchanges) - new PLOGI will initiate deletion of the following sessions (unless deletion is already IN_PROGRESS): - with the same port_name (with logout) - different port_name, different loop_id but the same port_id (with logout) - different port_name, different port_id, but the same loop_id (without logout) - additionally each new PLOGI will store imm notify iocb in the same port_name session being deleted. When deletion process completes this iocb will be acked. Only the most recent PLOGI iocb is stored. The older ones will be terminated when replaced. - new PRLI will initiate deletion of the following sessions (unless deletion is already IN_PROGRESS): - different port_name, different port_id, but the same loop_id (without logout) Cc: sta...@vger.kernel.org Signed-off-by: Alexei Potashnik ale...@purestorage.com Acked-by: Quinn Tran quinn.t...@qlogic.com Signed-off-by: Himanshu Madhani himanshu.madh...@qlogic.com --- drivers/scsi/qla2xxx/qla_dbg.c |6 +- drivers/scsi/qla2xxx/qla_def.h |2 + drivers/scsi/qla2xxx/qla_init.c|7 +- drivers/scsi/qla2xxx/qla_iocb.c|3 + drivers/scsi/qla2xxx/qla_target.c | 438 ++-- drivers/scsi/qla2xxx/qla_target.h | 43 - drivers/scsi/qla2xxx/tcm_qla2xxx.c |4 + 7 files changed, 481 insertions(+), 22 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c index e63aa07..05793b7 100644 --- a/drivers/scsi/qla2xxx/qla_dbg.c +++ b/drivers/scsi/qla2xxx/qla_dbg.c @@ -67,10 +67,10 @@ * | || 0xd031-0xd0ff | * | || 0xd101-0xd1fe | * | || 0xd214-0xd2fe | - * | Target Mode | 0xe079 || - * | Target Mode Management | 0xf083 | 0xf002 | + * | Target Mode | 0xe080 || + * | Target Mode Management | 0xf091 | 0xf002 | * | || 0xf046-0xf049 | - * | Target Mode Task Management | 0x1000b || + * | Target Mode Task Management | 0x1000d || * -- */ diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 2c10f1f..b036f1a 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -274,6 +274,7 @@ #define RESPONSE_ENTRY_CNT_FX00256 /* Number of response entries.*/ struct req_que; +struct qla_tgt_sess; /* * (sd.h is not exported, hence local inclusion) @@ -2026,6 +2027,7 @@ typedef struct fc_port { uint16_t port_id; unsigned long retry_delay_timestamp; + struct qla_tgt_sess *tgt_session; } fc_port_t; #include qla_mr.h diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index 4895a4a..14456b1 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -115,6 +115,8 @@ qla2x00_async_iocb_timeout(void *data) QLA_LOGIO_LOGIN_RETRIED : 0; qla2x00_post_async_login_done_work(fcport-vha, fcport, lio-u.logio.data); + } else if (sp-type == SRB_LOGOUT_CMD) { + qlt_logo_completion_handler(fcport, QLA_FUNCTION_TIMEOUT); } } @@ -497,7 +499,10 @@ void qla2x00_async_logout_done(struct scsi_qla_host *vha, fc_port_t *fcport, uint16_t *data) { - qla2x00_mark_device_lost(vha, fcport, 1, 0); + /* Don't re-login in target mode */ + if (!fcport-tgt_session) + qla2x00_mark_device_lost(vha, fcport, 1, 0); + qlt_logo_completion_handler(fcport, data[0]); return; } diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c index 42d0e44..6b23970 100644 --- a/drivers/scsi/qla2xxx/qla_iocb.c +++ b/drivers/scsi/qla2xxx/qla_iocb.c @@ -1944,6 +1944,9 @@ qla24xx_logout_iocb(srb_t *sp, struct logio_entry_24xx *logio) logio-entry_type = LOGINOUT_PORT_IOCB_TYPE; logio-control_flags = cpu_to_le16(LCF_COMMAND_LOGO|LCF_IMPL_LOGO); + if (!sp-fcport-tgt_session || + !sp-fcport-tgt_session-keep_nport_handle) +
[PATCH 07/11] qla2xxx: drop cmds/tmrs arrived while session is being deleted
From: Alexei Potashnik ale...@purestorage.com If a new initiator (different WWN) shows up on the same fcport, old initiator's session is scheduled for deletion. But there is a small window between it being marked with QLA_SESS_DELETION_IN_PROGRESS and qlt_unret_sess getting called when new session's commands will keep finding old session in the fcport map. This patch drops cmds/tmrs if they find session in the progress of being deleted. Cc: sta...@vger.kernel.org Signed-off-by: Alexei Potashnik ale...@purestorage.com Acked-by: Quinn Tran quinn.t...@qlogic.com Signed-off-by: Himanshu Madhani himanshu.madh...@qlogic.com --- drivers/scsi/qla2xxx/qla_target.c | 28 1 files changed, 28 insertions(+), 0 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index b14623c..ed9fdd7 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -1477,6 +1477,11 @@ static void qlt_24xx_handle_abts(struct scsi_qla_host *vha, return; } + if (sess-deleted == QLA_SESS_DELETION_IN_PROGRESS) { + qlt_24xx_send_abts_resp(vha, abts, FCP_TMF_REJECTED, false); + return; + } + rc = __qlt_24xx_handle_abts(vha, abts, sess); if (rc != 0) { ql_dbg(ql_dbg_tgt_mgt, vha, 0xf054, @@ -3776,6 +3781,16 @@ static int qlt_handle_cmd_for_atio(struct scsi_qla_host *vha, queue_work(qla_tgt_wq, op-work); return 0; } + + /* Another WWN used to have our s_id. Our PLOGI scheduled its +* session deletion, but it's still in sess_del_work wq */ + if (sess-deleted == QLA_SESS_DELETION_IN_PROGRESS) { + ql_dbg(ql_dbg_io, vha, 0x3061, + New command while old session %p is being deleted\n, + sess); + return -EFAULT; + } + /* * Do kref_get() before returning + dropping qla_hw_data-hardware_lock. */ @@ -3939,6 +3954,9 @@ static int qlt_handle_task_mgmt(struct scsi_qla_host *vha, void *iocb) sizeof(struct atio_from_isp)); } + if (sess-deleted == QLA_SESS_DELETION_IN_PROGRESS) + return -EFAULT; + return qlt_issue_task_mgmt(sess, unpacked_lun, fn, iocb, 0); } @@ -5616,6 +5634,11 @@ static void qlt_abort_work(struct qla_tgt *tgt, if (!sess) goto out_term; } else { + if (sess-deleted == QLA_SESS_DELETION_IN_PROGRESS) { + sess = NULL; + goto out_term; + } + kref_get(sess-se_sess-sess_kref); } @@ -5670,6 +5693,11 @@ static void qlt_tmr_work(struct qla_tgt *tgt, if (!sess) goto out_term; } else { + if (sess-deleted == QLA_SESS_DELETION_IN_PROGRESS) { + sess = NULL; + goto out_term; + } + kref_get(sess-se_sess-sess_kref); } -- 1.7.7 -- 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 05/11] qla2xxx: added sess generations to detect RSCN update races
From: Alexei Potashnik ale...@purestorage.com RSCN processing in qla2xxx driver can run in parallel with ELS/IO processing. As such the decision to remove disappeared fc port's session could be stale, because a new login sequence has occurred since and created a brand new session. Previous mechanism of dealing with this by delaying deletion request was prone to erroneous deletions if the event that was supposed to cancel the deletion never arrived or has been delayed in processing. New mechanism relies on a time-like generation counter to serialize RSCN updates relative to ELS/IO updates. Cc: sta...@vger.kernel.org Signed-off-by: Alexei Potashnik ale...@purestorage.com Signed-off-by: Himanshu Madhani himanshu.madh...@qlogic.com --- drivers/scsi/qla2xxx/qla_dbg.c|2 +- drivers/scsi/qla2xxx/qla_def.h|5 +++ drivers/scsi/qla2xxx/qla_init.c | 32 --- drivers/scsi/qla2xxx/qla_os.c |5 ++- drivers/scsi/qla2xxx/qla_target.c | 60 ++--- drivers/scsi/qla2xxx/qla_target.h |5 ++- 6 files changed, 83 insertions(+), 26 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c index 05793b7..8b011ae 100644 --- a/drivers/scsi/qla2xxx/qla_dbg.c +++ b/drivers/scsi/qla2xxx/qla_dbg.c @@ -68,7 +68,7 @@ * | || 0xd101-0xd1fe | * | || 0xd214-0xd2fe | * | Target Mode | 0xe080 || - * | Target Mode Management | 0xf091 | 0xf002 | + * | Target Mode Management | 0xf096 | 0xf002 | * | || 0xf046-0xf049 | * | Target Mode Task Management | 0x1000d || * -- diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index b036f1a..4a7aadc 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -3607,6 +3607,11 @@ typedef struct scsi_qla_host { struct list_headqla_sess_op_cmd_list; spinlock_t cmd_list_lock; + /* Counter to detect races between ELS and RSCN events */ + atomic_tgeneration_tick; + /* Time when global fcport update has been scheduled */ + int total_fcport_update_gen; + uint32_tvp_abort_cnt; struct fc_vport *fc_vport; /* holds fc_vport * for each vport */ diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index 14456b1..3f3cdbf 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -2925,24 +2925,14 @@ qla2x00_rport_del(void *data) { fc_port_t *fcport = data; struct fc_rport *rport; - scsi_qla_host_t *vha = fcport-vha; unsigned long flags; - unsigned long vha_flags; spin_lock_irqsave(fcport-vha-host-host_lock, flags); rport = fcport-drport ? fcport-drport: fcport-rport; fcport-drport = NULL; spin_unlock_irqrestore(fcport-vha-host-host_lock, flags); - if (rport) { + if (rport) fc_remote_port_delete(rport); - /* -* Release the target mode FC NEXUS in qla_target.c code -* if target mod is enabled. -*/ - spin_lock_irqsave(vha-hw-hardware_lock, vha_flags); - qlt_fc_port_deleted(vha, fcport); - spin_unlock_irqrestore(vha-hw-hardware_lock, vha_flags); - } } /** @@ -3382,6 +3372,7 @@ qla2x00_configure_fabric(scsi_qla_host_t *vha) LIST_HEAD(new_fcports); struct qla_hw_data *ha = vha-hw; struct scsi_qla_host *base_vha = pci_get_drvdata(ha-pdev); + int discovery_gen; /* If FL port exists, then SNS is present */ if (IS_FWI2_CAPABLE(ha)) @@ -3452,6 +3443,14 @@ qla2x00_configure_fabric(scsi_qla_host_t *vha) fcport-scan_state = QLA_FCPORT_SCAN; } + /* Mark the time right before querying FW for connected ports. +* This process is long, asynchronous and by the time it's done, +* collected information might not be accurate anymore. E.g. +* disconnected port might have re-connected and a brand new +* session has been created. In this case session's generation +* will be newer than discovery_gen. */ + qlt_do_generation_tick(vha, discovery_gen); + rval = qla2x00_find_all_fabric_devs(vha, new_fcports); if (rval != QLA_SUCCESS) break; @@ -3503,7 +3502,8 @@ qla2x00_configure_fabric(scsi_qla_host_t *vha) atomic_read(fcport-state),
[PATCH 08/11] qla2xxx: terminate exchange when command is aborted by LIO
From: Alexei Potashnik ale...@purestorage.com The newly introduced aborted_task TFO callback has to terminate exchange with QLogic driver, since command is being deleted and no status will be queued to the driver at a later point. This patch also moves the burden of releasing one cmd refcount to the aborted_task handler. Changed iSCSI aborted_task logic to satisfy the above requirement. Cc: sta...@vger.kernel.org Signed-off-by: Alexei Potashnik ale...@purestorage.com Acked-by: Quinn Tran quinn.t...@qlogic.com Signed-off-by: Himanshu Madhani himanshu.madh...@qlogic.com --- drivers/scsi/qla2xxx/qla_target.c | 34 -- drivers/scsi/qla2xxx/qla_target.h |9 + drivers/scsi/qla2xxx/tcm_qla2xxx.c | 11 +-- 3 files changed, 18 insertions(+), 36 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index ed9fdd7..2832253 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -1924,21 +1924,6 @@ static int qlt_pre_xmit_response(struct qla_tgt_cmd *cmd, struct qla_hw_data *ha = vha-hw; struct se_cmd *se_cmd = cmd-se_cmd; - if (unlikely(cmd-aborted)) { - ql_dbg(ql_dbg_tgt_mgt, vha, 0xf014, - qla_target(%d): terminating exchange - for aborted cmd=%p (se_cmd=%p, tag=%d), vha-vp_idx, cmd, - se_cmd, cmd-tag); - - cmd-state = QLA_TGT_STATE_ABORTED; - cmd-cmd_flags |= BIT_6; - - qlt_send_term_exchange(vha, cmd, cmd-atio, 0); - - /* !! At this point cmd could be already freed !! */ - return QLA_TGT_PRE_XMIT_RESP_CMD_ABORTED; - } - prm-cmd = cmd; prm-tgt = tgt; prm-rq_result = scsi_status; @@ -2526,9 +2511,6 @@ int qlt_xmit_response(struct qla_tgt_cmd *cmd, int xmit_type, res = qlt_pre_xmit_response(cmd, prm, xmit_type, scsi_status, full_req_cnt); if (unlikely(res != 0)) { - if (res == QLA_TGT_PRE_XMIT_RESP_CMD_ABORTED) - return 0; - return res; } @@ -3100,6 +3082,22 @@ static void qlt_chk_exch_leak_thresh_hold(struct scsi_qla_host *vha) } +void qlt_abort_cmd(struct qla_tgt_cmd *cmd) +{ + struct qla_tgt *tgt = cmd-tgt; + struct scsi_qla_host *vha = tgt-vha; + + ql_dbg(ql_dbg_tgt_mgt, vha, 0xf014, + qla_target(%d): terminating exchange for aborted cmd=%p + (se_cmd=%p, tag=%d), vha-vp_idx, cmd, cmd-se_cmd, cmd-tag); + + cmd-state = QLA_TGT_STATE_ABORTED; + cmd-cmd_flags |= BIT_6; + + qlt_send_term_exchange(vha, cmd, cmd-atio, 0); +} +EXPORT_SYMBOL(qlt_abort_cmd); + void qlt_free_cmd(struct qla_tgt_cmd *cmd) { struct qla_tgt_sess *sess = cmd-sess; diff --git a/drivers/scsi/qla2xxx/qla_target.h b/drivers/scsi/qla2xxx/qla_target.h index e521fbad..abcaefa 100644 --- a/drivers/scsi/qla2xxx/qla_target.h +++ b/drivers/scsi/qla2xxx/qla_target.h @@ -808,13 +808,6 @@ int qla2x00_wait_for_hba_online(struct scsi_qla_host *); #defineFC_TM_REJECT4 #define FC_TM_FAILED5 -/* - * Error code of qlt_pre_xmit_response() meaning that cmd's exchange was - * terminated, so no more actions is needed and success should be returned - * to target. - */ -#define QLA_TGT_PRE_XMIT_RESP_CMD_ABORTED 0x1717 - #if (BITS_PER_LONG 32) || defined(CONFIG_HIGHMEM64G) #define pci_dma_lo32(a) (a 0x) #define pci_dma_hi32(a) a) 16)16) 0x) @@ -950,7 +943,6 @@ struct qla_tgt_cmd { unsigned int conf_compl_supported:1; unsigned int sg_mapped:1; unsigned int free_sg:1; - unsigned int aborted:1; /* Needed in case of SRR */ unsigned int write_data_transferred:1; unsigned int ctx_dsd_alloced:1; unsigned int q_full:1; @@ -1135,6 +1127,7 @@ static inline uint32_t sid_to_key(const uint8_t *s_id) extern void qlt_response_pkt_all_vps(struct scsi_qla_host *, response_t *); extern int qlt_rdy_to_xfer(struct qla_tgt_cmd *); extern int qlt_xmit_response(struct qla_tgt_cmd *, int, uint8_t); +extern void qlt_abort_cmd(struct qla_tgt_cmd *); extern void qlt_xmit_tm_rsp(struct qla_tgt_mgmt_cmd *); extern void qlt_free_mcmd(struct qla_tgt_mgmt_cmd *); extern void qlt_free_cmd(struct qla_tgt_cmd *cmd); diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c index 7bf3043..b2baaa1 100644 --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c @@ -673,7 +673,6 @@ static int tcm_qla2xxx_queue_data_in(struct se_cmd *se_cmd) cmd-cmd_flags |= BIT_4; cmd-bufflen = se_cmd-data_length; cmd-dma_data_direction = target_reverse_dma_direction(se_cmd); - cmd-aborted = (se_cmd-transport_state CMD_T_ABORTED); cmd-sg_cnt = se_cmd-t_data_nents; cmd-sg = se_cmd-t_data_sg; @@ -702,7
[PATCH 09/11] qla2xxx: Added interface to send ELS commands from driver.
Cc: sta...@vger.kernel.org Signed-off-by: Himanshu Madhani himanshu.madh...@qlogic.com Signed-off-by: Giridhar Malavali giridhar.malav...@qlogic.com --- drivers/scsi/qla2xxx/qla_attr.c | 36 +++ drivers/scsi/qla2xxx/qla_dbg.c|5 +- drivers/scsi/qla2xxx/qla_def.h| 19 - drivers/scsi/qla2xxx/qla_gbl.h|2 + drivers/scsi/qla2xxx/qla_inline.h |2 + drivers/scsi/qla2xxx/qla_iocb.c | 189 + drivers/scsi/qla2xxx/qla_isr.c|6 + 7 files changed, 255 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index 437254e..129b266 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c @@ -824,6 +824,41 @@ static struct bin_attribute sysfs_reset_attr = { }; static ssize_t +qla2x00_issue_logo(struct file *filp, struct kobject *kobj, + struct bin_attribute *bin_attr, + char *buf, loff_t off, size_t count) +{ + struct scsi_qla_host *vha = shost_priv(dev_to_shost(container_of(kobj, + struct device, kobj))); + int type; + int rval = 0; + port_id_t did; + + type = simple_strtol(buf, NULL, 10); + + did.b.domain = (type 0x00ff) 16; + did.b.area = (type 0xff00) 8; + did.b.al_pa = (type 0x00ff); + + ql_log(ql_log_info, vha, 0x70e3, portid=%02x%02x%02x done\n, + did.b.domain, did.b.area, did.b.al_pa); + + ql_log(ql_log_info, vha, 0x70e4, %s: %d\n, __func__, type); + + rval = qla24xx_els_dcmd_iocb(vha, ELS_DCMD_LOGO, did); + return count; +} + +static struct bin_attribute sysfs_issue_logo_attr = { + .attr = { + .name = issue_logo, + .mode = S_IWUSR, + }, + .size = 0, + .write = qla2x00_issue_logo, +}; + +static ssize_t qla2x00_sysfs_read_xgmac_stats(struct file *filp, struct kobject *kobj, struct bin_attribute *bin_attr, char *buf, loff_t off, size_t count) @@ -939,6 +974,7 @@ static struct sysfs_entry { { vpd, sysfs_vpd_attr, 1 }, { sfp, sysfs_sfp_attr, 1 }, { reset, sysfs_reset_attr, }, + { issue_logo, sysfs_issue_logo_attr, }, { xgmac_stats, sysfs_xgmac_stats_attr, 3 }, { dcbx_tlv, sysfs_dcbx_tlv_attr, 3 }, { NULL }, diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c index 8b011ae..d242fdf 100644 --- a/drivers/scsi/qla2xxx/qla_dbg.c +++ b/drivers/scsi/qla2xxx/qla_dbg.c @@ -19,7 +19,7 @@ * | Device Discovery | 0x2016 | 0x2020-0x2022, | * | || 0x2011-0x2012, | * | || 0x2099-0x20a4 | - * | Queue Command and IO tracing | 0x3059 | 0x300b | + * | Queue Command and IO tracing | 0x3074 | 0x300b | * | || 0x3027-0x3028 | * | || 0x303d-0x3041 | * | || 0x302d,0x3033 | @@ -27,12 +27,11 @@ * | || 0x303a | * | DPC Thread | 0x4023 | 0x4002,0x4013 | * | Async Events | 0x5087 | 0x502b-0x502f | - * | || 0x5047 | * | || 0x5084,0x5075 | * | || 0x503d,0x5044 | * | || 0x507b,0x505f | * | Timer Routines | 0x6012 || - * | User Space Interactions | 0x70e2 | 0x7018,0x702e | + * | User Space Interactions | 0x70e65 | 0x7018,0x702e | * | || 0x7020,0x7024 | * | || 0x7039,0x7045 | * | || 0x7073-0x7075 | diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 4a7aadc..12a78b9 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -309,6 +309,14 @@ struct srb_cmd { /* To identify if a srb is of T10-CRC type. @sp = srb_t pointer */ #define IS_PROT_IO(sp) (sp-flags SRB_CRC_CTX_DSD_VALID) +struct els_logo_payload { + uint8_t opcode; + uint8_t rsvd[3]; + uint8_t s_id[3]; + uint8_t rsvd1[1]; + uint8_t wwpn[WWN_SIZE]; +}; + /* * SRB extensions. */ @@ -322,6 +330,15 @@ struct srb_iocb { uint16_t data[2]; } logio; struct { +#define ELS_DCMD_TIMEOUT 20 +#define ELS_DCMD_LOGO 0x5 + uint32_t flags; +
Re: [Patch V2 2/9] [SCSI] aacraid: Add Power Management support
On 06/25/2015 06:54 PM, Rajinikanth Pandurangan wrote: Hello Tomas, Please see my response below. Thanks, -Raj P. -Original Message- From: Tomas Henzl [mailto:the...@redhat.com] Sent: Thursday, June 25, 2015 8:43 AM To: Rajinikanth Pandurangan; jbottom...@parallels.com; linux-scsi@vger.kernel.org Cc: aacr...@pmc-sierra.com; Harry Yang; Mahesh Rajashekhara; Rich Bono; Achim Leubner; Murthy Bhat Subject: Re: [Patch V2 2/9] [SCSI] aacraid: Add Power Management support On 06/11/2015 03:42 AM, rajinikanth.panduran...@pmcs.com wrote: From: Rajinikanth Pandurangan rajinikanth.panduran...@pmcs.com Description: * .suspend() and .resume() routines implemented in the driver * aac_release_resources() initiates firmware shutdown * aac_acquire_resources re-initializes the host interface Signed-off-by: Rajinikanth Pandurangan rajinikanth.panduran...@pmcs.com --- drivers/scsi/aacraid/aacraid.h | 5 ++ drivers/scsi/aacraid/comminit.c | 154 drivers/scsi/aacraid/linit.c| 147 ++ drivers/scsi/aacraid/rx.c | 1 + drivers/scsi/aacraid/sa.c | 1 + drivers/scsi/aacraid/src.c | 2 + 6 files changed, 232 insertions(+), 78 deletions(-) diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h index 40fe65c..62b0999 100644 --- a/drivers/scsi/aacraid/aacraid.h +++ b/drivers/scsi/aacraid/aacraid.h @@ -547,6 +547,7 @@ struct adapter_ops 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); +void (*adapter_start)(struct aac_dev *dev); /* Transport operations */ int (*adapter_ioremap)(struct aac_dev * dev, u32 size); irq_handler_t adapter_intr; @@ -1247,6 +1248,9 @@ struct aac_dev #define aac_adapter_restart(dev,bled) \ (dev)-a_ops.adapter_restart(dev,bled) +#define aac_adapter_start(dev) \ +((dev)-a_ops.adapter_start(dev)) + #define aac_adapter_ioremap(dev, size) \ (dev)-a_ops.adapter_ioremap(dev, size) @@ -2127,6 +2131,7 @@ int aac_sa_init(struct aac_dev *dev); int aac_src_init(struct aac_dev *dev); int aac_srcv_init(struct aac_dev *dev); int aac_queue_get(struct aac_dev * dev, u32 * index, u32 qid, struct hw_fib * hw_fib, int wait, struct fib * fibptr, unsigned long *nonotify); +void aac_define_int_mode(struct aac_dev *dev); unsigned int aac_response_normal(struct aac_queue * q); unsigned int aac_command_normal(struct aac_queue * q); unsigned int aac_intr_normal(struct aac_dev *dev, u32 Index, diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c index 45db84a..e0a76d5 100644 --- a/drivers/scsi/aacraid/comminit.c +++ b/drivers/scsi/aacraid/comminit.c @@ -43,8 +43,6 @@ #include aacraid.h -static void aac_define_int_mode(struct aac_dev *dev); - struct aac_common aac_config = { .irq_mod = 1 }; @@ -338,6 +336,82 @@ static int aac_comm_init(struct aac_dev * dev) return 0; } +void aac_define_int_mode(struct aac_dev *dev) { +int i, msi_count; + +msi_count = i = 0; +/* max. vectors from GET_COMM_PREFERRED_SETTINGS */ +if (dev-max_msix == 0 || +dev-pdev-device == PMC_DEVICE_S6 || +dev-sync_mode) { +dev-max_msix = 1; +dev-vector_cap = +dev-scsi_host_ptr-can_queue + +AAC_NUM_MGT_FIB; +return; +} + +/* Don't bother allocating more MSI-X vectors than cpus */ +msi_count = min(dev-max_msix, +(unsigned int)num_online_cpus()); + +dev-max_msix = msi_count; + +if (msi_count AAC_MAX_MSIX) +msi_count = AAC_MAX_MSIX; + +for (i = 0; i msi_count; i++) +dev-msixentry[i].entry = i; + +if (msi_count 1 +pci_find_capability(dev-pdev, PCI_CAP_ID_MSIX)) { +i = pci_enable_msix_exact(dev-pdev, +dev-msixentry, +msi_count); + /* Che Hi, pci_enable_msix_exact returns either an error value or 0. Maybe what you wanted is pci_enable_msix_range (, 1, msi_count); Please do not make silent changes like this, without describing it - it looks like only a whole code block was moved. Also there is a rule which should be followed, that is that every single functional change need it's own patch. When you send a new version of any patch add a description what is new in that newer version. [RajP] Yes, original intention was just to move the whole code block up. But when you reviewed my V1, you suggested to change pci_enable_msix() as it's deprecated. So I made this change in my V2, and I
Re: [Patch V2 5/9] [SCSI] aacraid: Tune response path if IsFastPath bit set
On 06/11/2015 03:42 AM, rajinikanth.panduran...@pmcs.com wrote: From: Rajinikanth Pandurangan rajinikanth.panduran...@pmcs.com Description: If 'IsFastPath' bit is set, then response path assumes no error and skips error check. Signed-off-by: Rajinikanth Pandurangan rajinikanth.panduran...@pmcs.com --- drivers/scsi/aacraid/aachba.c | 259 ++ 1 file changed, 137 insertions(+), 122 deletions(-) With this patch applied we get : if (fibptr-flags FIB_CONTEXT_FLAG_FASTRESP) { /* fast response */ srbreply-srb_status = cpu_to_le32(SRB_STATUS_SUCCESS); srbreply-scsi_status = cpu_to_le32(SAM_STAT_GOOD); } else { /* * Calculate resid for sg */ } /* * OR in the scsi status (already shifted up a bit) */ scsicmd-result |= le32_to_cpu(srbreply-scsi_status); aac_fib_complete(fibptr); aac_fib_free(fibptr); scsicmd-scsi_done(scsicmd); } From that it looks like you do not need set srbreply-srb_status = cpu_to_le32(SRB_STATUS_SUCCESS); because it's never used later. You could you rearrange it to : if (fibptr-flags FIB_CONTEXT_FLAG_FASTRESP) { /* fast response */ srbreply-scsi_status = cpu_to_le32(SAM_STAT_GOOD); goto done; } /* * Calculate resid for sg */ done: /* * OR in the scsi status (already shifted up a bit) */ scsicmd-result |= le32_to_cpu(srbreply-scsi_status); aac_fib_complete(fibptr); aac_fib_free(fibptr); scsicmd-scsi_done(scsicmd); The advantage is that you don't need move ~150 lines one tab to the right and don't have to wrap lines because of the 80 char limit. diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index fe59b00..864e9f6 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c @@ -2977,11 +2977,16 @@ static void aac_srb_callback(void *context, struct fib * fibptr) return; BUG_ON(fibptr == NULL); - dev = fibptr-dev; - srbreply = (struct aac_srb_reply *) fib_data(fibptr); + 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); + + 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) { @@ -2994,147 +2999,157 @@ static void aac_srb_callback(void *context, struct fib * fibptr) */ scsi_set_resid(scsicmd, scsi_bufflen(scsicmd) - le32_to_cpu(srbreply-data_xfer_length)); - } - - 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); + /* + * First check the fib status + */ - /* - * First check the fib status - */ + if (le32_to_cpu(srbreply-status) != ST_OK) { + int len; - 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); - } + 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); + } - /* - * 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]){
[PATCH] drivers/scsi: fix macro in sg
This patch fix the macro transport_class_to_sdev to the resonable name and use the macro. Signed-off-by: vonnyfly lifeng1...@gmail.com --- drivers/scsi/sg.c |6 +++--- include/scsi/scsi_device.h |2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 9d7b7db..be7f132 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c @@ -1454,10 +1454,10 @@ out_unlock: static int sg_add_device(struct device *cl_dev, struct class_interface *cl_intf) { - struct scsi_device *scsidp = to_scsi_device(cl_dev-parent); - struct gendisk *disk; + struct scsi_device *scsidp = transport_class_to_scsi_device(cl_dev); + struct gendisk *disk = NULL; Sg_device *sdp = NULL; - struct cdev * cdev = NULL; + struct cdev *cdev = NULL; int error; unsigned long iflags; diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index ae84b22..f6a5473 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h @@ -227,7 +227,7 @@ struct scsi_dh_data { container_of(d, struct scsi_device, sdev_gendev) #define class_to_sdev(d) \ container_of(d, struct scsi_device, sdev_dev) -#define transport_class_to_sdev(class_dev) \ +#define transport_class_to_scsi_device(class_dev) \ to_scsi_device(class_dev-parent) #define sdev_dbg(sdev, fmt, a...) \ -- 1.7.10.4 -- Thanks and Best Regards, Feng Li(Alex) -- 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