Re: [RFC PATCH] target: sanitize ALUA and PR state file paths before use

2018-12-10 Thread David Disseldorp
Ping - any feedback on this change?

On Thu, 22 Nov 2018 14:38:00 +0100, David Disseldorp wrote:

> Block ALUA and PR state storage if any of the dynamic subdirectory
> components include a path separator.
> 
> Fixes: c66ac9db8d4a ("[SCSI] target: Add LIO target core v4.0.0-rc6")
> Signed-off-by: David Disseldorp 
> Signed-off-by: Lee Duncan 
> ---
> Note:
> Submitted as an RFC, as I've not properly tested the alua code path.
> I'm also not sure whether it's reasonable to break existing setups
> with a '/' in the configured unit_serial. Where "break" means fail
> APTPL PR requests; ALUA state-save failures are ignored internally.

I'd also be happy with any pointers on properly testing ALUA.

Cheers, David


[Bug 201953] New: System freeze/hang during shutdown/restart (at " sd 0:0:0:0: [sda] Stopping disk")

2018-12-10 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=201953

Bug ID: 201953
   Summary: System freeze/hang during shutdown/restart (at " sd
0:0:0:0:  [sda] Stopping disk")
   Product: SCSI Drivers
   Version: 2.5
Kernel Version: 4.*  ish (i checked many distros and everything has
it))
  Hardware: Intel
OS: Linux
  Tree: Mainline
Status: NEW
  Severity: high
  Priority: P1
 Component: Other
  Assignee: scsi_drivers-ot...@kernel-bugs.osdl.org
  Reporter: sivadasrajan...@gmail.com
Regression: No

Created attachment 279923
  --> https://bugzilla.kernel.org/attachment.cgi?id=279923&action=edit
phphoto of frozen screen during shutdown(screen is black during restart hang)

I was using kali linux 2018.2 on my laptop(hardware specs at the end) without
any problem. then i replaced my hard disk with an ssd and this problem started
during 95% of shutdowns/restart


The real problem


1)When i shutdown the system hangs at this specific step(photo of frozen screen
during shutdown is  attached,for restart screen goes black and hang)

2)when i restart screen turns off (goes black/backlight turns off) but still
frozen (hdd/wifi/numlock leds stuck)

the last messege on screen is the following

 "sd 0:0:0:0:  [sda] Stopping disk"


  i tried the following distros and all has the same problem (why i 
concluded this is a kernel issue)
   => kali 2018.2 
   => ubuntu 18.4 LTS
   => fedora workstation 29-1.2
   => openSUSE Tumbleweed 20181120 (netinstall)

NOTE:
1) this system used to have a baytrail cstate freeze bug 
   https://bugzilla.kernel.org/show_bug.cgi?id=109051

   and fixed with the boot parameter



you may find the following info useful 


HARDWARE of my SYSTEM
=

i use a laptop HP-15-r250tu with the following hardware

 cpu: intel pentum N3540
 ram: 4gb samsung ddr3 
 graphics: intel hd graphics (Vendor ID: 0x8086,Device ID: 0x0F31)
 storage: KINGSTON A400 SSD 240GB (SA400S37/240g) 



===

My findings:(maybe somone find this useful,probably not for experts )
--

i have no prior experiance with linux kernel code. but i downloaded linux
source v4.19.8 and found these

 *) the kernel module that issue this "Stop disk" command is 
sd (drivers/scsi/sd.c)

  *)and this traces to a general function call to execute all scsi commands
 which is 
 "scsi_execute(sdp, cmd, DMA_NONE, NULL, 0, NULL, &sshdr,SD_TIMEOUT, 
  SD_MAX_RETRIES, 0, RQF_PM, NULL)"

My conclusion(from my knowledge and understanding :-) )


   probably cause is "scsi_execute" function not returning, so that  it put the
system in a very long wait .






THats all i have 
hope we togather can fix this

-- 
You are receiving this mail because:
You are watching the assignee of the bug.


Re: [PATCH] scsi: qla2xxx: disabling pci error handler early

2018-12-10 Thread Anatoliy Glagolev
Thanks, Brian. Great point. Even for AER, it looks like in-flight
error handler completion is not guaranteed on
pci_disable_pcie_error_reporting call, so the crash is still possible.
It looks like we need to maintain per-pci_dev context and keep track
of in-flight callbacks to make a clean fix. I will send a new patch.

