Re: [PATCH v2 4/9] ipr: Use pci_enable_msi_range() and pci_enable_msix_range()

2014-01-28 Thread Alexander Gordeev
On Fri, Jan 17, 2014 at 05:02:18PM +0100, Alexander Gordeev wrote:
> As result deprecation of MSI-X/MSI enablement functions
> pci_enable_msix() and pci_enable_msi_block() all drivers
> using these two interfaces need to be updated to use the
> new pci_enable_msi_range() and pci_enable_msix_range()
> interfaces.
> 
> Signed-off-by: Alexander Gordeev 

Brian, James,

Could you please review patches 3 and 4?

Thanks!

-- 
Regards,
Alexander Gordeev
agord...@redhat.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: status of drivers/scsi/scsi_tgt_lib.c

2014-01-28 Thread Hannes Reinecke
On 01/27/2014 04:45 PM, FUJITA Tomonori wrote:
> On Sun, 26 Jan 2014 23:50:38 -0800
> Christoph Hellwig  wrote:
> 
 Do you know if either SRP or ibmvscsi are used regularly these days?
 Does tgtd userspace still support this interface?
>>>
>>> It doesn't. I think that ibm pseries switched to virtual fc driver
>>> from virtual srp long ago. Only very old pseries could use the
>>> driver. I'm not sure there are any users of the driver. I guess that
>>> you could try to remove the driver to see if someone would complain.
>>
>> Should we try to throw in a deprecation warnings for this merge window
>> and see if anyone cares, or go ahead and remove it entirely?
> 
> Either is fine by me.

I actually know of a customer using this (with a semi-proprietary
target mode driver). I'll be asking him what his plans are.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke   zSeries & Storage
h...@suse.de  +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
--
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 4/9] ipr: Use pci_enable_msi_range() and pci_enable_msix_range()

2014-01-28 Thread Brian King
On 01/28/2014 03:54 AM, Alexander Gordeev wrote:
> On Fri, Jan 17, 2014 at 05:02:18PM +0100, Alexander Gordeev wrote:
>> As result deprecation of MSI-X/MSI enablement functions
>> pci_enable_msix() and pci_enable_msi_block() all drivers
>> using these two interfaces need to be updated to use the
>> new pci_enable_msi_range() and pci_enable_msix_range()
>> interfaces.
>>
>> Signed-off-by: Alexander Gordeev 
> 
> Brian, James,
> 
> Could you please review patches 3 and 4?

These look like they will conflict with a recent patch to
the ipr driver:

http://www.spinics.net/lists/linux-scsi/msg71644.html

Do you want me to rediff your patches on top of this one,
or do you want to keep the entire MSI series together
and do the rediff? Otherwise the patches seem fine.

Thanks,

Brian


-- 
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


[LSF/MM ATTEND] T10-PI, scsi target core, FCoE target/initiator

2014-01-28 Thread Vu Pham

Hello,

I have worked and contributed in SRP initiator driver, SRP target and 
iSER target transport drivers for scsi target core (lio core), I would 
like to attend the discussion about SCSI error handler, scsi-mq, T10-PI 
and FCoE target/initiator drivers.


thanks,
-vu
--
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 0/3] target/iscsi networkportal race fixes

2014-01-28 Thread Nicholas A. Bellinger
Hi Andy,

On Fri, 2014-01-24 at 16:18 -0800, Andy Grover wrote:
> see https://bugzilla.redhat.com/show_bug.cgi?id=1055064
> 
> Summary: if thread doesn't run before 2nd identical portal is created,
> it misses the existing one and the kernel_bind returns an error.
> 
> The first one-line patch fixes the issue for a single thread creating
> multiple network portals via configfs.
> 
> The second two close the race between multiple threads creating
> network portals.
> 
> Testing: failing test script now works.
> 

Applied, squashed into a single bugfix patch, and adding a CC'ed to
stable.

FYI, on patch #3, there where a few exception path mutex_unlocks
missing, so the following incremental has been applied + squashed as
well.

Thanks,

--nab

diff --git a/drivers/target/iscsi/iscsi_target.c 
b/drivers/target/iscsi/iscsi_target.c
index 13868ff..1ab9b18 100644
--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -365,6 +365,7 @@ struct iscsi_np *iscsit_add_np(
np = kzalloc(sizeof(struct iscsi_np), GFP_KERNEL);
if (!np) {
pr_err("Unable to allocate memory for struct iscsi_np\n");
+   mutex_unlock(&np_lock);
return ERR_PTR(-ENOMEM);
}
 
@@ -387,6 +388,7 @@ struct iscsi_np *iscsit_add_np(
ret = iscsi_target_setup_login_socket(np, sockaddr);
if (ret != 0) {
kfree(np);
+   mutex_unlock(&np_lock);
return ERR_PTR(ret);
}
 
@@ -395,6 +397,7 @@ struct iscsi_np *iscsit_add_np(
pr_err("Unable to create kthread: iscsi_np\n");
ret = PTR_ERR(np->np_thread);
kfree(np);
+   mutex_unlock(&np_lock);
return ERR_PTR(ret);
}
/*


--
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 0/3] target/iscsi networkportal race fixes

2014-01-28 Thread Andy Grover
On 01/28/2014 11:15 AM, Nicholas A. Bellinger wrote:
> Hi Andy,
> 
> On Fri, 2014-01-24 at 16:18 -0800, Andy Grover wrote:
>> see https://bugzilla.redhat.com/show_bug.cgi?id=1055064
>>
>> Summary: if thread doesn't run before 2nd identical portal is created,
>> it misses the existing one and the kernel_bind returns an error.

> Applied, squashed into a single bugfix patch, and adding a CC'ed to
> stable.
> 
> FYI, on patch #3, there where a few exception path mutex_unlocks
> missing, so the following incremental has been applied + squashed as
> well.

Thanks for the review and fixes! -- Andy

--
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: linux rdma 3.14 merge plans

2014-01-28 Thread Or Gerlitz
On Wed, Jan 22, 2014, Sagi Grimberg  wrote:
> On 1/22/2014 2:43 AM, Roland Dreier wrote:
>> On Tue, Jan 21, 2014, Or Gerlitz  wrote:

>>> Roland, ping! the signature patches were posted > three months ago. We
>>> deserve a response from the maintainer that goes beyond "I need to
>>> think on that". Responsiveness was stated by Linus to be the #1 requirement
>>> from kernel maintainers.

> Hi Roland, I'll try to respond here. removing LKML and adding Linux-scsi.

Sorry, it seems we will not getting responses unless coping LKML, so
lets do that again -- Roland, below is the detailed response Sagi
wrote you following your "adds a bunch of complexity to support a
feature no one really cares about" comment, can we get you to respond
on that?

>> Or, I'm not sure what response you're after from me.  Linus has also
>> said that maintainers should say "no" a lot more
>> (http://lwn.net/Articles/571995/) so maybe you want me to say, "No, I
>> won't merge this patch set, since it adds a bunch of complexity to
>> support a feature no one really cares about."

> 1. I disagree about no-one cares about DIF/DIX. We are witnessing growing
> interests in this especially for RDMA.
> 2. We put a lot of efforts to avoid complexity here and plug-in as simple as
> possible.
> Application that will choose to use DIF will implement only 3 steps:
> a. allocate signature enabled MR.
> b. register signature enabled MR with DIF attributes (via post_send) and
> then do RDMA.
> c. check MR status after transaction is completed (_lightweight_ verb that
> can be called from interrupt context).

>> Is that it?  (And yes I am skeptical about this stuff -- I work at an 
>> enterprise
>> storage company and even here it's hard to find anyone who cares about
>> DIF/DIX, especially offload features that stop it from being end-to-end)


> 1. RDMA verbs are _NOT_ stopping DIF from being end-to-end.
> OS (or SCSI in our specific case) passes LLD 2 scatterlists: data {block1,
> block2, block3,...}, and protection {DIF1, DIF2, DIF3}.
> LLD is required to verify the data integrity (block guards) and to
> interleave over the wire {block1, DIF1, block2, DIF2}.
> You must support that in HW, you rather iSER/SRP will use giant copy's to
> interleave by itself? or in case OS asked LLD
> to INSERT DIF iSER/SRP will compute CRC for each data-block? RDMA storage
> ULPs are transports - they should have no business with
> data processing.

> 2. HW DIF offload also gives you protection across the PCI. the
> data-validation is done (hopefully offloaded) also
> when data+protection are written to the back-end device. end-to-end is
> preserved.

> 3. SAS & FC have T10-PI offload. This is just adding RDMA into the game.
> With this set of verbs iSER, SRP, FCoE Initiators and targets will be able
> to support T10-PI.


>> I'm sure you're not expecting me to say, "Sure, I'll merge it without
>> understanding the problem it's solving

> Problem: T10-PI offload support for RDMA based initiators. Supporting
> end-to-end data integrity while sustaining high RDMA performance.


>>   or how it's doing that,"

> How it's doing that:
> - We introduce a new type of memory region that posses protection attributes
> suited for data integrity offload.
> - We Introduce a new fast registration method that can bind all the relevant
> info for verify/generate of protection information:
>   * describe if/how to interleave data with protection.
>   * describe what method of data integrity is used (DIF type X, CRC, XOR...)
> and the seeds that HW should start calculation from.
>   * describe how to verify the data.
> - We Introduce a new lightweight check of the data-integrity status to check
> if there were any integrity errors and get information on them.

> Note: We made MR allocation routine generic enough to lay a framework to
> unite all MR allocation
> methods (get_dma_mr, alloc_fast_reg_mr, reg_phys, reg_user_mr, fmrs, and
> probably more in the future...).
> We defined ib_create_mr that can actually get mr_init_attr which can be
> easily extended as opposed to the specific calls exists today.
> So I would say this even reduces complexity.

> Hope this helps,
> Sagi.
--
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


[LSF/MM TOPIC][ATTEND] Plumbing I/O Cache / Tiered Storage Hints

2014-01-28 Thread Dan Williams
In addition to disk drives with internally tiered-storage (solid-state
+ magnetic media) the kernel has also grown native I/O-caching /
tiered-storage implementations in bcache and dm-cache.

Currently, all these solutions depend on heuristics to determine what
tier the data referenced in an I/O belongs.  However, the presence of
hinting proposals from SCSI [1], ATA [2], and bcache [3] indicate that
these devices (hardware or virtual) want to consume explicit hints
indicating the value of caching data in a higher performing tier.

At LSF I want to discuss options and opportunities for plumbing cache
hints from userspace, through the I/O stack to devices.  My colleague,
Jason Akers, is also interested in this discussion as he is
investigating how to exploit these hints from userspace.  I
participated in the LSF 2012 discussion of this topic, see that it was
raised again at LSF 2013, and note that we have not settled on an
enabling path.  What's new for this year is an effort to set aside,
for now, the deeper complexities of the device specification proposals
and focus on a minimal set of hints that can be specified per-process
(ionice) and maybe per-file (fadvise).

My suspicion is that AIO attributes is useful for applications that
want access to the full range of access hints exposed by a device.
However, for the general buffered-I/O / tiered-storage case, a small
set of hints achieves the bulk of the value.

I am also interested in:
Volatile ranges
SMR Enabling
Integrity passthrough

--
Dan

[1] T10 LBA Access Hints
[2] T13 Hybrid Information Feature
[3] AIO Attributes: http://marc.info/?l=linux-aio&m=136580574523674&w=2
--
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 09/11] scsi: use device_remove_file_self() instead of device_schedule_callback()

2014-01-28 Thread Tejun Heo
driver-core now supports synchrnous self-deletion of attributes and
the asynchrnous removal mechanism is scheduled for removal.  Use it
instead of device_schedule_callback().  This makes "delete" behave
synchronously.

Signed-off-by: Tejun Heo 
Cc: "James E.J. Bottomley" 
Cc: linux-scsi@vger.kernel.org
---
 drivers/scsi/scsi_sysfs.c | 15 ++-
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 9117d0b..8ead24c 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -649,23 +649,12 @@ store_rescan_field (struct device *dev, struct 
device_attribute *attr,
 }
 static DEVICE_ATTR(rescan, S_IWUSR, NULL, store_rescan_field);
 
-static void sdev_store_delete_callback(struct device *dev)
-{
-   scsi_remove_device(to_scsi_device(dev));
-}
-
 static ssize_t
 sdev_store_delete(struct device *dev, struct device_attribute *attr,
  const char *buf, size_t count)
 {
-   int rc;
-
-   /* An attribute cannot be unregistered by one of its own methods,
-* so we have to use this roundabout approach.
-*/
-   rc = device_schedule_callback(dev, sdev_store_delete_callback);
-   if (rc)
-   count = rc;
+   if (device_remove_file_self(dev, attr))
+   scsi_remove_device(to_scsi_device(dev));
return count;
 };
 static DEVICE_ATTR(delete, S_IWUSR, NULL, sdev_store_delete);
-- 
1.8.5.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 3/3] m68k/atari - atari_scsi lock fixes: punt if deadlocked

2014-01-28 Thread Michael Schmitz
In case a SCSI command is queued from softirq context, and another
driver currently holds the ST-DMA lock, tell the SCSI midlevel to
hold off queueing commands for now. Something will hopefully resume
play later.

Signed-off-by: Michael Schmitz 
---
 drivers/scsi/atari_NCR5380.c |   12 +---
 drivers/scsi/atari_scsi.c|   26 +-
 2 files changed, 30 insertions(+), 8 deletions(-)

diff --git a/drivers/scsi/atari_NCR5380.c b/drivers/scsi/atari_NCR5380.c
index 465e63d..90a90e8 100644
--- a/drivers/scsi/atari_NCR5380.c
+++ b/drivers/scsi/atari_NCR5380.c
@@ -967,9 +967,15 @@ static int NCR5380_queue_command_lck(Scsi_Cmnd *cmd, void 
(*done)(Scsi_Cmnd *))
 * alter queues and touch the lock.
 */