On Fri, Dec 07, 2018 at 04:00:27PM -0600, Brian King wrote:
> On 12/07/2018 01:56 PM, Anatoliy Glagolev wrote:
> > qla2x00_disable_board_on_pci_error and pcie error handlers may run
> > in parallel. Specifically, I observed qla2xxx_pci_slot_reset running
> > at around the same moment as qla2x00_disable_board_on_pci_error.
> > If scsi_qla_host_t or qla_hw_data structs are removed before an error
> > handler completes, the handler crashes.
> > 
> > This patch disables pcie error handling early in
> > qla2x00_disable_board_on_pci_error and in other paths that remove
> > those structs.
> 
> While this may fix this issue for PCIe AER, I think you'll still have
> the exposure for EEH errors on a Power system, since we don't have
> the pci_enable_pcie_error_reporting API wired up to do anything,
> nor do we have much ability to do anything with it since its an
> attribute of the hardware.
> 
> Is there a way to fix this that doesn't break Power?
> 
> Thanks,
> 
> Brian
> 
> > 
> > Signed-off-by: Anatoliy Glagolev 
> > ---
> >  drivers/scsi/qla2xxx/qla_os.c | 15 +--
> >  1 file changed, 9 insertions(+), 6 deletions(-)
> > 
> > diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
> > index e881fce..b8f277a 100644
> > --- a/drivers/scsi/qla2xxx/qla_os.c
> > +++ b/drivers/scsi/qla2xxx/qla_os.c
> > @@ -2775,9 +2775,6 @@ static void qla2x00_iocb_work_fn(struct work_struct 
> > *work)
> > return ret;
> > }
> > 
> > -   /* This may fail but that's ok */
> > -   pci_enable_pcie_error_reporting(pdev);
> > -
> > ha = kzalloc(sizeof(struct qla_hw_data), GFP_KERNEL);
> > if (!ha) {
> > ql_log_pci(ql_log_fatal, pdev, 0x0009,
> > @@ -3039,6 +3036,9 @@ static void qla2x00_iocb_work_fn(struct work_struct 
> > *work)
> > goto probe_hw_failed;
> > }
> > 
> > +   /* This may fail but that's ok */
> > +   pci_enable_pcie_error_reporting(pdev);
> > +
> > pci_set_drvdata(pdev, base_vha);
> > set_bit(PFLG_DRIVER_PROBING, &base_vha->pci_flags);
> > 
> > @@ -3400,6 +3400,8 @@ static void qla2x00_iocb_work_fn(struct work_struct 
> > *work)
> > kthread_stop(t);
> > }
> > 
> > +   pci_disable_pcie_error_reporting();
> > +
> > qla2x00_free_device(base_vha);
> > scsi_host_put(base_vha->host);
> > /*
> > @@ -3625,6 +3627,8 @@ static void qla2x00_iocb_work_fn(struct work_struct 
> > *work)
> > }
> > qla2x00_wait_for_hba_ready(base_vha);
> > 
> > +   pci_disable_pcie_error_reporting(pdev);
> > +
> > qla2x00_wait_for_sess_deletion(base_vha);
> > 
> > /*
> > @@ -3698,8 +3702,6 @@ static void qla2x00_iocb_work_fn(struct work_struct 
> > *work)
> > pci_release_selected_regions(ha->pdev, ha->bars);
> > kfree(ha);
> > 
> > -   pci_disable_pcie_error_reporting(pdev);
> > -
> > pci_disable_device(pdev);
> >  }
> > 
> > @@ -5826,6 +5828,8 @@ void qla2x00_relogin(struct scsi_qla_host *vha)
> > return;
> > }
> > 
> > +   pci_disable_pcie_error_reporting(pdev);
> > +
> > qla2x00_wait_for_sess_deletion(base_vha);
> > 
> > set_bit(UNLOADING, &base_vha->dpc_flags);
> > @@ -5866,7 +5870,6 @@ void qla2x00_relogin(struct scsi_qla_host *vha)
> > qla2x00_unmap_iobases(ha);
> > 
> > pci_release_selected_regions(ha->pdev, ha->bars);
> > -   pci_disable_pcie_error_reporting(pdev);
> > pci_disable_device(pdev);
> > 
> > /*
> > 
> 
> 
> -- 
> Brian King
> Power Linux I/O
> IBM Linux Technology Center
> 


Re: BUG in copy_page_to_iter() when iscsi sets ENABLE_CLUSTERING

2018-12-10 Thread Chris Leech
On Wed, Dec 05, 2018 at 12:09:40PM -0800, Lee Duncan wrote:
> I recently found what I believe is a bug, and I'd appreciate feedback
> on if that is correct, and if so how to proceed.

... 

> I used the same system for both the iSCSI initiator (using open-iscsi)
> and the iscsi target (using targetcli-fb). [I believe you _could_ use
> a different system for the initiator, but I did not test this.]

Thanks for sharing detailed reproduction steps Lee.  I was able to
recreate this pretty easily, but I also tried between different
initiator and target VMs and was not able to reproduce in that setup.
So this might be specific to loopback operation, but it seems like we'll
have to dig in to see the exact structure of what's causing the problem
to know for sure.

- Chris



Re: [RFC PATCH] target: sanitize ALUA and PR state file paths before use

2018-12-10 Thread Bart Van Assche
On Mon, 2018-12-10 at 14:36 +0100, David Disseldorp wrote:
> Ping - any feedback on this change?
> 
> On Thu, 22 Nov 2018 14:38:00 +0100, David Disseldorp wrote:
> 
> > Block ALUA and PR state storage if any of the dynamic subdirectory
> > components include a path separator.
> > 
> > Fixes: c66ac9db8d4a ("[SCSI] target: Add LIO target core v4.0.0-rc6")
> > Signed-off-by: David Disseldorp 
> > Signed-off-by: Lee Duncan 
> > ---
> > Note:
> > Submitted as an RFC, as I've not properly tested the alua code path.
> > I'm also not sure whether it's reasonable to break existing setups
> > with a '/' in the configured unit_serial. Where "break" means fail
> > APTPL PR requests; ALUA state-save failures are ignored internally.
> 
> I'd also be happy with any pointers on properly testing ALUA.

Embedding SCSI properties like the unit serial number in a file system path
seems wrong to me. I think the path in which these properties are stored
should be derived from configfs item names configured by the user. These
names are guaranteed to be ASCII strings. If you want to see an example of
alternative approach you are welcome to have a look at scst_pr_set_file_name()
and scst_pr_sync_device_file() in the SCST source code.

Regarding testing ALUA code: I use sg_rtpg and sg_stpg to test SCSI target
ALUA code.

Bart.


Re: [RFC PATCH] target: sanitize ALUA and PR state file paths before use

2018-12-10 Thread David Disseldorp
On Mon, 10 Dec 2018 11:19:59 -0800, Bart Van Assche wrote:

> Embedding SCSI properties like the unit serial number in a file system path
> seems wrong to me.

I completely agree, but unfortunately that's where we currently stand.

> I think the path in which these properties are stored
> should be derived from configfs item names configured by the user. These
> names are guaranteed to be ASCII strings. If you want to see an example of
> alternative approach you are welcome to have a look at scst_pr_set_file_name()
> and scst_pr_sync_device_file() in the SCST source code.

Sounds reasonable, although that would leave us with the task of
migrating consumers of the existing unit-serial-number derived paths
to use the new state file locations.

> Regarding testing ALUA code: I use sg_rtpg and sg_stpg to test SCSI target
> ALUA code.

Thanks, I'll have a play with them.

Cheers, David


[PATCH 1/4] qla2xxx: Enable FC-NVME on NPIV ports

2018-12-10 Thread Himanshu Madhani
From: Anil Gurumurthy 

Signed-off-by: Anil Gurumurthy 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_mid.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/scsi/qla2xxx/qla_mid.c b/drivers/scsi/qla2xxx/qla_mid.c
index d620f4bebcd0..099d8e9851cb 100644
--- a/drivers/scsi/qla2xxx/qla_mid.c
+++ b/drivers/scsi/qla2xxx/qla_mid.c
@@ -507,6 +507,7 @@ qla24xx_create_vhost(struct fc_vport *fc_vport)
qla2x00_start_timer(vha, WATCH_INTERVAL);
 
vha->req = base_vha->req;
+   vha->flags.nvme_enabled = base_vha->flags.nvme_enabled;
host->can_queue = base_vha->req->length + 128;
host->cmd_per_lun = 3;
if (IS_T10_PI_CAPABLE(ha) && ql2xenabledif)
-- 
2.12.0



[PATCH 4/4] qla2xxx: Update driver version to 10.00.00.12-k

2018-12-10 Thread Himanshu Madhani
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_version.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/qla2xxx/qla_version.h 
b/drivers/scsi/qla2xxx/qla_version.h
index 12bafff71a1a..ca7945cb959b 100644
--- a/drivers/scsi/qla2xxx/qla_version.h
+++ b/drivers/scsi/qla2xxx/qla_version.h
@@ -7,7 +7,7 @@
 /*
  * Driver version
  */
-#define QLA2XXX_VERSION  "10.00.00.11-k"
+#define QLA2XXX_VERSION  "10.00.00.12-k"
 
 #define QLA_DRIVER_MAJOR_VER   10
 #define QLA_DRIVER_MINOR_VER   0