if (!IS_A_TT()) {
-   /* perhaps stop command timer here */
-   falcon_get_lock();
-   /* perhaps restart command timer here */
+   /* MSch 20140119: check whether obtaining the ST-DMA lock did
+* succeed.
+* If the lock could not be acquired without risking to
+* deadlock, i.e. from softirq context with ST-DMA currently
+* otherwise locked, defer queueing further commands.
+*/
+   if (falcon_get_lock()) {
+   return SCSI_MLQUEUE_HOST_BUSY;
+   }
}
if (!(hostdata->issue_queue) || (cmd->cmnd[0] == REQUEST_SENSE)) {
LIST(cmd, hostdata->issue_queue);
diff --git a/drivers/scsi/atari_scsi.c b/drivers/scsi/atari_scsi.c
index 5e19509..2b62ce2 100644
--- a/drivers/scsi/atari_scsi.c
+++ b/drivers/scsi/atari_scsi.c
@@ -197,7 +197,7 @@ static unsigned long atari_dma_xfer_len(unsigned long 
wanted_len,
 static irqreturn_t scsi_tt_intr(int irq, void *dummy);
 static irqreturn_t scsi_falcon_intr(int irq, void *dummy);
 static void falcon_release_lock_if_possible(struct NCR5380_hostdata *hostdata);
-static void falcon_get_lock(void);
+static int falcon_get_lock(void);
 #ifdef CONFIG_ATARI_SCSI_RESET_BOOT
 static void atari_scsi_reset_boot(void);
 #endif
@@ -541,24 +541,39 @@ static void falcon_release_lock_if_possible(struct 
NCR5380_hostdata *hostdata)
  * Complicated, complicated Sigh...
  */
 
-static void falcon_get_lock(void)
+static int falcon_get_lock(void)
 {
unsigned long flags;
 
if (IS_A_TT())
-   return;
+   return 0;
 
local_irq_save(flags);
 
wait_event_cmd(falcon_fairness_wait,
-   in_irq() || !falcon_got_lock || !stdma_others_waiting(),
+   in_interrupt() || !falcon_got_lock || !stdma_others_waiting(),
local_irq_restore(flags),
local_irq_save(flags));
 
while (!falcon_got_lock) {
if (in_irq())
-   panic("Falcon SCSI hasn't ST-DMA lock in interrupt");
+   panic("Falcon SCSI hasn't got ST-DMA lock in irq");
if (!falcon_trying_lock) {
+   if (in_interrupt()) {
+   if (stdma_islocked()) {
+   /* MSch 20140119: problem -
+* cannot schedule in interrupt!
+* Unless stdma_lock can be modified
+* to interruptible wait, this will
+* be needed to avoid deadlocking here!
+* Return error to indicate command
+* queueing would deadlock, and allow
+* queue_command() to stall queueing.
+*/
+   local_irq_restore(flags);
+   return 1;
+   }
+   }
falcon_trying_lock = 1;
stdma_lock(scsi_falcon_intr, NULL);
falcon_got_lock = 1;
@@ -575,6 +590,7 @@ static void falcon_get_lock(void)
local_irq_restore(flags);
if (!falcon_got_lock)
panic("Falcon SCSI: someone stole the lock :-(\n");
+   return 0;
 }
 
 
-- 
1.7.0.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 2/3] m68k/atari - atari_scsi: change abort/reset return codes

2014-01-28 Thread Michael Schmitz
The abort/reset lowlevel return codes had changed with the new
error SCSI handling - update Atari NCR5380 driver to reflect this.

Change reset handling to clear queues only, do not attempt to
call done() on each command aborted by the reset. The EH code
should do that for us.
Queues _must_ be cleared, otherwise atari_scsi_bus_reset will not
release the ST-DMA lock, deadlocking further error recovery.

Signed-off-by: Michael Schmitz 
---
 drivers/scsi/atari_NCR5380.c |   29 ++---
 drivers/scsi/atari_scsi.c|2 +-
 2 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/drivers/scsi/atari_NCR5380.c b/drivers/scsi/atari_NCR5380.c
index 0f3cdbc..465e63d 100644
--- a/drivers/scsi/atari_NCR5380.c
+++ b/drivers/scsi/atari_NCR5380.c
@@ -2683,11 +2683,11 @@ int NCR5380_abort(Scsi_Cmnd *cmd)
local_irq_restore(flags);
cmd->scsi_done(cmd);
falcon_release_lock_if_possible(hostdata);
-   return SCSI_ABORT_SUCCESS;
+   return SUCCESS;
} else {
 /* local_irq_restore(flags); */
printk("scsi%d: abort of connected command failed!\n", 
HOSTNO);
-   return SCSI_ABORT_ERROR;
+   return FAILED;
}
}
 #endif
@@ -2711,7 +2711,7 @@ int NCR5380_abort(Scsi_Cmnd *cmd)
 * yet... */
tmp->scsi_done(tmp);
falcon_release_lock_if_possible(hostdata);
-   return SCSI_ABORT_SUCCESS;
+   return SUCCESS;
}
}
 
@@ -2729,7 +2729,7 @@ int NCR5380_abort(Scsi_Cmnd *cmd)
if (hostdata->connected) {
local_irq_restore(flags);
ABRT_PRINTK("scsi%d: abort failed, command connected.\n", 
HOSTNO);
-   return SCSI_ABORT_SNOOZE;
+   return FAILED;
}
 
/*
@@ -2764,7 +2764,7 @@ int NCR5380_abort(Scsi_Cmnd *cmd)
ABRT_PRINTK("scsi%d: aborting disconnected command.\n", 
HOSTNO);
 
if (NCR5380_select(instance, cmd, (int)cmd->tag))
-   return SCSI_ABORT_BUSY;
+   return FAILED;
 
ABRT_PRINTK("scsi%d: nexus reestablished.\n", HOSTNO);
 
@@ -2791,7 +2791,7 @@ int NCR5380_abort(Scsi_Cmnd *cmd)
local_irq_restore(flags);
tmp->scsi_done(tmp);

falcon_release_lock_if_possible(hostdata);
-   return SCSI_ABORT_SUCCESS;
+   return SUCCESS;
}
}
}
@@ -2816,7 +2816,7 @@ int NCR5380_abort(Scsi_Cmnd *cmd)
 */
falcon_release_lock_if_possible(hostdata);
 
-   return SCSI_ABORT_NOT_RUNNING;
+   return FAILED;
 }
 
 
@@ -2834,7 +2834,7 @@ static int NCR5380_bus_reset(Scsi_Cmnd *cmd)
SETUP_HOSTDATA(cmd->device->host);
int i;
unsigned long flags;
-#if 1
+#if defined(RESET_RUN_DONE)
Scsi_Cmnd *connected, *disconnected_queue;
 #endif
 
@@ -2859,7 +2859,14 @@ static int NCR5380_bus_reset(Scsi_Cmnd *cmd)
 * through anymore ... */
(void)NCR5380_read(RESET_PARITY_INTERRUPT_REG);
 
-#if 1  /* XXX Should now be done by midlevel code, but it's broken XXX */
+   /* MSch 20140115 - looking at the generic NCR5380 driver, all of this
+* should go.
+* Catch-22: if we don't clear all queues, the SCSI driver lock will
+* not be reset by atari_scsi_reset()!
+*/
+
+#if defined(RESET_RUN_DONE)
+   /* XXX Should now be done by midlevel code, but it's broken XXX */
/* XXX see belowXXX */
 
/* MSch: old-style reset: actually abort all command processing here */
@@ -2915,7 +2922,7 @@ static int NCR5380_bus_reset(Scsi_Cmnd *cmd)
 * the midlevel code that the reset was SUCCESSFUL, and there is no
 * need to 'wake up' the commands by a request_sense
 */
-   return SCSI_RESET_SUCCESS | SCSI_RESET_BUS_RESET;
+   return SUCCESS;
 #else /* 1 */
 
/* MSch: new-style reset handling: let the mid-level do what it can */
@@ -2963,6 +2970,6 @@ static int NCR5380_bus_reset(Scsi_Cmnd *cmd)
local_irq_restore(flags);
 
/* we did no complete reset of all commands, so a wakeup is required */
-   return SCSI_RESET_WAKEUP | SCSI_RESET_BUS_RESET;
+   return SUCCESS;
 #endif /* 1 */
 }
diff --git a/drivers/scsi/atari_scsi.c b/drivers/scsi/atari_scsi.c
index cc1b013..5e19509 100644
--- a/drivers/scsi/atari_scsi.c
+++ b/drivers/scsi/atari_scsi.c
@@ -827,7 +827,7 @@ static int atari_scsi_bus_reset(Scsi_Cmnd *cmd)
} else {
 

[PATCH 0/3] m68k/atari - Atari NCR5380 SCSI driver fixes (resent)

2014-01-28 Thread Michael Schmitz
Geert,

this patch series brings the Atari NCR5380 driver up to date with current 3.x
(or perhaps even 2.6) series SCSI midlevel and error handling changes.

The first patch fixes completion condition errors contained in Arnd Bergmann's
patch ([PATCH, RFC 02/30] scsi: atari_scsi: fix sleep_on race). The locking
scheme still isn't 100% race free that way, but much improved, and I've seen
the driver successfully handle error recovery from aborting a disconnected
command via bus reset with all three patches applied (never managed to do that
since 2.4 days). 
Not sure whether this one should be taken through your tree or handled by Arnd
rather.

The other two are a rehash of old patches I had prepared somewhere along the
2.6 series - somehow or other these were lost when one of my old git trees
went pear shaped. 

Abort and reset handlers nowadays return SUCCESS or FAILED only, and the SCSI
midlevel now queues commands (in particular error handling ones) from soft
interrupt context - the Falcon locking scheme still is ill equipped to handle
that. Return codes have been changed and the reset handler in particular will
leave running command completion handlers to the midlevel now. 

If a SCSI command is queued while IDE or floppy have reserved the shared DMA
and interrupt, queue_command() may not wait for lock release and instead will
return SCSI_MLQUEUE_HOST_BUSY to indicate that. 

CC: to linux-scsi and the SCSI maintainer added as per your request. 

Cheers,

Michael
--
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/3] m68k/atari - atari_scsi: fix wait_event completion conditions