-- 
2.12.0



[PATCH 0/4] qla2xxx: Enable NPIV support for FC-NVMe capable ports

2018-12-10 Thread Himanshu Madhani
Hi Martin, 

This series adds support for NPIV on FC-NVMe enabled ports.

Please apply this series to 4.21/scsi-misc at your earliest convenience.

Thanks,
Himanshu

Anil Gurumurthy (1):
  qla2xxx: Enable FC-NVME on NPIV ports

Giridhar Malavali (1):
  qla2xxx: Fix for FC-NVMe discovery for NPIV port

Himanshu Madhani (2):
  qla2xxx: Fix NPIV handling for FC-NVMe
  qla2xxx: Update driver version to 10.00.00.12-k

 drivers/scsi/qla2xxx/qla_attr.c|  2 ++
 drivers/scsi/qla2xxx/qla_init.c| 10 --
 drivers/scsi/qla2xxx/qla_mid.c |  1 +
 drivers/scsi/qla2xxx/qla_nvme.c| 16 +++-
 drivers/scsi/qla2xxx/qla_os.c  |  2 ++
 drivers/scsi/qla2xxx/qla_version.h |  2 +-
 6 files changed, 13 insertions(+), 20 deletions(-)

-- 
2.12.0



[PATCH 2/4] qla2xxx: Fix NPIV handling for FC-NVMe

2018-12-10 Thread Himanshu Madhani
This patch fixes issues with NPIV port with FC-NVMe. Clean up
code for remoteport delete and also call nvme_delete when
deleting VPs.

Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_nvme.c | 16 +++-
 drivers/scsi/qla2xxx/qla_os.c   |  2 ++
 2 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c
index 7e78e7eff783..34996fcfd4fc 100644
--- a/drivers/scsi/qla2xxx/qla_nvme.c
+++ b/drivers/scsi/qla2xxx/qla_nvme.c
@@ -474,21 +474,10 @@ static int qla_nvme_post_cmd(struct nvme_fc_local_port 
*lport,
int rval = -ENODEV;
srb_t *sp;
struct qla_qpair *qpair = hw_queue_handle;
-   struct nvme_private *priv;
+   struct nvme_private *priv = fd->private;
struct qla_nvme_rport *qla_rport = rport->private;
 
-   if (!fd || !qpair) {
-   ql_log(ql_log_warn, NULL, 0x2134,
-   "NO NVMe request or Queue Handle\n");
-   return rval;
-   }
-
-   priv = fd->private;
fcport = qla_rport->fcport;
-   if (!fcport) {
-   ql_log(ql_log_warn, NULL, 0x210e, "No fcport ptr\n");
-   return rval;
-   }
 
vha = fcport->vha;
 
@@ -517,6 +506,7 @@ static int qla_nvme_post_cmd(struct nvme_fc_local_port 
*lport,
sp->name = "nvme_cmd";
sp->done = qla_nvme_sp_done;
sp->qpair = qpair;
+   sp->vha = vha;
nvme = &sp->u.iocb_cmd;
nvme->u.nvme.desc = fd;
 
@@ -564,7 +554,7 @@ static void qla_nvme_remoteport_delete(struct 
nvme_fc_remote_port *rport)
schedule_work(&fcport->free_work);
}
 
-   fcport->nvme_flag &= ~(NVME_FLAG_REGISTERED | NVME_FLAG_DELETING);
+   fcport->nvme_flag &= ~NVME_FLAG_DELETING;
ql_log(ql_log_info, fcport->vha, 0x2110,
"remoteport_delete of %p completed.\n", fcport);
 }
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index b658b9a5eb1e..f0ffb0e5c113 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -3570,6 +3570,8 @@ qla2x00_delete_all_vps(struct qla_hw_data *ha, 
scsi_qla_host_t *base_vha)
spin_unlock_irqrestore(&ha->vport_slock, flags);
mutex_unlock(&ha->vport_lock);
 
+   qla_nvme_delete(vha);
+
fc_vport_terminate(vha->fc_vport);
scsi_host_put(vha->host);
 
-- 
2.12.0



[PATCH 3/4] qla2xxx: Fix for FC-NVMe discovery for NPIV port

2018-12-10 Thread Himanshu Madhani
From: Giridhar Malavali 

This patch fixes NVMe discovery by setting SKIP_PRLI flag, so that
PRLI is driven by driver and is retried when the NPIV port is detected
to have NVMe capability.

Signed-off-by: Giridhar Malavali 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_attr.c |  2 ++
 drivers/scsi/qla2xxx/qla_init.c | 10 --
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index 0bb9ac6ece92..00444dc79756 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -2712,6 +2712,8 @@ qla24xx_vport_delete(struct fc_vport *fc_vport)
test_bit(FCPORT_UPDATE_NEEDED, &vha->dpc_flags))
msleep(1000);
 