2014-01-28 Thread Michael Schmitz
Fix patch by ArndB changing falcon_get_lock to use wait_event.
Some of the completion conditions had been missed when converting
from while() {} to do {} until() logic.

Signed-off-by: Michael Schmitz 
---
 drivers/scsi/atari_scsi.c |   14 +++---
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/atari_scsi.c b/drivers/scsi/atari_scsi.c
index 1986ecb..cc1b013 100644
--- a/drivers/scsi/atari_scsi.c
+++ b/drivers/scsi/atari_scsi.c
@@ -550,10 +550,10 @@ static void falcon_get_lock(void)
 
local_irq_save(flags);
 
-   wait_event_cmd(falcon_fairness_wait,
-  !in_irq() && falcon_got_lock && stdma_others_waiting(),
-  local_irq_restore(flags),
-  local_irq_save(flags));
+   wait_event_cmd(falcon_fairness_wait,
+   in_irq() || !falcon_got_lock || !stdma_others_waiting(),
+   local_irq_restore(flags),
+   local_irq_save(flags));
 
while (!falcon_got_lock) {
if (in_irq())
@@ -566,9 +566,9 @@ static void falcon_get_lock(void)
wake_up(&falcon_try_wait);
} else {
wait_event_cmd(falcon_try_wait,
-  !falcon_got_lock && !falcon_trying_lock,
-  local_irq_restore(flags),
-  local_irq_save(flags));
+   falcon_got_lock && !falcon_trying_lock,
+   local_irq_restore(flags),
+   local_irq_save(flags));
}
}
 
-- 
1.7.0.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] cxgb4i: Use cxgb4_select_ntuple to correctly calculate ntuple fields

2014-01-28 Thread kxie
[PATCH] cxgb4i: Use cxgb4_select_ntuple to correctly calculate ntuple fields

From: Karen Xie 

Fixed calculates wrong tuple values on T5 adapter: switch to use the exported 
API cxgb4_select_ntuple() from cxgb4 base driver.

Signed-off-by: Karen Xie 
---
 drivers/scsi/cxgbi/cxgb4i/cxgb4i.c |   59 
 1 files changed, 7 insertions(+), 52 deletions(-)

diff --git a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c 
b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
index 5a9f842..e8ee5e5 100644
--- a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
+++ b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
@@ -175,52 +175,6 @@ static inline int is_ofld_imm(const struct sk_buff *skb)
sizeof(struct fw_ofld_tx_data_wr));
 }
 