+   qla_nvme_delete(vha);
+
qla24xx_disable_vp(vha);
qla2x00_wait_for_sess_deletion(vha);
 
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index eb59c796a795..364bb52ed2a6 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -237,15 +237,13 @@ qla2x00_async_login(struct scsi_qla_host *vha, fc_port_t 
*fcport,
qla2x00_init_timer(sp, qla2x00_get_async_timeout(vha) + 2);
 
sp->done = qla2x00_async_login_sp_done;
-   if (N2N_TOPO(fcport->vha->hw) && fcport_is_bigger(fcport)) {
+   if (N2N_TOPO(fcport->vha->hw) && fcport_is_bigger(fcport))
lio->u.logio.flags |= SRB_LOGIN_PRLI_ONLY;
-   } else {
+   else
lio->u.logio.flags |= SRB_LOGIN_COND_PLOGI;
 
-   if (fcport->fc4f_nvme)
-   lio->u.logio.flags |= SRB_LOGIN_SKIP_PRLI;
-
-   }
+   if (fcport->fc4f_nvme)
+   lio->u.logio.flags |= SRB_LOGIN_SKIP_PRLI;
 
ql_dbg(ql_dbg_disc, vha, 0x2072,
"Async-login - %8phC hdl=%x, loopid=%x portid=%02x%02x%02x "
-- 
2.12.0



[PATCH] scsi: qla2xxx: fix unused function warning

2018-12-10 Thread Arnd Bergmann
In what seems to be a mismatch between the scsi-fixes branch and
the scsi-mkp/for-next branch, a newly introduced variable from
one patch got obsoleted in another one:

drivers/scsi/qla2xxx/qla_os.c: In function '__qla2x00_abort_all_cmds':
drivers/scsi/qla2xxx/qla_os.c:1791:11: error: unused variable 'status' 
[-Werror=unused-variable]

Remove the variable again.

Fixes: c4e521b654e1 ("scsi: qla2xxx: Split the __qla2x00_abort_all_cmds() 
function")
Fixes: f2ffd4e5bc7b ("scsi: qla2xxx: Timeouts occur on surprise removal of 
QLogic adapter")
Signed-off-by: Arnd Bergmann 
---
Maybe check carefully that the merge in linux-next is otherwise correct
---
 drivers/scsi/qla2xxx/qla_os.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 63c47bc7ae59..db331cb5ba3c 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -1788,7 +1788,7 @@ static void qla2x00_abort_srb(struct qla_qpair *qp, srb_t 
*sp, const int res,
 static void
 __qla2x00_abort_all_cmds(struct qla_qpair *qp, int res)
 {
-   int cnt, status;
+   int cnt;
unsigned long flags;
srb_t *sp;
scsi_qla_host_t *vha = qp->vha;
-- 
2.20.0



Re: [PATCH] scsi: qla2xxx: fix unused function warning

2018-12-10 Thread Bart Van Assche
On Mon, 2018-12-10 at 21:51 +0100, Arnd Bergmann wrote:
> In what seems to be a mismatch between the scsi-fixes branch and
> the scsi-mkp/for-next branch, a newly introduced variable from
> one patch got obsoleted in another one:
> 
> drivers/scsi/qla2xxx/qla_os.c: In function '__qla2x00_abort_all_cmds':
> drivers/scsi/qla2xxx/qla_os.c:1791:11: error: unused variable 'status' 
> [-Werror=unused-variable]
> 
> Remove the variable again.
> 
> Fixes: c4e521b654e1 ("scsi: qla2xxx: Split the __qla2x00_abort_all_cmds() 
> function")
> Fixes: f2ffd4e5bc7b ("scsi: qla2xxx: Timeouts occur on surprise removal of 
> QLogic adapter")
> Signed-off-by: Arnd Bergmann 
> ---
> Maybe check carefully that the merge in linux-next is otherwise correct
> ---
>  drivers/scsi/qla2xxx/qla_os.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
> index 63c47bc7ae59..db331cb5ba3c 100644
> --- a/drivers/scsi/qla2xxx/qla_os.c
> +++ b/drivers/scsi/qla2xxx/qla_os.c
> @@ -1788,7 +1788,7 @@ static void qla2x00_abort_srb(struct qla_qpair *qp, 
> srb_t *sp, const int res,
>  static void
>  __qla2x00_abort_all_cmds(struct qla_qpair *qp, int res)
>  {
> - int cnt, status;
> + int cnt;
>   unsigned long flags;
>   srb_t *sp;
>   scsi_qla_host_t *vha = qp->vha;

When I prepared commit c4e521b654e1 I verified that my patch did not produce any
warnings when building with W=1. So something must be wrong at your side. Did 
you
perhaps start from linux-next to prepare this patch? If so, please submit this
patch to Stephen Rothwell.

Bart.


Re: [PATCH] scsi: qla2xxx: fix unused function warning

2018-12-10 Thread Arnd Bergmann
On Mon, Dec 10, 2018 at 10:01 PM Bart Van Assche  wrote:
>
> On Mon, 2018-12-10 at 21:51 +0100, Arnd Bergmann wrote:
> > In what seems to be a mismatch between the scsi-fixes branch and
> > the scsi-mkp/for-next branch, a newly introduced variable from
> > one patch got obsoleted in another one:
> >
> > drivers/scsi/qla2xxx/qla_os.c: In function '__qla2x00_abort_all_cmds':
> > drivers/scsi/qla2xxx/qla_os.c:1791:11: error: unused variable 'status' 
> > [-Werror=unused-variable]
> >
> > Remove the variable again.
> >
> > Fixes: c4e521b654e1 ("scsi: qla2xxx: Split the __qla2x00_abort_all_cmds() 
> > function")
> > Fixes: f2ffd4e5bc7b ("scsi: qla2xxx: Timeouts occur on surprise removal of 
> > QLogic adapter")
> > Signed-off-by: Arnd Bergmann 
> > ---
> > Maybe check carefully that the merge in linux-next is otherwise correct
> > ---
> >  drivers/scsi/qla2xxx/qla_os.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
> > index 63c47bc7ae59..db331cb5ba3c 100644
> > --- a/drivers/scsi/qla2xxx/qla_os.c
> > +++ b/drivers/scsi/qla2xxx/qla_os.c
> > @@ -1788,7 +1788,7 @@ static void qla2x00_abort_srb(struct qla_qpair *qp, 
> > srb_t *sp, const int res,
> >  static void
> >  __qla2x00_abort_all_cmds(struct qla_qpair *qp, int res)
> >  {
> > - int cnt, status;
> > + int cnt;
> >   unsigned long flags;
> >   srb_t *sp;
> >   scsi_qla_host_t *vha = qp->vha;
>
> When I prepared commit c4e521b654e1 I verified that my patch did not produce 
> any
> warnings when building with W=1. So something must be wrong at your side. Did 
> you
> perhaps start from linux-next to prepare this patch? If so, please submit this
> patch to Stephen Rothwell.

Yes, I tried to make clear that the two branches are fine by themselves, sorry
if I was still ambiguous. The patch is currently only needed on linux-next
as far as I can tell, but we should avoid getting the same error when the
branches are merged in mainline.

Arnd


Re: [PATCH] scsi: qla2xxx: fix unused function warning

2018-12-10 Thread James Bottomley
On Mon, 2018-12-10 at 22:28 +0100, Arnd Bergmann wrote:
> On Mon, Dec 10, 2018 at 10:01 PM Bart Van Assche 
> wrote:
> > 
> > On Mon, 2018-12-10 at 21:51 +0100, Arnd Bergmann wrote:
> > > In what seems to be a mismatch between the scsi-fixes branch and
> > > the scsi-mkp/for-next branch, a newly introduced variable from
> > > one patch got obsoleted in another one:
> > > 
> > > drivers/scsi/qla2xxx/qla_os.c: In function
> > > '__qla2x00_abort_all_cmds':
> > > drivers/scsi/qla2xxx/qla_os.c:1791:11: error: unused variable
> > > 'status' [-Werror=unused-variable]
> > > 
> > > Remove the variable again.
> > > 
> > > Fixes: c4e521b654e1 ("scsi: qla2xxx: Split the
> > > __qla2x00_abort_all_cmds() function")
> > > Fixes: f2ffd4e5bc7b ("scsi: qla2xxx: Timeouts occur on surprise
> > > removal of QLogic adapter")
> > > Signed-off-by: Arnd Bergmann 
> > > ---
> > > Maybe check carefully that the merge in linux-next is otherwise
> > > correct
> > > ---
> > >  drivers/scsi/qla2xxx/qla_os.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/scsi/qla2xxx/qla_os.c
> > > b/drivers/scsi/qla2xxx/qla_os.c
> > > index 63c47bc7ae59..db331cb5ba3c 100644
> > > --- a/drivers/scsi/qla2xxx/qla_os.c
> > > +++ b/drivers/scsi/qla2xxx/qla_os.c
> > > @@ -1788,7 +1788,7 @@ static void qla2x00_abort_srb(struct
> > > qla_qpair *qp, srb_t *sp, const int res,
> > >  static void
> > >  __qla2x00_abort_all_cmds(struct qla_qpair *qp, int res)
> > >  {
> > > - int cnt, status;
> > > + int cnt;
> > >   unsigned long flags;
> > >   srb_t *sp;
> > >   scsi_qla_host_t *vha = qp->vha;
> > 
> > When I prepared commit c4e521b654e1 I verified that my patch did
> > not produce any
> > warnings when building with W=1. So something must be wrong at your
> > side. Did you
> > perhaps start from linux-next to prepare this patch? If so, please
> > submit this
> > patch to Stephen Rothwell.
> 
> Yes, I tried to make clear that the two branches are fine by
> themselves, sorry if I was still ambiguous. The patch is currently
> only needed on linux-next as far as I can tell, but we should avoid
> getting the same error when the branches are merged in mainline.

It should be fixed in linux-next as of the next release.  It was just a
problem with the original merge which I fixed when I did my version of
it.

James



[PATCH 1/2] scsi: aacraid: change wait_sem to a completion

2018-12-10 Thread Arnd Bergmann
The wait_sem member is used like a completion, so we should
use the respective API. The behavior is unchanged.

Signed-off-by: Arnd Bergmann 
---
 drivers/scsi/aacraid/aacraid.h  | 2 +-
 drivers/scsi/aacraid/commctrl.c | 4 ++--
 drivers/scsi/aacraid/commsup.c  | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 39eb415987fc..531a0b9a58f8 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -1241,7 +1241,7 @@ struct aac_fib_context {
u32 unique; // unique value representing 
this context
ulong   jiffies;// used for cleanup - dmb 
changed to ulong
struct list_headnext;   // used to link context's into 
a linked list
-   struct semaphorewait_sem;   // this is used to wait for the 
next fib to arrive.
+   struct completion   completion; // this is used to wait for the 
next fib to arrive.
int wait;   // Set to true when thread is 
in WaitForSingleObject
unsigned long   count;  // total number of FIBs on 
FibList
struct list_headfib_list;   // this holds fibs and their 
attachd hw_fibs
diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c
index 25f6600d6c09..6a6ad9477786 100644
--- a/drivers/scsi/aacraid/commctrl.c
+++ b/drivers/scsi/aacraid/commctrl.c
@@ -203,7 +203,7 @@ static int open_getadapter_fib(struct aac_dev * dev, void 
__user *arg)
/*
 *  Initialize the mutex used to wait for the next AIF.
 */
-   sema_init(&fibctx->wait_sem, 0);
+   init_completion(&fibctx->completion);
fibctx->wait = 0;
/*
 *  Initialize the fibs and set the count of fibs on
@@ -335,7 +335,7 @@ static int next_getadapter_fib(struct aac_dev * dev, void 
__user *arg)
ssleep(1);
}
if (f.wait) {
-   if(down_interruptible(&fibctx->wait_sem) < 0) {
+   if 
(wait_for_completion_interruptible(&fibctx->completion) < 0) {
status = -ERESTARTSYS;
} else {
/* Lock again and retry */
diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
index 1e77d96a18f2..7ed51a77e39d 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -1828,7 +1828,7 @@ int aac_check_health(struct aac_dev * aac)
 * Set the event to wake up the
 * thread that will waiting.
 */
-   up(&fibctx->wait_sem);
+   complete(&fibctx->completion);
} else {
printk(KERN_WARNING "aifd: didn't allocate NewFib.\n");
kfree(fib);
@@ -2165,7 +2165,7 @@ static void wakeup_fibctx_threads(struct aac_dev *dev,
 * Set the event to wake up the
 * thread that is waiting.
 */
-   up(&fibctx->wait_sem);
+   complete(&fibctx->completion);
 
entry = entry->next;
}
-- 
2.20.0



[PATCH 2/2] scsi: aacraid: change event_wait to a completion

2018-12-10 Thread Arnd Bergmann
The event_wait semaphore has completion semantics, so we can
change it over to the completion interface for clarity without
changing the behavior.

Signed-off-by: Arnd Bergmann 
---
 drivers/scsi/aacraid/aacraid.h  |  3 ++-
 drivers/scsi/aacraid/commctrl.c |  1 -
 drivers/scsi/aacraid/commsup.c  | 15 +++
 drivers/scsi/aacraid/dpcsup.c   | 19 +--
 drivers/scsi/aacraid/linit.c|  2 +-
 drivers/scsi/aacraid/src.c  |  2 +-
 6 files changed, 20 insertions(+), 22 deletions(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 531a0b9a58f8..3291d1c16864 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -40,6 +40,7 @@
 #define nblank(x) _nblank(x)[0]
 
 #include 
+#include 
 #include 
 #include 
 
@@ -1313,7 +1314,7 @@ struct fib {
 *  This is the event the sendfib routine will wait on if the
 *  caller did not pass one and this is synch io.
 */
-   struct semaphoreevent_wait;
+   struct completion   event_wait;
spinlock_t  event_lock;
 
u32 done;   /* gets set to 1 when fib is complete */
diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c
index 6a6ad9477786..e2899ff7913e 100644
--- a/drivers/scsi/aacraid/commctrl.c
+++ b/drivers/scsi/aacraid/commctrl.c
@@ -41,7 +41,6 @@
 #include 
 #include  /* ssleep prototype */
 #include 
-#include 
 #include 
 #include 
 
diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
index 7ed51a77e39d..d5a6aa9676c8 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -44,7 +44,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -189,7 +188,7 @@ int aac_fib_setup(struct aac_dev * dev)
fibptr->hw_fib_va = hw_fib;
fibptr->data = (void *) fibptr->hw_fib_va->data;
fibptr->next = fibptr+1;/* Forward chain the fibs */
-   sema_init(&fibptr->event_wait, 0);
+   init_completion(&fibptr->event_wait);
spin_lock_init(&fibptr->event_lock);
hw_fib->header.XferState = cpu_to_le32(0x);
hw_fib->header.SenderSize =
@@ -623,7 +622,7 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned 
long size,
}
if (wait) {
fibptr->flags |= FIB_CONTEXT_FLAG_WAIT;
-   if (down_interruptible(&fibptr->event_wait)) {
+   if 
(wait_for_completion_interruptible(&fibptr->event_wait)) {
fibptr->flags &= ~FIB_CONTEXT_FLAG_WAIT;
return -EFAULT;
}
@@ -659,7 +658,7 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned 
long size,
 * hardware failure has occurred.
 */
unsigned long timeout = jiffies + (180 * HZ); /* 3 
minutes */
-   while (down_trylock(&fibptr->event_wait)) {
+   while (!try_wait_for_completion(&fibptr->event_wait)) {
int blink;
if (time_is_before_eq_jiffies(timeout)) {
struct aac_queue * q = 
&dev->queues->queue[AdapNormCmdQueue];
@@ -689,9 +688,9 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned 
long size,
 */
schedule();
}
-   } else if (down_interruptible(&fibptr->event_wait)) {
+   } else if 
(wait_for_completion_interruptible(&fibptr->event_wait)) {
/* Do nothing ... satisfy
-* down_interruptible must_check */
+* wait_for_completion_interruptible must_check */
}
 
spin_lock_irqsave(&fibptr->event_lock, flags);
@@ -777,7 +776,7 @@ int aac_hba_send(u8 command, struct fib *fibptr, 
fib_callback callback,
return -EFAULT;
 
fibptr->flags |= FIB_CONTEXT_FLAG_WAIT;
-   if (down_interruptible(&fibptr->event_wait))
+   if (wait_for_completion_interruptible(&fibptr->event_wait))
fibptr->done = 2;
fibptr->flags &= ~(FIB_CONTEXT_FLAG_WAIT);
 
@@ -1538,7 +1537,7 @@ static int _aac_reset_adapter(struct aac_dev *aac, int 
forced, u8 reset_type)
  || fib->flags & FIB_CONTEXT_FLAG_WAIT) {
unsigned long flagv;
spin_lock_irqsave(&fib->event_lock, flagv);
-   up(&fib->event_wait);
+   complete(&fib->event_wait);
spin_unlock_irqrestore(&fib->event_lock, flagv);
schedule();

[PATCH][scsi-next] scsi: qla2xxx: remove unused variable status

2018-12-10 Thread Colin King
From: Colin Ian King 

Variable 'status' is declared but not used, remove it.

Cleans up warning:
warning: unused variable ‘status’ [-Wunused-variable]

Signed-off-by: Colin Ian King 
---
 drivers/scsi/qla2xxx/qla_os.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 63c47bc7ae59..db331cb5ba3c 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -1788,7 +1788,7 @@ static void qla2x00_abort_srb(struct qla_qpair *qp, srb_t 
*sp, const int res,
 static void
 __qla2x00_abort_all_cmds(struct qla_qpair *qp, int res)
 {
-   int cnt, status;
+   int cnt;
unsigned long flags;
srb_t *sp;
scsi_qla_host_t *vha = qp->vha;
-- 
2.19.1



[PATCH] scsi: nsp32: Remove unnecessary self assignment in nsp32_set_sync_entry

2018-12-10 Thread Nathan Chancellor
Clang warns:

drivers/scsi/nsp32.c:2444:14: warning: explicitly assigning value of
variable of type 'unsigned char' to itself [-Wself-assign]
offset  = offset;
~~  ^

Signed-off-by: Nathan Chancellor 
---
 drivers/scsi/nsp32.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c
index 5aac3e801903..7ce6e7acf2f3 100644
--- a/drivers/scsi/nsp32.c
+++ b/drivers/scsi/nsp32.c
@@ -2441,7 +2441,6 @@ static void nsp32_set_sync_entry(nsp32_hw_data *data,
 
period  = data->synct[entry].period_num;
ackwidth= data->synct[entry].ackwidth;
-   offset  = offset;
sample_rate = data->synct[entry].sample_rate;
 
target->syncreg= TO_SYNCREG(period, offset);
-- 
2.20.0



[PATCH] pcmcia: Remove unnecessary parentheses

2018-12-10 Thread Nathan Chancellor
Clang warns:

drivers/scsi/pcmcia/nsp_cs.c:1137:27: warning: equality comparison with
extraneous parentheses [-Wparentheses-equality]
if ((tmpSC->SCp.Message == MSG_COMMAND_COMPLETE)) {
 ~~~^~~
drivers/scsi/pcmcia/nsp_cs.c:1137:27: note: remove extraneous
parentheses around the comparison to silence this warning
if ((tmpSC->SCp.Message == MSG_COMMAND_COMPLETE)) {
~   ^  ~
drivers/scsi/pcmcia/nsp_cs.c:1137:27: note: use '=' to turn this
equality comparison into an assignment
if ((tmpSC->SCp.Message == MSG_COMMAND_COMPLETE)) {
^~
=
1 warning generated.

Signed-off-by: Nathan Chancellor 
---
 drivers/scsi/pcmcia/nsp_cs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c
index f3230494a8c9..f28105b144fc 100644
--- a/drivers/scsi/pcmcia/nsp_cs.c
+++ b/drivers/scsi/pcmcia/nsp_cs.c
@@ -1134,7 +1134,8 @@ static irqreturn_t nspintr(int irq, void *dev_id)
 
//*sync_neg   = SYNC_NOT_YET;
 
-   if ((tmpSC->SCp.Message == MSG_COMMAND_COMPLETE)) { /* all 
command complete and return status */
+   /* all command complete and return status */
+   if (tmpSC->SCp.Message == MSG_COMMAND_COMPLETE) {
tmpSC->result = (DID_OK  << 16) |
((tmpSC->SCp.Message & 0xff) <<  8) |
((tmpSC->SCp.Status  & 0xff) <<  0);
-- 
2.20.0



Re: [PATCH 2/9] scsi: introduce a max_segment_size host_template parameters

2018-12-10 Thread Ming Lei
On Thu, Dec 06, 2018 at 07:52:51AM -0800, Christoph Hellwig wrote:
> This allows the host driver to indicate the maximum supported
> segment size in a nice an easy way, so that the driver doesn't
> have to worry about DMA-layer imposed limitations.
> 
> Signed-off-by: Christoph Hellwig 
> ---
>  drivers/scsi/be2iscsi/be_main.c | 8 +---
>  drivers/scsi/hosts.c| 5 +
>  drivers/scsi/scsi_debug.c   | 2 +-
>  drivers/scsi/scsi_lib.c | 3 ++-
>  include/scsi/scsi_host.h| 6 ++
>  5 files changed, 15 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
> index c4108b17d5ab..39f3820572b4 100644
> --- a/drivers/scsi/be2iscsi/be_main.c
> +++ b/drivers/scsi/be2iscsi/be_main.c
> @@ -214,12 +214,6 @@ static char const *cqe_desc[] = {
>   "CXN_KILLED_IMM_DATA_RCVD"
>  };
>  
> -static int beiscsi_slave_configure(struct scsi_device *sdev)
> -{
> - blk_queue_max_segment_size(sdev->request_queue, 65536);
> - return 0;
> -}
> -
>  static int beiscsi_eh_abort(struct scsi_cmnd *sc)
>  {
>   struct iscsi_task *abrt_task = (struct iscsi_task *)sc->SCp.ptr;
> @@ -393,7 +387,6 @@ static struct scsi_host_template beiscsi_sht = {
>   .proc_name = DRV_NAME,
>   .queuecommand = iscsi_queuecommand,
>   .change_queue_depth = scsi_change_queue_depth,
> - .slave_configure = beiscsi_slave_configure,
>   .target_alloc = iscsi_target_alloc,
>   .eh_timed_out = iscsi_eh_cmd_timed_out,
>   .eh_abort_handler = beiscsi_eh_abort,
> @@ -404,6 +397,7 @@ static struct scsi_host_template beiscsi_sht = {
>   .can_queue = BE2_IO_DEPTH,
>   .this_id = -1,
>   .max_sectors = BEISCSI_MAX_SECTORS,
> + .max_segment_size = 65536,
>   .cmd_per_lun = BEISCSI_CMD_PER_LUN,
>   .vendor_id = SCSI_NL_VID_TYPE_PCI | BE_VENDOR_ID,
>   .track_queue_depth = 1,
> diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
> index ea4b0bb0c1cd..e8148ba414a3 100644
> --- a/drivers/scsi/hosts.c
> +++ b/drivers/scsi/hosts.c
> @@ -464,6 +464,11 @@ struct Scsi_Host *scsi_host_alloc(struct 
> scsi_host_template *sht, int privsize)
>   else
>   shost->max_sectors = SCSI_DEFAULT_MAX_SECTORS;
>  
> + if (sht->max_segment_size)
> + shost->max_segment_size = sht->max_segment_size;
> + else
> + shost->max_segment_size = BLK_MAX_SEGMENT_SIZE;
> +
>   /*
>* assume a 4GB boundary, if not set
>*/
> diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
> index 53ba417bef8a..57d418d7d74e 100644
> --- a/drivers/scsi/scsi_debug.c
> +++ b/drivers/scsi/scsi_debug.c
> @@ -3973,7 +3973,6 @@ static int scsi_debug_slave_configure(struct 
> scsi_device *sdp)
>   return 1;  /* no resources, will be marked offline */
>   }
>   sdp->hostdata = devip;
> - blk_queue_max_segment_size(sdp->request_queue, -1U);
>   if (sdebug_no_uld)
>   sdp->no_uld_attach = 1;
>   config_cdb_len(sdp);
> @@ -5851,6 +5850,7 @@ static struct scsi_host_template sdebug_driver_template 
> = {
>   .sg_tablesize = SG_MAX_SEGMENTS,
>   .cmd_per_lun =  DEF_CMD_PER_LUN,
>   .max_sectors =  -1U,
> + .max_segment_size = -1U,
>   .module =   THIS_MODULE,
>   .track_queue_depth =1,
>  };
> diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
> index f6900e0b3024..2d4fd6b4bd92 100644
> --- a/drivers/scsi/scsi_lib.c
> +++ b/drivers/scsi/scsi_lib.c
> @@ -2227,7 +2227,8 @@ void __scsi_init_queue(struct Scsi_Host *shost, struct 
> request_queue *q)
>   blk_queue_segment_boundary(q, shost->dma_boundary);
>   dma_set_seg_boundary(dev, shost->dma_boundary);
>  
> - blk_queue_max_segment_size(q, dma_get_max_seg_size(dev));
> + blk_queue_max_segment_size(q,
> + min(shost->max_segment_size, dma_get_max_seg_size(dev)));
>  
>   if (shost->use_clustering == DISABLE_CLUSTERING)
>   q->limits.cluster = 0;
> diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
> index 7dc534c794dc..834204681ca3 100644
> --- a/include/scsi/scsi_host.h
> +++ b/include/scsi/scsi_host.h
> @@ -364,6 +364,11 @@ struct scsi_host_template {
>*/
>   unsigned int max_sectors;
>  
> + /*
> +  * Maximum size in bytes of a single segment.
> +  */
> + unsigned int max_segment_size;
> +
>   /*
>* DMA scatter gather segment boundary limit. A segment crossing this
>* boundary will be split in two.
> @@ -603,6 +608,7 @@ struct Scsi_Host {
>   short unsigned int sg_tablesize;
>   short unsigned int sg_prot_tablesize;
>   unsigned int max_sectors;
> + unsigned int max_segment_size;
>   unsigned long dma_boundary;
>   /*
>* In scsi-mq mode, the number of hardware queues supported by the LLD.
> -- 
> 2.19.1
> 

Just one concern, max segment size is often related with one specific

[PATCH 01/22] lpfc: Enable Management features for IF_TYPE=6

2018-12-10 Thread James Smart
Addition of support for if_type=6 missed several checks for interface
type, resulting in the failure of several key management features
such as firmware dump and loopback testing.

Correct the checks on the if_type so that both SLI4 IF_TYPE's 2 and 6
are supported.

Signed-off-by: Dick Kennedy 
Signed-off-by: James Smart 
---
 drivers/scsi/lpfc/lpfc_attr.c| 4 ++--
 drivers/scsi/lpfc/lpfc_bsg.c | 6 +++---
 drivers/scsi/lpfc/lpfc_els.c | 2 +-
 drivers/scsi/lpfc/lpfc_hbadisc.c | 2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index 83924d66fd39..513ac1be861f 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -1358,7 +1358,7 @@ lpfc_sli4_pdev_reg_request(struct lpfc_hba *phba, 
uint32_t opcode)
return -EACCES;
 
if ((phba->sli_rev < LPFC_SLI_REV4) ||
-   (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) !=
+   (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) <
 LPFC_SLI_INTF_IF_TYPE_2))
return -EPERM;
 
@@ -4361,7 +4361,7 @@ lpfc_link_speed_store(struct device *dev, struct 
device_attribute *attr,
uint32_t prev_val, if_type;
 
if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf);
-   if (if_type == LPFC_SLI_INTF_IF_TYPE_2 &&
+   if (if_type >= LPFC_SLI_INTF_IF_TYPE_2 &&
phba->hba_flag & HBA_FORCED_LINK_SPEED)
return -EPERM;
 
diff --git a/drivers/scsi/lpfc/lpfc_bsg.c b/drivers/scsi/lpfc/lpfc_bsg.c
index cb18dac68e28..8698af86485d 100644
--- a/drivers/scsi/lpfc/lpfc_bsg.c
+++ b/drivers/scsi/lpfc/lpfc_bsg.c
@@ -,7 +,7 @@ lpfc_bsg_diag_loopback_mode(struct bsg_job *job)
 
if (phba->sli_rev < LPFC_SLI_REV4)
rc = lpfc_sli3_bsg_diag_loopback_mode(phba, job);
-   else if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) ==
+   else if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) >=
 LPFC_SLI_INTF_IF_TYPE_2)
rc = lpfc_sli4_bsg_diag_loopback_mode(phba, job);
else
@@ -2262,7 +2262,7 @@ lpfc_sli4_bsg_diag_mode_end(struct bsg_job *job)
 
if (phba->sli_rev < LPFC_SLI_REV4)
return -ENODEV;
-   if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) !=
+   if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) <
LPFC_SLI_INTF_IF_TYPE_2)
return -ENODEV;
 
@@ -2354,7 +2354,7 @@ lpfc_sli4_bsg_link_diag_test(struct bsg_job *job)
rc = -ENODEV;
goto job_error;
}
-   if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) !=
+   if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) <
LPFC_SLI_INTF_IF_TYPE_2) {
rc = -ENODEV;
goto job_error;
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index 103ee7049633..d222baf35d15 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -5733,7 +5733,7 @@ lpfc_els_rcv_rdp(struct lpfc_vport *vport, struct 
lpfc_iocbq *cmdiocb,
struct ls_rjt stat;
 
if (phba->sli_rev < LPFC_SLI_REV4 ||
-   bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) !=
+   bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) <
LPFC_SLI_INTF_IF_TYPE_2) {
rjt_err = LSRJT_UNABLE_TPC;
rjt_expl = LSEXP_REQ_UNSUPPORTED;
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
index 8857f559e6c3..91189e9c8530 100644
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c
@@ -4850,7 +4850,7 @@ lpfc_unreg_rpi(struct lpfc_vport *vport, struct 
lpfc_nodelist *ndlp)
if (phba->sli_rev == LPFC_SLI_REV4 &&
(!(vport->load_flag & FC_UNLOADING)) &&
(bf_get(lpfc_sli_intf_if_type,
-&phba->sli4_hba.sli_intf) ==
+&phba->sli4_hba.sli_intf) >=
  LPFC_SLI_INTF_IF_TYPE_2) &&
(kref_read(&ndlp->kref) > 0)) {
mbox->ctx_ndlp = lpfc_nlp_get(ndlp);
-- 
2.13.7



[PATCH repost] lpfc: Enable Management features for IF_TYPE=6

2018-12-10 Thread James Smart
Addition of support for if_type=6 missed several checks for interface
type, resulting in the failure of several key management features
such as firmware dump and loopback testing.

Correct the checks on the if_type so that both SLI4 IF_TYPE's 2 and 6
are supported.

Signed-off-by: Dick Kennedy 
Signed-off-by: James Smart 
---
 drivers/scsi/lpfc/lpfc_attr.c| 4 ++--
 drivers/scsi/lpfc/lpfc_bsg.c | 6 +++---
 drivers/scsi/lpfc/lpfc_els.c | 2 +-
 drivers/scsi/lpfc/lpfc_hbadisc.c | 2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index 83924d66fd39..513ac1be861f 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -1358,7 +1358,7 @@ lpfc_sli4_pdev_reg_request(struct lpfc_hba *phba, 
uint32_t opcode)
return -EACCES;
 
if ((phba->sli_rev < LPFC_SLI_REV4) ||
-   (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) !=
+   (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) <
 LPFC_SLI_INTF_IF_TYPE_2))
return -EPERM;
 
@@ -4361,7 +4361,7 @@ lpfc_link_speed_store(struct device *dev, struct 
device_attribute *attr,
uint32_t prev_val, if_type;
 
if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf);
-   if (if_type == LPFC_SLI_INTF_IF_TYPE_2 &&
+   if (if_type >= LPFC_SLI_INTF_IF_TYPE_2 &&
phba->hba_flag & HBA_FORCED_LINK_SPEED)
return -EPERM;
 
diff --git a/drivers/scsi/lpfc/lpfc_bsg.c b/drivers/scsi/lpfc/lpfc_bsg.c
index cb18dac68e28..8698af86485d 100644
--- a/drivers/scsi/lpfc/lpfc_bsg.c
+++ b/drivers/scsi/lpfc/lpfc_bsg.c
@@ -,7 +,7 @@ lpfc_bsg_diag_loopback_mode(struct bsg_job *job)
 
if (phba->sli_rev < LPFC_SLI_REV4)
rc = lpfc_sli3_bsg_diag_loopback_mode(phba, job);
-   else if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) ==
+   else if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) >=
 LPFC_SLI_INTF_IF_TYPE_2)
rc = lpfc_sli4_bsg_diag_loopback_mode(phba, job);
else
@@ -2262,7 +2262,7 @@ lpfc_sli4_bsg_diag_mode_end(struct bsg_job *job)
 
if (phba->sli_rev < LPFC_SLI_REV4)
return -ENODEV;
-   if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) !=
+   if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) <
LPFC_SLI_INTF_IF_TYPE_2)
return -ENODEV;
 
@@ -2354,7 +2354,7 @@ lpfc_sli4_bsg_link_diag_test(struct bsg_job *job)
rc = -ENODEV;
goto job_error;
}
-   if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) !=
+   if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) <
LPFC_SLI_INTF_IF_TYPE_2) {
rc = -ENODEV;
goto job_error;
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index 103ee7049633..d222baf35d15 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -5733,7 +5733,7 @@ lpfc_els_rcv_rdp(struct lpfc_vport *vport, struct 
lpfc_iocbq *cmdiocb,
struct ls_rjt stat;
 
if (phba->sli_rev < LPFC_SLI_REV4 ||
-   bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) !=
+   bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) <
LPFC_SLI_INTF_IF_TYPE_2) {
rjt_err = LSRJT_UNABLE_TPC;
rjt_expl = LSEXP_REQ_UNSUPPORTED;
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
index 8857f559e6c3..91189e9c8530 100644
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c
@@ -4850,7 +4850,7 @@ lpfc_unreg_rpi(struct lpfc_vport *vport, struct 
lpfc_nodelist *ndlp)
if (phba->sli_rev == LPFC_SLI_REV4 &&
(!(vport->load_flag & FC_UNLOADING)) &&
(bf_get(lpfc_sli_intf_if_type,
-&phba->sli4_hba.sli_intf) ==
+&phba->sli4_hba.sli_intf) >=
  LPFC_SLI_INTF_IF_TYPE_2) &&
(kref_read(&ndlp->kref) > 0)) {
mbox->ctx_ndlp = lpfc_nlp_get(ndlp);
-- 
2.13.7



Re: [PATCH 1/2] scsi: aacraid: change wait_sem to a completion

2018-12-10 Thread Johannes Thumshirn
Looks good,
Reviewed-by: Johannes Thumshirn 
-- 
Johannes ThumshirnSUSE Labs Filesystems
jthumsh...@suse.de+49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850


Re: [PATCH 2/2] scsi: aacraid: change event_wait to a completion

2018-12-10 Thread Johannes Thumshirn
Looks good,
Reviewed-by: Johannes Thumshirn 
-- 
Johannes ThumshirnSUSE Labs Filesystems
jthumsh...@suse.de+49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850