-
-#define VLAN_NONE 0xfff
-#define FILTER_SEL_VLAN_NONE 0x
-#define FILTER_SEL_WIDTH_P_FC (3+1) /* port uses 3 bits, FCoE one bit */
-#define FILTER_SEL_WIDTH_VIN_P_FC \
-   (6 + 7 + FILTER_SEL_WIDTH_P_FC) /* 6 bits are unused, VF uses 7 bits*/
-#define FILTER_SEL_WIDTH_TAG_P_FC \
-   (3 + FILTER_SEL_WIDTH_VIN_P_FC) /* PF uses 3 bits */
-#define FILTER_SEL_WIDTH_VLD_TAG_P_FC (1 + FILTER_SEL_WIDTH_TAG_P_FC)
-
-static unsigned int select_ntuple(struct cxgbi_device *cdev,
-   struct l2t_entry *l2t)
-{
-   struct cxgb4_lld_info *lldi = cxgbi_cdev_priv(cdev);
-   unsigned int ntuple = 0;
-   u32 viid;
-
-   switch (lldi->filt_mode) {
-
-   /* default filter mode */
-   case HW_TPL_FR_MT_PR_IV_P_FC:
-   if (l2t->vlan == VLAN_NONE)
-   ntuple |= FILTER_SEL_VLAN_NONE << FILTER_SEL_WIDTH_P_FC;
-   else {
-   ntuple |= l2t->vlan << FILTER_SEL_WIDTH_P_FC;
-   ntuple |= 1 << FILTER_SEL_WIDTH_VLD_TAG_P_FC;
-   }
-   ntuple |= l2t->lport << S_PORT | IPPROTO_TCP <<
- FILTER_SEL_WIDTH_VLD_TAG_P_FC;
-   break;
-   case HW_TPL_FR_MT_PR_OV_P_FC: {
-   viid = cxgb4_port_viid(l2t->neigh->dev);
-
-   ntuple |= FW_VIID_VIN_GET(viid) << FILTER_SEL_WIDTH_P_FC;
-   ntuple |= FW_VIID_PFN_GET(viid) << FILTER_SEL_WIDTH_VIN_P_FC;
-   ntuple |= FW_VIID_VIVLD_GET(viid) << FILTER_SEL_WIDTH_TAG_P_FC;
-   ntuple |= l2t->lport << S_PORT | IPPROTO_TCP <<
- FILTER_SEL_WIDTH_VLD_TAG_P_FC;
-   break;
-   }
-   default:
-   break;
-   }
-   return ntuple;
-}
-
 static void send_act_open_req(struct cxgbi_sock *csk, struct sk_buff *skb,
struct l2t_entry *e)
 {
@@ -248,8 +202,6 @@ static void send_act_open_req(struct cxgbi_sock *csk, 
struct sk_buff *skb,
struct cpl_act_open_req *req =
(struct cpl_act_open_req *)skb->head;
 
-   req = (struct cpl_act_open_req *)skb->head;
-
INIT_TP_WR(req, 0);
OPCODE_TID(req) = cpu_to_be32(MK_OPCODE_TID(CPL_ACT_OPEN_REQ,
qid_atid));
@@ -258,7 +210,9 @@ static void send_act_open_req(struct cxgbi_sock *csk, 
struct sk_buff *skb,
req->local_ip = csk->saddr.sin_addr.s_addr;
req->peer_ip = csk->daddr.sin_addr.s_addr;
req->opt0 = cpu_to_be64(opt0);
-   req->params = cpu_to_be32(select_ntuple(csk->cdev, csk->l2t));
+   req->params = cpu_to_be32(cxgb4_select_ntuple(
+   csk->cdev->ports[csk->port_id],
+   csk->l2t));
opt2 |= 1 << 22;
req->opt2 = cpu_to_be32(opt2);
 
@@ -271,8 +225,6 @@ static void send_act_open_req(struct cxgbi_sock *csk, 
struct sk_buff *skb,
struct cpl_t5_act_open_req *req =
(struct cpl_t5_act_open_req *)skb->head;
 
-   req = (struct cpl_t5_act_open_req *)skb->head;
-
INIT_TP_WR(req, 0);
OPCODE_TID(req) = cpu_to_be32(MK_OPCODE_TID(CPL_ACT_OPEN_REQ,
qid_atid));
@@ -281,7 +233,10 @@ static void send_act_open_req(struct cxgbi_sock *csk, 
struct sk_buff *skb,
req->local_ip = csk->saddr.sin_addr.s_addr;
req->peer_ip = csk->daddr.sin_addr.s_addr;
req->opt0 = cpu_to_be64(opt0);
-   req->params = cpu_to_be32(select_ntuple(csk->cdev, csk->l2t));
+   req->params = cpu_to_be64(V_FILTER_TUPLE(
+   cxgb4_select_ntuple(
+   csk->cdev->ports[csk->port_id],
+   csk->l2t)));
opt2 |= 1 << 31;
req->opt2 = cpu_to_be32(opt2);
 
--
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.htm

[PATCH 1/8] be2iscsi: Fix handling timed out MBX completion from FW

2014-01-28 Thread Jayamohan Kallickal
From: Jayamohan Kallickal 

 When an MBX command timeout happens,the resources associated with
 the MBX command were freed. If FW were to give the response to
 host after the timeout value set by driver then driver crashes as the MBX Cmd
 resources were already freed.

 This patch fixes this issue by maintaing a state flag for each of
 the MBX command posted/timedout/completed.

Signed-off-by: John Soni Jose 
Signed-off-by: Jayamohan Kallickal 
---
 drivers/scsi/be2iscsi/be.h   | 10 +
 drivers/scsi/be2iscsi/be_cmds.c  | 90 ++--
 drivers/scsi/be2iscsi/be_cmds.h  |  3 +-
 drivers/scsi/be2iscsi/be_iscsi.c | 10 +++--
 drivers/scsi/be2iscsi/be_main.c  | 27 
 drivers/scsi/be2iscsi/be_mgmt.c  | 22 +-
 6 files changed, 117 insertions(+), 45 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be.h b/drivers/scsi/be2iscsi/be.h
index 2e28f6c..23c73fe 100644
--- a/drivers/scsi/be2iscsi/be.h
+++ b/drivers/scsi/be2iscsi/be.h
@@ -98,6 +98,14 @@ struct be_mcc_obj {
struct be_queue_info cq;
 };
 
+struct beiscsi_mcc_tag_state {
+#define MCC_TAG_STATE_COMPLETED 0x00
+#define MCC_TAG_STATE_RUNNING   0x01
+#define MCC_TAG_STATE_TIMEOUT   0x02
+   uint8_t tag_state;
+   struct be_dma_mem tag_mem_state;
+};
+
 struct be_ctrl_info {
u8 __iomem *csr;
u8 __iomem *db; /* Door Bell */
@@ -122,6 +130,8 @@ struct be_ctrl_info {
unsigned short mcc_alloc_index;
unsigned short mcc_free_index;
unsigned int mcc_tag_available;
+
+   struct beiscsi_mcc_tag_state ptag_state[MAX_MCC_CMD + 1];
 };
 
 #include "be_cmds.h"
diff --git a/drivers/scsi/be2iscsi/be_cmds.c b/drivers/scsi/be2iscsi/be_cmds.c
index 3338391..b14949a 100644
--- a/drivers/scsi/be2iscsi/be_cmds.c
+++ b/drivers/scsi/be2iscsi/be_cmds.c
@@ -138,7 +138,7 @@ unsigned int alloc_mcc_tag(struct beiscsi_hba *phba)
  * @phba: Driver private structure
  * @tag: Tag for the MBX Command
  * @wrb: the WRB used for the MBX Command
- * @cmd_hdr: IOCTL Hdr for the MBX Cmd
+ * @mbx_cmd_mem: ptr to memory allocated for MBX Cmd
  *
  * Waits for MBX completion with the passed TAG.
  *
@@ -148,21 +148,26 @@ unsigned int alloc_mcc_tag(struct beiscsi_hba *phba)
  **/
 int beiscsi_mccq_compl(struct beiscsi_hba *phba,
uint32_t tag, struct be_mcc_wrb **wrb,
-   void *cmd_hdr)
+   struct be_dma_mem *mbx_cmd_mem)
 {
int rc = 0;
uint32_t mcc_tag_response;
uint16_t status = 0, addl_status = 0, wrb_num = 0;
struct be_mcc_wrb *temp_wrb;
-   struct be_cmd_req_hdr *ioctl_hdr;
-   struct be_cmd_resp_hdr *ioctl_resp_hdr;
+   struct be_cmd_req_hdr *mbx_hdr;
+   struct be_cmd_resp_hdr *mbx_resp_hdr;
struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q;
 
if (beiscsi_error(phba)) {
free_mcc_tag(&phba->ctrl, tag);
-   return -EIO;
+   return -EPERM;
}
 
+   /* Set MBX Tag state to Active */
+   spin_lock(&phba->ctrl.mbox_lock);
+   phba->ctrl.ptag_state[tag].tag_state = MCC_TAG_STATE_RUNNING;
+   spin_unlock(&phba->ctrl.mbox_lock);
+
/* wait for the mccq completion */
rc = wait_event_interruptible_timeout(
phba->ctrl.mcc_wait[tag],
@@ -171,56 +176,71 @@ int beiscsi_mccq_compl(struct beiscsi_hba *phba,
BEISCSI_HOST_MBX_TIMEOUT));
 
if (rc <= 0) {
+   struct be_dma_mem *tag_mem;
+   /* Set MBX Tag state to timeout */
+   spin_lock(&phba->ctrl.mbox_lock);
+   phba->ctrl.ptag_state[tag].tag_state = MCC_TAG_STATE_TIMEOUT;
+   spin_unlock(&phba->ctrl.mbox_lock);
+
+   /* Store resource addr to be freed later */
+   tag_mem = &phba->ctrl.ptag_state[tag].tag_mem_state;
+   if (mbx_cmd_mem) {
+   tag_mem->size = mbx_cmd_mem->size;
+   tag_mem->va = mbx_cmd_mem->va;
+   tag_mem->dma = mbx_cmd_mem->dma;
+   } else
+   tag_mem->size = 0;
+
beiscsi_log(phba, KERN_ERR,
BEISCSI_LOG_INIT | BEISCSI_LOG_EH |
BEISCSI_LOG_CONFIG,
"BC_%d : MBX Cmd Completion timed out\n");
-   rc = -EBUSY;
-
-   /* decrement the mccq used count */
-   atomic_dec(&phba->ctrl.mcc_obj.q.used);
-
-   goto release_mcc_tag;
-   } else
+   return -EBUSY;
+   } else {
rc = 0;
+   /* Set MBX Tag state to completed */
+   spin_lock(&phba->ctrl.mbox_lock);
+   phba->ctrl.ptag_state[tag].tag_state = MCC_TAG_STATE_COMPLETED;
+   spin_unlock(&phba->ctrl.mbox_lock);
+   }
 
mcc_tag_response = phba->ctrl.mcc_numtag[tag];
status = (mcc_tag_response & CQE_STATUS_

[PATCH 2/8] be2iscsi: Fix port speed typo in driver.

2014-01-28 Thread Jayamohan Kallickal
From: Jayamohan Kallickal 

 The 100Mbps port speed macro used was not proper.

Signed-off-by: John Soni Jose 
Signed-off-by: Jayamohan Kallickal 
---
 drivers/scsi/be2iscsi/be_iscsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/be2iscsi/be_iscsi.c b/drivers/scsi/be2iscsi/be_iscsi.c
index bdd0f05..a7a210e 100644
--- a/drivers/scsi/be2iscsi/be_iscsi.c
+++ b/drivers/scsi/be2iscsi/be_iscsi.c
@@ -793,7 +793,7 @@ static int beiscsi_get_port_speed(struct Scsi_Host *shost)
ihost->port_speed = ISCSI_PORT_SPEED_10MBPS;
break;
case BE2ISCSI_LINK_SPEED_100MBPS:
-   ihost->port_speed = BE2ISCSI_LINK_SPEED_100MBPS;
+   ihost->port_speed = ISCSI_PORT_SPEED_100MBPS;
break;
case BE2ISCSI_LINK_SPEED_1GBPS:
ihost->port_speed = ISCSI_PORT_SPEED_1GBPS;
-- 
1.8.5.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 5/8] be2iscsi: Fix the session cleanup when reboot/shutdown happens

2014-01-28 Thread Jayamohan Kallickal
From: Jayamohan Kallickal 

 In iSCSI Boot scenario, when machine is reboot/shutdown phase
 the active sessions are not closed. Driver queue cleanup is
 done as part of unload and device is disabled.

 Sessions are still active, iSCSI commands are issued from
 session which comes to driver, as driver cleanup and device
 disabled there is kernel stack dump with errors.

 Fix is invoking iscsi_session_failure with ISCSI_ERR_INVALID_HOST
 on all the active sessions when shutdown routine is called.

Signed-off-by: John Soni Jose 
Signed-off-by: Jayamohan Kallickal 
---
 drivers/scsi/be2iscsi/be.h   |  1 +
 drivers/scsi/be2iscsi/be_cmds.c  | 17 -
 drivers/scsi/be2iscsi/be_cmds.h  |  1 +
 drivers/scsi/be2iscsi/be_iscsi.c |  1 +
 drivers/scsi/be2iscsi/be_main.c  |  2 ++
 drivers/scsi/be2iscsi/be_main.h  |  5 +
 6 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/be2iscsi/be.h b/drivers/scsi/be2iscsi/be.h
index 23c73fe..1bfb0bd 100644
--- a/drivers/scsi/be2iscsi/be.h
+++ b/drivers/scsi/be2iscsi/be.h
@@ -139,6 +139,7 @@ struct be_ctrl_info {
 #define PAGE_SHIFT_4K 12
 #define PAGE_SIZE_4K (1 << PAGE_SHIFT_4K)
 #define mcc_timeout12 /* 12s timeout */
+#define BEISCSI_LOGOUT_SYNC_DELAY  250
 
 /* Returns number of pages spanned by the data starting at the given addr */
 #define PAGES_4K_SPANNED(_address, size)   \
diff --git a/drivers/scsi/be2iscsi/be_cmds.c b/drivers/scsi/be2iscsi/be_cmds.c
index 86d91f3..1432ed5 100644
--- a/drivers/scsi/be2iscsi/be_cmds.c
+++ b/drivers/scsi/be2iscsi/be_cmds.c
@@ -400,8 +400,23 @@ static struct be_mcc_compl *be_mcc_compl_get(struct 
beiscsi_hba *phba)
return NULL;
 }
 
-static void be2iscsi_fail_session(struct iscsi_cls_session *cls_session)
+/**
+ * be2iscsi_fail_session(): Closing session with appropriate error
+ * @cls_session: ptr to session
+ *
+ * Depending on adapter state appropriate error flag is passed.
+ **/
+void be2iscsi_fail_session(struct iscsi_cls_session *cls_session)
 {
+   struct Scsi_Host *shost = iscsi_session_to_shost(cls_session);
+   struct beiscsi_hba *phba = iscsi_host_priv(shost);
+   uint32_t iscsi_err_flag;
+
+   if (phba->state & BE_ADAPTER_STATE_SHUTDOWN)
+   iscsi_err_flag = ISCSI_ERR_INVALID_HOST;
+   else
+   iscsi_err_flag = ISCSI_ERR_CONN_FAILED;
+
iscsi_session_failure(cls_session->dd_data, ISCSI_ERR_CONN_FAILED);
 }
 
diff --git a/drivers/scsi/be2iscsi/be_cmds.h b/drivers/scsi/be2iscsi/be_cmds.h
index 59abd27..64b60e7 100644
--- a/drivers/scsi/be2iscsi/be_cmds.h
+++ b/drivers/scsi/be2iscsi/be_cmds.h
@@ -1325,4 +1325,5 @@ void be_wrb_hdr_prepare(struct be_mcc_wrb *wrb, int 
payload_len,
 void be_cmd_hdr_prepare(struct be_cmd_req_hdr *req_hdr,
u8 subsystem, u8 opcode, int cmd_len);
 
+void be2iscsi_fail_session(struct iscsi_cls_session *cls_session);
 #endif /* !BEISCSI_CMDS_H */
diff --git a/drivers/scsi/be2iscsi/be_iscsi.c b/drivers/scsi/be2iscsi/be_iscsi.c
index a7a210e..a3df433 100644
--- a/drivers/scsi/be2iscsi/be_iscsi.c
+++ b/drivers/scsi/be2iscsi/be_iscsi.c
@@ -1361,6 +1361,7 @@ void beiscsi_ep_disconnect(struct iscsi_endpoint *ep)
beiscsi_mccq_compl(phba, tag, NULL, NULL);
beiscsi_close_conn(beiscsi_ep, tcp_upload_flag);
 free_ep:
+   msleep(BEISCSI_LOGOUT_SYNC_DELAY);
beiscsi_free_ep(beiscsi_ep);
beiscsi_unbind_conn_to_cid(phba, beiscsi_ep->ep_cid);
iscsi_destroy_endpoint(beiscsi_ep->openiscsi_ep);
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 257e2d2..ee6094c 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -5383,6 +5383,8 @@ static void beiscsi_shutdown(struct pci_dev *pcidev)
return;
}
 
+   phba->state = BE_ADAPTER_STATE_SHUTDOWN;
+   iscsi_host_for_each_session(phba->shost, be2iscsi_fail_session);
beiscsi_quiesce(phba, BEISCSI_CLEAN_UNLOAD);
pci_disable_device(pcidev);
 }
diff --git a/drivers/scsi/be2iscsi/be_main.h b/drivers/scsi/be2iscsi/be_main.h
index 224a8ae..f86b7f1 100644
--- a/drivers/scsi/be2iscsi/be_main.h
+++ b/drivers/scsi/be2iscsi/be_main.h
@@ -97,9 +97,14 @@
 
 #define INVALID_SESS_HANDLE0x
 
+/**
+ * Adapter States
+ **/
 #define BE_ADAPTER_LINK_UP 0x001
 #define BE_ADAPTER_LINK_DOWN   0x002
 #define BE_ADAPTER_PCI_ERR 0x004
+#define BE_ADAPTER_STATE_SHUTDOWN  0x008
+
 
 #define BEISCSI_CLEAN_UNLOAD   0x01
 #define BEISCSI_EEH_UNLOAD 0x02
-- 
1.8.5.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 4/8] be2iscsi: Fix doorbell format for EQ/CQ/RQ s per SLI spec.

2014-01-28 Thread Jayamohan Kallickal
From: Jayamohan Kallickal 

 The doorbel format has been updated to support additonal functionalities
 of SKH-R adapter. These changes are made such that older FW also works fine.

Signed-off-by: John Soni Jose 
Signed-off-by: Jayamohan Kallickal 
---
 drivers/scsi/be2iscsi/be_cmds.c | 14 +-
 drivers/scsi/be2iscsi/be_cmds.h |  6 +++---
 drivers/scsi/be2iscsi/be_main.c | 25 ++---
 drivers/scsi/be2iscsi/be_main.h | 16 ++--
 4 files changed, 40 insertions(+), 21 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be_cmds.c b/drivers/scsi/be2iscsi/be_cmds.c
index b14949a..86d91f3 100644
--- a/drivers/scsi/be2iscsi/be_cmds.c
+++ b/drivers/scsi/be2iscsi/be_cmds.c
@@ -432,18 +432,6 @@ void beiscsi_async_link_state_process(struct beiscsi_hba 
*phba,
}
 }
 
-static void beiscsi_cq_notify(struct beiscsi_hba *phba, u16 qid, bool arm,
-  u16 num_popped)
-{
-   u32 val = 0;
-   val |= qid & DB_CQ_RING_ID_MASK;
-   if (arm)
-   val |= 1 << DB_CQ_REARM_SHIFT;
-   val |= num_popped << DB_CQ_NUM_POPPED_SHIFT;
-   iowrite32(val, phba->db_va + DB_CQ_OFFSET);
-}
-
-
 int beiscsi_process_mcc(struct beiscsi_hba *phba)
 {
struct be_mcc_compl *compl;
@@ -474,7 +462,7 @@ int beiscsi_process_mcc(struct beiscsi_hba *phba)
}
 
if (num)
-   beiscsi_cq_notify(phba, phba->ctrl.mcc_obj.cq.id, true, num);
+   hwi_ring_cq_db(phba, phba->ctrl.mcc_obj.cq.id, num, 1, 0);
 
spin_unlock_bh(&phba->ctrl.mcc_cq_lock);
return status;
diff --git a/drivers/scsi/be2iscsi/be_cmds.h b/drivers/scsi/be2iscsi/be_cmds.h
index 69f849e..59abd27 100644
--- a/drivers/scsi/be2iscsi/be_cmds.h
+++ b/drivers/scsi/be2iscsi/be_cmds.h
@@ -103,7 +103,7 @@ struct be_mcc_compl {
 
 /** MCC door bell /
 #define DB_MCCQ_OFFSET 0x140
-#define DB_MCCQ_RING_ID_MASK 0x7FF /* bits 0 - 10 */
+#define DB_MCCQ_RING_ID_MASK 0x/* bits 0 - 15 */
 /* Number of entries posted */
 #define DB_MCCQ_NUM_POSTED_SHIFT 16/* bits 16 - 29 */
 
@@ -1025,8 +1025,8 @@ struct be_mcc_wrb_context {
int *users_final_status;
 } __packed;
 
-#define DB_DEF_PDU_RING_ID_MASK0x3FF   /* bits 0 - 9 */
-#define DB_DEF_PDU_CQPROC_MASK 0x3FFF  /* bits 0 - 9 */
+#define DB_DEF_PDU_RING_ID_MASK0x3FFF  /* bits 0 - 13 */
+#define DB_DEF_PDU_CQPROC_MASK 0x3FFF  /* bits 16 - 29 */
 #define DB_DEF_PDU_REARM_SHIFT 14
 #define DB_DEF_PDU_EVENT_SHIFT 15
 #define DB_DEF_PDU_CQPROC_SHIFT16
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 89bf558..257e2d2 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -811,14 +811,23 @@ static void hwi_ring_eq_db(struct beiscsi_hba *phba,
   unsigned char rearm, unsigned char event)
 {
u32 val = 0;
-   val |= id & DB_EQ_RING_ID_MASK;
+
if (rearm)
val |= 1 << DB_EQ_REARM_SHIFT;
if (clr_interrupt)
val |= 1 << DB_EQ_CLR_SHIFT;
if (event)
val |= 1 << DB_EQ_EVNT_SHIFT;
+
val |= num_processed << DB_EQ_NUM_POPPED_SHIFT;
+   /* Setting lower order EQ_ID Bits */
+   val |= (id & DB_EQ_RING_ID_LOW_MASK);
+
+   /* Setting Higher order EQ_ID Bits */
+   val |= (((id >> DB_EQ_HIGH_FEILD_SHIFT) &
+ DB_EQ_RING_ID_HIGH_MASK)
+ << DB_EQ_HIGH_SET_SHIFT);
+
iowrite32(val, phba->db_va + DB_EQ_OFFSET);
 }
 
@@ -1150,15 +1159,25 @@ free_msix_irqs:
return ret;
 }
 
-static void hwi_ring_cq_db(struct beiscsi_hba *phba,
+void hwi_ring_cq_db(struct beiscsi_hba *phba,
   unsigned int id, unsigned int num_processed,
   unsigned char rearm, unsigned char event)
 {
u32 val = 0;
-   val |= id & DB_CQ_RING_ID_MASK;
+
if (rearm)
val |= 1 << DB_CQ_REARM_SHIFT;
+
val |= num_processed << DB_CQ_NUM_POPPED_SHIFT;
+
+   /* Setting lower order CQ_ID Bits */
+   val |= (id & DB_CQ_RING_ID_LOW_MASK);
+
+   /* Setting Higher order CQ_ID Bits */
+   val |= (((id >> DB_CQ_HIGH_FEILD_SHIFT) &
+ DB_CQ_RING_ID_HIGH_MASK)
+ << DB_CQ_HIGH_SET_SHIFT);
+
iowrite32(val, phba->db_va + DB_CQ_OFFSET);
 }
 
diff --git a/drivers/scsi/be2iscsi/be_main.h b/drivers/scsi/be2iscsi/be_main.h
index 0076119..224a8ae 100644
--- a/drivers/scsi/be2iscsi/be_main.h
+++ b/drivers/scsi/be2iscsi/be_main.h
@@ -135,11 +135,15 @@
 #define DB_RXULP0_OFFSET 0xA0
 /* Event Q door bell */
 #define DB_EQ_OFFSET   DB_CQ_OFFSET
-#define DB_EQ_RING_ID_MASK 0x1FF   /* bits 0 - 8 */
+#define DB_EQ_RING_ID_LOW_MASK 0x1FF   /* bits 0 - 8 */
 /* Clear the interrupt for this eq */
 #define DB_EQ_CLR_SHIFT(9

[PATCH 3/8] be2iscsi : Fix IRQ_Affinity support in driver.

2014-01-28 Thread Jayamohan Kallickal
From: Jayamohan Kallickal 

 Provides IRQ_Affinity setting for the driver. Enabling IRQ_Affinity
 is through  module params. Default IRQ_AFFINITY  support is OFF.

Signed-off-by: John Soni Jose 
Signed-off-by: Jayamohan Kallickal 
---
 drivers/scsi/be2iscsi/be_cmds.h |  9 +++-
 drivers/scsi/be2iscsi/be_main.c | 97 +++--
 drivers/scsi/be2iscsi/be_main.h | 22 +++---
 drivers/scsi/be2iscsi/be_mgmt.c | 63 --
 drivers/scsi/be2iscsi/be_mgmt.h | 49 ++---
 5 files changed, 222 insertions(+), 18 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be_cmds.h b/drivers/scsi/be2iscsi/be_cmds.h
index 770b6c8..69f849e 100644
--- a/drivers/scsi/be2iscsi/be_cmds.h
+++ b/drivers/scsi/be2iscsi/be_cmds.h
@@ -174,6 +174,7 @@ struct be_mcc_mailbox {
 #define OPCODE_COMMON_EQ_DESTROY   55
 #define OPCODE_COMMON_QUERY_FIRMWARE_CONFIG58
 #define OPCODE_COMMON_FUNCTION_RESET   61
+#define OPCODE_COMMON_GET_CNTL_ADV_ATTRIB  121
 
 /**
  * LIST of opcodes that are common between Initiator and Target
@@ -197,6 +198,8 @@ struct be_mcc_mailbox {
 #define OPCODE_COMMON_ISCSI_WRBQ_CREATE66
 #define OPCODE_COMMON_ISCSI_WRBQ_DESTROY   67
 
+#define MBOX_CMD_V20x01
+
 struct be_cmd_req_hdr {
u8 opcode;  /* dword 0 */
u8 subsystem;   /* dword 0 */
@@ -966,6 +969,9 @@ struct amap_it_dmsg_cqe_v2 {
 #define DB_DEF_PDU_WRB_INDEX_SHIFT 16
 #define DB_DEF_PDU_NUM_POSTED_SHIFT24
 
+#define BEISCSI_IFD_STATE_DISABLE  0x0
+#define BEISCSI_IFD_STATE_ENABLE   0x1
+
 struct fragnum_bits_for_sgl_cra_in {
struct be_cmd_req_hdr hdr;
u32 num_bits;
@@ -1002,7 +1008,8 @@ struct tcp_connect_and_offload_in {
u16 hdr_ring_id;
u16 data_ring_id;
u8 do_offload;
-   u8 rsvd0[3];
+   u8 ifd_state;
+   u8 rsvd0[2];
 } __packed;
 
 struct tcp_connect_and_offload_out {
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 1a1729b..89bf558 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -47,6 +47,7 @@
 static unsigned int be_iopoll_budget = 10;
 static unsigned int be_max_phys_size = 64;
 static unsigned int enable_msix = 1;
+static unsigned int beiscsi_irq_affinity_enable;
 
 MODULE_DEVICE_TABLE(pci, beiscsi_pci_id_table);
 MODULE_DESCRIPTION(DRV_DESC " " BUILD_STR);
@@ -59,6 +60,7 @@ module_param(be_max_phys_size, uint, S_IRUGO);
 MODULE_PARM_DESC(be_max_phys_size,
"Maximum Size (In Kilobytes) of physically contiguous "
"memory that can be allocated. Range is 16 - 128");
+module_param(beiscsi_irq_affinity_enable, uint, 0);
 
 #define beiscsi_disp_param(_name)\
 ssize_t\
@@ -1026,6 +1028,46 @@ static irqreturn_t be_isr(int irq, void *dev_id)
}
 }
 
+static void beiscsi_set_irq_affinity_params(struct beiscsi_hba *phba,
+   uint16_t cpu_index, uint16_t eqcq_index, uint16_t msix_vec)
+{
+   struct hwi_controller *phwi_ctrlr;
+   struct hwi_context_memory *phwi_context;
+
+   phwi_ctrlr = phba->phwi_ctrlr;
+   phwi_context = phwi_ctrlr->phwi_ctxt;
+
+   if (msix_vec) {
+   if (cpu_online(cpu_index))
+   cpumask_set_cpu(cpu_index,
+   &phba->msix_cpu_map[
+   cpu_index].affinity_mask);
+   else
+   cpumask_copy(&phba->msix_cpu_map[
+cpu_index].affinity_mask,
+cpu_online_mask);
+
+   phba->msix_cpu_map[cpu_index].eq_id =
+   phwi_context->be_eq[eqcq_index].q.id;
+   phba->msix_cpu_map[cpu_index].cq_id =
+   phwi_context->be_cq[eqcq_index].id;
+   phba->msix_cpu_map[cpu_index].cpu_id = cpu_index;
+   phba->msix_cpu_map[cpu_index].nvec = msix_vec;
+   phba->msix_cpu_map[cpu_index].node_id =
+   cpu_to_node(cpu_index);
+
+   irq_set_affinity_hint(msix_vec,
+ &phba->msix_cpu_map[
+ cpu_index].affinity_mask);
+   } else {
+   phba->msix_cpu_map[cpu_index].eq_id =
+   phba->msix_cpu_map[eqcq_index].eq_id;
+   phba->msix_cpu_map[cpu_index].cq_id =
+   phba->msix_cpu_map[eqcq_index].cq_id;
+   phba->msix_cpu_map[cpu_index].cpu_id = cpu_index;
+   }
+}
+
 static int beiscsi_init_irqs(struct beiscsi_hba *phba)
 {
struct pci_dev *pcidev = phba->pcidev;
@@ -1059,7 +1101,11 @@ static int beiscsi_init_irqs(struct beiscsi_hba *phba)
kfree(phba->msi_name[i]);
goto free_msix_irqs;
  

[PATCH 8/8] be2iscsi : Bump the driver version

2014-01-28 Thread Jayamohan Kallickal
From: Jayamohan Kallickal 

Bump Driver Version

Signed-off-by: John Soni Jose 
Signed-off-by: Jayamohan Kallickal 
---
 drivers/scsi/be2iscsi/be_main.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/be2iscsi/be_main.h b/drivers/scsi/be2iscsi/be_main.h
index f86b7f1..09ba0b9 100644
--- a/drivers/scsi/be2iscsi/be_main.h
+++ b/drivers/scsi/be2iscsi/be_main.h
@@ -36,7 +36,7 @@
 #include 
 
 #define DRV_NAME   "be2iscsi"
-#define BUILD_STR  "10.0.659.0"
+#define BUILD_STR  "10.2.125.0"
 #define BE_NAME"Emulex OneConnect" \
"Open-iSCSI Driver version" BUILD_STR
 #define DRV_DESC   BE_NAME " " "Driver"
-- 
1.8.5.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 V2 0/8] be2iscsi: Update to 10.2.125.0

2014-01-28 Thread Jayamohan Kallickal
From: Jayamohan Kallickal 

This patchset updates be2iscsi driver to 10.2.125.0. 

Regarding comments by Mike Christie  on Version 1 

 Patch 5/7) - converted to common function
 Patch 4/7  - Will withdraw for now as there is lots of
changes to be done.

These patches are based of scsi.git scsi

 0001 - Fix handling timed out MBX completion from FW
 0002 - Fix port speed typo in driver
 0003 - Fix IRQ_Affinity support in driver
 0004 - Fix doorbell format for EQ CQ RQ per SLI
 0005 - Fix the session cleanup when reboot shutdown
 0006 - Fix scsi_cmnd leakage in driver
 0007 - Fix DMA Out of SW IOMMU space error
 0008 - Bump the driver version


Thanks
Jay

Signed-off-by: Jayamohan Kallickal 
---
--
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 7/8] be2iscsi : Fix DMA Out of SW-IOMMU space error

2014-01-28 Thread Jayamohan Kallickal
From: Jayamohan Kallickal 

 Setting DMA bit mask 64 and roll back to 32 if not supported.

Signed-off-by: Minh Tran 
Signed-off-by: Jayamohan Kallickal 
---
 drivers/scsi/be2iscsi/be_main.c | 15 +--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index d9bd4b9..dd7eb12 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -681,8 +681,19 @@ static int beiscsi_enable_pci(struct pci_dev *pcidev)
}
 
pci_set_master(pcidev);
-   if (pci_set_consistent_dma_mask(pcidev, DMA_BIT_MASK(64))) {
-   ret = pci_set_consistent_dma_mask(pcidev, DMA_BIT_MASK(32));
+   ret = pci_set_dma_mask(pcidev, DMA_BIT_MASK(64));
+   if (ret) {
+   ret = pci_set_dma_mask(pcidev, DMA_BIT_MASK(32));
+   if (ret) {
+   dev_err(&pcidev->dev, "Could not set PCI DMA Mask\n");
+   pci_disable_device(pcidev);
+   return ret;
+   } else {
+   ret = pci_set_consistent_dma_mask(pcidev,
+ DMA_BIT_MASK(32));
+   }
+   } else {
+   ret = pci_set_consistent_dma_mask(pcidev, DMA_BIT_MASK(64));
if (ret) {
dev_err(&pcidev->dev, "Could not set PCI DMA Mask\n");
pci_disable_device(pcidev);
-- 
1.8.5.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 6/8] be2iscsi: Fix scsi_cmnd leakage in driver.

2014-01-28 Thread Jayamohan Kallickal
From: Jayamohan Kallickal 

 scsi_cmnd n io_task was not NULL when
  - Link goes down while IO was happening and session is closed.
  - Task for which TMF was sent.

Signed-off-by: John Soni Jose 
Signed-off-by: Jayamohan Kallickal 
---
 drivers/scsi/be2iscsi/be_main.c | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index ee6094c..d9bd4b9 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -1418,8 +1418,10 @@ be_complete_io(struct beiscsi_conn *beiscsi_conn,
resid = csol_cqe->res_cnt;
 
if (!task->sc) {
-   if (io_task->scsi_cmnd)
+   if (io_task->scsi_cmnd) {
scsi_dma_unmap(io_task->scsi_cmnd);
+   io_task->scsi_cmnd = NULL;
+   }
 
return;
}
@@ -1456,6 +1458,7 @@ be_complete_io(struct beiscsi_conn *beiscsi_conn,
conn->rxdata_octets += resid;
 unmap:
scsi_dma_unmap(io_task->scsi_cmnd);
+   io_task->scsi_cmnd = NULL;
iscsi_complete_scsi_task(task, exp_cmdsn, max_cmdsn);
 }
 
@@ -4705,6 +4708,11 @@ static void beiscsi_cleanup_task(struct iscsi_task *task)
spin_unlock(&phba->io_sgl_lock);
io_task->psgl_handle = NULL;
}
+
+   if (io_task->scsi_cmnd) {
+   scsi_dma_unmap(io_task->scsi_cmnd);
+   io_task->scsi_cmnd = NULL;
+   }
} else {
if (!beiscsi_conn->login_in_progress)
beiscsi_free_mgmt_task_handles(beiscsi_conn, task);
-- 
1.8.5.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